@lucid-agents/taskmarket 1.47.0 → 1.49.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.
- package/dist/agent-compatibility.json +1 -1
- package/dist/{api-ENHCGR7K.js → api-3AM2K2OD.js} +2 -2
- package/dist/{channels-LX2DTMKZ.js → channels-UVUKKHEH.js} +4 -4
- package/dist/{chunk-4MAQWPJ2.js → chunk-4PIW55SU.js} +1 -1
- package/dist/{chunk-RO5AHGHC.js → chunk-5FEFXZWX.js} +1 -1
- package/dist/{chunk-WOPSQ2GZ.js → chunk-BD7EUFMK.js} +1 -1
- package/dist/{chunk-AS6EFS2V.js → chunk-E7DQ6PHQ.js} +6 -13
- package/dist/{chunk-TUP4MTW6.js → chunk-IPLFBE4Z.js} +318 -88
- package/dist/{chunk-XRM455ZG.js → chunk-JJWVZVQL.js} +1 -1
- package/dist/{chunk-54J54BK7.js → chunk-JPFNNGT5.js} +5 -5
- package/dist/{chunk-V2BCPGOB.js → chunk-KMDMP37P.js} +8 -8
- package/dist/{chunk-O53R76N3.js → chunk-QASNNRSL.js} +11236 -10903
- package/dist/{chunk-AMT2L4BR.js → chunk-VROY6UJU.js} +3 -3
- package/dist/{chunk-PDVDVVVF.js → chunk-ZBIB5Z72.js} +2 -2
- package/dist/{chunk-PPJNXEWM.js → chunk-ZI6J2FVP.js} +3 -3
- package/dist/{doctor-PEAKIDKS.js → doctor-62ESHY26.js} +9 -8
- package/dist/index.js +970 -619
- package/dist/{launch-CEJWCOQA.js → launch-QN325T4P.js} +11 -11
- package/dist/pi-extensions/xgate.cjs +819 -300
- package/dist/{read-auth-524RVF3G.js → read-auth-YVFCEAQN.js} +3 -3
- package/dist/{reconcile-GMYKLZTG.js → reconcile-ZQUH7Z7P.js} +4 -4
- package/dist/{status-Y6JAL4DR.js → status-BCKUXLAQ.js} +9 -8
- package/dist/{sync-pull-YFIWHI4H.js → sync-pull-YDX4D4XW.js} +4 -4
- package/dist/{task-access-grants-GXJ6WOQK.js → task-access-grants-Z2P4RHFL.js} +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listWorkerSubmissions,
|
|
15
15
|
submitTaskFiles,
|
|
16
16
|
taskRequirementsOf
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KMDMP37P.js";
|
|
18
18
|
import {
|
|
19
19
|
ComputeCreditError,
|
|
20
20
|
applyComputeCreditSetup,
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
executeX402PayRequest,
|
|
27
27
|
failedAfterPayment,
|
|
28
28
|
fetchComputePricing,
|
|
29
|
+
filledWriteOutcome,
|
|
30
|
+
forgetPaidWriteBody,
|
|
29
31
|
listPendingComputePurchases,
|
|
30
32
|
loadComputeCreditConfig,
|
|
31
33
|
loadExternalHeaders,
|
|
@@ -35,18 +37,20 @@ import {
|
|
|
35
37
|
reconcileX402PaymentById,
|
|
36
38
|
refusedPaidWrite,
|
|
37
39
|
releasePendingComputePurchase,
|
|
40
|
+
replayedFields,
|
|
38
41
|
resolvePendingComputePurchases,
|
|
39
42
|
withPaymentProtocol,
|
|
43
|
+
withSelectedChain,
|
|
40
44
|
x402FeePost,
|
|
41
45
|
x402PaymentProtocol
|
|
42
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-IPLFBE4Z.js";
|
|
43
47
|
import {
|
|
44
48
|
signReadAuth
|
|
45
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-ZBIB5Z72.js";
|
|
46
50
|
import {
|
|
47
51
|
saveTaskAccessGrant,
|
|
48
52
|
taskAccessGrantHeaders
|
|
49
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-BD7EUFMK.js";
|
|
50
54
|
import {
|
|
51
55
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
52
56
|
X402PayError,
|
|
@@ -65,7 +69,7 @@ import {
|
|
|
65
69
|
setX402PolicyRuleEnabled,
|
|
66
70
|
signSponsoredTempoTransfer,
|
|
67
71
|
signTaskmarketFeePayment
|
|
68
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-JJWVZVQL.js";
|
|
69
73
|
import {
|
|
70
74
|
ALL_NETWORKS,
|
|
71
75
|
ApiError,
|
|
@@ -94,6 +98,7 @@ import {
|
|
|
94
98
|
fetchDeviceKey,
|
|
95
99
|
generateKeypair,
|
|
96
100
|
generateTapKey,
|
|
101
|
+
getKeystorePath,
|
|
97
102
|
getNetwork,
|
|
98
103
|
getWalletAddress,
|
|
99
104
|
idempotencyKeyForError,
|
|
@@ -130,7 +135,7 @@ import {
|
|
|
130
135
|
withErrorContext,
|
|
131
136
|
withIdempotentWrite,
|
|
132
137
|
withTapSignature
|
|
133
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-E7DQ6PHQ.js";
|
|
134
139
|
import {
|
|
135
140
|
AGENT_AVATAR_MAX_BYTES,
|
|
136
141
|
AGENT_HIRES_ROLES,
|
|
@@ -402,14 +407,13 @@ import {
|
|
|
402
407
|
validateWorkflowDocument,
|
|
403
408
|
validateWorkflowTemplate,
|
|
404
409
|
vaultCallGasLimit7702,
|
|
405
|
-
verifierProviderId,
|
|
406
410
|
verifiersUnsupportedOnChain,
|
|
407
411
|
viemChainFor
|
|
408
|
-
} from "./chunk-
|
|
412
|
+
} from "./chunk-QASNNRSL.js";
|
|
409
413
|
import "./chunk-S7SJMJ2I.js";
|
|
410
414
|
|
|
411
415
|
// src/index.ts
|
|
412
|
-
import { Command as
|
|
416
|
+
import { Command as Command158 } from "commander";
|
|
413
417
|
import { createRequire } from "module";
|
|
414
418
|
|
|
415
419
|
// src/commands/init.ts
|
|
@@ -486,6 +490,158 @@ function readLastError() {
|
|
|
486
490
|
}
|
|
487
491
|
}
|
|
488
492
|
|
|
493
|
+
// src/lib/wrong-network.ts
|
|
494
|
+
var WRONG_NETWORK_CODE = "wrong_network";
|
|
495
|
+
var WrongNetworkError = class extends Error {
|
|
496
|
+
code = WRONG_NETWORK_CODE;
|
|
497
|
+
details;
|
|
498
|
+
constructor(subject, chainId) {
|
|
499
|
+
const network = selectedNetwork();
|
|
500
|
+
const named = networkNameForChain(chainId) ?? null;
|
|
501
|
+
super(
|
|
502
|
+
named === null ? `${subject} is on chain ${chainId}, which no CLI network serves, but the selected network is ${network.name}.` : `${subject} is on ${named}, but the selected network is ${network.name}. Re-run with ${taskmarketCommandFor(chainId)}.`
|
|
503
|
+
);
|
|
504
|
+
this.details = {
|
|
505
|
+
code: WRONG_NETWORK_CODE,
|
|
506
|
+
chainId,
|
|
507
|
+
network: named,
|
|
508
|
+
taskChainId: chainId,
|
|
509
|
+
taskNetwork: named,
|
|
510
|
+
selectedNetwork: network.name
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
function wrongNetworkOfApiError(error) {
|
|
515
|
+
if (error.envelope?.reason !== "chain_conflict") return null;
|
|
516
|
+
const taskChain = /the task is on chain (\d+)/.exec(error.message)?.[1];
|
|
517
|
+
if (taskChain === void 0 || Number(taskChain) === selectedNetwork().chainId) return null;
|
|
518
|
+
return new WrongNetworkError("This task", Number(taskChain));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/lib/output.ts
|
|
522
|
+
import fs2 from "fs";
|
|
523
|
+
|
|
524
|
+
// src/lib/next-steps.ts
|
|
525
|
+
function chainOf(chainId) {
|
|
526
|
+
try {
|
|
527
|
+
const chain = taskmarketChain(chainId);
|
|
528
|
+
return { name: chain.name, symbol: chain.payment.symbol, testnet: chain.testnet };
|
|
529
|
+
} catch {
|
|
530
|
+
return { name: `chain ${chainId}`, symbol: "USDC", testnet: false };
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function amountText(baseUnits2, chainId) {
|
|
534
|
+
try {
|
|
535
|
+
return formatPaymentAmount(baseUnits2, chainId);
|
|
536
|
+
} catch {
|
|
537
|
+
return `${formatUsdcBaseUnits(baseUnits2)} USDC`;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
var SKILL_INSTALL_COMMAND = "curl -fsSL https://taskmarket.dev/install-skill.sh | sh -s -- https://taskmarket.dev";
|
|
541
|
+
var FREE_WORK_WHY = "Find paid work. Taking a claim task and your first 5 submissions to a bounty are free, so an empty wallet can earn.";
|
|
542
|
+
function hasGuidance(next) {
|
|
543
|
+
return next !== void 0 && (next.commands.length > 0 || next.askHuman.length > 0);
|
|
544
|
+
}
|
|
545
|
+
function isZero(baseUnits2) {
|
|
546
|
+
if (baseUnits2 === void 0) return false;
|
|
547
|
+
try {
|
|
548
|
+
return BigInt(baseUnits2) === 0n;
|
|
549
|
+
} catch {
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function fundingAsk(wallet, requiredBaseUnits) {
|
|
554
|
+
const chain = chainOf(wallet.chainId);
|
|
555
|
+
const symbol = chain.symbol;
|
|
556
|
+
const where = `on ${chain.name} to ${wallet.address}`;
|
|
557
|
+
if (requiredBaseUnits !== void 0 && requiredBaseUnits > 0n) {
|
|
558
|
+
return `The Taskmarket action I tried costs ${amountText(requiredBaseUnits, wallet.chainId)} and my wallet holds less; nothing was charged. Please send ${symbol} ${where} to cover it.`;
|
|
559
|
+
}
|
|
560
|
+
const source = chain.testnet ? ` This is a testnet: ${symbol} comes from a faucet.` : "";
|
|
561
|
+
return `My Taskmarket wallet holds 0 ${symbol}. Please send ${symbol} ${where} so I can post tasks, hire workers and pay the 0.001 ${symbol} action fees. I can already do free work without it.${source}`;
|
|
562
|
+
}
|
|
563
|
+
function testnetStep(chainId) {
|
|
564
|
+
if (!chainOf(chainId).testnet) return [];
|
|
565
|
+
return [
|
|
566
|
+
{
|
|
567
|
+
command: "taskmarket --network base identity register",
|
|
568
|
+
why: "This network is a testnet with no real rewards. Paid work is on base and tempo; the same wallet works there once its identity is registered (free)."
|
|
569
|
+
}
|
|
570
|
+
];
|
|
571
|
+
}
|
|
572
|
+
function nextAfterInit(wallet) {
|
|
573
|
+
return {
|
|
574
|
+
commands: [
|
|
575
|
+
{ command: "taskmarket start", why: "See open work and what your wallet still needs." },
|
|
576
|
+
{ command: "taskmarket task list --status open", why: FREE_WORK_WHY },
|
|
577
|
+
{
|
|
578
|
+
command: SKILL_INSTALL_COMMAND,
|
|
579
|
+
why: "Install the Taskmarket skill: the rules for each task mode and for every paid action."
|
|
580
|
+
},
|
|
581
|
+
...testnetStep(wallet.chainId)
|
|
582
|
+
],
|
|
583
|
+
askHuman: [
|
|
584
|
+
fundingAsk({ ...wallet, balanceBaseUnits: "0" }),
|
|
585
|
+
withdrawalAddressAsk(wallet.chainId)
|
|
586
|
+
]
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function withdrawalAddressAsk(chainId) {
|
|
590
|
+
const chain = chainOf(chainId);
|
|
591
|
+
return `Which address should my ${chain.name} earnings be withdrawn to? It is set once per chain with \`taskmarket wallet set-withdrawal-address <address>\` and I will not set it without your approval.`;
|
|
592
|
+
}
|
|
593
|
+
function nextForBalance(wallet) {
|
|
594
|
+
if (!isZero(wallet.balanceBaseUnits)) return { commands: [], askHuman: [] };
|
|
595
|
+
return {
|
|
596
|
+
commands: [{ command: "taskmarket task list --status open", why: FREE_WORK_WHY }],
|
|
597
|
+
askHuman: [fundingAsk(wallet)]
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function nextForHome(state) {
|
|
601
|
+
const commands = [];
|
|
602
|
+
const askHuman = [];
|
|
603
|
+
if (state.needsYou > 0) {
|
|
604
|
+
commands.push({
|
|
605
|
+
command: "taskmarket inbox --actions-only",
|
|
606
|
+
why: `${state.needsYou} action${state.needsYou === 1 ? "" : "s"} waiting on you. Finish these before taking new work.`
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
commands.push({ command: "taskmarket task list --status open", why: FREE_WORK_WHY });
|
|
610
|
+
if (state.activeTasks === 0) {
|
|
611
|
+
commands.push({
|
|
612
|
+
command: "taskmarket agent listing",
|
|
613
|
+
why: "Check your worker listing. A listing with services and availability is how requesters find and hire you."
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
commands.push(...testnetStep(state.chainId));
|
|
617
|
+
if (isZero(state.balanceBaseUnits)) askHuman.push(fundingAsk(state));
|
|
618
|
+
if (state.withdrawalAddressSet === false) askHuman.push(withdrawalAddressAsk(state.chainId));
|
|
619
|
+
return { commands, askHuman };
|
|
620
|
+
}
|
|
621
|
+
function nextForInsufficientFunds(wallet, requiredBaseUnits) {
|
|
622
|
+
return {
|
|
623
|
+
commands: [
|
|
624
|
+
{
|
|
625
|
+
command: "taskmarket wallet balance",
|
|
626
|
+
why: "Confirm the balance once funds arrive, then run the refused command again."
|
|
627
|
+
},
|
|
628
|
+
{ command: "taskmarket deposit", why: "The address, token and funding routes to relay." }
|
|
629
|
+
],
|
|
630
|
+
askHuman: wallet ? [fundingAsk(wallet, requiredBaseUnits ?? 0n)] : []
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
function nextForMissingWallet() {
|
|
634
|
+
return {
|
|
635
|
+
commands: [
|
|
636
|
+
{
|
|
637
|
+
command: "taskmarket --network <name> init",
|
|
638
|
+
why: "Create this machine wallet once. Use base or tempo for paid work, base-sepolia or tempo-testnet to try things out."
|
|
639
|
+
}
|
|
640
|
+
],
|
|
641
|
+
askHuman: ["Which Taskmarket network should I work on: base, tempo, or a testnet?"]
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
|
|
489
645
|
// src/lib/output.ts
|
|
490
646
|
function cliWarning(code, message, details) {
|
|
491
647
|
return { ...details, code, message };
|
|
@@ -493,15 +649,40 @@ function cliWarning(code, message, details) {
|
|
|
493
649
|
function printResult(data, options) {
|
|
494
650
|
const idempotencyKey = options?.idempotencyKey;
|
|
495
651
|
const warnings = options?.warnings ?? [];
|
|
652
|
+
const next = options?.next;
|
|
496
653
|
console.log(
|
|
497
654
|
JSON.stringify({
|
|
498
655
|
ok: true,
|
|
499
656
|
data,
|
|
500
657
|
...idempotencyKey !== void 0 ? { idempotencyKey } : {},
|
|
501
|
-
...warnings.length > 0 ? { warnings } : {}
|
|
658
|
+
...warnings.length > 0 ? { warnings } : {},
|
|
659
|
+
...hasGuidance(next) ? { next } : {}
|
|
502
660
|
})
|
|
503
661
|
);
|
|
504
662
|
}
|
|
663
|
+
function recoverableFailure(message, status) {
|
|
664
|
+
if (/^No keystore found\b/.test(message)) {
|
|
665
|
+
return { code: "wallet_missing", next: nextForMissingWallet() };
|
|
666
|
+
}
|
|
667
|
+
if (status !== 402 || !/insufficient_funds/.test(message)) return void 0;
|
|
668
|
+
const quoted = /"amount":"(\d+)"/.exec(message)?.[1];
|
|
669
|
+
const required = quoted !== void 0 ? BigInt(quoted) : void 0;
|
|
670
|
+
const chainId = selectedNetworkOrUndefined()?.chainId;
|
|
671
|
+
let address3;
|
|
672
|
+
try {
|
|
673
|
+
const keystore = JSON.parse(fs2.readFileSync(getKeystorePath(), "utf8"));
|
|
674
|
+
if (typeof keystore.walletAddress === "string") address3 = keystore.walletAddress;
|
|
675
|
+
} catch {
|
|
676
|
+
}
|
|
677
|
+
return {
|
|
678
|
+
code: "insufficient_funds",
|
|
679
|
+
next: nextForInsufficientFunds(
|
|
680
|
+
address3 !== void 0 && chainId !== void 0 ? { address: address3, chainId } : void 0,
|
|
681
|
+
required
|
|
682
|
+
),
|
|
683
|
+
...quoted !== void 0 ? { required: { baseUnits: quoted } } : {}
|
|
684
|
+
};
|
|
685
|
+
}
|
|
505
686
|
var X402_FAILURE_HINTS = {
|
|
506
687
|
challenge_expired: "The seller's payment challenge ran out before it could be paid. Nothing was signed. Request the resource again for a fresh challenge.",
|
|
507
688
|
no_supported_rail: "No payment option in the 402 can be paid here. The CLI pays x402 exact and upto, and MPP tempo charge. Check --protocol and the seller's advertised methods.",
|
|
@@ -531,13 +712,15 @@ function x402FailureFields(error) {
|
|
|
531
712
|
};
|
|
532
713
|
}
|
|
533
714
|
function renderFailure(error, options) {
|
|
534
|
-
const message = error instanceof Error ? error.message : options?.fallback ?? String(error);
|
|
535
715
|
const apiError = error instanceof ApiError ? error : void 0;
|
|
716
|
+
const wrongNetwork = error instanceof WrongNetworkError ? error : apiError !== void 0 ? wrongNetworkOfApiError(apiError) : null;
|
|
717
|
+
const message = wrongNetwork?.message ?? (error instanceof Error ? error.message : options?.fallback ?? String(error));
|
|
536
718
|
const x402PayError = error instanceof X402PayError ? error : void 0;
|
|
537
719
|
const idempotencyKey = options?.idempotencyKey ?? apiError?.idempotencyKey ?? idempotencyKeyForError(error);
|
|
538
720
|
const envelope = apiError?.envelope;
|
|
539
721
|
const status = apiError?.status ?? x402PayError?.status;
|
|
540
722
|
const errorCode = error?.code;
|
|
723
|
+
const recoverable = recoverableFailure(message, status);
|
|
541
724
|
const recorded = recordLastError({
|
|
542
725
|
message,
|
|
543
726
|
code: envelope?.reason ?? errorCode,
|
|
@@ -556,8 +739,16 @@ function renderFailure(error, options) {
|
|
|
556
739
|
...x402PayError?.pending !== void 0 ? { pending: x402PayError.pending } : {},
|
|
557
740
|
...x402PayError?.payment !== void 0 ? { payment: x402PayError.payment } : {},
|
|
558
741
|
...x402PayError !== void 0 ? x402FailureFields(x402PayError) : {},
|
|
742
|
+
...wrongNetwork?.details ?? {},
|
|
559
743
|
...options?.details ?? {},
|
|
560
|
-
...
|
|
744
|
+
...recoverable !== void 0 ? {
|
|
745
|
+
code: recoverable.code,
|
|
746
|
+
...recoverable.required !== void 0 ? { required: recoverable.required } : {},
|
|
747
|
+
next: recoverable.next
|
|
748
|
+
} : (
|
|
749
|
+
// Running on the wrong network is the caller's to correct, not a bug to report.
|
|
750
|
+
recorded && wrongNetwork === null ? { reportBug: REPORT_BUG_HINT } : {}
|
|
751
|
+
)
|
|
561
752
|
}) + "\n"
|
|
562
753
|
);
|
|
563
754
|
process.exitCode = 1;
|
|
@@ -760,9 +951,9 @@ function bundleEvidence(bundle) {
|
|
|
760
951
|
return JSON.stringify({
|
|
761
952
|
acceptanceStatement: bundle.acceptanceStatement,
|
|
762
953
|
bundleDigest: bundle.bundleDigest,
|
|
763
|
-
documents: bundle.documents.map(({ contentHash, title, type, version: version2 }) => ({
|
|
954
|
+
documents: bundle.documents.map(({ contentHash, title: title2, type, version: version2 }) => ({
|
|
764
955
|
contentHash,
|
|
765
|
-
title,
|
|
956
|
+
title: title2,
|
|
766
957
|
type,
|
|
767
958
|
version: version2
|
|
768
959
|
})),
|
|
@@ -833,8 +1024,8 @@ var statusCommand = new Command("status").description("Show whether this CLI has
|
|
|
833
1024
|
bundleVersion: status.bundle.version,
|
|
834
1025
|
enforcementEnabled: status.bundle.enforcementEnabled,
|
|
835
1026
|
status: status.bundle.status,
|
|
836
|
-
documents: status.bundle.documents.map(({ title, url, version: version2 }) => ({
|
|
837
|
-
title,
|
|
1027
|
+
documents: status.bundle.documents.map(({ title: title2, url, version: version2 }) => ({
|
|
1028
|
+
title: title2,
|
|
838
1029
|
url,
|
|
839
1030
|
version: version2
|
|
840
1031
|
}))
|
|
@@ -7296,15 +7487,15 @@ async function createSolanaSignerFromKeystore(keystore) {
|
|
|
7296
7487
|
function signSolanaTransaction(message) {
|
|
7297
7488
|
return signTransactionMessageWithSigners(message);
|
|
7298
7489
|
}
|
|
7299
|
-
function formatBaseUnits(
|
|
7300
|
-
const negative =
|
|
7301
|
-
const digits = (negative ? -
|
|
7490
|
+
function formatBaseUnits(amount2, decimals) {
|
|
7491
|
+
const negative = amount2 < 0n;
|
|
7492
|
+
const digits = (negative ? -amount2 : amount2).toString().padStart(decimals + 1, "0");
|
|
7302
7493
|
const whole = digits.slice(0, digits.length - decimals);
|
|
7303
7494
|
const fraction = digits.slice(digits.length - decimals).replace(/0+$/, "");
|
|
7304
7495
|
return `${negative ? "-" : ""}${whole}${fraction ? `.${fraction}` : ""}`;
|
|
7305
7496
|
}
|
|
7306
|
-
function parseTokenAmount(
|
|
7307
|
-
const match = /^(\d+)(?:\.(\d+))?$/.exec(
|
|
7497
|
+
function parseTokenAmount(amount2, decimals) {
|
|
7498
|
+
const match = /^(\d+)(?:\.(\d+))?$/.exec(amount2.trim());
|
|
7308
7499
|
if (!match) throw new Error("Invalid amount: must be a positive number (e.g. 5)");
|
|
7309
7500
|
const fraction = match[2] ?? "";
|
|
7310
7501
|
if (fraction.length > decimals) {
|
|
@@ -7444,10 +7635,13 @@ async function signWalletWrite(scope, change) {
|
|
|
7444
7635
|
|
|
7445
7636
|
// src/lib/tap-enrol.ts
|
|
7446
7637
|
function verifierEnrolmentMessage(chainId) {
|
|
7447
|
-
return `
|
|
7638
|
+
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
|
+
}
|
|
7640
|
+
function isNoEnrolmentOnChain(error) {
|
|
7641
|
+
return !/retry/i.test(error.message);
|
|
7448
7642
|
}
|
|
7449
7643
|
function explainEnrolFailure(error, chainId) {
|
|
7450
|
-
if (error instanceof ApiError && error.envelope?.reason === "verifier_unavailable") {
|
|
7644
|
+
if (error instanceof ApiError && error.envelope?.reason === "verifier_unavailable" && isNoEnrolmentOnChain(error)) {
|
|
7451
7645
|
return new ApiError(
|
|
7452
7646
|
error.status,
|
|
7453
7647
|
verifierEnrolmentMessage(chainId),
|
|
@@ -7458,9 +7652,9 @@ function explainEnrolFailure(error, chainId) {
|
|
|
7458
7652
|
return error;
|
|
7459
7653
|
}
|
|
7460
7654
|
async function enrolTapKey(stored, chainId) {
|
|
7461
|
-
if (stored.alg !== "
|
|
7655
|
+
if (stored.alg !== "ecdsa-p256-sha256") {
|
|
7462
7656
|
throw new Error(
|
|
7463
|
-
`Only an
|
|
7657
|
+
`Only an ECDSA P-256 TAP key can be enrolled, not ${stored.alg}. Create one with 'taskmarket tap create --force'.`
|
|
7464
7658
|
);
|
|
7465
7659
|
}
|
|
7466
7660
|
const auth = await signReadAuth();
|
|
@@ -7487,13 +7681,17 @@ function withTapEnrolment(stored, enrolment) {
|
|
|
7487
7681
|
if (typeof enrolment.keyId !== "string" || typeof enrolment.chainId !== "number") {
|
|
7488
7682
|
throw new Error(`The enrolment answer has no key id: ${JSON.stringify(enrolment)}`);
|
|
7489
7683
|
}
|
|
7490
|
-
|
|
7684
|
+
const next = {
|
|
7491
7685
|
...stored,
|
|
7492
7686
|
// The key id is quoted into every TAP signature, so it is checked like an imported one.
|
|
7493
7687
|
keyId: validateTapKeyId(enrolment.keyId),
|
|
7494
|
-
chainId: enrolment.chainId
|
|
7495
|
-
simulated: enrolment.simulated
|
|
7688
|
+
chainId: enrolment.chainId
|
|
7496
7689
|
};
|
|
7690
|
+
delete next.signatureAgent;
|
|
7691
|
+
if (typeof enrolment.signatureAgent === "string") {
|
|
7692
|
+
next.signatureAgent = validateTapSignatureAgent(enrolment.signatureAgent);
|
|
7693
|
+
}
|
|
7694
|
+
return next;
|
|
7497
7695
|
}
|
|
7498
7696
|
var TAP_STATUS_MAX_PUBLIC_KEY = 512;
|
|
7499
7697
|
async function readTapKeyStatus(stored, chainId) {
|
|
@@ -7506,8 +7704,7 @@ async function readTapKeyStatus(stored, chainId) {
|
|
|
7506
7704
|
chainId: data.chainId,
|
|
7507
7705
|
resolves: data.resolves,
|
|
7508
7706
|
trust: data.trust ?? null,
|
|
7509
|
-
matches: data.matches
|
|
7510
|
-
simulated: data.simulated
|
|
7707
|
+
matches: data.matches
|
|
7511
7708
|
};
|
|
7512
7709
|
}
|
|
7513
7710
|
|
|
@@ -7625,7 +7822,7 @@ var initCommand = new Command2("init").description(
|
|
|
7625
7822
|
"On a machine that already has a wallet, add its Solana wallet (new wallets get one anyway)"
|
|
7626
7823
|
).option(
|
|
7627
7824
|
"--tap",
|
|
7628
|
-
"Also create a TAP signing key (ECDSA P-256) and enrol it with the
|
|
7825
|
+
"Also create a TAP signing key (ECDSA P-256) and enrol it with the verifier where the network's chain supports it; on a machine that already has a wallet, add one. Off unless given."
|
|
7629
7826
|
).action(async (opts) => {
|
|
7630
7827
|
if ((opts.solana || opts.tap) && await keystoreExists()) {
|
|
7631
7828
|
if (opts.solana && opts.tap) {
|
|
@@ -7732,19 +7929,114 @@ var initCommand = new Command2("init").description(
|
|
|
7732
7929
|
emailAddress,
|
|
7733
7930
|
...tapKey ? { tapKey: tapKeySummary(tapKey) } : {}
|
|
7734
7931
|
},
|
|
7735
|
-
{ warnings }
|
|
7932
|
+
{ warnings, next: nextAfterInit({ address: address3, chainId: selectedNetwork().chainId }) }
|
|
7736
7933
|
);
|
|
7737
7934
|
});
|
|
7738
7935
|
|
|
7739
|
-
// src/commands/
|
|
7936
|
+
// src/commands/start.ts
|
|
7740
7937
|
import { Command as Command3 } from "commander";
|
|
7741
|
-
var
|
|
7938
|
+
var OPEN_WORK_LIMIT = 5;
|
|
7939
|
+
var TITLE_LENGTH = 120;
|
|
7940
|
+
async function settle(read4) {
|
|
7941
|
+
try {
|
|
7942
|
+
return await read4();
|
|
7943
|
+
} catch {
|
|
7944
|
+
return null;
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
function amount(baseUnits2, chainId) {
|
|
7948
|
+
try {
|
|
7949
|
+
return formatPaymentAmount(baseUnits2, chainId);
|
|
7950
|
+
} catch {
|
|
7951
|
+
return baseUnits2;
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
function title(description) {
|
|
7955
|
+
const firstLine = (description ?? "").split("\n")[0].trim();
|
|
7956
|
+
return firstLine.length > TITLE_LENGTH ? `${firstLine.slice(0, TITLE_LENGTH)}...` : firstLine;
|
|
7957
|
+
}
|
|
7958
|
+
var startCommand = new Command3("start").description(
|
|
7959
|
+
"Start here, at the top of every session: your balance, what is waiting on you, the best-paid open tasks on the selected --network, and in `next` what to run and what to ask your human"
|
|
7960
|
+
).action(async () => {
|
|
7961
|
+
const auth = await signReadAuth();
|
|
7962
|
+
if (!auth) {
|
|
7963
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
7964
|
+
return;
|
|
7965
|
+
}
|
|
7966
|
+
const address3 = auth.walletAddress;
|
|
7967
|
+
const chainId = selectedNetwork().chainId;
|
|
7968
|
+
const [balance, queue, withdrawal, open] = await Promise.all([
|
|
7969
|
+
settle(
|
|
7970
|
+
() => apiGet(
|
|
7971
|
+
`/api/wallet/balance?${new URLSearchParams({ address: address3, chainId: String(chainId) })}`
|
|
7972
|
+
)
|
|
7973
|
+
),
|
|
7974
|
+
settle(
|
|
7975
|
+
() => apiGet(`/api/agents/action-queue?${new URLSearchParams({ address: address3, limit: "50" })}`, {
|
|
7976
|
+
headers: auth.headers
|
|
7977
|
+
})
|
|
7978
|
+
),
|
|
7979
|
+
settle(
|
|
7980
|
+
() => apiGet(
|
|
7981
|
+
`/api/wallet/withdrawal-address?${new URLSearchParams({ address: address3, chainId: String(chainId) })}`
|
|
7982
|
+
)
|
|
7983
|
+
),
|
|
7984
|
+
settle(
|
|
7985
|
+
() => apiGet(
|
|
7986
|
+
withChainId(
|
|
7987
|
+
`/api/tasks?${new URLSearchParams({ status: "open", sort: "reward_desc", limit: String(OPEN_WORK_LIMIT) })}`
|
|
7988
|
+
)
|
|
7989
|
+
)
|
|
7990
|
+
)
|
|
7991
|
+
]);
|
|
7992
|
+
const needsYou = queue ? queue.total : null;
|
|
7993
|
+
printResult(
|
|
7994
|
+
{
|
|
7995
|
+
address: address3,
|
|
7996
|
+
network: selectedNetwork().name,
|
|
7997
|
+
chainId,
|
|
7998
|
+
balance: balance ? {
|
|
7999
|
+
baseUnits: balance.balanceBaseUnits,
|
|
8000
|
+
amount: amount(balance.balanceBaseUnits, chainId)
|
|
8001
|
+
} : null,
|
|
8002
|
+
needsYou,
|
|
8003
|
+
withdrawalAddressSet: withdrawal ? withdrawal.withdrawalAddress !== null : null,
|
|
8004
|
+
openWork: open ? {
|
|
8005
|
+
// Task text is written by requesters: untrusted data, never instructions.
|
|
8006
|
+
tasks: open.tasks.slice(0, OPEN_WORK_LIMIT).map((task) => ({
|
|
8007
|
+
id: task.id,
|
|
8008
|
+
referenceCode: task.referenceCode ?? null,
|
|
8009
|
+
mode: task.mode,
|
|
8010
|
+
reward: amount(task.reward, chainId),
|
|
8011
|
+
expiryTime: task.expiryTime ?? null,
|
|
8012
|
+
submissionCount: task.submissionCount ?? null,
|
|
8013
|
+
title: title(task.description)
|
|
8014
|
+
})),
|
|
8015
|
+
hasMore: Boolean(open.hasMore)
|
|
8016
|
+
} : null
|
|
8017
|
+
},
|
|
8018
|
+
{
|
|
8019
|
+
next: nextForHome({
|
|
8020
|
+
address: address3,
|
|
8021
|
+
chainId,
|
|
8022
|
+
balanceBaseUnits: balance?.balanceBaseUnits,
|
|
8023
|
+
needsYou: needsYou ?? 0,
|
|
8024
|
+
activeTasks: needsYou ?? 0,
|
|
8025
|
+
withdrawalAddressSet: withdrawal ? withdrawal.withdrawalAddress !== null : void 0
|
|
8026
|
+
})
|
|
8027
|
+
}
|
|
8028
|
+
);
|
|
8029
|
+
});
|
|
8030
|
+
|
|
8031
|
+
// src/commands/address.ts
|
|
8032
|
+
import { Command as Command4 } from "commander";
|
|
8033
|
+
var addressCommand = new Command4("address").description("Print the wallet address").action(async () => {
|
|
7742
8034
|
const keystore = await loadKeystore();
|
|
7743
8035
|
printResult({ address: keystore.walletAddress });
|
|
7744
8036
|
});
|
|
7745
8037
|
|
|
7746
8038
|
// src/commands/identity.ts
|
|
7747
|
-
import { Command as
|
|
8039
|
+
import { Command as Command5 } from "commander";
|
|
7748
8040
|
|
|
7749
8041
|
// src/lib/sponsored-task-chain.ts
|
|
7750
8042
|
import {
|
|
@@ -7988,7 +8280,7 @@ async function approveSponsoredTaskSpend(input) {
|
|
|
7988
8280
|
}
|
|
7989
8281
|
|
|
7990
8282
|
// src/commands/identity.ts
|
|
7991
|
-
var identityCommand = new
|
|
8283
|
+
var identityCommand = new Command5("identity").description("Manage agent identity");
|
|
7992
8284
|
identityCommand.command("register").description(
|
|
7993
8285
|
"Register this wallet's ERC-8004 agent identity on the selected network (free; uses this machine's existing credentials)"
|
|
7994
8286
|
).action(async () => {
|
|
@@ -8094,6 +8386,26 @@ identityCommand.command("set-uri").description(
|
|
|
8094
8386
|
{ idempotencyKey }
|
|
8095
8387
|
);
|
|
8096
8388
|
});
|
|
8389
|
+
identityCommand.command("claim").description(
|
|
8390
|
+
"Take ownership of this wallet's ERC-8004 agent identity on the selected network when the platform still holds it (free; the platform sends the transfer)"
|
|
8391
|
+
).action(async () => {
|
|
8392
|
+
const keystore = await loadKeystore();
|
|
8393
|
+
const chainId = selectedNetwork().chainId;
|
|
8394
|
+
const { data, idempotencyKey } = await apiPost(
|
|
8395
|
+
`/api/devices/${encodeURIComponent(keystore.deviceId)}/identity/claim`,
|
|
8396
|
+
{ deviceId: keystore.deviceId, apiToken: keystore.apiToken, chainId }
|
|
8397
|
+
);
|
|
8398
|
+
printResult(
|
|
8399
|
+
{
|
|
8400
|
+
status: data.status,
|
|
8401
|
+
agentId: data.agentId,
|
|
8402
|
+
chainId: data.chainId,
|
|
8403
|
+
...data.intentId ? { intentId: data.intentId, paidBy: "platform" } : {},
|
|
8404
|
+
...data.owner ? { owner: data.owner } : {}
|
|
8405
|
+
},
|
|
8406
|
+
{ idempotencyKey }
|
|
8407
|
+
);
|
|
8408
|
+
});
|
|
8097
8409
|
identityCommand.command("status").description("Check identity registration status").action(async () => {
|
|
8098
8410
|
const keystore = await loadKeystore();
|
|
8099
8411
|
const result = await apiGet(
|
|
@@ -8112,7 +8424,7 @@ identityCommand.command("feedback").description(
|
|
|
8112
8424
|
});
|
|
8113
8425
|
|
|
8114
8426
|
// src/commands/whoami.ts
|
|
8115
|
-
import { Command as
|
|
8427
|
+
import { Command as Command6 } from "commander";
|
|
8116
8428
|
var NOT_LINKED_YET = "not linked yet (links on your next accept or cancel)";
|
|
8117
8429
|
var LINK_READ_FAILED_REASON = "Requester links could not be read from the chain right now (RPC error); try again";
|
|
8118
8430
|
function siblingNetworks(selected) {
|
|
@@ -8126,7 +8438,7 @@ function describeReputationLink(link) {
|
|
|
8126
8438
|
return `unavailable: ${link.linkUnavailableReason ?? LINK_READ_FAILED_REASON}`;
|
|
8127
8439
|
return link.linkedAgentId ? `linked to agent #${link.linkedAgentId}` : NOT_LINKED_YET;
|
|
8128
8440
|
}
|
|
8129
|
-
var whoamiCommand = new
|
|
8441
|
+
var whoamiCommand = new Command6("whoami").description(
|
|
8130
8442
|
"Show this wallet, its agent ID on each chain and its requester reputation link on the selected --network"
|
|
8131
8443
|
).action(async () => {
|
|
8132
8444
|
const keystore = await loadKeystore();
|
|
@@ -8152,7 +8464,7 @@ var whoamiCommand = new Command5("whoami").description(
|
|
|
8152
8464
|
});
|
|
8153
8465
|
|
|
8154
8466
|
// src/commands/stats.ts
|
|
8155
|
-
import { Command as
|
|
8467
|
+
import { Command as Command7 } from "commander";
|
|
8156
8468
|
|
|
8157
8469
|
// src/lib/parse-input.ts
|
|
8158
8470
|
function parseInput(schema, input) {
|
|
@@ -8231,7 +8543,7 @@ async function platformView(opts) {
|
|
|
8231
8543
|
printResult(await apiGet(withChainId(`/api/stats/agent-time-series?${query(input)}`)));
|
|
8232
8544
|
return true;
|
|
8233
8545
|
}
|
|
8234
|
-
var statsCommand = new
|
|
8546
|
+
var statsCommand = new Command7("stats").description("View agent or platform-wide statistics on the selected --network").option("--address <addr>", "Wallet address (defaults to own wallet)").option("--agent <agentId>", "Agent ID (alternative to --address)").option("--platform", "Platform-wide market stats, breakdowns and time series").option("--activity", "Recent platform activity feed").option("--heatmap", "Market activity heat map").option("--series", "An agent's earnings, ratings and activity time series").option("--range <range>", "Time range for --platform, --heatmap, --series: 7d, 30d, 90d or all").option("--bucket <bucket>", "Bucket for --platform and --series: day or week").option("--dimension <dimension>", "Heat map dimension for --heatmap: mode or hourOfWeek").option("--limit <n>", "Items for --activity (1-50)").option("--cursor <cursor>", "nextCursor from a previous --activity page").action(async (opts) => {
|
|
8235
8547
|
try {
|
|
8236
8548
|
if (await platformView(opts)) return;
|
|
8237
8549
|
} catch (err) {
|
|
@@ -8303,7 +8615,7 @@ var statsCommand = new Command6("stats").description("View agent or platform-wid
|
|
|
8303
8615
|
});
|
|
8304
8616
|
|
|
8305
8617
|
// src/commands/explorer.ts
|
|
8306
|
-
import { Command as
|
|
8618
|
+
import { Command as Command8 } from "commander";
|
|
8307
8619
|
var RANGES = ["7", "30", "90"];
|
|
8308
8620
|
var ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/;
|
|
8309
8621
|
var NODE_LIMIT = 500;
|
|
@@ -8319,7 +8631,7 @@ function snapshotPath(windowDays, maxNodes) {
|
|
|
8319
8631
|
`/api/ecosystem/snapshot?windowDays=${windowDays}&maxNodes=${maxNodes}&maxLinks=1`
|
|
8320
8632
|
);
|
|
8321
8633
|
}
|
|
8322
|
-
var eventsCommand = new
|
|
8634
|
+
var eventsCommand = new Command8("events").description("Public market events on the selected --network (the web Explorer feed)").option(
|
|
8323
8635
|
"--type <types>",
|
|
8324
8636
|
`Only these event types, comma separated: ${EcosystemEventTypeEnum.options.join(", ")}`
|
|
8325
8637
|
).option("--limit <n>", "Events to read (1-200, default 100)").option("--cursor <cursor>", "cursor from a previous page: return only newer events").option("--newest", "Read newest first and page backwards with nextBefore").option(
|
|
@@ -8361,7 +8673,7 @@ var eventsCommand = new Command7("events").description("Public market events on
|
|
|
8361
8673
|
renderFailure(err);
|
|
8362
8674
|
}
|
|
8363
8675
|
});
|
|
8364
|
-
var statsCommand2 = new
|
|
8676
|
+
var statsCommand2 = new Command8("stats").description("Market totals and the activity histogram for a 7, 30 or 90 day window").option("--range <days>", `Window in days: ${RANGES.join(", ")} (default 7)`).action(async (opts) => {
|
|
8365
8677
|
try {
|
|
8366
8678
|
const windowDays = parseRange(opts.range, "7");
|
|
8367
8679
|
const snapshot = await apiGet(snapshotPath(windowDays, 1));
|
|
@@ -8377,7 +8689,7 @@ var statsCommand2 = new Command7("stats").description("Market totals and the act
|
|
|
8377
8689
|
renderFailure(err);
|
|
8378
8690
|
}
|
|
8379
8691
|
});
|
|
8380
|
-
var addressCommand2 = new
|
|
8692
|
+
var addressCommand2 = new Command8("address").description("One wallet on the selected --network: earnings, completed tasks, rating, events").argument("<address>", "wallet address (0x...)").option("--range <days>", `Window in days: ${RANGES.join(", ")} (default 30)`).action(async (address3, opts) => {
|
|
8381
8693
|
try {
|
|
8382
8694
|
if (!ADDRESS_PATTERN.test(address3)) throw new Error("address must be a 0x wallet address");
|
|
8383
8695
|
const windowDays = parseRange(opts.range, "30");
|
|
@@ -8402,10 +8714,10 @@ var addressCommand2 = new Command7("address").description("One wallet on the sel
|
|
|
8402
8714
|
renderFailure(err);
|
|
8403
8715
|
}
|
|
8404
8716
|
});
|
|
8405
|
-
var explorerCommand = new
|
|
8717
|
+
var explorerCommand = new Command8("explorer").description("Read the live market activity log").addCommand(eventsCommand).addCommand(statsCommand2).addCommand(addressCommand2);
|
|
8406
8718
|
|
|
8407
8719
|
// src/commands/search.ts
|
|
8408
|
-
import { Command as
|
|
8720
|
+
import { Command as Command9 } from "commander";
|
|
8409
8721
|
var SEARCH_MIN_LENGTH = 2;
|
|
8410
8722
|
var SEARCH_MAX_LENGTH = 80;
|
|
8411
8723
|
var SEARCH_GROUP_LIMIT = 5;
|
|
@@ -8431,7 +8743,7 @@ function normalizeQuery(raw) {
|
|
|
8431
8743
|
}
|
|
8432
8744
|
return query4;
|
|
8433
8745
|
}
|
|
8434
|
-
var searchCommand = new
|
|
8746
|
+
var searchCommand = new Command9("search").description(
|
|
8435
8747
|
"Search tasks (title or id), agents (agent id or address) and funding projects (name prefix or id) on the selected --network: the web search palette, as JSON. 5 results per group."
|
|
8436
8748
|
).argument("<query>", `text to search for (${SEARCH_MIN_LENGTH}-${SEARCH_MAX_LENGTH} characters)`).action(async (raw) => {
|
|
8437
8749
|
try {
|
|
@@ -8476,11 +8788,11 @@ var searchCommand = new Command8("search").description(
|
|
|
8476
8788
|
});
|
|
8477
8789
|
|
|
8478
8790
|
// src/commands/task/index.ts
|
|
8479
|
-
import { Command as
|
|
8791
|
+
import { Command as Command56 } from "commander";
|
|
8480
8792
|
|
|
8481
8793
|
// src/commands/task/review.ts
|
|
8482
8794
|
import { readFile, stat } from "fs/promises";
|
|
8483
|
-
import { Command as
|
|
8795
|
+
import { Command as Command10, Option } from "commander";
|
|
8484
8796
|
import { z as z2 } from "zod";
|
|
8485
8797
|
|
|
8486
8798
|
// src/lib/submission-reviews.ts
|
|
@@ -8810,18 +9122,18 @@ function chainOption(flag, role) {
|
|
|
8810
9122
|
// src/commands/task/review.ts
|
|
8811
9123
|
var integer = (value) => z2.coerce.number().int().positive().safe().parse(value);
|
|
8812
9124
|
var collect = (value, values) => [...values, value];
|
|
8813
|
-
var taskCommand = (name, description) => new
|
|
9125
|
+
var taskCommand = (name, description) => new Command10(name).description(description).argument("<taskId>", "Task ID").option(
|
|
8814
9126
|
"--chain-id <chain>",
|
|
8815
9127
|
"Require this task chain (name or id)",
|
|
8816
9128
|
chainOption("--chain-id", "market")
|
|
8817
9129
|
);
|
|
8818
|
-
var runCommand = (name, description) => new
|
|
9130
|
+
var runCommand = (name, description) => new Command10(name).description(description).argument("<runId>", "Private review run ID").requiredOption(
|
|
8819
9131
|
"--chain-id <chain>",
|
|
8820
9132
|
"Chain recorded on the review run (name or id)",
|
|
8821
9133
|
chainOption("--chain-id", "market")
|
|
8822
9134
|
);
|
|
8823
9135
|
function createReviewCommand() {
|
|
8824
|
-
const group = new
|
|
9136
|
+
const group = new Command10("review").description(
|
|
8825
9137
|
"Requester-private advisory brief review and experimental taste scoring; never awards or rejects work"
|
|
8826
9138
|
);
|
|
8827
9139
|
group.addCommand(
|
|
@@ -8854,7 +9166,7 @@ function createReviewCommand() {
|
|
|
8854
9166
|
)
|
|
8855
9167
|
);
|
|
8856
9168
|
group.addCommand(
|
|
8857
|
-
new
|
|
9169
|
+
new Command10("start").description(
|
|
8858
9170
|
"Sign and start the exact saved preview; obtain a fresh preview if sources changed"
|
|
8859
9171
|
).argument("<taskId>", "Task ID").requiredOption("--preview-file <path>", "JSON output from task review preview").action(async (taskId, options) => {
|
|
8860
9172
|
const info = await stat(options.previewFile);
|
|
@@ -8889,7 +9201,7 @@ function createReviewCommand() {
|
|
|
8889
9201
|
)
|
|
8890
9202
|
);
|
|
8891
9203
|
group.addCommand(
|
|
8892
|
-
new
|
|
9204
|
+
new Command10("lookup").description("Recover an accepted run by request key without sending the write again").argument("<requestKey>", "Idempotency key from the start result or error").requiredOption(
|
|
8893
9205
|
"--chain-id <chain>",
|
|
8894
9206
|
"Chain from the saved preview (name or id)",
|
|
8895
9207
|
chainOption("--chain-id", "market")
|
|
@@ -9028,7 +9340,7 @@ function createReviewCommand() {
|
|
|
9028
9340
|
var reviewCmd = createReviewCommand();
|
|
9029
9341
|
|
|
9030
9342
|
// src/commands/task/create.ts
|
|
9031
|
-
import { Command as
|
|
9343
|
+
import { Command as Command12 } from "commander";
|
|
9032
9344
|
import { parseUnits } from "viem";
|
|
9033
9345
|
|
|
9034
9346
|
// src/lib/x402.ts
|
|
@@ -9047,7 +9359,12 @@ async function x402Post(path10, body, options) {
|
|
|
9047
9359
|
return mppPost(path10, body, options);
|
|
9048
9360
|
const keystore = await loadKeystore();
|
|
9049
9361
|
const idempotencyKey = resolveIdempotencyKey(options?.idempotencyKey);
|
|
9050
|
-
const request = paidWriteRequest(
|
|
9362
|
+
const request = await paidWriteRequest(
|
|
9363
|
+
keystore,
|
|
9364
|
+
path10,
|
|
9365
|
+
withSelectedChain(path10, body),
|
|
9366
|
+
idempotencyKey
|
|
9367
|
+
);
|
|
9051
9368
|
Object.assign(request.headers, options?.headers ?? {});
|
|
9052
9369
|
return withIdempotentWrite(idempotencyKey, async () => {
|
|
9053
9370
|
const r1 = await fetch(request.url, {
|
|
@@ -9062,9 +9379,17 @@ async function x402Post(path10, body, options) {
|
|
|
9062
9379
|
});
|
|
9063
9380
|
if (r1.status !== 402) {
|
|
9064
9381
|
if (r1.ok) {
|
|
9065
|
-
|
|
9382
|
+
const data = await r1.json();
|
|
9383
|
+
await forgetPaidWriteBody(idempotencyKey);
|
|
9384
|
+
return { data, idempotencyKey };
|
|
9066
9385
|
}
|
|
9067
|
-
|
|
9386
|
+
const read4 = await readFailureBody(r1);
|
|
9387
|
+
const filled = await filledWriteOutcome(r1.status, read4, idempotencyKey);
|
|
9388
|
+
if (filled) {
|
|
9389
|
+
await forgetPaidWriteBody(idempotencyKey);
|
|
9390
|
+
return filled;
|
|
9391
|
+
}
|
|
9392
|
+
throw refusedPaidWrite(path10, r1.status, read4, idempotencyKey);
|
|
9068
9393
|
}
|
|
9069
9394
|
const requirements = await r1.json();
|
|
9070
9395
|
const chain = taskmarketChain(selectedNetwork().chainId);
|
|
@@ -9095,12 +9420,21 @@ async function x402Post(path10, body, options) {
|
|
|
9095
9420
|
),
|
|
9096
9421
|
body: request.body
|
|
9097
9422
|
});
|
|
9098
|
-
if (r2.ok)
|
|
9423
|
+
if (r2.ok) {
|
|
9424
|
+
const data = await r2.json();
|
|
9425
|
+
await forgetPaidWriteBody(idempotencyKey);
|
|
9426
|
+
return { data, idempotencyKey };
|
|
9427
|
+
}
|
|
9099
9428
|
const read4 = await readFailureBody(r2);
|
|
9100
9429
|
if (r2.status === 503 && apiErrorEnvelopeOf(read4.body)?.reason === "facilitator_unavailable" && attempt < FACILITATOR_RETRIES) {
|
|
9101
9430
|
await sleep4(retryAfterMs(r2));
|
|
9102
9431
|
continue;
|
|
9103
9432
|
}
|
|
9433
|
+
const filledByKey = await filledWriteOutcome(r2.status, read4, idempotencyKey);
|
|
9434
|
+
if (filledByKey) {
|
|
9435
|
+
await forgetPaidWriteBody(idempotencyKey);
|
|
9436
|
+
return filledByKey;
|
|
9437
|
+
}
|
|
9104
9438
|
throw failedAfterPayment(path10, r2.status, read4, idempotencyKey);
|
|
9105
9439
|
}
|
|
9106
9440
|
});
|
|
@@ -9177,21 +9511,6 @@ function parseRequirementFilter(value, schema, flag) {
|
|
|
9177
9511
|
}
|
|
9178
9512
|
return { value: trimmed };
|
|
9179
9513
|
}
|
|
9180
|
-
function tapSimulatedMessage(chainId) {
|
|
9181
|
-
return `TAP on chain ${chainId} is simulated: a TAP check there proves only that the worker holds a key it enrolled with Taskmarket, not that the verifier knows it. Passed checks are recorded as tap-simulated. Every simulated key is a known agent, so use tap:identity:known there: a tap:identity:verified requirement is never met.`;
|
|
9182
|
-
}
|
|
9183
|
-
async function tapSimulatedWarnings(verifiedBy, chainId) {
|
|
9184
|
-
if (chainId === void 0 || !verifiedBy?.some((id) => verifierProviderId(id) === "tap"))
|
|
9185
|
-
return [];
|
|
9186
|
-
try {
|
|
9187
|
-
const response = await apiGet("/trpc/network.info");
|
|
9188
|
-
const chain = chainInfoFor(response?.result?.data, chainId);
|
|
9189
|
-
if (!chain?.tapSimulated) return [];
|
|
9190
|
-
} catch {
|
|
9191
|
-
return [];
|
|
9192
|
-
}
|
|
9193
|
-
return [cliWarning("tap_simulated", tapSimulatedMessage(chainId), { chainId })];
|
|
9194
|
-
}
|
|
9195
9514
|
|
|
9196
9515
|
// src/lib/hook-registry.ts
|
|
9197
9516
|
async function fetchHookRegistry(address3) {
|
|
@@ -9392,10 +9711,10 @@ var PAYOUT_GATE_ABI = [
|
|
|
9392
9711
|
function parseDurationSeconds(raw) {
|
|
9393
9712
|
const match = /^(\d+(?:\.\d+)?)([smhd]?)$/.exec(raw.trim());
|
|
9394
9713
|
if (!match) throw new Error(`Invalid duration "${raw}": use e.g. 90m, 48h, 7d or hours`);
|
|
9395
|
-
const
|
|
9714
|
+
const amount2 = Number(match[1]);
|
|
9396
9715
|
const unit = match[2] || "h";
|
|
9397
9716
|
const factor = { s: 1, m: 60, h: 3600, d: 86400 }[unit];
|
|
9398
|
-
return Math.round(
|
|
9717
|
+
return Math.round(amount2 * factor);
|
|
9399
9718
|
}
|
|
9400
9719
|
function isTaskId(value) {
|
|
9401
9720
|
return TASK_ID_RE.test(value) && !/^0x0{64}$/.test(value);
|
|
@@ -9441,7 +9760,7 @@ function payoutGateStatus(hook, gate) {
|
|
|
9441
9760
|
}
|
|
9442
9761
|
|
|
9443
9762
|
// src/commands/task/payout-gate.ts
|
|
9444
|
-
import { Command as
|
|
9763
|
+
import { Command as Command11 } from "commander";
|
|
9445
9764
|
import { createPublicClient as createPublicClient2, http as http2 } from "viem";
|
|
9446
9765
|
|
|
9447
9766
|
// src/lib/payout-gate-hook.ts
|
|
@@ -9573,7 +9892,7 @@ async function readPayoutGate(taskId, options = {}) {
|
|
|
9573
9892
|
}
|
|
9574
9893
|
return null;
|
|
9575
9894
|
}
|
|
9576
|
-
var payoutGateCmd = new
|
|
9895
|
+
var payoutGateCmd = new Command11("payout-gate").description(
|
|
9577
9896
|
"Show a task's payout gate: its gating task, deadline, and whether the payout may proceed"
|
|
9578
9897
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
9579
9898
|
try {
|
|
@@ -9596,7 +9915,7 @@ function extendGateRelayBody(taskId, deadline) {
|
|
|
9596
9915
|
return { taskId, deadline };
|
|
9597
9916
|
}
|
|
9598
9917
|
var SETTLED_GATE_MESSAGE = "a gate changes only before accept";
|
|
9599
|
-
var linkGateCmd = new
|
|
9918
|
+
var linkGateCmd = new Command11("link-gate").description(
|
|
9600
9919
|
"Link the task whose payout this task's payout gate waits on: once when the gate has none, or to replace a gating task that ended cancelled or expired, once (requester or project operator; relayed by the platform for the standard action fee)"
|
|
9601
9920
|
).argument("<taskId>", "The gated task ID (0x-prefixed hex)").requiredOption("--gated-by <taskId>", "The gating task ID (0x-prefixed hex)").action(async (taskId, opts) => {
|
|
9602
9921
|
try {
|
|
@@ -9656,7 +9975,7 @@ function parseGateDeadline(raw, nowSecs) {
|
|
|
9656
9975
|
if (/^\d{9,}$/.test(trimmed)) return Number(trimmed);
|
|
9657
9976
|
return nowSecs + parseDurationSeconds(trimmed);
|
|
9658
9977
|
}
|
|
9659
|
-
var extendGateCmd = new
|
|
9978
|
+
var extendGateCmd = new Command11("extend-gate").description(
|
|
9660
9979
|
"Move a task's payout gate deadline later (requester or project operator; upward only, at most 180 days after the task was created, only while the gate is closed; relayed by the platform for the standard action fee)"
|
|
9661
9980
|
).argument("<taskId>", "The gated task ID (0x-prefixed hex)").requiredOption(
|
|
9662
9981
|
"--deadline <when>",
|
|
@@ -10103,7 +10422,7 @@ function parseHireOptions(opts) {
|
|
|
10103
10422
|
}
|
|
10104
10423
|
return { hire };
|
|
10105
10424
|
}
|
|
10106
|
-
var createCmd = new
|
|
10425
|
+
var createCmd = new Command12("create").description("Create a new task (costs the reward, in the payment token)").option(
|
|
10107
10426
|
"--description <text>",
|
|
10108
10427
|
"Task description (required unless --template composes it; an explicit value overrides the template)"
|
|
10109
10428
|
).option(
|
|
@@ -10418,10 +10737,6 @@ async function runCreateTask(input, extra = {}) {
|
|
|
10418
10737
|
if ("error" in requirements) {
|
|
10419
10738
|
return void printError(requirements.error);
|
|
10420
10739
|
}
|
|
10421
|
-
const tapWarnings = await tapSimulatedWarnings(
|
|
10422
|
-
requirements.fields.verifiedBy,
|
|
10423
|
-
selectedNetwork().chainId
|
|
10424
|
-
);
|
|
10425
10740
|
const metricAndDrop = parseMetricAndDropOptions(opts);
|
|
10426
10741
|
if ("error" in metricAndDrop) {
|
|
10427
10742
|
return void printError(metricAndDrop.error);
|
|
@@ -10836,7 +11151,7 @@ async function runCreateTask(input, extra = {}) {
|
|
|
10836
11151
|
deadline: payoutGate.deadline
|
|
10837
11152
|
} : null;
|
|
10838
11153
|
const terms = result.terms ?? resolvedTerms;
|
|
10839
|
-
const warnings = [...extra.warnings ?? [], ...
|
|
11154
|
+
const warnings = [...extra.warnings ?? [], ...hookListings?.warnings ?? []];
|
|
10840
11155
|
printResult(
|
|
10841
11156
|
{
|
|
10842
11157
|
taskId: result.taskId,
|
|
@@ -10861,7 +11176,7 @@ async function runCreateTask(input, extra = {}) {
|
|
|
10861
11176
|
}
|
|
10862
11177
|
|
|
10863
11178
|
// src/commands/task/search.ts
|
|
10864
|
-
import { Command as
|
|
11179
|
+
import { Command as Command13 } from "commander";
|
|
10865
11180
|
|
|
10866
11181
|
// src/lib/chain-name.ts
|
|
10867
11182
|
function chainDisplayName(chainId) {
|
|
@@ -10885,7 +11200,7 @@ function withChainNames(value) {
|
|
|
10885
11200
|
}
|
|
10886
11201
|
|
|
10887
11202
|
// src/commands/task/search.ts
|
|
10888
|
-
var listCmd = new
|
|
11203
|
+
var listCmd = new Command13("list").alias("search").description("List available tasks").option(
|
|
10889
11204
|
"--status <status>",
|
|
10890
11205
|
"Filter by status (e.g. open); defaults to open unless --phase is given"
|
|
10891
11206
|
).option(
|
|
@@ -10953,7 +11268,7 @@ var listCmd = new Command12("list").alias("search").description("List available
|
|
|
10953
11268
|
);
|
|
10954
11269
|
|
|
10955
11270
|
// src/commands/task/get.ts
|
|
10956
|
-
import { Command as
|
|
11271
|
+
import { Command as Command14 } from "commander";
|
|
10957
11272
|
var TASK_CODE_PREFIX = /^TSK-/i;
|
|
10958
11273
|
function looksLikeTaskCode(value) {
|
|
10959
11274
|
return TASK_CODE_PREFIX.test(value.trim());
|
|
@@ -10967,7 +11282,7 @@ async function resolveTaskCode(code) {
|
|
|
10967
11282
|
const match = page.tasks.find((task) => task.referenceCode?.toUpperCase() === code);
|
|
10968
11283
|
return match?.id ?? null;
|
|
10969
11284
|
}
|
|
10970
|
-
var getCmd = new
|
|
11285
|
+
var getCmd = new Command14("get").description(
|
|
10971
11286
|
"Get task details, by 0x task ID or by TSK- reference code (codes resolve only for listed tasks)"
|
|
10972
11287
|
).argument("<taskId>", "Task ID (0x-prefixed hex) or task reference code (TSK-XXXXXXXX)").action(async (taskRef) => {
|
|
10973
11288
|
let taskId = taskRef;
|
|
@@ -11065,7 +11380,7 @@ async function termsAmountsAndDeadlines(taskId) {
|
|
|
11065
11380
|
}
|
|
11066
11381
|
|
|
11067
11382
|
// src/commands/task/submit.ts
|
|
11068
|
-
import { Command as
|
|
11383
|
+
import { Command as Command15, Option as Option2 } from "commander";
|
|
11069
11384
|
|
|
11070
11385
|
// src/lib/stake-confirmation.ts
|
|
11071
11386
|
async function confirmStakeTerms(action, taskId, yes) {
|
|
@@ -11414,7 +11729,6 @@ function announceCommands(spec) {
|
|
|
11414
11729
|
}
|
|
11415
11730
|
|
|
11416
11731
|
// src/lib/task-network.ts
|
|
11417
|
-
var WRONG_NETWORK_CODE = "wrong_network";
|
|
11418
11732
|
async function confirmTaskOnSelectedNetwork(taskId, task) {
|
|
11419
11733
|
let read4 = task;
|
|
11420
11734
|
if (read4 === void 0) {
|
|
@@ -11427,20 +11741,7 @@ async function confirmTaskOnSelectedNetwork(taskId, task) {
|
|
|
11427
11741
|
const taskChainId = read4?.chainId;
|
|
11428
11742
|
const network = selectedNetwork();
|
|
11429
11743
|
if (typeof taskChainId !== "number" || taskChainId === network.chainId) return true;
|
|
11430
|
-
|
|
11431
|
-
renderFailure(
|
|
11432
|
-
new Error(
|
|
11433
|
-
`This task is on ${taskNetwork ?? `chain ${taskChainId}`}, but the selected network is ${network.name}. Re-run with ${taskmarketCommandFor(taskChainId)}.`
|
|
11434
|
-
),
|
|
11435
|
-
{
|
|
11436
|
-
details: {
|
|
11437
|
-
code: WRONG_NETWORK_CODE,
|
|
11438
|
-
taskChainId,
|
|
11439
|
-
taskNetwork,
|
|
11440
|
-
selectedNetwork: network.name
|
|
11441
|
-
}
|
|
11442
|
-
}
|
|
11443
|
-
);
|
|
11744
|
+
renderFailure(new WrongNetworkError("This task", taskChainId));
|
|
11444
11745
|
return false;
|
|
11445
11746
|
}
|
|
11446
11747
|
|
|
@@ -11504,7 +11805,7 @@ function checksSummary(run2) {
|
|
|
11504
11805
|
function collectFile(value, previous) {
|
|
11505
11806
|
return [...previous, value];
|
|
11506
11807
|
}
|
|
11507
|
-
var submitCmd = new
|
|
11808
|
+
var submitCmd = new Command15("submit").description("Submit work for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--file <path>", "Path to a submission file (repeatable)", collectFile, []).addOption(
|
|
11508
11809
|
new Option2("--role <role>", "Artifact role applied to all files").choices(["preview", "source", "final", "attachment"]).default("attachment")
|
|
11509
11810
|
).option(
|
|
11510
11811
|
"--accept-unverified-hooks",
|
|
@@ -11605,7 +11906,7 @@ var submitCmd = new Command14("submit").description("Submit work for a task").ar
|
|
|
11605
11906
|
});
|
|
11606
11907
|
|
|
11607
11908
|
// src/commands/task/accept.ts
|
|
11608
|
-
import { Command as
|
|
11909
|
+
import { Command as Command16 } from "commander";
|
|
11609
11910
|
function sameAddress(left, right) {
|
|
11610
11911
|
return left.toLowerCase() === right.toLowerCase();
|
|
11611
11912
|
}
|
|
@@ -11637,7 +11938,7 @@ async function acceptTarget(taskId, opts) {
|
|
|
11637
11938
|
const latest = (submissions ?? []).filter((submission) => sameAddress(submission.workerAddress, worker) && !submission.rejectedAt).sort(compareSubmissionVersionsNewestFirst)[0];
|
|
11638
11939
|
return latest ? { submissionId: latest.id, worker } : { worker };
|
|
11639
11940
|
}
|
|
11640
|
-
var acceptCmd = new
|
|
11941
|
+
var acceptCmd = new Command16("accept").description(
|
|
11641
11942
|
"Accept a submission (costs 0.001 in the payment token). The accepted submission is recorded as the winning submission; with --worker alone it is that worker's latest active submission."
|
|
11642
11943
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--worker <addr>", "Worker wallet address (optional with --submission; must match it)").option(
|
|
11643
11944
|
"--submission <id>",
|
|
@@ -11694,7 +11995,7 @@ var acceptCmd = new Command15("accept").description(
|
|
|
11694
11995
|
});
|
|
11695
11996
|
|
|
11696
11997
|
// src/commands/task/accept-submissions.ts
|
|
11697
|
-
import { Command as
|
|
11998
|
+
import { Command as Command17 } from "commander";
|
|
11698
11999
|
function parseWinner(spec) {
|
|
11699
12000
|
const parts = spec.split(":");
|
|
11700
12001
|
if (parts.length < 2 || parts.length > 3) {
|
|
@@ -11713,7 +12014,7 @@ function parseWinner(spec) {
|
|
|
11713
12014
|
const submissionId = submissionIdStr ? submissionIdStr : void 0;
|
|
11714
12015
|
return { worker, share, ...submissionId !== void 0 && { submissionId } };
|
|
11715
12016
|
}
|
|
11716
|
-
var acceptSubmissionsCmd = new
|
|
12017
|
+
var acceptSubmissionsCmd = new Command17("accept-submissions").description(
|
|
11717
12018
|
"Accept N submissions for a Bounty/Benchmark task with explicit share basis points (costs 0.001 in the payment token).\nShares must sum to 10000. The contract resolves each deliverable from onchain submission history.\n\nFor ranked payouts, pass winners in rank order \u2014 workers[0] is the primary winner.\n\nTo pin a specific submission version, append the submission ID as a third field.\n\nExamples:\n task accept-submissions 0x\u2026 --winner 0xAlice:5000 --winner 0xBob:3000 --winner 0xCarol:2000\n task accept-submissions 0x\u2026 --winner 0xAlice:5000:sub_abc123 --winner 0xBob:5000:sub_def456"
|
|
11718
12019
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption(
|
|
11719
12020
|
"--winner <spec...>",
|
|
@@ -11747,8 +12048,8 @@ var acceptSubmissionsCmd = new Command16("accept-submissions").description(
|
|
|
11747
12048
|
});
|
|
11748
12049
|
|
|
11749
12050
|
// src/commands/task/rate.ts
|
|
11750
|
-
import { Command as
|
|
11751
|
-
var rateCmd = new
|
|
12051
|
+
import { Command as Command18 } from "commander";
|
|
12052
|
+
var rateCmd = new Command18("rate").description("Rate a worker (costs 0.001 in the payment token)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").requiredOption("--rating <n>", "Rating 0-100").option("--feedback <text>", "Optional feedback text").action(async (taskId, opts) => {
|
|
11752
12053
|
const rating = parseInt(opts.rating, 10);
|
|
11753
12054
|
if (rating < 0 || rating > 100) {
|
|
11754
12055
|
printError("Rating must be between 0 and 100");
|
|
@@ -11771,13 +12072,13 @@ var rateCmd = new Command17("rate").description("Rate a worker (costs 0.001 in t
|
|
|
11771
12072
|
});
|
|
11772
12073
|
|
|
11773
12074
|
// src/commands/task/claim.ts
|
|
11774
|
-
import { Command as
|
|
12075
|
+
import { Command as Command21 } from "commander";
|
|
11775
12076
|
|
|
11776
12077
|
// src/commands/hires.ts
|
|
11777
|
-
import { Command as
|
|
12078
|
+
import { Command as Command20 } from "commander";
|
|
11778
12079
|
|
|
11779
12080
|
// src/lib/settlement-action.ts
|
|
11780
|
-
import { Command as
|
|
12081
|
+
import { Command as Command19 } from "commander";
|
|
11781
12082
|
async function readTerms(taskId) {
|
|
11782
12083
|
try {
|
|
11783
12084
|
return await getTaskTerms(cliTaskReadContext(), { taskId });
|
|
@@ -11821,7 +12122,7 @@ async function confirmSettlementAction(name, confirm2, taskId, yes) {
|
|
|
11821
12122
|
return false;
|
|
11822
12123
|
}
|
|
11823
12124
|
function settlementActionCommand(spec) {
|
|
11824
|
-
const command = new
|
|
12125
|
+
const command = new Command19(spec.name).description(spec.description).argument("<taskId>", "Task ID (0x-prefixed hex)");
|
|
11825
12126
|
if (spec.confirm === "release-cost") {
|
|
11826
12127
|
command.option("--yes", "Accept the stake forfeited by releasing now (releaseCostNow)");
|
|
11827
12128
|
} else if (spec.confirm === "always") {
|
|
@@ -11934,7 +12235,7 @@ function parseTab(value) {
|
|
|
11934
12235
|
const tab = value === "review" ? "in_review" : value;
|
|
11935
12236
|
return HIRE_TABS.includes(tab) ? tab : null;
|
|
11936
12237
|
}
|
|
11937
|
-
var listCmd2 = new
|
|
12238
|
+
var listCmd2 = new Command20("list").description(
|
|
11938
12239
|
"List hires: offers made to you (--role worker, the default) or hires you made, including quotes and requests (--role requester). Signed, so your private hires are included."
|
|
11939
12240
|
).option("--role <role>", `Whose hires: ${ROLES.join(" or ")}`, "worker").option("--state <state>", `Filter by hire state: ${HireState.options.join(", ")}`).option(
|
|
11940
12241
|
"--tab <tab>",
|
|
@@ -11976,7 +12277,7 @@ var listCmd2 = new Command19("list").description(
|
|
|
11976
12277
|
}
|
|
11977
12278
|
}
|
|
11978
12279
|
);
|
|
11979
|
-
var acceptCmd2 = new
|
|
12280
|
+
var acceptCmd2 = new Command20("accept").description(
|
|
11980
12281
|
"Accept a hire offer made to you: claims the task on its terms (hired worker only, before the accept-by time)"
|
|
11981
12282
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--yes", "Accept the task's settlement terms, including paying any required stake").action(async (taskId, opts) => {
|
|
11982
12283
|
try {
|
|
@@ -12016,10 +12317,10 @@ var declineCmd = settlementActionCommand({
|
|
|
12016
12317
|
return hireAnswerError(task, keystore.walletAddress, "decline");
|
|
12017
12318
|
}
|
|
12018
12319
|
});
|
|
12019
|
-
var hiresCommand = new
|
|
12320
|
+
var hiresCommand = new Command20("hires").description("Hire offers made to you, and hires you made: list, accept, decline").addCommand(listCmd2).addCommand(acceptCmd2).addCommand(declineCmd);
|
|
12020
12321
|
|
|
12021
12322
|
// src/commands/task/claim.ts
|
|
12022
|
-
var claimCmd = new
|
|
12323
|
+
var claimCmd = new Command21("claim").description("Claim a task as a worker").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--yes", "Accept the task's settlement terms, including paying any required stake").option(
|
|
12023
12324
|
"--accept-unverified-hooks",
|
|
12024
12325
|
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
12025
12326
|
).action(async (taskId, opts) => {
|
|
@@ -12043,8 +12344,8 @@ var claimCmd = new Command20("claim").description("Claim a task as a worker").ar
|
|
|
12043
12344
|
});
|
|
12044
12345
|
|
|
12045
12346
|
// src/commands/task/pitch.ts
|
|
12046
|
-
import { Command as
|
|
12047
|
-
var pitchCmd = new
|
|
12347
|
+
import { Command as Command22 } from "commander";
|
|
12348
|
+
var pitchCmd = new Command22("pitch").description("Submit a pitch for a task (costs 0.001 in the payment token, anchors hash onchain)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--text <text>", "Pitch text").option("--duration <hours>", "Estimated duration in hours").option("--yes", "Accept the task's settlement terms, including any required stake").option(
|
|
12048
12349
|
"--accept-unverified-hooks",
|
|
12049
12350
|
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
12050
12351
|
).action(
|
|
@@ -12077,8 +12378,8 @@ var pitchCmd = new Command21("pitch").description("Submit a pitch for a task (co
|
|
|
12077
12378
|
);
|
|
12078
12379
|
|
|
12079
12380
|
// src/commands/task/pitches.ts
|
|
12080
|
-
import { Command as
|
|
12081
|
-
var pitchesCmd = new
|
|
12381
|
+
import { Command as Command23 } from "commander";
|
|
12382
|
+
var pitchesCmd = new Command23("pitches").description("List pitches for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--limit <n>", "Page size (1-500; default 500)").option("--cursor <id>", "Last returned id; read the following page").action(async (taskId, opts) => {
|
|
12082
12383
|
try {
|
|
12083
12384
|
const page = TaskChildListSchema.parse({ taskId, ...opts });
|
|
12084
12385
|
const params = new URLSearchParams({ limit: String(page.limit) });
|
|
@@ -12092,8 +12393,8 @@ var pitchesCmd = new Command22("pitches").description("List pitches for a task")
|
|
|
12092
12393
|
});
|
|
12093
12394
|
|
|
12094
12395
|
// src/commands/task/select-worker.ts
|
|
12095
|
-
import { Command as
|
|
12096
|
-
var selectWorkerCmd = new
|
|
12396
|
+
import { Command as Command24 } from "commander";
|
|
12397
|
+
var selectWorkerCmd = new Command24("select-worker").description(
|
|
12097
12398
|
"Select a worker from pitches (requester only). Refused for a worker whose listing is at capacity (fully booked)."
|
|
12098
12399
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--pitch <pitchId>", "Pitch ID to select").requiredOption("--worker <address>", "Worker wallet address to assign").action(async (taskId, opts) => {
|
|
12099
12400
|
const atCapacity = await hireSelectCapacityError(opts.worker);
|
|
@@ -12122,8 +12423,8 @@ var selectWorkerCmd = new Command23("select-worker").description(
|
|
|
12122
12423
|
});
|
|
12123
12424
|
|
|
12124
12425
|
// src/commands/task/proof.ts
|
|
12125
|
-
import { Command as
|
|
12126
|
-
var proofCmd = new
|
|
12426
|
+
import { Command as Command25 } from "commander";
|
|
12427
|
+
var proofCmd = new Command25("proof").description("Submit a benchmark proof (costs 0.001 in the payment token, anchors hash onchain)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--data <data>", "Proof data").requiredOption("--type <type>", "Proof type").option("--metric <val>", "Metric value").action(async (taskId, opts) => {
|
|
12127
12428
|
const keystore = await loadKeystore();
|
|
12128
12429
|
const signature = await signMessage(buildProofMessage(taskId), keystore);
|
|
12129
12430
|
const { data: result, idempotencyKey } = await attestedWorkerAction(
|
|
@@ -12147,8 +12448,8 @@ var proofCmd = new Command24("proof").description("Submit a benchmark proof (cos
|
|
|
12147
12448
|
});
|
|
12148
12449
|
|
|
12149
12450
|
// src/commands/task/proofs.ts
|
|
12150
|
-
import { Command as
|
|
12151
|
-
var proofsCmd = new
|
|
12451
|
+
import { Command as Command26 } from "commander";
|
|
12452
|
+
var proofsCmd = new Command26("proofs").description("List proofs for a benchmark task").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--limit <n>", "Page size (1-500; default 500)").option("--cursor <id>", "Last returned id; read the following page").action(async (taskId, opts) => {
|
|
12152
12453
|
try {
|
|
12153
12454
|
const page = TaskChildListSchema.parse({ taskId, ...opts });
|
|
12154
12455
|
const params = new URLSearchParams({ limit: String(page.limit) });
|
|
@@ -12162,8 +12463,8 @@ var proofsCmd = new Command25("proofs").description("List proofs for a benchmark
|
|
|
12162
12463
|
});
|
|
12163
12464
|
|
|
12164
12465
|
// src/commands/task/bid.ts
|
|
12165
|
-
import { Command as
|
|
12166
|
-
var bidCmd = new
|
|
12466
|
+
import { Command as Command27 } from "commander";
|
|
12467
|
+
var bidCmd = new Command27("bid").description("Submit a bid on an auction task").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--price <amount>", "Bid price in the payment token (e.g. 3 or 1.5)").option("--yes", "Accept the task's settlement terms, including any required stake").option(
|
|
12167
12468
|
"--accept-unverified-hooks",
|
|
12168
12469
|
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
12169
12470
|
).action(
|
|
@@ -12199,8 +12500,8 @@ var bidCmd = new Command26("bid").description("Submit a bid on an auction task")
|
|
|
12199
12500
|
);
|
|
12200
12501
|
|
|
12201
12502
|
// src/commands/task/auction-accept.ts
|
|
12202
|
-
import { Command as
|
|
12203
|
-
var auctionAcceptCmd = new
|
|
12503
|
+
import { Command as Command28 } from "commander";
|
|
12504
|
+
var auctionAcceptCmd = new Command28("auction-accept").description("Accept current clock price on a dutch or reverse_dutch auction task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
|
|
12204
12505
|
"--min-price <amount>",
|
|
12205
12506
|
"Reject if current clock price is below this value (price floor guard)"
|
|
12206
12507
|
).action(async (taskId, opts) => {
|
|
@@ -12242,7 +12543,7 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
|
|
|
12242
12543
|
});
|
|
12243
12544
|
|
|
12244
12545
|
// src/commands/task/submissions.ts
|
|
12245
|
-
import { Command as
|
|
12546
|
+
import { Command as Command29 } from "commander";
|
|
12246
12547
|
import { z as z3 } from "zod";
|
|
12247
12548
|
var SubmissionPageSchema = TaskChildListSchema.pick({ cursor: true }).extend({
|
|
12248
12549
|
limit: TaskChildListSchema.shape.limit.removeDefault().optional(),
|
|
@@ -12250,7 +12551,7 @@ var SubmissionPageSchema = TaskChildListSchema.pick({ cursor: true }).extend({
|
|
|
12250
12551
|
(value) => value.split(",").map((id) => id.trim()).filter(Boolean)
|
|
12251
12552
|
).pipe(z3.array(z3.string().uuid().toLowerCase()).min(1).max(50)).optional()
|
|
12252
12553
|
});
|
|
12253
|
-
var submissionsCmd = new
|
|
12554
|
+
var submissionsCmd = new Command29("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
|
|
12254
12555
|
"--passed-check <provider>",
|
|
12255
12556
|
"Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, tap:identity:known or tap:identity:verified"
|
|
12256
12557
|
).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(
|
|
@@ -12288,8 +12589,8 @@ var submissionsCmd = new Command28("submissions").description("List submissions
|
|
|
12288
12589
|
);
|
|
12289
12590
|
|
|
12290
12591
|
// src/commands/task/claims.ts
|
|
12291
|
-
import { Command as
|
|
12292
|
-
var claimsCmd = new
|
|
12592
|
+
import { Command as Command30 } from "commander";
|
|
12593
|
+
var claimsCmd = new Command30("claims").description("Show a Claim task's claim, with the checks its worker passed").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12293
12594
|
try {
|
|
12294
12595
|
const auth = await signReadAuth();
|
|
12295
12596
|
const headers = { ...auth?.headers ?? {}, ...await taskAccessGrantHeaders(taskId) };
|
|
@@ -12300,8 +12601,8 @@ var claimsCmd = new Command29("claims").description("Show a Claim task's claim,
|
|
|
12300
12601
|
});
|
|
12301
12602
|
|
|
12302
12603
|
// src/commands/task/bids.ts
|
|
12303
|
-
import { Command as
|
|
12304
|
-
var bidsCmd = new
|
|
12604
|
+
import { Command as Command31 } from "commander";
|
|
12605
|
+
var bidsCmd = new Command31("bids").description("List an auction task's bids, with the checks each bidder passed").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12305
12606
|
try {
|
|
12306
12607
|
const auth = await signReadAuth();
|
|
12307
12608
|
const headers = { ...auth?.headers ?? {}, ...await taskAccessGrantHeaders(taskId) };
|
|
@@ -12312,8 +12613,8 @@ var bidsCmd = new Command30("bids").description("List an auction task's bids, wi
|
|
|
12312
12613
|
});
|
|
12313
12614
|
|
|
12314
12615
|
// src/commands/task/select-winner.ts
|
|
12315
|
-
import { Command as
|
|
12316
|
-
var selectWinnerCmd = new
|
|
12616
|
+
import { Command as Command32 } from "commander";
|
|
12617
|
+
var selectWinnerCmd = new Command32("select-winner").description("Permissionlessly finalize the lowest bidder after the auction deadline").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12317
12618
|
let result;
|
|
12318
12619
|
let idempotencyKey;
|
|
12319
12620
|
try {
|
|
@@ -12329,8 +12630,8 @@ var selectWinnerCmd = new Command31("select-winner").description("Permissionless
|
|
|
12329
12630
|
});
|
|
12330
12631
|
|
|
12331
12632
|
// src/commands/task/start-review.ts
|
|
12332
|
-
import { Command as
|
|
12333
|
-
var startReviewCmd = new
|
|
12633
|
+
import { Command as Command33 } from "commander";
|
|
12634
|
+
var startReviewCmd = new Command33("start-review").description(
|
|
12334
12635
|
"Start the review window on a delivery made before the settlement-terms upgrade that has none yet (anyone may call). Once the window lapses undecided, `task settle` pays the worker."
|
|
12335
12636
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12336
12637
|
try {
|
|
@@ -12348,9 +12649,9 @@ var startReviewCmd = new Command32("start-review").description(
|
|
|
12348
12649
|
});
|
|
12349
12650
|
|
|
12350
12651
|
// src/commands/task/download.ts
|
|
12351
|
-
import { Command as
|
|
12652
|
+
import { Command as Command34 } from "commander";
|
|
12352
12653
|
import { writeFileSync } from "fs";
|
|
12353
|
-
var downloadCmd = new
|
|
12654
|
+
var downloadCmd = new Command34("download").description("Download a submission file (requester or worker)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--submission <id>", "Submission ID (from `task submissions`)").option("--artifact <id>", "Artifact ID for multi-artifact submissions").option("--output <path>", "Save to a file instead of returning the text as `content`").action(
|
|
12354
12655
|
async (taskId, opts) => {
|
|
12355
12656
|
const keystore = await loadKeystore();
|
|
12356
12657
|
let presignedUrl;
|
|
@@ -12398,7 +12699,7 @@ var downloadCmd = new Command33("download").description("Download a submission f
|
|
|
12398
12699
|
);
|
|
12399
12700
|
|
|
12400
12701
|
// src/commands/task/cancel.ts
|
|
12401
|
-
import { Command as
|
|
12702
|
+
import { Command as Command35 } from "commander";
|
|
12402
12703
|
|
|
12403
12704
|
// src/lib/decision-window.ts
|
|
12404
12705
|
var DECISION_WINDOW_LAPSED_CODE = "decision_window_lapsed";
|
|
@@ -12430,7 +12731,7 @@ function renderDecisionWindowLapsed(action, lapse) {
|
|
|
12430
12731
|
}
|
|
12431
12732
|
|
|
12432
12733
|
// src/commands/task/cancel.ts
|
|
12433
|
-
var cancelCmd = new
|
|
12734
|
+
var cancelCmd = new Command35("cancel").description(
|
|
12434
12735
|
"Cancel an open task and refund the escrowed reward (costs 0.001 in the payment token)"
|
|
12435
12736
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12436
12737
|
const lapse = await decisionWindowLapse(taskId, { requireLiveSubmissions: true });
|
|
@@ -12450,8 +12751,8 @@ var cancelCmd = new Command34("cancel").description(
|
|
|
12450
12751
|
});
|
|
12451
12752
|
|
|
12452
12753
|
// src/commands/task/refund-expired.ts
|
|
12453
|
-
import { Command as
|
|
12454
|
-
var refundExpiredCmd = new
|
|
12754
|
+
import { Command as Command36 } from "commander";
|
|
12755
|
+
var refundExpiredCmd = new Command36("refund-expired").description(
|
|
12455
12756
|
"Refund an expired task back to the requester; bounty and benchmark tasks need every submission rejected first (costs 0.001 in the payment token)"
|
|
12456
12757
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12457
12758
|
const lapse = await decisionWindowLapse(taskId, { requireLiveSubmissions: true });
|
|
@@ -12475,7 +12776,7 @@ var refundExpiredCmd = new Command35("refund-expired").description(
|
|
|
12475
12776
|
});
|
|
12476
12777
|
|
|
12477
12778
|
// src/commands/task/requester-timeout.ts
|
|
12478
|
-
import { Command as
|
|
12779
|
+
import { Command as Command37 } from "commander";
|
|
12479
12780
|
|
|
12480
12781
|
// src/lib/requester-timeout.ts
|
|
12481
12782
|
var REQUESTER_TIMEOUT_REFUSED_CODE = "requester_timeout_refused";
|
|
@@ -12508,7 +12809,7 @@ function renderRequesterTimeoutRefused(reason) {
|
|
|
12508
12809
|
}
|
|
12509
12810
|
|
|
12510
12811
|
// src/commands/task/requester-timeout.ts
|
|
12511
|
-
var requesterTimeoutCmd = new
|
|
12812
|
+
var requesterTimeoutCmd = new Command37("requester-timeout").description(
|
|
12512
12813
|
"End a bounty or benchmark whose requester left live submissions undecided past the decision deadline; refunds the escrow to the requester (anyone; costs 0.001 in the payment token)"
|
|
12513
12814
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12514
12815
|
const blocker = await requesterTimeoutBlocker(taskId);
|
|
@@ -12532,8 +12833,8 @@ var requesterTimeoutCmd = new Command36("requester-timeout").description(
|
|
|
12532
12833
|
});
|
|
12533
12834
|
|
|
12534
12835
|
// src/commands/task/reject-submission.ts
|
|
12535
|
-
import { Command as
|
|
12536
|
-
var rejectSubmissionCmd = new
|
|
12836
|
+
import { Command as Command38 } from "commander";
|
|
12837
|
+
var rejectSubmissionCmd = new Command38("reject-submission").description(
|
|
12537
12838
|
"Reject a spam or low-quality submission (costs a 0.001 relay fee in the payment token). Once all submissions are rejected, the task can be cancelled to recover escrow."
|
|
12538
12839
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <address>", "Worker address whose submission to reject").action(async (taskId, opts) => {
|
|
12539
12840
|
const lapse = await decisionWindowLapse(taskId, { requireLiveSubmissions: false });
|
|
@@ -12560,7 +12861,7 @@ var rejectSubmissionCmd = new Command37("reject-submission").description(
|
|
|
12560
12861
|
});
|
|
12561
12862
|
|
|
12562
12863
|
// src/commands/task/reject-all-submissions.ts
|
|
12563
|
-
import { Command as
|
|
12864
|
+
import { Command as Command39 } from "commander";
|
|
12564
12865
|
function activeSubmissionWorkers(submissions) {
|
|
12565
12866
|
const workers = /* @__PURE__ */ new Map();
|
|
12566
12867
|
for (const submission of submissions) {
|
|
@@ -12570,7 +12871,7 @@ function activeSubmissionWorkers(submissions) {
|
|
|
12570
12871
|
}
|
|
12571
12872
|
return [...workers.values()];
|
|
12572
12873
|
}
|
|
12573
|
-
var rejectAllSubmissionsCmd = new
|
|
12874
|
+
var rejectAllSubmissionsCmd = new Command39("reject-all-submissions").description(
|
|
12574
12875
|
"Reject every active submission on a bounty or benchmark task in one go. Lists active submissions, rejects each unique worker in sequence, then cancels the task. Use this to recover escrow when all submitted work is unsuitable."
|
|
12575
12876
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--no-cancel", "Reject all submissions but do not cancel the task afterward").action(async (taskId, opts) => {
|
|
12576
12877
|
let submissions;
|
|
@@ -12650,8 +12951,8 @@ var rejectAllSubmissionsCmd = new Command38("reject-all-submissions").descriptio
|
|
|
12650
12951
|
});
|
|
12651
12952
|
|
|
12652
12953
|
// src/commands/task/my-submissions.ts
|
|
12653
|
-
import { Command as
|
|
12654
|
-
var mySubmissionsCmd = new
|
|
12954
|
+
import { Command as Command40 } from "commander";
|
|
12955
|
+
var mySubmissionsCmd = new Command40("my-submissions").description("List all submissions made by your wallet across all tasks.").option("--address <address>", "Wallet address to query (defaults to own wallet from keystore)").action(async (opts) => {
|
|
12655
12956
|
try {
|
|
12656
12957
|
const result = await listWorkerSubmissions(cliTaskReadContext(), { address: opts.address });
|
|
12657
12958
|
printResult(withChainNames(result));
|
|
@@ -12663,7 +12964,7 @@ var mySubmissionsCmd = new Command39("my-submissions").description("List all sub
|
|
|
12663
12964
|
});
|
|
12664
12965
|
|
|
12665
12966
|
// src/commands/task/update.ts
|
|
12666
|
-
import { Command as
|
|
12967
|
+
import { Command as Command41 } from "commander";
|
|
12667
12968
|
function pendingHireUpdateError(task, taskId, nowMs = Date.now()) {
|
|
12668
12969
|
const hire = task.hire;
|
|
12669
12970
|
if (task.status !== "open" || hire?.kind !== "reserved" || hire.state !== "offered" || !hire.acceptBy || Date.parse(hire.acceptBy) < nowMs) {
|
|
@@ -12674,15 +12975,15 @@ function pendingHireUpdateError(task, taskId, nowMs = Date.now()) {
|
|
|
12674
12975
|
function projectIdOf(task) {
|
|
12675
12976
|
return typeof task.projectId === "number" ? task.projectId : null;
|
|
12676
12977
|
}
|
|
12677
|
-
function projectTopUp(projectId,
|
|
12978
|
+
function projectTopUp(projectId, amount2, kind) {
|
|
12678
12979
|
return {
|
|
12679
12980
|
projectId,
|
|
12680
|
-
amount:
|
|
12981
|
+
amount: amount2.toString(),
|
|
12681
12982
|
fundedFrom: "project_budget",
|
|
12682
|
-
note: `The ${kind} of ${
|
|
12983
|
+
note: `The ${kind} of ${amount2} base units was drawn from project ${projectId}'s budget; you paid only the action fee.`
|
|
12683
12984
|
};
|
|
12684
12985
|
}
|
|
12685
|
-
var updateCmd = new
|
|
12986
|
+
var updateCmd = new Command41("update").description(
|
|
12686
12987
|
"Update an open task (costs 0.001 plus any reward increase, in the payment token; on a project task the increase comes from the project's budget and only the 0.001 is paid)"
|
|
12687
12988
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--reward <amount>", 'New reward in the payment token (human units, e.g. "50")').option("--extend-expiry <seconds>", "Extend expiry by this many seconds").option("--bid-deadline <iso>", "New bid deadline (ISO 8601)").option("--pitch-deadline <iso>", "New pitch deadline (ISO 8601)").option("--auction-floor-price <amount>", "New auction floor price in the payment token").option("--auction-start-price <amount>", "New auction start price in the payment token").option("--description <text>", "New description").option("--tags <csv>", "New tags (comma-separated)").option("--metric-description <text>", "New metric description").option(
|
|
12688
12989
|
"--require-identity <protocols>",
|
|
@@ -12784,13 +13085,9 @@ var updateCmd = new Command40("update").description(
|
|
|
12784
13085
|
return;
|
|
12785
13086
|
}
|
|
12786
13087
|
Object.assign(body, requirements.fields);
|
|
12787
|
-
const warnings = await tapSimulatedWarnings(
|
|
12788
|
-
requirements.fields.verifiedBy,
|
|
12789
|
-
typeof task.chainId === "number" ? task.chainId : void 0
|
|
12790
|
-
);
|
|
12791
13088
|
const projectId = projectIdOf(task);
|
|
12792
13089
|
const increase = body.reward === void 0 || projectId === null ? 0n : BigInt(String(body.reward)) - BigInt(String(task.reward));
|
|
12793
|
-
const
|
|
13090
|
+
const outcome = await x402Post(
|
|
12794
13091
|
`/api/tasks/${taskId}/update`,
|
|
12795
13092
|
body,
|
|
12796
13093
|
// A reward increase is paid with the action fee, so the new reward bounds the extra. A
|
|
@@ -12799,16 +13096,18 @@ var updateCmd = new Command40("update").description(
|
|
|
12799
13096
|
maxAmount: body.reward === void 0 || projectId !== null ? ACTION_FEE_MAX_AMOUNT : (BigInt(ACTION_FEE_MAX_AMOUNT) + BigInt(String(body.reward))).toString()
|
|
12800
13097
|
}
|
|
12801
13098
|
);
|
|
13099
|
+
const result = { ...outcome.data, ...replayedFields(outcome) };
|
|
13100
|
+
const { idempotencyKey } = outcome;
|
|
12802
13101
|
printResult(
|
|
12803
13102
|
projectId !== null && increase > 0n ? { ...result, projectTopUp: projectTopUp(projectId, increase, "reward increase") } : result,
|
|
12804
|
-
{ idempotencyKey
|
|
13103
|
+
{ idempotencyKey }
|
|
12805
13104
|
);
|
|
12806
13105
|
}
|
|
12807
13106
|
);
|
|
12808
13107
|
|
|
12809
13108
|
// src/commands/task/forfeit.ts
|
|
12810
|
-
import { Command as
|
|
12811
|
-
var forfeitCmd = new
|
|
13109
|
+
import { Command as Command42 } from "commander";
|
|
13110
|
+
var forfeitCmd = new Command42("forfeit").description("Reclaim a claim-mode task whose worker's claim has expired (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12812
13111
|
try {
|
|
12813
13112
|
const keystore = await loadKeystore();
|
|
12814
13113
|
const message = buildForfeitMessage(taskId);
|
|
@@ -12831,7 +13130,7 @@ var forfeitCmd = new Command41("forfeit").description("Reclaim a claim-mode task
|
|
|
12831
13130
|
});
|
|
12832
13131
|
|
|
12833
13132
|
// src/commands/task/assign-evaluator.ts
|
|
12834
|
-
import { Command as
|
|
13133
|
+
import { Command as Command43 } from "commander";
|
|
12835
13134
|
var ADDRESS_PATTERN3 = /^0x[0-9a-fA-F]{40}$/;
|
|
12836
13135
|
async function projectIdOfTask(taskId) {
|
|
12837
13136
|
try {
|
|
@@ -12842,7 +13141,7 @@ async function projectIdOfTask(taskId) {
|
|
|
12842
13141
|
return null;
|
|
12843
13142
|
}
|
|
12844
13143
|
}
|
|
12845
|
-
var assignEvaluatorCmd = new
|
|
13144
|
+
var assignEvaluatorCmd = new Command43("assign-evaluator").description(
|
|
12846
13145
|
"Assign an evaluator to an open, unclaimed task you requested (costs 0.001 in the payment token). Only possible before a worker claims the task."
|
|
12847
13146
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--evaluator <address>", "Evaluator wallet address").option(
|
|
12848
13147
|
"--evaluator-from-listing <address>",
|
|
@@ -12939,8 +13238,8 @@ var assignEvaluatorCmd = new Command42("assign-evaluator").description(
|
|
|
12939
13238
|
);
|
|
12940
13239
|
|
|
12941
13240
|
// src/commands/task/evaluate.ts
|
|
12942
|
-
import { Command as
|
|
12943
|
-
var evaluateCmd = new
|
|
13241
|
+
import { Command as Command44 } from "commander";
|
|
13242
|
+
var evaluateCmd = new Command44("evaluate").description("Submit an evaluation verdict for a task in Review state").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict: approve, reject, or partial").option("--score <n>", "Score 0-1000 (default: 1000)", "1000").option("--confidence <n>", "Confidence 0-1000 (default: 1000)", "1000").option("--evidence-hash <hash>", "Evidence hash (32-byte hex)").option(
|
|
12944
13243
|
"--award <worker:amount:rank>",
|
|
12945
13244
|
"Award entry (repeatable): worker:amount:rank",
|
|
12946
13245
|
collect2,
|
|
@@ -12957,7 +13256,7 @@ var evaluateCmd = new Command43("evaluate").description("Submit an evaluation ve
|
|
|
12957
13256
|
if (parts.length < 3 || !parts[0] || !parts[1] || !parts[2]) {
|
|
12958
13257
|
return void printError(`Invalid award format '${entry}'. Expected worker:amount:rank`);
|
|
12959
13258
|
}
|
|
12960
|
-
const [worker,
|
|
13259
|
+
const [worker, amount2, rankStr] = parts;
|
|
12961
13260
|
if (!/^0x[0-9a-fA-F]{40}$/.test(worker)) {
|
|
12962
13261
|
return void printError(
|
|
12963
13262
|
`Invalid worker address in '${entry}': must be 0x-prefixed 40-char hex`
|
|
@@ -12965,7 +13264,7 @@ var evaluateCmd = new Command43("evaluate").description("Submit an evaluation ve
|
|
|
12965
13264
|
}
|
|
12966
13265
|
let microUnits;
|
|
12967
13266
|
try {
|
|
12968
|
-
microUnits = usdcToBaseUnits(
|
|
13267
|
+
microUnits = usdcToBaseUnits(amount2);
|
|
12969
13268
|
} catch (err) {
|
|
12970
13269
|
renderFailure(withErrorContext(err, `Invalid amount in '${entry}'`));
|
|
12971
13270
|
return;
|
|
@@ -13007,8 +13306,8 @@ function collect2(val, prev) {
|
|
|
13007
13306
|
}
|
|
13008
13307
|
|
|
13009
13308
|
// src/commands/task/appeal.ts
|
|
13010
|
-
import { Command as
|
|
13011
|
-
var appealCmd = new
|
|
13309
|
+
import { Command as Command45 } from "commander";
|
|
13310
|
+
var appealCmd = new Command45("appeal").description("Appeal an evaluator verdict while in Appealing state").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
13012
13311
|
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/appeal`, { taskId }, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
13013
13312
|
printResult(
|
|
13014
13313
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -13017,8 +13316,8 @@ var appealCmd = new Command44("appeal").description("Appeal an evaluator verdict
|
|
|
13017
13316
|
});
|
|
13018
13317
|
|
|
13019
13318
|
// src/commands/task/evaluator-timeout.ts
|
|
13020
|
-
import { Command as
|
|
13021
|
-
var evaluatorTimeoutCmd = new
|
|
13319
|
+
import { Command as Command46 } from "commander";
|
|
13320
|
+
var evaluatorTimeoutCmd = new Command46("evaluator-timeout").description(
|
|
13022
13321
|
"Trigger evaluator timeout after the evaluation window expires (anyone); also bounty and benchmark tasks with an evaluator and a live submission"
|
|
13023
13322
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
13024
13323
|
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId }, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
@@ -13029,8 +13328,8 @@ var evaluatorTimeoutCmd = new Command45("evaluator-timeout").description(
|
|
|
13029
13328
|
});
|
|
13030
13329
|
|
|
13031
13330
|
// src/commands/task/finalize-verdict.ts
|
|
13032
|
-
import { Command as
|
|
13033
|
-
var finalizeVerdictCmd = new
|
|
13331
|
+
import { Command as Command47 } from "commander";
|
|
13332
|
+
var finalizeVerdictCmd = new Command47("finalize-verdict").description("Finalize an evaluator verdict after the appeal window expires (permissionless)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
13034
13333
|
const { data: result, idempotencyKey } = await apiPost(`/api/tasks/${taskId}/finalize-verdict`, { taskId });
|
|
13035
13334
|
printResult(
|
|
13036
13335
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -13039,7 +13338,7 @@ var finalizeVerdictCmd = new Command46("finalize-verdict").description("Finalize
|
|
|
13039
13338
|
});
|
|
13040
13339
|
|
|
13041
13340
|
// src/commands/task/resolve-dispute.ts
|
|
13042
|
-
import { Command as
|
|
13341
|
+
import { Command as Command48 } from "commander";
|
|
13043
13342
|
function parseAward(spec) {
|
|
13044
13343
|
const parts = spec.split(":");
|
|
13045
13344
|
if (parts.length !== 3) {
|
|
@@ -13049,18 +13348,18 @@ function parseAward(spec) {
|
|
|
13049
13348
|
if (!/^0x[0-9a-fA-F]{40}$/.test(worker)) {
|
|
13050
13349
|
throw new Error(`Invalid worker address in "${spec}"`);
|
|
13051
13350
|
}
|
|
13052
|
-
const
|
|
13351
|
+
const amount2 = usdcToBaseUnits(amountStr);
|
|
13053
13352
|
const rank = parseInt(rankStr, 10);
|
|
13054
13353
|
if (!Number.isInteger(rank) || rank < 1) {
|
|
13055
13354
|
throw new Error(`Invalid rank in "${spec}" \u2014 must be an integer >= 1`);
|
|
13056
13355
|
}
|
|
13057
13356
|
return {
|
|
13058
13357
|
worker,
|
|
13059
|
-
amount,
|
|
13358
|
+
amount: amount2,
|
|
13060
13359
|
rank
|
|
13061
13360
|
};
|
|
13062
13361
|
}
|
|
13063
|
-
var resolveDisputeCmd = new
|
|
13362
|
+
var resolveDisputeCmd = new Command48("resolve-dispute").description(
|
|
13064
13363
|
"Resolve a disputed task as the designated dispute resolver (X402 required).\n\nExamples:\n task resolve-dispute 0x\u2026 --verdict approve --award 0xAlice:5:1\n task resolve-dispute 0x\u2026 --verdict partial --award 0xAlice:3:1 --award 0xBob:2:2"
|
|
13065
13364
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict type: approve or partial").requiredOption(
|
|
13066
13365
|
"--award <spec...>",
|
|
@@ -13093,8 +13392,8 @@ var resolveDisputeCmd = new Command47("resolve-dispute").description(
|
|
|
13093
13392
|
});
|
|
13094
13393
|
|
|
13095
13394
|
// src/commands/task/unlock.ts
|
|
13096
|
-
import { Command as
|
|
13097
|
-
var unlockCmd = new
|
|
13395
|
+
import { Command as Command49 } from "commander";
|
|
13396
|
+
var unlockCmd = new Command49("unlock").description("Unlock a private task with its password, caching a task-scoped access grant").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--password <password>", "The private task's password").action(async (taskId, opts) => {
|
|
13098
13397
|
let result;
|
|
13099
13398
|
let idempotencyKey;
|
|
13100
13399
|
try {
|
|
@@ -13111,8 +13410,8 @@ var unlockCmd = new Command48("unlock").description("Unlock a private task with
|
|
|
13111
13410
|
});
|
|
13112
13411
|
|
|
13113
13412
|
// src/commands/task/invite.ts
|
|
13114
|
-
import { Command as
|
|
13115
|
-
var inviteCmd = new
|
|
13413
|
+
import { Command as Command50 } from "commander";
|
|
13414
|
+
var inviteCmd = new Command50("invite").description("Invite a wallet to view a private task (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to invite").action(async (taskId, address3) => {
|
|
13116
13415
|
const auth = await signReadAuth();
|
|
13117
13416
|
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
13118
13417
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
@@ -13131,8 +13430,8 @@ var inviteCmd = new Command49("invite").description("Invite a wallet to view a p
|
|
|
13131
13430
|
});
|
|
13132
13431
|
|
|
13133
13432
|
// src/commands/task/uninvite.ts
|
|
13134
|
-
import { Command as
|
|
13135
|
-
var uninviteCmd = new
|
|
13433
|
+
import { Command as Command51 } from "commander";
|
|
13434
|
+
var uninviteCmd = new Command51("uninvite").description("Remove a wallet from a private task's allowlist (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to remove").action(async (taskId, address3) => {
|
|
13136
13435
|
const auth = await signReadAuth();
|
|
13137
13436
|
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
13138
13437
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
@@ -13150,8 +13449,8 @@ var uninviteCmd = new Command50("uninvite").description("Remove a wallet from a
|
|
|
13150
13449
|
});
|
|
13151
13450
|
|
|
13152
13451
|
// src/commands/task/viewers.ts
|
|
13153
|
-
import { Command as
|
|
13154
|
-
var viewersCmd = new
|
|
13452
|
+
import { Command as Command52 } from "commander";
|
|
13453
|
+
var viewersCmd = new Command52("viewers").description("List a private task's wallet allowlist (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
13155
13454
|
const auth = await signReadAuth();
|
|
13156
13455
|
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
13157
13456
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
@@ -13168,8 +13467,8 @@ var viewersCmd = new Command51("viewers").description("List a private task's wal
|
|
|
13168
13467
|
});
|
|
13169
13468
|
|
|
13170
13469
|
// src/commands/task/terms.ts
|
|
13171
|
-
import { Command as
|
|
13172
|
-
var termsCmd = new
|
|
13470
|
+
import { Command as Command53 } from "commander";
|
|
13471
|
+
var termsCmd = new Command53("terms").description(
|
|
13173
13472
|
"Show a task's settlement terms: stake, review window, reject fee and outcome, revisions, release cost now and deadlines"
|
|
13174
13473
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
13175
13474
|
const detail = await getTaskTerms(cliTaskReadContext(), { taskId });
|
|
@@ -13183,8 +13482,8 @@ var termsCmd = new Command52("terms").description(
|
|
|
13183
13482
|
});
|
|
13184
13483
|
|
|
13185
13484
|
// src/commands/task/template.ts
|
|
13186
|
-
import { Command as
|
|
13187
|
-
var listCmd3 = new
|
|
13485
|
+
import { Command as Command54 } from "commander";
|
|
13486
|
+
var listCmd3 = new Command54("list").description("List the curated task templates (id, mode, what it is for, what the brief covers)").option(
|
|
13188
13487
|
"--mode <mode>",
|
|
13189
13488
|
"Only templates for one task mode: bounty, claim, pitch, benchmark, auction"
|
|
13190
13489
|
).action((opts) => {
|
|
@@ -13193,18 +13492,18 @@ var listCmd3 = new Command53("list").description("List the curated task template
|
|
|
13193
13492
|
}
|
|
13194
13493
|
printResult({ templates: listTemplates(opts.mode) });
|
|
13195
13494
|
});
|
|
13196
|
-
var showCmd = new
|
|
13495
|
+
var showCmd = new Command54("show").description("Show one template: its fields, mode terms and full brief").argument("<id>", "Template id (see `taskmarket task template list`)").action((id) => {
|
|
13197
13496
|
const template = findTemplate(id);
|
|
13198
13497
|
if (!template) return void printError(templateNotFound(id));
|
|
13199
13498
|
printResult(templateDetail(template));
|
|
13200
13499
|
});
|
|
13201
|
-
var templateCmd = new
|
|
13500
|
+
var templateCmd = new Command54("template").description(
|
|
13202
13501
|
"Browse the curated task templates; create from one with `task create --template <id>`"
|
|
13203
13502
|
).addCommand(listCmd3).addCommand(showCmd);
|
|
13204
13503
|
|
|
13205
13504
|
// src/commands/task/checks.ts
|
|
13206
13505
|
import { readFileSync as readFileSync2 } from "fs";
|
|
13207
|
-
import { Command as
|
|
13506
|
+
import { Command as Command55 } from "commander";
|
|
13208
13507
|
|
|
13209
13508
|
// src/lib/task-hidden-checks.ts
|
|
13210
13509
|
import { createHash } from "crypto";
|
|
@@ -13242,7 +13541,7 @@ function readBytes(path10) {
|
|
|
13242
13541
|
return `Cannot read ${path10}: ${error.message}`;
|
|
13243
13542
|
}
|
|
13244
13543
|
}
|
|
13245
|
-
var commitCmd = new
|
|
13544
|
+
var commitCmd = new Command55("commit").description(
|
|
13246
13545
|
"Commit to a hidden checks file: validates it and prints { commitment, count }. Put both in the public spec's hiddenChecks, then encrypt the file to each verifier with `taskmarket encrypt`"
|
|
13247
13546
|
).requiredOption("--file <path>", "The hidden checks file (a taskmarket.checks/1 spec)").action((opts) => {
|
|
13248
13547
|
const bytes = readBytes(opts.file);
|
|
@@ -13251,7 +13550,7 @@ var commitCmd = new Command54("commit").description(
|
|
|
13251
13550
|
if (!file.valid) return void printError(file.error);
|
|
13252
13551
|
printResult({ commitment: hiddenChecksCommitment(bytes), count: file.count });
|
|
13253
13552
|
});
|
|
13254
|
-
var verifyCmd = new
|
|
13553
|
+
var verifyCmd = new Command55("verify").description("Check a decrypted hidden checks file against the commitment in the public spec").requiredOption("--file <path>", "The decrypted hidden checks file").requiredOption("--commitment <sha256:...>", "The spec's hiddenChecks.commitment").action((opts) => {
|
|
13255
13554
|
if (!isCommitment(opts.commitment)) {
|
|
13256
13555
|
return void printError("--commitment must look like sha256:<64 lowercase hex characters>");
|
|
13257
13556
|
}
|
|
@@ -13266,7 +13565,7 @@ var verifyCmd = new Command54("verify").description("Check a decrypted hidden ch
|
|
|
13266
13565
|
count: file.valid ? file.count : null
|
|
13267
13566
|
});
|
|
13268
13567
|
});
|
|
13269
|
-
var checksCmd = new
|
|
13568
|
+
var checksCmd = new Command55("checks").description(
|
|
13270
13569
|
"Hidden checks: commit to a private checks file and verify it against the commitment"
|
|
13271
13570
|
).addCommand(commitCmd).addCommand(verifyCmd);
|
|
13272
13571
|
|
|
@@ -13295,7 +13594,7 @@ var settleCmd = settlementActionCommand({
|
|
|
13295
13594
|
});
|
|
13296
13595
|
|
|
13297
13596
|
// src/commands/task/index.ts
|
|
13298
|
-
var taskCommand2 = new
|
|
13597
|
+
var taskCommand2 = new Command56("task").description("Manage tasks");
|
|
13299
13598
|
taskCommand2.addCommand(createCmd);
|
|
13300
13599
|
taskCommand2.addCommand(templateCmd);
|
|
13301
13600
|
taskCommand2.addCommand(listCmd);
|
|
@@ -13348,10 +13647,10 @@ taskCommand2.addCommand(reviewCmd, { hidden: true });
|
|
|
13348
13647
|
taskCommand2.addCommand(startReviewCmd);
|
|
13349
13648
|
|
|
13350
13649
|
// src/commands/agent/index.ts
|
|
13351
|
-
import { Command as
|
|
13650
|
+
import { Command as Command60, Option as Option4 } from "commander";
|
|
13352
13651
|
|
|
13353
13652
|
// src/commands/agent/credits.ts
|
|
13354
|
-
import { Command as
|
|
13653
|
+
import { Command as Command57 } from "commander";
|
|
13355
13654
|
|
|
13356
13655
|
// src/lib/tty-confirm.ts
|
|
13357
13656
|
import { createInterface as createInterface3 } from "readline";
|
|
@@ -13404,7 +13703,7 @@ function setupLines(plan, pricing) {
|
|
|
13404
13703
|
...rateLines(pricing)
|
|
13405
13704
|
];
|
|
13406
13705
|
}
|
|
13407
|
-
var setupCommand = new
|
|
13706
|
+
var setupCommand = new Command57("setup").description(
|
|
13408
13707
|
"Approve the compute allocation that pays for sandboxes: daily and monthly caps, and optional auto-top-up"
|
|
13409
13708
|
).requiredOption("--per-day <usd>", "Most compute credit bought in one UTC day, in USD").requiredOption("--per-month <usd>", "Most compute credit bought in one UTC month, in USD").option("--total <usd>", "Most this allocation ever buys, in USD (default: 12 months)").option(
|
|
13410
13709
|
"--auto-top-up-below <credits>",
|
|
@@ -13441,7 +13740,7 @@ var setupCommand = new Command56("setup").description(
|
|
|
13441
13740
|
printResult({ config, caps: plan.caps, autoTopUp: plan.autoTopUp ?? null });
|
|
13442
13741
|
}
|
|
13443
13742
|
);
|
|
13444
|
-
var buyCommand = new
|
|
13743
|
+
var buyCommand = new Command57("buy").description("Buy compute credit over x402 from the compute allocation, after showing the rate").option("--amount <usd>", "Purchase size in whole USD (see `credits status` for the sizes)").option("--yes", "Skip the confirmation prompt (the allocation caps still apply)").action(async (options) => {
|
|
13445
13744
|
const config = await loadComputeCreditConfig();
|
|
13446
13745
|
if (!config) {
|
|
13447
13746
|
throw new ComputeCreditError(
|
|
@@ -13471,17 +13770,17 @@ var buyCommand = new Command56("buy").description("Buy compute credit over x402
|
|
|
13471
13770
|
rate: { rateCardVersion: pricing.rateCardVersion, usdPerCredit: pricing.usdPerCredit }
|
|
13472
13771
|
});
|
|
13473
13772
|
});
|
|
13474
|
-
var statusCommand2 = new
|
|
13773
|
+
var statusCommand2 = new Command57("status").description(
|
|
13475
13774
|
"Show compute credit balance, rate, recent debits and purchases, and the caps; an approved auto-top-up runs when the balance is below its threshold"
|
|
13476
13775
|
).action(async () => {
|
|
13477
13776
|
printResult(await computeCreditStatus());
|
|
13478
13777
|
});
|
|
13479
|
-
var checkCommand = new
|
|
13778
|
+
var checkCommand = new Command57("check").description(
|
|
13480
13779
|
"Check the compute credit balance and, when auto-top-up was approved and the balance is low, buy one chunk"
|
|
13481
13780
|
).action(async () => {
|
|
13482
13781
|
printResult(await checkComputeBalance());
|
|
13483
13782
|
});
|
|
13484
|
-
var reconcileCommand = new
|
|
13783
|
+
var reconcileCommand = new Command57("reconcile").description(
|
|
13485
13784
|
"Settle purchases whose outcome was lost, by their idempotency key; never pays again"
|
|
13486
13785
|
).option(
|
|
13487
13786
|
"--release <key>",
|
|
@@ -13528,10 +13827,10 @@ var reconcileCommand = new Command56("reconcile").description(
|
|
|
13528
13827
|
...recoveryError === void 0 ? {} : { recoveryError }
|
|
13529
13828
|
});
|
|
13530
13829
|
});
|
|
13531
|
-
var disableAutoTopUpCommand = new
|
|
13830
|
+
var disableAutoTopUpCommand = new Command57("disable-auto-top-up").description("Turn off auto-top-up and close its allocation").action(async () => {
|
|
13532
13831
|
printResult({ config: await disableComputeAutoTopUp() });
|
|
13533
13832
|
});
|
|
13534
|
-
var agentCreditsCommand = new
|
|
13833
|
+
var agentCreditsCommand = new Command57("credits").description("Prepaid compute credit for agent sandboxes, bought over x402").addCommand(setupCommand).addCommand(buyCommand).addCommand(statusCommand2).addCommand(checkCommand).addCommand(reconcileCommand).addCommand(disableAutoTopUpCommand);
|
|
13535
13834
|
|
|
13536
13835
|
// src/commands/agent/launch.ts
|
|
13537
13836
|
var EXPERIMENTAL_AGENT_ENV = "TASKMARKET_EXPERIMENTAL_AGENT";
|
|
@@ -13553,7 +13852,7 @@ async function runAgentCommand(options) {
|
|
|
13553
13852
|
try {
|
|
13554
13853
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
13555
13854
|
const pi = assertAgentCompatibility();
|
|
13556
|
-
const { runAgent } = await import("./launch-
|
|
13855
|
+
const { runAgent } = await import("./launch-QN325T4P.js");
|
|
13557
13856
|
result = await runAgent({
|
|
13558
13857
|
model: options.model,
|
|
13559
13858
|
pi,
|
|
@@ -13587,7 +13886,7 @@ async function runAgentCommand(options) {
|
|
|
13587
13886
|
import { createHash as createHash2, randomBytes as randomBytes4 } from "crypto";
|
|
13588
13887
|
import { readFile as readFile2 } from "fs/promises";
|
|
13589
13888
|
import { extname } from "path";
|
|
13590
|
-
import { Command as
|
|
13889
|
+
import { Command as Command58, Option as Option3 } from "commander";
|
|
13591
13890
|
var WRITE_TTL_SECONDS2 = 5 * 60;
|
|
13592
13891
|
var HOUR = 3600;
|
|
13593
13892
|
var LISTING_UNTRUSTED_FIELDS = [
|
|
@@ -13720,7 +14019,7 @@ async function ownListing() {
|
|
|
13720
14019
|
const keystore = await loadKeystore();
|
|
13721
14020
|
return fetchListing(keystore.walletAddress);
|
|
13722
14021
|
}
|
|
13723
|
-
var profileCommand = new
|
|
14022
|
+
var profileCommand = new Command58("profile").description(
|
|
13724
14023
|
"Your listing's profile: name, description, roles, specialties and capabilities"
|
|
13725
14024
|
);
|
|
13726
14025
|
profileCommand.command("set").description(
|
|
@@ -13872,7 +14171,7 @@ function addServiceOptions(command) {
|
|
|
13872
14171
|
"fixed or quote: a hire of this service must name an evaluator before it is accepted"
|
|
13873
14172
|
).option("--no-requires-evaluator", "fixed or quote: hires need no evaluator (the default)");
|
|
13874
14173
|
}
|
|
13875
|
-
var serviceCommand = new
|
|
14174
|
+
var serviceCommand = new Command58("service").description(
|
|
13876
14175
|
"Your listing services: the priced offers requesters hire you for"
|
|
13877
14176
|
);
|
|
13878
14177
|
addServiceOptions(
|
|
@@ -13894,8 +14193,8 @@ addServiceOptions(
|
|
|
13894
14193
|
if (!stored) throw new Error(`No service ${serviceId} on your listing`);
|
|
13895
14194
|
let base = serviceInputFromStored(stored);
|
|
13896
14195
|
if (opts.kind !== void 0 && opts.kind !== stored.kind) {
|
|
13897
|
-
const { title, description, deliverable, specialties, acceptedChainIds } = base;
|
|
13898
|
-
base = { title, description, deliverable, specialties };
|
|
14196
|
+
const { title: title2, description, deliverable, specialties, acceptedChainIds } = base;
|
|
14197
|
+
base = { title: title2, description, deliverable, specialties };
|
|
13899
14198
|
if (acceptedChainIds) base.acceptedChainIds = acceptedChainIds;
|
|
13900
14199
|
}
|
|
13901
14200
|
await writeListingChange({
|
|
@@ -13914,7 +14213,7 @@ serviceCommand.command("remove").description("Remove a service from your listing
|
|
|
13914
14213
|
renderFailure(err);
|
|
13915
14214
|
}
|
|
13916
14215
|
});
|
|
13917
|
-
var availabilityCommand = new
|
|
14216
|
+
var availabilityCommand = new Command58("availability").description(
|
|
13918
14217
|
"Open your listing for hires or pause it (services stay visible but cannot be hired), and set your capacity"
|
|
13919
14218
|
).argument("[state]", "open or paused; keeps the saved state when left out").option("--capacity <n>", 'Most hires in progress at once, or "none" for no limit').action(async (state, opts) => {
|
|
13920
14219
|
try {
|
|
@@ -13934,7 +14233,7 @@ var availabilityCommand = new Command57("availability").description(
|
|
|
13934
14233
|
renderFailure(err);
|
|
13935
14234
|
}
|
|
13936
14235
|
});
|
|
13937
|
-
var listingCommand = new
|
|
14236
|
+
var listingCommand = new Command58("listing").description(
|
|
13938
14237
|
"Show your listing, or another worker's, with whether it is taking hires now and each service's track record on the selected --network"
|
|
13939
14238
|
).argument("[address]", "Wallet address; your own when left out").action(async (address3) => {
|
|
13940
14239
|
try {
|
|
@@ -13961,7 +14260,7 @@ function agentListingCommands() {
|
|
|
13961
14260
|
}
|
|
13962
14261
|
|
|
13963
14262
|
// src/commands/agent/manage.ts
|
|
13964
|
-
import { Command as
|
|
14263
|
+
import { Command as Command59 } from "commander";
|
|
13965
14264
|
async function run(work) {
|
|
13966
14265
|
try {
|
|
13967
14266
|
const value = await work();
|
|
@@ -13984,27 +14283,27 @@ async function requireExperimental() {
|
|
|
13984
14283
|
);
|
|
13985
14284
|
}
|
|
13986
14285
|
function agentManagementCommands() {
|
|
13987
|
-
const status = new
|
|
14286
|
+
const status = new Command59("status").description(
|
|
13988
14287
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
13989
14288
|
).action(async () => {
|
|
13990
|
-
const { collectAgentStatus } = await import("./status-
|
|
14289
|
+
const { collectAgentStatus } = await import("./status-BCKUXLAQ.js");
|
|
13991
14290
|
await run(() => collectAgentStatus());
|
|
13992
14291
|
});
|
|
13993
|
-
const doctor = new
|
|
14292
|
+
const doctor = new Command59("doctor").description(
|
|
13994
14293
|
"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."
|
|
13995
14294
|
).action(async () => {
|
|
13996
|
-
const { runDoctor } = await import("./doctor-
|
|
14295
|
+
const { runDoctor } = await import("./doctor-62ESHY26.js");
|
|
13997
14296
|
const report = await run(() => runDoctor());
|
|
13998
14297
|
if (report && !report.ok) process.exitCode = 1;
|
|
13999
14298
|
});
|
|
14000
|
-
const reconcile = new
|
|
14299
|
+
const reconcile = new Command59("reconcile").description(
|
|
14001
14300
|
"Decide an agent purchase whose outcome is unknown, by its invocation ID; or, with --channel or --rail, everything one channel still has open. Never sends anything again."
|
|
14002
14301
|
).argument("[invocation-id]", "The purchase, as status or the agent named it").option("--rail <id>", "Reconcile the open purchases of this rail's channel").option(
|
|
14003
14302
|
"--channel <channel-id>",
|
|
14004
14303
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
14005
14304
|
).action(
|
|
14006
14305
|
async (invocationId, options) => {
|
|
14007
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
14306
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-ZQUH7Z7P.js");
|
|
14008
14307
|
const choice = { rail: options.rail, channel: options.channel };
|
|
14009
14308
|
if (invocationId !== void 0) {
|
|
14010
14309
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -14022,23 +14321,23 @@ function agentManagementCommands() {
|
|
|
14022
14321
|
});
|
|
14023
14322
|
}
|
|
14024
14323
|
);
|
|
14025
|
-
const topup = new
|
|
14324
|
+
const topup = new Command59("topup").description(
|
|
14026
14325
|
"Check a channel top-up against the approved budget: within it, the channel deposits by itself with the next turn that needs funds; over it, a new approval is needed"
|
|
14027
14326
|
).requiredOption("--amount <usdc>", "Top-up in USDC, e.g. 5 or 2.50").option("--rail <id>", "The rail to top up (required when the policy has more than one)").action(async (options) => {
|
|
14028
14327
|
await run(async () => {
|
|
14029
14328
|
await requireExperimental();
|
|
14030
14329
|
const { usdcToAtomic, AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
14031
14330
|
const { AgentLaunchError } = await import("./errors-2L357HGA.js");
|
|
14032
|
-
const
|
|
14033
|
-
if (
|
|
14331
|
+
const amount2 = usdcToAtomic(options.amount);
|
|
14332
|
+
if (amount2 === void 0 || amount2 === "0") {
|
|
14034
14333
|
throw new AgentLaunchError(
|
|
14035
14334
|
"invalid_amount",
|
|
14036
14335
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
14037
14336
|
);
|
|
14038
14337
|
}
|
|
14039
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
14338
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-UVUKKHEH.js");
|
|
14040
14339
|
const { rails } = await openAgentChannels();
|
|
14041
|
-
const result = await requestTopUp(selectRail(rails, options.rail),
|
|
14340
|
+
const result = await requestTopUp(selectRail(rails, options.rail), amount2);
|
|
14042
14341
|
return {
|
|
14043
14342
|
version: AGENT_VIEW_VERSION,
|
|
14044
14343
|
kind: "taskmarket.agent.topup",
|
|
@@ -14047,7 +14346,7 @@ function agentManagementCommands() {
|
|
|
14047
14346
|
};
|
|
14048
14347
|
});
|
|
14049
14348
|
});
|
|
14050
|
-
const close = new
|
|
14349
|
+
const close = new Command59("close").description(
|
|
14051
14350
|
"Close the agent's channel and refund its unused balance cooperatively; checks an earlier close instead of sending it again"
|
|
14052
14351
|
).option("--rail <id>", "The rail to close (required when the policy has more than one)").option(
|
|
14053
14352
|
"--channel <channel-id>",
|
|
@@ -14056,8 +14355,8 @@ function agentManagementCommands() {
|
|
|
14056
14355
|
await run(async () => {
|
|
14057
14356
|
await requireExperimental();
|
|
14058
14357
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
14059
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
14060
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
14358
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-UVUKKHEH.js");
|
|
14359
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-ZQUH7Z7P.js");
|
|
14061
14360
|
const opened = await openAgentChannels();
|
|
14062
14361
|
const { rail, retired } = selectChannel(opened, options);
|
|
14063
14362
|
const result = await closeChannel(
|
|
@@ -14088,7 +14387,7 @@ function agentManagementCommands() {
|
|
|
14088
14387
|
};
|
|
14089
14388
|
});
|
|
14090
14389
|
});
|
|
14091
|
-
const pull = new
|
|
14390
|
+
const pull = new Command59("pull").description(
|
|
14092
14391
|
"After a session: review the changes the agent left in its sandbox (saved when the session ended; the sandbox is not resumed) and apply them to this project on approval. Conflicts with your local edits and host configuration are listed, never applied. Inside a session use /pull."
|
|
14093
14392
|
).option("--diff", "Print the full diff").option("--apply", "Apply the clean changes without asking").option(
|
|
14094
14393
|
"--overwrite <path>",
|
|
@@ -14111,7 +14410,7 @@ function agentManagementCommands() {
|
|
|
14111
14410
|
async (options) => {
|
|
14112
14411
|
await run(async () => {
|
|
14113
14412
|
await requireExperimental();
|
|
14114
|
-
const { runPull } = await import("./sync-pull-
|
|
14413
|
+
const { runPull } = await import("./sync-pull-YDX4D4XW.js");
|
|
14115
14414
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
14116
14415
|
return runPull(options, {
|
|
14117
14416
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -14129,7 +14428,7 @@ function agentManagementCommands() {
|
|
|
14129
14428
|
|
|
14130
14429
|
// src/commands/agent/index.ts
|
|
14131
14430
|
var experimental = agentCommandEnabled();
|
|
14132
|
-
var agentCommand = new
|
|
14431
|
+
var agentCommand = new Command60("agent").description(
|
|
14133
14432
|
experimental ? "The Taskmarket agent and the compute it runs on. Without a subcommand (experimental), open Pi's interactive coding agent in this project, with paid xgate inference from your wallet and tools in your cloud sandbox" : "The Taskmarket agent and the compute it runs on"
|
|
14134
14433
|
).addOption(
|
|
14135
14434
|
new Option4("--model <id>", "Start on one model from your approved spending policy").hideHelp(
|
|
@@ -14166,7 +14465,7 @@ for (const command of agentManagementCommands()) {
|
|
|
14166
14465
|
}
|
|
14167
14466
|
|
|
14168
14467
|
// src/commands/agents.ts
|
|
14169
|
-
import { Command as
|
|
14468
|
+
import { Command as Command61 } from "commander";
|
|
14170
14469
|
var MIN_RATINGS = ["3", "4", "4.5"];
|
|
14171
14470
|
var MIN_TASKS = ["5", "10", "50"];
|
|
14172
14471
|
var AVAILABILITIES = ["available", "unavailable", "any"];
|
|
@@ -14176,7 +14475,7 @@ function allowListed(flag, value, allowed) {
|
|
|
14176
14475
|
throw new Error(`${flag} must be one of: ${allowed.join(", ")}`);
|
|
14177
14476
|
}
|
|
14178
14477
|
}
|
|
14179
|
-
var agentsCommand = new
|
|
14478
|
+
var agentsCommand = new Command61("agents").description("Browse the worker directory (agents and humans) on the selected --network").enablePositionalOptions().option(
|
|
14180
14479
|
"--sort <order>",
|
|
14181
14480
|
"Sort order: reputation (top rated), tasks, hires (most hired: completed reserved, quote and request hires) or volume (settled earnings)",
|
|
14182
14481
|
"reputation"
|
|
@@ -14422,7 +14721,7 @@ agentsCommand.command("report").description("Report a worker's listing, or one o
|
|
|
14422
14721
|
});
|
|
14423
14722
|
|
|
14424
14723
|
// src/commands/dashboard.ts
|
|
14425
|
-
import { Command as
|
|
14724
|
+
import { Command as Command62 } from "commander";
|
|
14426
14725
|
|
|
14427
14726
|
// src/lib/dashboard.ts
|
|
14428
14727
|
var DASHBOARD_LIST_LIMIT = 5;
|
|
@@ -14612,14 +14911,14 @@ function buildWorkflows(workflows, schedules, limit = DASHBOARD_LIST_LIMIT) {
|
|
|
14612
14911
|
// src/commands/dashboard.ts
|
|
14613
14912
|
var PROJECTS_READ_LIMIT = 25;
|
|
14614
14913
|
var SWARM_NOTE = "Hosted agents are managed in the web app (/dashboard/swarm) and need a web sign-in, so the CLI does not read them.";
|
|
14615
|
-
async function
|
|
14914
|
+
async function settle2(read4) {
|
|
14616
14915
|
try {
|
|
14617
14916
|
return { value: await read4(), error: null };
|
|
14618
14917
|
} catch (error) {
|
|
14619
14918
|
return { value: null, error: error instanceof Error ? error.message : String(error) };
|
|
14620
14919
|
}
|
|
14621
14920
|
}
|
|
14622
|
-
var dashboardCommand = new
|
|
14921
|
+
var dashboardCommand = new Command62("dashboard").description(
|
|
14623
14922
|
"Show your home base: what needs you, your money, tasks you posted and work you do, projects and workflows, and recent activity"
|
|
14624
14923
|
).action(async () => {
|
|
14625
14924
|
const auth = await signReadAuth();
|
|
@@ -14636,36 +14935,36 @@ var dashboardCommand = new Command61("dashboard").description(
|
|
|
14636
14935
|
limit: String(AUTOMATIONS_READ_LIMIT)
|
|
14637
14936
|
});
|
|
14638
14937
|
const [queue, inbox, workflows, schedules, projects, balance, activity] = await Promise.all([
|
|
14639
|
-
|
|
14938
|
+
settle2(
|
|
14640
14939
|
() => apiGet(`/api/agents/action-queue?${new URLSearchParams({ address: address3, limit: "50" })}`, {
|
|
14641
14940
|
headers
|
|
14642
14941
|
})
|
|
14643
14942
|
),
|
|
14644
|
-
|
|
14943
|
+
settle2(
|
|
14645
14944
|
() => apiGet(
|
|
14646
14945
|
`/api/agents/inbox?${new URLSearchParams({ address: address3, sort: "attention", limit: String(DASHBOARD_TASK_LIMIT) })}`,
|
|
14647
14946
|
{ headers }
|
|
14648
14947
|
)
|
|
14649
14948
|
),
|
|
14650
|
-
|
|
14949
|
+
settle2(
|
|
14651
14950
|
() => apiGet(withChainId(`/api/workflows?${owner}`))
|
|
14652
14951
|
),
|
|
14653
|
-
|
|
14952
|
+
settle2(
|
|
14654
14953
|
() => apiGet(withChainId(`/api/schedules?${owner}`))
|
|
14655
14954
|
),
|
|
14656
|
-
|
|
14955
|
+
settle2(
|
|
14657
14956
|
() => apiGet(
|
|
14658
14957
|
withChainId(
|
|
14659
14958
|
`/api/projects?${new URLSearchParams({ address: address3, role: "owner", status: "open", limit: String(PROJECTS_READ_LIMIT) })}`
|
|
14660
14959
|
)
|
|
14661
14960
|
)
|
|
14662
14961
|
),
|
|
14663
|
-
|
|
14962
|
+
settle2(
|
|
14664
14963
|
() => apiGet(
|
|
14665
14964
|
`/api/wallet/balance?${new URLSearchParams({ address: address3, chainId: String(chainId) })}`
|
|
14666
14965
|
)
|
|
14667
14966
|
),
|
|
14668
|
-
|
|
14967
|
+
settle2(
|
|
14669
14968
|
() => apiGet(
|
|
14670
14969
|
`/api/market-events?${new URLSearchParams({
|
|
14671
14970
|
order: "newest",
|
|
@@ -14686,17 +14985,18 @@ var dashboardCommand = new Command61("dashboard").description(
|
|
|
14686
14985
|
if (projects.error) errors.projects = projects.error;
|
|
14687
14986
|
if (balance.error) errors.balance = balance.error;
|
|
14688
14987
|
if (activity.error) errors.activity = activity.error;
|
|
14988
|
+
const needsYou = buildNeedsYou({
|
|
14989
|
+
actions: queue.value?.items,
|
|
14990
|
+
workflows: workflows.value?.workflows,
|
|
14991
|
+
schedules: schedules.value?.schedules,
|
|
14992
|
+
more: Boolean(queue.value?.nextCursor)
|
|
14993
|
+
});
|
|
14689
14994
|
printResult(
|
|
14690
14995
|
withChainNames({
|
|
14691
14996
|
address: address3,
|
|
14692
14997
|
chainId,
|
|
14693
14998
|
generatedAt: new Date(nowMs).toISOString(),
|
|
14694
|
-
needsYou
|
|
14695
|
-
actions: queue.value?.items,
|
|
14696
|
-
workflows: workflows.value?.workflows,
|
|
14697
|
-
schedules: schedules.value?.schedules,
|
|
14698
|
-
more: Boolean(queue.value?.nextCursor)
|
|
14699
|
-
}),
|
|
14999
|
+
needsYou,
|
|
14700
15000
|
money: {
|
|
14701
15001
|
balance: balance.value ? {
|
|
14702
15002
|
baseUnits: balance.value.balanceBaseUnits,
|
|
@@ -14723,13 +15023,22 @@ var dashboardCommand = new Command61("dashboard").description(
|
|
|
14723
15023
|
summary: event.summary
|
|
14724
15024
|
})),
|
|
14725
15025
|
...Object.keys(errors).length > 0 ? { errors } : {}
|
|
14726
|
-
})
|
|
15026
|
+
}),
|
|
15027
|
+
{
|
|
15028
|
+
next: nextForHome({
|
|
15029
|
+
address: address3,
|
|
15030
|
+
chainId,
|
|
15031
|
+
balanceBaseUnits: balance.value?.balanceBaseUnits,
|
|
15032
|
+
needsYou: needsYou.total,
|
|
15033
|
+
activeTasks: posted.length + work.length
|
|
15034
|
+
})
|
|
15035
|
+
}
|
|
14727
15036
|
);
|
|
14728
15037
|
});
|
|
14729
15038
|
|
|
14730
15039
|
// src/commands/inbox.ts
|
|
14731
|
-
import { Command as
|
|
14732
|
-
var inboxCommand = new
|
|
15040
|
+
import { Command as Command63 } from "commander";
|
|
15041
|
+
var inboxCommand = new Command63("inbox").description(
|
|
14733
15042
|
"Show what you need to do now, then tasks you created, tasks you are working on, and private tasks you were invited to"
|
|
14734
15043
|
).option(
|
|
14735
15044
|
"--limit <n>",
|
|
@@ -14872,7 +15181,7 @@ var inboxCommand = new Command62("inbox").description(
|
|
|
14872
15181
|
);
|
|
14873
15182
|
|
|
14874
15183
|
// src/commands/deposit.ts
|
|
14875
|
-
import { Command as
|
|
15184
|
+
import { Command as Command64 } from "commander";
|
|
14876
15185
|
|
|
14877
15186
|
// src/lib/relay-bridge.ts
|
|
14878
15187
|
import { z as z4 } from "zod";
|
|
@@ -14952,10 +15261,10 @@ async function fundingOptionsFor(chainId) {
|
|
|
14952
15261
|
symbol: route.destination.symbol
|
|
14953
15262
|
}
|
|
14954
15263
|
})) : [],
|
|
14955
|
-
note: "
|
|
15264
|
+
note: "Send the payment token to `address` on this network, or run `taskmarket deposit --relay-route <routeId> --amount <n>` for a Relay deposit address. The CLI has no fiat on-ramp: a person funds the wallet."
|
|
14956
15265
|
};
|
|
14957
15266
|
}
|
|
14958
|
-
var depositCommand = new
|
|
15267
|
+
var depositCommand = new Command64("deposit").description(
|
|
14959
15268
|
"Show wallet address, network info and cross-chain funding options for the selected --network"
|
|
14960
15269
|
).option(
|
|
14961
15270
|
"--relay-route <routeId>",
|
|
@@ -15006,7 +15315,19 @@ var depositCommand = new Command63("deposit").description(
|
|
|
15006
15315
|
renderFailure(new Error("--amount needs --relay-route"));
|
|
15007
15316
|
return;
|
|
15008
15317
|
}
|
|
15009
|
-
|
|
15318
|
+
const balance = await apiGet(
|
|
15319
|
+
`/api/wallet/balance?address=${address3}&chainId=${chainId}`
|
|
15320
|
+
).catch(() => null);
|
|
15321
|
+
printResult(
|
|
15322
|
+
{ ...data, fundingOptions },
|
|
15323
|
+
{
|
|
15324
|
+
next: nextForBalance({
|
|
15325
|
+
address: address3,
|
|
15326
|
+
chainId,
|
|
15327
|
+
balanceBaseUnits: balance?.balanceBaseUnits
|
|
15328
|
+
})
|
|
15329
|
+
}
|
|
15330
|
+
);
|
|
15010
15331
|
return;
|
|
15011
15332
|
}
|
|
15012
15333
|
try {
|
|
@@ -15045,10 +15366,10 @@ var depositCommand = new Command63("deposit").description(
|
|
|
15045
15366
|
});
|
|
15046
15367
|
|
|
15047
15368
|
// src/commands/wallet/index.ts
|
|
15048
|
-
import { Command as
|
|
15369
|
+
import { Command as Command75 } from "commander";
|
|
15049
15370
|
|
|
15050
15371
|
// src/commands/wallet/balance.ts
|
|
15051
|
-
import { Command as
|
|
15372
|
+
import { Command as Command65 } from "commander";
|
|
15052
15373
|
function balancePath(address3, chainId) {
|
|
15053
15374
|
return `/api/wallet/balance?address=${address3}&chainId=${chainId}`;
|
|
15054
15375
|
}
|
|
@@ -15082,7 +15403,7 @@ async function allChainBalances(address3) {
|
|
|
15082
15403
|
);
|
|
15083
15404
|
return { address: address3, chains };
|
|
15084
15405
|
}
|
|
15085
|
-
var walletBalanceCommand = new
|
|
15406
|
+
var walletBalanceCommand = new Command65("balance").description("Show the wallet's payment-token balance on the selected network").option("--address <addr>", "Address to check (defaults to own wallet)").option(
|
|
15086
15407
|
"--all-chains",
|
|
15087
15408
|
"Show the balance on every chain the selected deployment serves, one entry per chain"
|
|
15088
15409
|
).option(
|
|
@@ -15102,6 +15423,7 @@ var walletBalanceCommand = new Command64("balance").description("Show the wallet
|
|
|
15102
15423
|
return;
|
|
15103
15424
|
}
|
|
15104
15425
|
let address3 = opts.address;
|
|
15426
|
+
const ownWallet = !address3;
|
|
15105
15427
|
if (!address3) {
|
|
15106
15428
|
const keystore = await loadKeystore();
|
|
15107
15429
|
address3 = keystore.walletAddress;
|
|
@@ -15114,15 +15436,19 @@ var walletBalanceCommand = new Command64("balance").description("Show the wallet
|
|
|
15114
15436
|
}
|
|
15115
15437
|
return;
|
|
15116
15438
|
}
|
|
15117
|
-
const
|
|
15118
|
-
|
|
15439
|
+
const chainId = selectedNetwork().chainId;
|
|
15440
|
+
const result = await apiGet(balancePath(address3, chainId));
|
|
15441
|
+
printResult(
|
|
15442
|
+
result,
|
|
15443
|
+
ownWallet ? {
|
|
15444
|
+
next: nextForBalance({ address: address3, chainId, balanceBaseUnits: result.balanceBaseUnits })
|
|
15445
|
+
} : void 0
|
|
15119
15446
|
);
|
|
15120
|
-
printResult(result);
|
|
15121
15447
|
}
|
|
15122
15448
|
);
|
|
15123
15449
|
|
|
15124
15450
|
// src/commands/wallet/import.ts
|
|
15125
|
-
import { Command as
|
|
15451
|
+
import { Command as Command66 } from "commander";
|
|
15126
15452
|
import { createInterface as createInterface4 } from "readline";
|
|
15127
15453
|
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
15128
15454
|
function normalizePrivateKey(raw) {
|
|
@@ -15196,7 +15522,7 @@ async function importSolanaWallet(flagKey) {
|
|
|
15196
15522
|
{ warnings: argvKeyWarnings(keySource) }
|
|
15197
15523
|
);
|
|
15198
15524
|
}
|
|
15199
|
-
var walletImportCommand = new
|
|
15525
|
+
var walletImportCommand = new Command66("import").description("Import an existing private key as the agent wallet").option(
|
|
15200
15526
|
"--key <privateKey>",
|
|
15201
15527
|
"Private key to import (64 hex chars, with or without 0x prefix; with --solana, a base58 or JSON-array Solana secret key)"
|
|
15202
15528
|
).option(
|
|
@@ -15287,7 +15613,7 @@ var walletImportCommand = new Command65("import").description("Import an existin
|
|
|
15287
15613
|
|
|
15288
15614
|
// src/commands/wallet/set-withdrawal-address.ts
|
|
15289
15615
|
import { randomBytes as randomBytes5 } from "crypto";
|
|
15290
|
-
import { Command as
|
|
15616
|
+
import { Command as Command67 } from "commander";
|
|
15291
15617
|
|
|
15292
15618
|
// src/lib/withdrawal-pin.ts
|
|
15293
15619
|
var WithdrawalAddressMismatchError = class extends Error {
|
|
@@ -15364,7 +15690,7 @@ var SIGNATURE_TTL_SECONDS = 5 * 60;
|
|
|
15364
15690
|
function isValidAddress(addr) {
|
|
15365
15691
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
15366
15692
|
}
|
|
15367
|
-
var setWithdrawalAddressCommand = new
|
|
15693
|
+
var setWithdrawalAddressCommand = new Command67("set-withdrawal-address").description(
|
|
15368
15694
|
"Set the withdrawal address for payment-token withdrawals on the selected network (once per chain, free)"
|
|
15369
15695
|
).argument("<address>", "Ethereum address to receive withdrawals").action(async (address3) => {
|
|
15370
15696
|
if (!isValidAddress(address3)) {
|
|
@@ -15425,8 +15751,8 @@ var setWithdrawalAddressCommand = new Command66("set-withdrawal-address").descri
|
|
|
15425
15751
|
});
|
|
15426
15752
|
|
|
15427
15753
|
// src/commands/wallet/get-withdrawal-address.ts
|
|
15428
|
-
import { Command as
|
|
15429
|
-
var getWithdrawalAddressCommand = new
|
|
15754
|
+
import { Command as Command68 } from "commander";
|
|
15755
|
+
var getWithdrawalAddressCommand = new Command68("get-withdrawal-address").description(
|
|
15430
15756
|
"Show the withdrawal address registered on the selected network, if any (the address is per chain)"
|
|
15431
15757
|
).option("--address <addr>", "Wallet address to check (defaults to own wallet)").action(async (opts) => {
|
|
15432
15758
|
let address3 = opts.address;
|
|
@@ -15442,14 +15768,14 @@ var getWithdrawalAddressCommand = new Command67("get-withdrawal-address").descri
|
|
|
15442
15768
|
});
|
|
15443
15769
|
|
|
15444
15770
|
// src/commands/wallet/change-withdrawal-address.ts
|
|
15445
|
-
import { Command as
|
|
15771
|
+
import { Command as Command69 } from "commander";
|
|
15446
15772
|
function isValidAddress2(addr) {
|
|
15447
15773
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
15448
15774
|
}
|
|
15449
15775
|
function isValidRecoveryCode(code) {
|
|
15450
15776
|
return /^\d{8}$/.test(code);
|
|
15451
15777
|
}
|
|
15452
|
-
var changeWithdrawalAddressCommand = new
|
|
15778
|
+
var changeWithdrawalAddressCommand = new Command69("change-withdrawal-address").description(
|
|
15453
15779
|
"Change the selected network's withdrawal address using that chain's account recovery code (RFC-0012)"
|
|
15454
15780
|
).argument("<recovery-code>", "The 8-digit account recovery code from set-withdrawal-address").argument("<new-address>", "New Ethereum address to receive withdrawals").action(async (recoveryCode, newAddress) => {
|
|
15455
15781
|
if (!isValidRecoveryCode(recoveryCode)) {
|
|
@@ -15501,8 +15827,8 @@ var changeWithdrawalAddressCommand = new Command68("change-withdrawal-address").
|
|
|
15501
15827
|
});
|
|
15502
15828
|
|
|
15503
15829
|
// src/commands/wallet/sync-withdrawal-address.ts
|
|
15504
|
-
import { Command as
|
|
15505
|
-
var syncWithdrawalAddressCommand = new
|
|
15830
|
+
import { Command as Command70 } from "commander";
|
|
15831
|
+
var syncWithdrawalAddressCommand = new Command70("sync-withdrawal-address").description(
|
|
15506
15832
|
"Accept the selected network's withdrawal address registered on the server as the locally pinned one (after a change made elsewhere, e.g. on the web)"
|
|
15507
15833
|
).action(async () => {
|
|
15508
15834
|
let keystore;
|
|
@@ -15535,8 +15861,8 @@ var syncWithdrawalAddressCommand = new Command69("sync-withdrawal-address").desc
|
|
|
15535
15861
|
});
|
|
15536
15862
|
|
|
15537
15863
|
// src/commands/wallet/reveal-recovery-code.ts
|
|
15538
|
-
import { Command as
|
|
15539
|
-
var revealRecoveryCodeCommand = new
|
|
15864
|
+
import { Command as Command71 } from "commander";
|
|
15865
|
+
var revealRecoveryCodeCommand = new Command71("reveal-recovery-code").description(
|
|
15540
15866
|
"One-time reveal of the selected network's account recovery code, if one has not been generated yet"
|
|
15541
15867
|
).action(async () => {
|
|
15542
15868
|
let keystore;
|
|
@@ -15575,8 +15901,8 @@ var revealRecoveryCodeCommand = new Command70("reveal-recovery-code").descriptio
|
|
|
15575
15901
|
});
|
|
15576
15902
|
|
|
15577
15903
|
// src/commands/wallet/publish-key.ts
|
|
15578
|
-
import { Command as
|
|
15579
|
-
var publishKeyCommand = new
|
|
15904
|
+
import { Command as Command72 } from "commander";
|
|
15905
|
+
var publishKeyCommand = new Command72("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
15580
15906
|
let keystore;
|
|
15581
15907
|
try {
|
|
15582
15908
|
keystore = await loadKeystore();
|
|
@@ -15596,7 +15922,7 @@ var publishKeyCommand = new Command71("publish-key").description("Publish your s
|
|
|
15596
15922
|
});
|
|
15597
15923
|
|
|
15598
15924
|
// src/commands/wallet/withdraw-dreams.ts
|
|
15599
|
-
import { Command as
|
|
15925
|
+
import { Command as Command73 } from "commander";
|
|
15600
15926
|
import { toHex } from "viem";
|
|
15601
15927
|
var AUTHORIZATION_VALIDITY_SECONDS = 300;
|
|
15602
15928
|
function isValidAddress3(addr) {
|
|
@@ -15618,7 +15944,7 @@ function withdrawalTargets(balance, hook) {
|
|
|
15618
15944
|
targets: hooks.filter((entry) => BigInt(entry.claimableBaseUnits) > 0n).map((entry) => ({ hookAddress: entry.hookAddress, send: true }))
|
|
15619
15945
|
};
|
|
15620
15946
|
}
|
|
15621
|
-
var withdrawDreamsCommand = new
|
|
15947
|
+
var withdrawDreamsCommand = new Command73("withdraw-dreams").description(
|
|
15622
15948
|
"Withdraw accumulated DREAMS rewards to the withdrawal address: one signed withdrawal from each reward hook holding a balance, or from --hook alone"
|
|
15623
15949
|
).option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").option("--hook <address>", "Withdraw from this reward hook only").action(async (opts) => {
|
|
15624
15950
|
let keystore;
|
|
@@ -15739,7 +16065,7 @@ var withdrawDreamsCommand = new Command72("withdraw-dreams").description(
|
|
|
15739
16065
|
});
|
|
15740
16066
|
|
|
15741
16067
|
// src/commands/wallet/bridge.ts
|
|
15742
|
-
import { Command as
|
|
16068
|
+
import { Command as Command74 } from "commander";
|
|
15743
16069
|
import { toHex as toHex2 } from "viem";
|
|
15744
16070
|
var USDC_TYPES = {
|
|
15745
16071
|
TransferWithAuthorization: [
|
|
@@ -15783,17 +16109,17 @@ async function pollBridgeStatus(requestId) {
|
|
|
15783
16109
|
await sleep(bridgeTiming.intervalMs);
|
|
15784
16110
|
}
|
|
15785
16111
|
}
|
|
15786
|
-
var walletBridgeCommand = new
|
|
16112
|
+
var walletBridgeCommand = new Command74("bridge").description(
|
|
15787
16113
|
"Move free USDC on Base to OUSD at the same address on Tempo (gasless, through Relay)"
|
|
15788
16114
|
).requiredOption("--to <chain>", 'Destination chain (only "tempo")').option(
|
|
15789
16115
|
"--recipient <address>",
|
|
15790
16116
|
"Deliver the OUSD to this ready Tempo mainnet swarm wallet (a hosted agent wallet) instead of your own address; a refund still goes to your wallet on Base"
|
|
15791
|
-
).argument("<amount>", "Amount of USDC in whole tokens (minimum 1, e.g. 25)").action(async (
|
|
16117
|
+
).argument("<amount>", "Amount of USDC in whole tokens (minimum 1, e.g. 25)").action(async (amount2, opts) => {
|
|
15792
16118
|
if (opts.to !== "tempo") {
|
|
15793
16119
|
printError('Invalid --to: the only bridge destination is "tempo"');
|
|
15794
16120
|
return;
|
|
15795
16121
|
}
|
|
15796
|
-
if (!/^\d+(\.\d{1,6})?$/.test(
|
|
16122
|
+
if (!/^\d+(\.\d{1,6})?$/.test(amount2) || Number(amount2) <= 0) {
|
|
15797
16123
|
printError("Invalid amount: must be a positive number with at most 6 decimals (e.g. 25)");
|
|
15798
16124
|
return;
|
|
15799
16125
|
}
|
|
@@ -15801,7 +16127,7 @@ var walletBridgeCommand = new Command73("bridge").description(
|
|
|
15801
16127
|
printError("Invalid --recipient: must be a 0x-prefixed 20-byte address");
|
|
15802
16128
|
return;
|
|
15803
16129
|
}
|
|
15804
|
-
const [whole, fraction = ""] =
|
|
16130
|
+
const [whole, fraction = ""] = amount2.split(".");
|
|
15805
16131
|
const amountBaseUnits = (BigInt(whole) * 1000000n + BigInt(fraction.padEnd(6, "0"))).toString();
|
|
15806
16132
|
let keystore;
|
|
15807
16133
|
try {
|
|
@@ -15922,7 +16248,7 @@ var walletBridgeCommand = new Command73("bridge").description(
|
|
|
15922
16248
|
});
|
|
15923
16249
|
|
|
15924
16250
|
// src/commands/wallet/index.ts
|
|
15925
|
-
var walletCommand = new
|
|
16251
|
+
var walletCommand = new Command75("wallet").description("Wallet management commands");
|
|
15926
16252
|
walletCommand.addCommand(walletBalanceCommand);
|
|
15927
16253
|
walletCommand.addCommand(walletImportCommand);
|
|
15928
16254
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
@@ -15935,7 +16261,7 @@ walletCommand.addCommand(withdrawDreamsCommand);
|
|
|
15935
16261
|
walletCommand.addCommand(walletBridgeCommand);
|
|
15936
16262
|
|
|
15937
16263
|
// src/commands/withdraw.ts
|
|
15938
|
-
import { Command as
|
|
16264
|
+
import { Command as Command76 } from "commander";
|
|
15939
16265
|
import { toHex as toHex3 } from "viem";
|
|
15940
16266
|
|
|
15941
16267
|
// src/lib/solana-relay.ts
|
|
@@ -16011,7 +16337,7 @@ async function relaySolanaInstructions(input) {
|
|
|
16011
16337
|
}
|
|
16012
16338
|
|
|
16013
16339
|
// src/commands/withdraw.ts
|
|
16014
|
-
async function withdrawOnSolana(
|
|
16340
|
+
async function withdrawOnSolana(amount2, opts) {
|
|
16015
16341
|
if (!opts.mint || !opts.to) {
|
|
16016
16342
|
printError("withdraw --solana needs --mint <address> and --to <address>");
|
|
16017
16343
|
return;
|
|
@@ -16030,7 +16356,7 @@ async function withdrawOnSolana(amount, opts) {
|
|
|
16030
16356
|
const connection = solanaConnection(opts.solanaCluster);
|
|
16031
16357
|
if (!opts.yes && !await confirmAtTerminal(
|
|
16032
16358
|
[
|
|
16033
|
-
`Send ${
|
|
16359
|
+
`Send ${amount2} of mint ${opts.mint} on Solana ${connection.cluster}`,
|
|
16034
16360
|
`from ${keystore.solanaAddress} to ${opts.to}.`
|
|
16035
16361
|
],
|
|
16036
16362
|
"pass --yes to send without it"
|
|
@@ -16049,7 +16375,7 @@ async function withdrawOnSolana(amount, opts) {
|
|
|
16049
16375
|
signer,
|
|
16050
16376
|
mint: opts.mint,
|
|
16051
16377
|
to: opts.to,
|
|
16052
|
-
amount,
|
|
16378
|
+
amount: amount2,
|
|
16053
16379
|
// ADR-0394 and #3813: Taskmarket's relayer pays the fee and any recipient token account
|
|
16054
16380
|
// rent, so the agent's wallet needs no SOL.
|
|
16055
16381
|
rentPayer: relay.feePayer,
|
|
@@ -16114,14 +16440,14 @@ var USDC_TYPES2 = {
|
|
|
16114
16440
|
{ name: "nonce", type: "bytes32" }
|
|
16115
16441
|
]
|
|
16116
16442
|
};
|
|
16117
|
-
var withdrawCommand = new
|
|
16443
|
+
var withdrawCommand = new Command76("withdraw").description(
|
|
16118
16444
|
"Withdraw the payment token (USDC on Base, OUSD on Tempo) to the registered withdrawal address"
|
|
16119
|
-
).argument("<amount>", "Amount in whole tokens (e.g. 5 for 5 USDC or 5 OUSD)").option("--solana", "Send an SPL token from the agent's Solana wallet instead").option("--mint <address>", "With --solana: the SPL Token or Token-2022 mint to send").option("--to <address>", "With --solana: the Solana address to send to").option("--solana-cluster <cluster>", "With --solana: mainnet-beta or devnet").option("--yes", "With --solana: send without the terminal confirmation").action(async (
|
|
16445
|
+
).argument("<amount>", "Amount in whole tokens (e.g. 5 for 5 USDC or 5 OUSD)").option("--solana", "Send an SPL token from the agent's Solana wallet instead").option("--mint <address>", "With --solana: the SPL Token or Token-2022 mint to send").option("--to <address>", "With --solana: the Solana address to send to").option("--solana-cluster <cluster>", "With --solana: mainnet-beta or devnet").option("--yes", "With --solana: send without the terminal confirmation").action(async (amount2, opts) => {
|
|
16120
16446
|
if (opts.solana) {
|
|
16121
|
-
await withdrawOnSolana(
|
|
16447
|
+
await withdrawOnSolana(amount2, opts);
|
|
16122
16448
|
return;
|
|
16123
16449
|
}
|
|
16124
|
-
const parsed = parseFloat(
|
|
16450
|
+
const parsed = parseFloat(amount2);
|
|
16125
16451
|
if (isNaN(parsed) || parsed <= 0) {
|
|
16126
16452
|
printError("Invalid amount: must be a positive number (e.g. 5)");
|
|
16127
16453
|
return;
|
|
@@ -16203,12 +16529,12 @@ var withdrawCommand = new Command75("withdraw").description(
|
|
|
16203
16529
|
});
|
|
16204
16530
|
|
|
16205
16531
|
// src/commands/encrypt.ts
|
|
16206
|
-
import { Command as
|
|
16207
|
-
import { promises as
|
|
16208
|
-
var encryptCommand = new
|
|
16532
|
+
import { Command as Command77 } from "commander";
|
|
16533
|
+
import { promises as fs3 } from "fs";
|
|
16534
|
+
var encryptCommand = new Command77("encrypt").description("Encrypt a file with ECIES using wallet keys").argument("<file>", "Path to the file to encrypt").option("--recipient <address>", "Recipient wallet address (default: self)").option("--output <path>", "Output path (default: <file>.enc)").action(async (file, opts) => {
|
|
16209
16535
|
let plaintext;
|
|
16210
16536
|
try {
|
|
16211
|
-
plaintext = await
|
|
16537
|
+
plaintext = await fs3.readFile(file);
|
|
16212
16538
|
} catch {
|
|
16213
16539
|
printError(`Cannot read file: ${file}`);
|
|
16214
16540
|
return;
|
|
@@ -16244,7 +16570,7 @@ var encryptCommand = new Command76("encrypt").description("Encrypt a file with E
|
|
|
16244
16570
|
}
|
|
16245
16571
|
const encrypted = encryptForRecipient(plaintext, recipientPubKey);
|
|
16246
16572
|
const outputPath = opts.output ?? `${file}.enc`;
|
|
16247
|
-
await
|
|
16573
|
+
await fs3.writeFile(outputPath, encrypted);
|
|
16248
16574
|
printResult({
|
|
16249
16575
|
output: outputPath,
|
|
16250
16576
|
bytes: encrypted.length,
|
|
@@ -16253,12 +16579,12 @@ var encryptCommand = new Command76("encrypt").description("Encrypt a file with E
|
|
|
16253
16579
|
});
|
|
16254
16580
|
|
|
16255
16581
|
// src/commands/decrypt.ts
|
|
16256
|
-
import { Command as
|
|
16257
|
-
import { promises as
|
|
16258
|
-
var decryptCommand = new
|
|
16582
|
+
import { Command as Command78 } from "commander";
|
|
16583
|
+
import { promises as fs4 } from "fs";
|
|
16584
|
+
var decryptCommand = new Command78("decrypt").description("Decrypt a file using your wallet key").argument("<file>", "Path to the encrypted file").option("--output <path>", "Output path (default: strips .enc, otherwise appends .dec)").action(async (file, opts) => {
|
|
16259
16585
|
let ciphertext;
|
|
16260
16586
|
try {
|
|
16261
|
-
ciphertext = await
|
|
16587
|
+
ciphertext = await fs4.readFile(file);
|
|
16262
16588
|
} catch {
|
|
16263
16589
|
printError(`Cannot read file: ${file}`);
|
|
16264
16590
|
return;
|
|
@@ -16287,7 +16613,7 @@ var decryptCommand = new Command77("decrypt").description("Decrypt a file using
|
|
|
16287
16613
|
} else {
|
|
16288
16614
|
outputPath = `${file}.dec`;
|
|
16289
16615
|
}
|
|
16290
|
-
await
|
|
16616
|
+
await fs4.writeFile(outputPath, plaintext);
|
|
16291
16617
|
printResult({
|
|
16292
16618
|
output: outputPath,
|
|
16293
16619
|
bytes: plaintext.length
|
|
@@ -16295,10 +16621,10 @@ var decryptCommand = new Command77("decrypt").description("Decrypt a file using
|
|
|
16295
16621
|
});
|
|
16296
16622
|
|
|
16297
16623
|
// src/commands/xmtp.ts
|
|
16298
|
-
import { Command as
|
|
16624
|
+
import { Command as Command79 } from "commander";
|
|
16299
16625
|
|
|
16300
16626
|
// src/lib/xmtp-client.ts
|
|
16301
|
-
import
|
|
16627
|
+
import fs7 from "fs";
|
|
16302
16628
|
import path4 from "path";
|
|
16303
16629
|
import { randomUUID as randomUUID3, hkdfSync as hkdfSync2 } from "crypto";
|
|
16304
16630
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
@@ -16411,7 +16737,7 @@ function cachedInboxLookup(lookup, options = {}) {
|
|
|
16411
16737
|
}
|
|
16412
16738
|
|
|
16413
16739
|
// src/lib/xmtp-cursor.ts
|
|
16414
|
-
import
|
|
16740
|
+
import fs5 from "fs";
|
|
16415
16741
|
import path2 from "path";
|
|
16416
16742
|
var MAX_RECENT_IDS_PER_CONVERSATION = 5e3;
|
|
16417
16743
|
var MAX_CURSOR_RECENT_IDS = 2e4;
|
|
@@ -16425,7 +16751,7 @@ function readCursorFile(filePath) {
|
|
|
16425
16751
|
const conversations = /* @__PURE__ */ new Map();
|
|
16426
16752
|
let prunedBeforeNs = 0n;
|
|
16427
16753
|
try {
|
|
16428
|
-
const parsed = JSON.parse(
|
|
16754
|
+
const parsed = JSON.parse(fs5.readFileSync(filePath, "utf8"));
|
|
16429
16755
|
if (parsed?.version === 2 && parsed.conversations && typeof parsed.conversations === "object") {
|
|
16430
16756
|
if (typeof parsed.prunedBeforeNs === "string" && /^\d+$/.test(parsed.prunedBeforeNs)) {
|
|
16431
16757
|
prunedBeforeNs = BigInt(parsed.prunedBeforeNs);
|
|
@@ -16503,10 +16829,10 @@ function writeCursorFile(filePath, state) {
|
|
|
16503
16829
|
target.recentIds.push(id);
|
|
16504
16830
|
target.recentAtNs?.push(at.toString());
|
|
16505
16831
|
}
|
|
16506
|
-
|
|
16832
|
+
fs5.mkdirSync(path2.dirname(filePath), { recursive: true });
|
|
16507
16833
|
const tmpPath = `${filePath}.${process.pid}.tmp`;
|
|
16508
|
-
|
|
16509
|
-
|
|
16834
|
+
fs5.writeFileSync(tmpPath, JSON.stringify(value), { mode: 384 });
|
|
16835
|
+
fs5.renameSync(tmpPath, filePath);
|
|
16510
16836
|
}
|
|
16511
16837
|
function loadXmtpCursor(filePath, options = {}) {
|
|
16512
16838
|
const state = readCursorFile(filePath);
|
|
@@ -16576,7 +16902,7 @@ function loadXmtpCursor(filePath, options = {}) {
|
|
|
16576
16902
|
}
|
|
16577
16903
|
|
|
16578
16904
|
// src/lib/xmtp-sent-requests.ts
|
|
16579
|
-
import
|
|
16905
|
+
import fs6 from "fs";
|
|
16580
16906
|
import path3 from "path";
|
|
16581
16907
|
var SENT_REQUEST_TTL_MS = 24 * 60 * 6e4;
|
|
16582
16908
|
var MAX_SENT_REQUESTS = 1e3;
|
|
@@ -16587,7 +16913,7 @@ function sentRequestsPath(dbPath) {
|
|
|
16587
16913
|
}
|
|
16588
16914
|
function readRows(filePath, now) {
|
|
16589
16915
|
try {
|
|
16590
|
-
const parsed = JSON.parse(
|
|
16916
|
+
const parsed = JSON.parse(fs6.readFileSync(filePath, "utf8"));
|
|
16591
16917
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
16592
16918
|
return {};
|
|
16593
16919
|
}
|
|
@@ -16612,10 +16938,10 @@ function createSentRequestStore(filePath, options = {}) {
|
|
|
16612
16938
|
const rows = readRows(filePath, now());
|
|
16613
16939
|
rows[requestId] = { peerInboxId, expiresAt: now() + ttlMs };
|
|
16614
16940
|
const kept = Object.entries(rows).sort(([, a], [, b]) => a.expiresAt - b.expiresAt).slice(-MAX_SENT_REQUESTS);
|
|
16615
|
-
|
|
16941
|
+
fs6.mkdirSync(path3.dirname(filePath), { recursive: true });
|
|
16616
16942
|
const tmpPath = `${filePath}.${process.pid}.tmp`;
|
|
16617
|
-
|
|
16618
|
-
|
|
16943
|
+
fs6.writeFileSync(tmpPath, JSON.stringify(Object.fromEntries(kept)), { mode: 384 });
|
|
16944
|
+
fs6.renameSync(tmpPath, filePath);
|
|
16619
16945
|
} catch (error) {
|
|
16620
16946
|
process.stderr.write(
|
|
16621
16947
|
`xmtp: could not record sent request ${requestId}; a reply may be held by your peer policy: ${error instanceof Error ? error.message : String(error)}
|
|
@@ -16726,20 +17052,20 @@ function devConversationId(a, b) {
|
|
|
16726
17052
|
return `dev-dm-${[a, b].sort().join("-")}`;
|
|
16727
17053
|
}
|
|
16728
17054
|
function createFileBus(dir) {
|
|
16729
|
-
|
|
17055
|
+
fs7.mkdirSync(dir, { recursive: true });
|
|
16730
17056
|
const logPath = (inboxId) => path4.join(dir, `inbox-${inboxId}.jsonl`);
|
|
16731
17057
|
const addressPath = (address3) => path4.join(dir, `address-${address3.toLowerCase()}`);
|
|
16732
17058
|
return {
|
|
16733
|
-
register: (address3, inboxId) =>
|
|
17059
|
+
register: (address3, inboxId) => fs7.writeFileSync(addressPath(address3), inboxId),
|
|
16734
17060
|
lookup: (address3) => {
|
|
16735
17061
|
try {
|
|
16736
|
-
return
|
|
17062
|
+
return fs7.readFileSync(addressPath(address3), "utf8").trim() || null;
|
|
16737
17063
|
} catch {
|
|
16738
17064
|
return null;
|
|
16739
17065
|
}
|
|
16740
17066
|
},
|
|
16741
17067
|
append: (toInboxId, message) => {
|
|
16742
|
-
|
|
17068
|
+
fs7.appendFileSync(
|
|
16743
17069
|
logPath(toInboxId),
|
|
16744
17070
|
`${JSON.stringify({ ...message, sentAtNs: message.sentAtNs.toString() })}
|
|
16745
17071
|
`
|
|
@@ -16748,7 +17074,7 @@ function createFileBus(dir) {
|
|
|
16748
17074
|
readFrom: (inboxId, offset) => {
|
|
16749
17075
|
let text;
|
|
16750
17076
|
try {
|
|
16751
|
-
text =
|
|
17077
|
+
text = fs7.readFileSync(logPath(inboxId), "utf8");
|
|
16752
17078
|
} catch {
|
|
16753
17079
|
return { messages: [], offset };
|
|
16754
17080
|
}
|
|
@@ -17281,7 +17607,7 @@ async function createProductionClient(input, env) {
|
|
|
17281
17607
|
);
|
|
17282
17608
|
}
|
|
17283
17609
|
const dbPath = input.existingDbPath ?? defaultDbPath(input.walletAddress);
|
|
17284
|
-
|
|
17610
|
+
fs7.mkdirSync(path4.dirname(dbPath), { recursive: true, mode: 448 });
|
|
17285
17611
|
const client = await createSdkClient(clientFactory, signer, {
|
|
17286
17612
|
env,
|
|
17287
17613
|
dbPath,
|
|
@@ -17881,7 +18207,7 @@ async function proveInstallation(keystore, client) {
|
|
|
17881
18207
|
signature: client.signWithInstallationKey(issued.challenge)
|
|
17882
18208
|
};
|
|
17883
18209
|
}
|
|
17884
|
-
var xmtpCommand = new
|
|
18210
|
+
var xmtpCommand = new Command79("xmtp").description("Manage XMTP messaging for this agent");
|
|
17885
18211
|
xmtpCommand.hook("preAction", () => {
|
|
17886
18212
|
if (resolveXmtpEnv() !== "memory") assertXmtpSupported();
|
|
17887
18213
|
});
|
|
@@ -18148,7 +18474,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
18148
18474
|
});
|
|
18149
18475
|
|
|
18150
18476
|
// src/commands/daemon.ts
|
|
18151
|
-
import { Command as
|
|
18477
|
+
import { Command as Command81 } from "commander";
|
|
18152
18478
|
|
|
18153
18479
|
// src/lib/market-event-settings-auth.ts
|
|
18154
18480
|
function signMarketEventSettingsWrite(change) {
|
|
@@ -18156,10 +18482,10 @@ function signMarketEventSettingsWrite(change) {
|
|
|
18156
18482
|
}
|
|
18157
18483
|
|
|
18158
18484
|
// src/commands/events.ts
|
|
18159
|
-
import { Command as
|
|
18485
|
+
import { Command as Command80 } from "commander";
|
|
18160
18486
|
|
|
18161
18487
|
// src/lib/market-event-cursor.ts
|
|
18162
|
-
import { promises as
|
|
18488
|
+
import { promises as fs8 } from "fs";
|
|
18163
18489
|
import path5 from "path";
|
|
18164
18490
|
var EVENT_ID = /^\d{1,19}$/;
|
|
18165
18491
|
function marketEventCursorPath(walletAddress, network) {
|
|
@@ -18171,7 +18497,7 @@ function marketEventCursorPath(walletAddress, network) {
|
|
|
18171
18497
|
}
|
|
18172
18498
|
async function loadMarketEventCursor(walletAddress, network) {
|
|
18173
18499
|
try {
|
|
18174
|
-
const raw = await
|
|
18500
|
+
const raw = await fs8.readFile(marketEventCursorPath(walletAddress, network), "utf-8");
|
|
18175
18501
|
const record = JSON.parse(raw);
|
|
18176
18502
|
return typeof record.cursor === "string" && EVENT_ID.test(record.cursor) ? record.cursor : void 0;
|
|
18177
18503
|
} catch {
|
|
@@ -18180,11 +18506,11 @@ async function loadMarketEventCursor(walletAddress, network) {
|
|
|
18180
18506
|
}
|
|
18181
18507
|
async function saveMarketEventCursor(walletAddress, network, cursor) {
|
|
18182
18508
|
const file = marketEventCursorPath(walletAddress, network);
|
|
18183
|
-
await
|
|
18509
|
+
await fs8.mkdir(path5.dirname(file), { recursive: true });
|
|
18184
18510
|
const record = { cursor, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
18185
18511
|
const temp = `${file}.${process.pid}.tmp`;
|
|
18186
|
-
await
|
|
18187
|
-
await
|
|
18512
|
+
await fs8.writeFile(temp, JSON.stringify(record, null, 2), { mode: 384 });
|
|
18513
|
+
await fs8.rename(temp, file);
|
|
18188
18514
|
}
|
|
18189
18515
|
|
|
18190
18516
|
// src/commands/events.ts
|
|
@@ -18552,14 +18878,14 @@ async function readOrMarkSeen(options) {
|
|
|
18552
18878
|
printResult(data, { idempotencyKey });
|
|
18553
18879
|
}
|
|
18554
18880
|
function createSeenCommand() {
|
|
18555
|
-
return new
|
|
18881
|
+
return new Command80("seen").description(
|
|
18556
18882
|
"Show the newest event you have seen and how many are unread (the web Inbox's Activity count); --mark moves it forward"
|
|
18557
18883
|
).option("--mark <id>", "Mark events up to this event id as seen, or `latest` for all of them").action(async (options) => {
|
|
18558
18884
|
await readOrMarkSeen(options);
|
|
18559
18885
|
});
|
|
18560
18886
|
}
|
|
18561
18887
|
function createEventsCommand() {
|
|
18562
|
-
return new
|
|
18888
|
+
return new Command80("events").description(
|
|
18563
18889
|
"Read your market events, oldest first (or newest first with --newest), or one task's timeline; --follow waits for new ones and resumes after a restart"
|
|
18564
18890
|
).option("--since <id>", "Only events after this event id (overrides the stored cursor)").option("--limit <n>", `Events per read, 1 to ${MARKET_EVENT_PAGE_MAX}`).option(
|
|
18565
18891
|
"--task <taskId>",
|
|
@@ -18588,7 +18914,7 @@ function createEventsCommand() {
|
|
|
18588
18914
|
var eventsCommand2 = createEventsCommand();
|
|
18589
18915
|
|
|
18590
18916
|
// src/lib/email-follow.ts
|
|
18591
|
-
import { promises as
|
|
18917
|
+
import { promises as fs9 } from "fs";
|
|
18592
18918
|
import path6 from "path";
|
|
18593
18919
|
function emailReceivedLine(email) {
|
|
18594
18920
|
const senderVerification = email.senderVerification ?? "unverified";
|
|
@@ -18615,7 +18941,7 @@ function emailCursorPath(walletAddress, network) {
|
|
|
18615
18941
|
}
|
|
18616
18942
|
async function loadEmailCursor(walletAddress, network) {
|
|
18617
18943
|
try {
|
|
18618
|
-
const raw = await
|
|
18944
|
+
const raw = await fs9.readFile(emailCursorPath(walletAddress, network), "utf-8");
|
|
18619
18945
|
const record = JSON.parse(raw);
|
|
18620
18946
|
const receivedAt = record.receivedAt === null ? null : typeof record.receivedAt === "string" && !Number.isNaN(Date.parse(record.receivedAt)) ? record.receivedAt : void 0;
|
|
18621
18947
|
if (receivedAt === void 0 || !Array.isArray(record.ids)) return void 0;
|
|
@@ -18626,11 +18952,11 @@ async function loadEmailCursor(walletAddress, network) {
|
|
|
18626
18952
|
}
|
|
18627
18953
|
async function saveEmailCursor(walletAddress, network, cursor) {
|
|
18628
18954
|
const file = emailCursorPath(walletAddress, network);
|
|
18629
|
-
await
|
|
18955
|
+
await fs9.mkdir(path6.dirname(file), { recursive: true });
|
|
18630
18956
|
const record = { ...cursor, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
18631
18957
|
const temp = `${file}.${process.pid}.tmp`;
|
|
18632
|
-
await
|
|
18633
|
-
await
|
|
18958
|
+
await fs9.writeFile(temp, JSON.stringify(record, null, 2), { mode: 384 });
|
|
18959
|
+
await fs9.rename(temp, file);
|
|
18634
18960
|
}
|
|
18635
18961
|
function isAfter(email, cursor) {
|
|
18636
18962
|
if (cursor.receivedAt === null) return true;
|
|
@@ -18756,7 +19082,7 @@ async function agentEmailAddress(walletAddress, signal) {
|
|
|
18756
19082
|
}
|
|
18757
19083
|
|
|
18758
19084
|
// src/lib/bug-follow.ts
|
|
18759
|
-
import { promises as
|
|
19085
|
+
import { promises as fs10 } from "fs";
|
|
18760
19086
|
import path7 from "path";
|
|
18761
19087
|
function bugCursorPath(walletAddress, network) {
|
|
18762
19088
|
return path7.join(
|
|
@@ -18767,17 +19093,17 @@ function bugCursorPath(walletAddress, network) {
|
|
|
18767
19093
|
}
|
|
18768
19094
|
async function loadBugCursor(file) {
|
|
18769
19095
|
try {
|
|
18770
|
-
const record = JSON.parse(await
|
|
19096
|
+
const record = JSON.parse(await fs10.readFile(file, "utf-8"));
|
|
18771
19097
|
return record.reports && typeof record.reports === "object" ? record.reports : void 0;
|
|
18772
19098
|
} catch {
|
|
18773
19099
|
return void 0;
|
|
18774
19100
|
}
|
|
18775
19101
|
}
|
|
18776
19102
|
async function saveBugCursor(file, reports) {
|
|
18777
|
-
await
|
|
19103
|
+
await fs10.mkdir(path7.dirname(file), { recursive: true });
|
|
18778
19104
|
const temp = `${file}.${process.pid}.tmp`;
|
|
18779
|
-
await
|
|
18780
|
-
await
|
|
19105
|
+
await fs10.writeFile(temp, JSON.stringify({ reports }, null, 2), { mode: 384 });
|
|
19106
|
+
await fs10.rename(temp, file);
|
|
18781
19107
|
}
|
|
18782
19108
|
function bugLine(report) {
|
|
18783
19109
|
return {
|
|
@@ -18938,7 +19264,7 @@ function sleepOrAbort(ms2, signal) {
|
|
|
18938
19264
|
});
|
|
18939
19265
|
}
|
|
18940
19266
|
function createDaemonCommand(seams = {}) {
|
|
18941
|
-
return new
|
|
19267
|
+
return new Command81("daemon").description(
|
|
18942
19268
|
"The one long-running process for everything that reaches your agent: your market events from a stored cursor, your inbound XMTP messages and the mail to your agent email, one JSON line each, marked with its source"
|
|
18943
19269
|
).option("--heartbeat-interval <ms>", "Heartbeat interval in milliseconds", "1800000").option(
|
|
18944
19270
|
"--task-filters <json>",
|
|
@@ -19117,10 +19443,10 @@ function createDaemonCommand(seams = {}) {
|
|
|
19117
19443
|
var daemonCommand = createDaemonCommand();
|
|
19118
19444
|
|
|
19119
19445
|
// src/commands/events-filter.ts
|
|
19120
|
-
import { Command as
|
|
19446
|
+
import { Command as Command83 } from "commander";
|
|
19121
19447
|
|
|
19122
19448
|
// src/commands/events-settings.ts
|
|
19123
|
-
import { Command as
|
|
19449
|
+
import { Command as Command82 } from "commander";
|
|
19124
19450
|
var PREFERENCES_PATH = "/api/market-events/preferences";
|
|
19125
19451
|
var CHANNEL_OPTION = [
|
|
19126
19452
|
"--channel <channel>",
|
|
@@ -19138,7 +19464,7 @@ async function walletHeaders() {
|
|
|
19138
19464
|
function parseChannel(channel) {
|
|
19139
19465
|
return parseInput(MarketEventWalletChannelSchema, channel ?? "email");
|
|
19140
19466
|
}
|
|
19141
|
-
var listCommand = new
|
|
19467
|
+
var listCommand = new Command82("list").description(
|
|
19142
19468
|
"Show which event types reach this wallet on one channel (email by default); locked types cannot be turned off"
|
|
19143
19469
|
).option(...CHANNEL_OPTION).action(async (options) => {
|
|
19144
19470
|
try {
|
|
@@ -19152,7 +19478,7 @@ var listCommand = new Command81("list").description(
|
|
|
19152
19478
|
}
|
|
19153
19479
|
});
|
|
19154
19480
|
function setCommand(name, enabled, description) {
|
|
19155
|
-
return new
|
|
19481
|
+
return new Command82(name).description(description).argument("<type>", "Event type, e.g. task.invited (see `taskmarket events settings list`)").option(...CHANNEL_OPTION).action(async (type, options) => {
|
|
19156
19482
|
try {
|
|
19157
19483
|
const channel = parseChannel(options.channel);
|
|
19158
19484
|
const body = parseInput(SetMarketEventPreferenceInputSchema, { type, enabled });
|
|
@@ -19172,7 +19498,7 @@ function setCommand(name, enabled, description) {
|
|
|
19172
19498
|
}
|
|
19173
19499
|
});
|
|
19174
19500
|
}
|
|
19175
|
-
var eventsSettingsCommand = new
|
|
19501
|
+
var eventsSettingsCommand = new Command82("settings").description(
|
|
19176
19502
|
"Choose which market events reach this wallet by email or as in-app notices in the web app"
|
|
19177
19503
|
).addCommand(listCommand).addCommand(setCommand("on", true, "Turn an event type on for this wallet on one channel")).addCommand(
|
|
19178
19504
|
setCommand(
|
|
@@ -19226,7 +19552,7 @@ function mergeFilter(current, options) {
|
|
|
19226
19552
|
}
|
|
19227
19553
|
return { filter: parsed.data };
|
|
19228
19554
|
}
|
|
19229
|
-
var eventsFilterCommand = new
|
|
19555
|
+
var eventsFilterCommand = new Command83("filter").description(
|
|
19230
19556
|
"Read or set this wallet's discovery filter: which newly listed tasks are announced to it as task.listed events"
|
|
19231
19557
|
).option("--enable", "Turn discovery on").option("--disable", "Turn discovery off: no task.listed events at all").option(
|
|
19232
19558
|
"--modes <list>",
|
|
@@ -19288,11 +19614,11 @@ function attachEventsFilter(program2) {
|
|
|
19288
19614
|
}
|
|
19289
19615
|
|
|
19290
19616
|
// src/commands/email/index.ts
|
|
19291
|
-
import { Command as
|
|
19617
|
+
import { Command as Command92 } from "commander";
|
|
19292
19618
|
|
|
19293
19619
|
// src/commands/email/register.ts
|
|
19294
|
-
import { Command as
|
|
19295
|
-
var registerCommand = new
|
|
19620
|
+
import { Command as Command84 } from "commander";
|
|
19621
|
+
var registerCommand = new Command84("register").description(
|
|
19296
19622
|
"Register this agent email address, agent-<id>@taskmarket.dev (the backend assigns the id)"
|
|
19297
19623
|
).action(async () => {
|
|
19298
19624
|
const keystore = await loadKeystore();
|
|
@@ -19307,8 +19633,8 @@ var registerCommand = new Command83("register").description(
|
|
|
19307
19633
|
});
|
|
19308
19634
|
|
|
19309
19635
|
// src/commands/email/inbox.ts
|
|
19310
|
-
import { Command as
|
|
19311
|
-
var inboxCommand2 = new
|
|
19636
|
+
import { Command as Command85 } from "commander";
|
|
19637
|
+
var inboxCommand2 = new Command85("inbox").description("List emails in your inbox, each with a bodyPreview (use read for the full body)").option("--limit <n>", "Number of emails to return", "20").option("--offset <n>", "Skip this many emails, to page past --limit", "0").option("--unread", "Show only unread emails").action(async (opts) => {
|
|
19312
19638
|
const offset = Number(opts.offset);
|
|
19313
19639
|
if (!Number.isInteger(offset) || offset < 0) {
|
|
19314
19640
|
printError("--offset must be a whole number");
|
|
@@ -19330,7 +19656,7 @@ var inboxCommand2 = new Command84("inbox").description("List emails in your inbo
|
|
|
19330
19656
|
});
|
|
19331
19657
|
|
|
19332
19658
|
// src/commands/email/read.ts
|
|
19333
|
-
import { Command as
|
|
19659
|
+
import { Command as Command86 } from "commander";
|
|
19334
19660
|
var EMAIL_READ_BODY_MAX_CHARS = 32768;
|
|
19335
19661
|
function capEmailBodies(email, max) {
|
|
19336
19662
|
let truncated = false;
|
|
@@ -19347,7 +19673,7 @@ function capEmailBodies(email, max) {
|
|
|
19347
19673
|
}
|
|
19348
19674
|
return { ...email, ...capped, truncated };
|
|
19349
19675
|
}
|
|
19350
|
-
var readCommand = new
|
|
19676
|
+
var readCommand = new Command86("read").description(
|
|
19351
19677
|
`Read an email by ID (marks it as read). Each body is cut at ${EMAIL_READ_BODY_MAX_CHARS} characters unless --full`
|
|
19352
19678
|
).argument("<id>", "Email ID").option("--full", "Return the whole stored body instead of the first 32768 characters").action(async (id, opts) => {
|
|
19353
19679
|
const keystore = await loadKeystore();
|
|
@@ -19364,8 +19690,8 @@ var readCommand = new Command85("read").description(
|
|
|
19364
19690
|
});
|
|
19365
19691
|
|
|
19366
19692
|
// src/commands/email/send.ts
|
|
19367
|
-
import { Command as
|
|
19368
|
-
var sendCommand = new
|
|
19693
|
+
import { Command as Command87 } from "commander";
|
|
19694
|
+
var sendCommand = new Command87("send").description("Send an email").requiredOption("--to <address>", "Recipient email address").requiredOption("--subject <subject>", "Email subject").requiredOption("--body <text>", "Email body text").action(async (opts) => {
|
|
19369
19695
|
const keystore = await loadKeystore();
|
|
19370
19696
|
const { data: result, idempotencyKey } = await x402Post(
|
|
19371
19697
|
"/api/emails/send",
|
|
@@ -19384,7 +19710,7 @@ var sendCommand = new Command86("send").description("Send an email").requiredOpt
|
|
|
19384
19710
|
});
|
|
19385
19711
|
|
|
19386
19712
|
// src/commands/email/reply.ts
|
|
19387
|
-
import { Command as
|
|
19713
|
+
import { Command as Command88 } from "commander";
|
|
19388
19714
|
var VERIFIED_SENDER_VALUES = ["pass", "platform"];
|
|
19389
19715
|
function isVerifiedSender(senderVerification) {
|
|
19390
19716
|
return senderVerification != null && VERIFIED_SENDER_VALUES.includes(senderVerification);
|
|
@@ -19397,7 +19723,7 @@ function replyNeedsVerifiedSender(original) {
|
|
|
19397
19723
|
const platformDomain = original.toAddress ? domainOf(original.toAddress) : "";
|
|
19398
19724
|
return platformDomain === "" || domainOf(original.fromAddress) !== platformDomain;
|
|
19399
19725
|
}
|
|
19400
|
-
var replyCommand = new
|
|
19726
|
+
var replyCommand = new Command88("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").option(
|
|
19401
19727
|
"--allow-unverified-sender",
|
|
19402
19728
|
"Reply even though the sender's address is not verified (it may be forged)"
|
|
19403
19729
|
).action(async (id, opts) => {
|
|
@@ -19440,8 +19766,8 @@ var replyCommand = new Command87("reply").description("Reply to an email").argum
|
|
|
19440
19766
|
});
|
|
19441
19767
|
|
|
19442
19768
|
// src/commands/email/delete.ts
|
|
19443
|
-
import { Command as
|
|
19444
|
-
var deleteCommand = new
|
|
19769
|
+
import { Command as Command89 } from "commander";
|
|
19770
|
+
var deleteCommand = new Command89("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
19445
19771
|
const keystore = await loadKeystore();
|
|
19446
19772
|
const { data: result, idempotencyKey } = await apiPost(
|
|
19447
19773
|
"/api/emails/delete",
|
|
@@ -19455,15 +19781,15 @@ var deleteCommand = new Command88("delete").description("Delete an email by ID")
|
|
|
19455
19781
|
});
|
|
19456
19782
|
|
|
19457
19783
|
// src/commands/email/address.ts
|
|
19458
|
-
import { Command as
|
|
19459
|
-
var addressCommand3 = new
|
|
19784
|
+
import { Command as Command90 } from "commander";
|
|
19785
|
+
var addressCommand3 = new Command90("address").description("Show your registered email address").action(async () => {
|
|
19460
19786
|
const keystore = await loadKeystore();
|
|
19461
19787
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
19462
19788
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
19463
19789
|
});
|
|
19464
19790
|
|
|
19465
19791
|
// src/commands/email/mark-read.ts
|
|
19466
|
-
import { Command as
|
|
19792
|
+
import { Command as Command91 } from "commander";
|
|
19467
19793
|
async function setReadStatus(id, read4) {
|
|
19468
19794
|
const keystore = await loadKeystore();
|
|
19469
19795
|
const { data: result, idempotencyKey } = await apiPost(
|
|
@@ -19477,12 +19803,12 @@ async function setReadStatus(id, read4) {
|
|
|
19477
19803
|
);
|
|
19478
19804
|
printResult({ id: result.id, isRead: result.isRead }, { idempotencyKey });
|
|
19479
19805
|
}
|
|
19480
|
-
var markReadCommand = new
|
|
19806
|
+
var markReadCommand = new Command91("mark-read").description("Mark an email as read or unread").argument("<id>", "Email ID").option("--unread", "Mark as unread instead of read").action(async (id, opts) => {
|
|
19481
19807
|
await setReadStatus(id, !opts.unread);
|
|
19482
19808
|
});
|
|
19483
19809
|
|
|
19484
19810
|
// src/commands/email/index.ts
|
|
19485
|
-
var emailCommand = new
|
|
19811
|
+
var emailCommand = new Command92("email").description("Email management commands");
|
|
19486
19812
|
emailCommand.addCommand(registerCommand);
|
|
19487
19813
|
emailCommand.addCommand(inboxCommand2);
|
|
19488
19814
|
emailCommand.addCommand(readCommand);
|
|
@@ -19493,10 +19819,10 @@ emailCommand.addCommand(addressCommand3);
|
|
|
19493
19819
|
emailCommand.addCommand(markReadCommand);
|
|
19494
19820
|
|
|
19495
19821
|
// src/commands/bug/index.ts
|
|
19496
|
-
import { Command as
|
|
19822
|
+
import { Command as Command101 } from "commander";
|
|
19497
19823
|
|
|
19498
19824
|
// src/commands/bug/browse.ts
|
|
19499
|
-
import { Command as
|
|
19825
|
+
import { Command as Command93 } from "commander";
|
|
19500
19826
|
|
|
19501
19827
|
// src/commands/bug/known-problem.ts
|
|
19502
19828
|
async function fetchKnownProblem() {
|
|
@@ -19509,7 +19835,7 @@ async function fetchKnownProblem() {
|
|
|
19509
19835
|
}
|
|
19510
19836
|
|
|
19511
19837
|
// src/commands/bug/browse.ts
|
|
19512
|
-
var browseCommand = new
|
|
19838
|
+
var browseCommand = new Command93("browse").description(
|
|
19513
19839
|
"Browse public bug reports, to check whether a bug is already known; no wallet needed"
|
|
19514
19840
|
).option("--query <text>", "Only reports whose title or description contains this text").option("--status <status>", `Only reports with this status: ${BUG_REPORT_STATUSES.join(", ")}`).option("--sort <order>", `Order: ${PUBLIC_BUG_REPORT_SORTS.join(", ")}`, "newest").option("--limit <n>", "Maximum reports to return (1-100)", "50").option("--offset <n>", "Skip this many reports, for paging", "0").action(
|
|
19515
19841
|
async (opts) => {
|
|
@@ -19556,7 +19882,7 @@ var browseCommand = new Command92("browse").description(
|
|
|
19556
19882
|
);
|
|
19557
19883
|
|
|
19558
19884
|
// src/commands/bug/comment.ts
|
|
19559
|
-
import { Command as
|
|
19885
|
+
import { Command as Command94 } from "commander";
|
|
19560
19886
|
|
|
19561
19887
|
// src/lib/stdin.ts
|
|
19562
19888
|
var STDIN_FIRST_BYTE_MS = 5e3;
|
|
@@ -19610,7 +19936,7 @@ async function resolveBugReportId(ref) {
|
|
|
19610
19936
|
}
|
|
19611
19937
|
|
|
19612
19938
|
// src/commands/bug/comment.ts
|
|
19613
|
-
var commentCommand = new
|
|
19939
|
+
var commentCommand = new Command94("comment").description(
|
|
19614
19940
|
"Comment on a public bug report. Comments are public: never include keys, seed phrases or other private data"
|
|
19615
19941
|
).argument("<report>", BUG_REPORT_REF_HELP).argument("[message]", 'Your comment; read from stdin when omitted or "-"').option("--agent <id>", "Your agent id, shown with the comment").action(async (report, message, opts) => {
|
|
19616
19942
|
const ref = parseBugReportRef(report);
|
|
@@ -19656,8 +19982,8 @@ var commentCommand = new Command93("comment").description(
|
|
|
19656
19982
|
});
|
|
19657
19983
|
|
|
19658
19984
|
// src/commands/bug/list.ts
|
|
19659
|
-
import { Command as
|
|
19660
|
-
var listCommand2 = new
|
|
19985
|
+
import { Command as Command95 } from "commander";
|
|
19986
|
+
var listCommand2 = new Command95("list").description("List the bug reports you submitted and their status").option("--status <status>", `Only reports with this status: ${BUG_REPORT_STATUSES.join(", ")}`).option("--limit <n>", "Maximum reports to return (1-100)", "50").action(async (opts) => {
|
|
19661
19987
|
if (opts.status && !BUG_REPORT_STATUSES.includes(opts.status)) {
|
|
19662
19988
|
printError(`--status must be one of ${BUG_REPORT_STATUSES.join(", ")}`);
|
|
19663
19989
|
return;
|
|
@@ -19688,8 +20014,8 @@ var listCommand2 = new Command94("list").description("List the bug reports you s
|
|
|
19688
20014
|
});
|
|
19689
20015
|
|
|
19690
20016
|
// src/commands/bug/me-too.ts
|
|
19691
|
-
import { Command as
|
|
19692
|
-
var meTooCommand = new
|
|
20017
|
+
import { Command as Command96 } from "commander";
|
|
20018
|
+
var meTooCommand = new Command96("me-too").description("Say you hit a public bug report too; counted once per wallet").argument("<report>", BUG_REPORT_REF_HELP).action(async (report) => {
|
|
19693
20019
|
const ref = parseBugReportRef(report);
|
|
19694
20020
|
if (!ref) {
|
|
19695
20021
|
printError(BUG_REPORT_REF_ERROR);
|
|
@@ -19713,8 +20039,8 @@ var meTooCommand = new Command95("me-too").description("Say you hit a public bug
|
|
|
19713
20039
|
});
|
|
19714
20040
|
|
|
19715
20041
|
// src/commands/bug/reply.ts
|
|
19716
|
-
import { Command as
|
|
19717
|
-
var replyCommand2 = new
|
|
20042
|
+
import { Command as Command97 } from "commander";
|
|
20043
|
+
var replyCommand2 = new Command97("reply").description(
|
|
19718
20044
|
"Reply to Taskmarket staff on one of your bug reports; a reply does not change its status"
|
|
19719
20045
|
).argument("<id>", "Bug report id").argument("[message]", 'Your reply; read from stdin when omitted or "-"').action(async (id, message) => {
|
|
19720
20046
|
const body = await textOrStdin(message);
|
|
@@ -19748,8 +20074,8 @@ var replyCommand2 = new Command96("reply").description(
|
|
|
19748
20074
|
});
|
|
19749
20075
|
|
|
19750
20076
|
// src/commands/bug/show.ts
|
|
19751
|
-
import { Command as
|
|
19752
|
-
var showCommand = new
|
|
20077
|
+
import { Command as Command98 } from "commander";
|
|
20078
|
+
var showCommand = new Command98("show").description(
|
|
19753
20079
|
"Show a public bug report by its number (#N, no wallet needed), or one of your own by its id with messages from staff"
|
|
19754
20080
|
).argument("<report>", "Public number (#N) of any public report, or the id of one of yours").action(async (report) => {
|
|
19755
20081
|
const ref = parseBugReportRef(report);
|
|
@@ -19777,7 +20103,7 @@ var showCommand = new Command97("show").description(
|
|
|
19777
20103
|
});
|
|
19778
20104
|
|
|
19779
20105
|
// src/commands/bug/submit.ts
|
|
19780
|
-
import { Command as
|
|
20106
|
+
import { Command as Command99 } from "commander";
|
|
19781
20107
|
|
|
19782
20108
|
// src/commands/bug/context.ts
|
|
19783
20109
|
import os from "os";
|
|
@@ -19801,7 +20127,7 @@ function cliVersionOf(command) {
|
|
|
19801
20127
|
var LAST_COMMAND_MAX_CHARS = 2048;
|
|
19802
20128
|
var LAST_ERROR_MAX_CHARS = 16 * 1024;
|
|
19803
20129
|
var PUBLIC_NOTICE = "This report is public: anyone can read it, with your wallet and agent id. Never include keys, seed phrases or other private data. Make it private with `taskmarket bug visibility <id> private`.";
|
|
19804
|
-
var submitCommand = new
|
|
20130
|
+
var submitCommand = new Command99("submit").description(
|
|
19805
20131
|
"Report a Taskmarket bug; CLI version, OS, Node version and network are attached. Reports are public unless --private"
|
|
19806
20132
|
).requiredOption("--title <text>", "Short summary (at most 200 characters)").option(
|
|
19807
20133
|
"--description <text>",
|
|
@@ -19877,8 +20203,8 @@ var submitCommand = new Command98("submit").description(
|
|
|
19877
20203
|
});
|
|
19878
20204
|
|
|
19879
20205
|
// src/commands/bug/visibility.ts
|
|
19880
|
-
import { Command as
|
|
19881
|
-
var visibilityCommand = new
|
|
20206
|
+
import { Command as Command100 } from "commander";
|
|
20207
|
+
var visibilityCommand = new Command100("visibility").description(
|
|
19882
20208
|
"Make one of your bug reports public or private; a private report is seen only by you and staff"
|
|
19883
20209
|
).argument("<report>", `${BUG_REPORT_REF_HELP}; a private report only by its id`).argument("<visibility>", BUG_REPORT_VISIBILITIES.join(" or ")).action(async (report, visibility) => {
|
|
19884
20210
|
const ref = parseBugReportRef(report);
|
|
@@ -19913,7 +20239,7 @@ var visibilityCommand = new Command99("visibility").description(
|
|
|
19913
20239
|
});
|
|
19914
20240
|
|
|
19915
20241
|
// src/commands/bug/index.ts
|
|
19916
|
-
var bugCommand = new
|
|
20242
|
+
var bugCommand = new Command101("bug").description(
|
|
19917
20243
|
"Report Taskmarket bugs, browse public reports, follow their status and reply to staff"
|
|
19918
20244
|
);
|
|
19919
20245
|
bugCommand.addCommand(submitCommand);
|
|
@@ -19926,7 +20252,7 @@ bugCommand.addCommand(commentCommand);
|
|
|
19926
20252
|
bugCommand.addCommand(visibilityCommand);
|
|
19927
20253
|
|
|
19928
20254
|
// src/commands/bookmark/index.ts
|
|
19929
|
-
import { Command as
|
|
20255
|
+
import { Command as Command103 } from "commander";
|
|
19930
20256
|
|
|
19931
20257
|
// src/commands/bookmark/auth.ts
|
|
19932
20258
|
async function bookmarkAuth(action) {
|
|
@@ -19939,8 +20265,8 @@ async function bookmarkAuth(action) {
|
|
|
19939
20265
|
}
|
|
19940
20266
|
|
|
19941
20267
|
// src/commands/bookmark/collection.ts
|
|
19942
|
-
import { Command as
|
|
19943
|
-
var createCommand = new
|
|
20268
|
+
import { Command as Command102 } from "commander";
|
|
20269
|
+
var createCommand = new Command102("create").description("Create a private collection").argument("<name>", "Collection name, up to 120 characters").action(async (name) => {
|
|
19944
20270
|
const trimmed = name.trim();
|
|
19945
20271
|
if (trimmed.length === 0 || trimmed.length > 120) {
|
|
19946
20272
|
printError("Collection name must be 1 to 120 characters");
|
|
@@ -19959,7 +20285,7 @@ var createCommand = new Command101("create").description("Create a private colle
|
|
|
19959
20285
|
return renderFailure(error);
|
|
19960
20286
|
}
|
|
19961
20287
|
});
|
|
19962
|
-
var listCommand3 = new
|
|
20288
|
+
var listCommand3 = new Command102("list").description("List your collections; a published one carries its publishedSlug (/c/<slug>)").action(async () => {
|
|
19963
20289
|
const auth = await bookmarkAuth("Listing collections");
|
|
19964
20290
|
if (!auth) return;
|
|
19965
20291
|
try {
|
|
@@ -19969,7 +20295,7 @@ var listCommand3 = new Command101("list").description("List your collections; a
|
|
|
19969
20295
|
}
|
|
19970
20296
|
});
|
|
19971
20297
|
function publishToggle(name, description, action) {
|
|
19972
|
-
return new
|
|
20298
|
+
return new Command102(name).description(description).argument("<collection-id>", "Collection id (from `taskmarket bookmark collection list`)").action(async (collectionId) => {
|
|
19973
20299
|
const auth = await bookmarkAuth(action);
|
|
19974
20300
|
if (!auth) return;
|
|
19975
20301
|
try {
|
|
@@ -19985,7 +20311,7 @@ function publishToggle(name, description, action) {
|
|
|
19985
20311
|
}
|
|
19986
20312
|
});
|
|
19987
20313
|
}
|
|
19988
|
-
var collectionCommand = new
|
|
20314
|
+
var collectionCommand = new Command102("collection").description(
|
|
19989
20315
|
"Create, list, publish and unpublish bookmark collections"
|
|
19990
20316
|
);
|
|
19991
20317
|
collectionCommand.addCommand(createCommand);
|
|
@@ -20016,7 +20342,7 @@ function parseEntityType(value, flag) {
|
|
|
20016
20342
|
function chainFor(entityType) {
|
|
20017
20343
|
return entityType === "agent" ? { chainId: selectedNetwork().chainId } : {};
|
|
20018
20344
|
}
|
|
20019
|
-
var addCommand = new
|
|
20345
|
+
var addCommand = new Command103("add").description(
|
|
20020
20346
|
"Bookmark a task, submission or agent; an agent is saved on the selected network (--network)"
|
|
20021
20347
|
).argument("<type>", `What to bookmark: ${ENTITY_TYPES.join(", ")}`).argument("<id>", "Task id, submission id or agent id").option("--collection <id>", "Save it to one of your collections (moves an existing bookmark)").option("--note <text>", "A private note, up to 500 characters").action(async (type, id, opts) => {
|
|
20022
20348
|
const entityType = parseEntityType(type, "<type>");
|
|
@@ -20044,7 +20370,7 @@ var addCommand = new Command102("add").description(
|
|
|
20044
20370
|
return renderFailure(error);
|
|
20045
20371
|
}
|
|
20046
20372
|
});
|
|
20047
|
-
var removeCommand = new
|
|
20373
|
+
var removeCommand = new Command103("remove").description("Remove a bookmark; an agent bookmark is matched on the selected network").argument("<type>", `What was bookmarked: ${ENTITY_TYPES.join(", ")}`).argument("<id>", "Task id, submission id or agent id").action(async (type, id) => {
|
|
20048
20374
|
const entityType = parseEntityType(type, "<type>");
|
|
20049
20375
|
if (!entityType) return;
|
|
20050
20376
|
const auth = await bookmarkAuth("Removing a bookmark");
|
|
@@ -20060,7 +20386,7 @@ var removeCommand = new Command102("remove").description("Remove a bookmark; an
|
|
|
20060
20386
|
return renderFailure(error);
|
|
20061
20387
|
}
|
|
20062
20388
|
});
|
|
20063
|
-
var listCommand4 = new
|
|
20389
|
+
var listCommand4 = new Command103("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(
|
|
20064
20390
|
async (opts) => {
|
|
20065
20391
|
const entityType = opts.type === void 0 ? void 0 : parseEntityType(opts.type, "--type");
|
|
20066
20392
|
if (entityType === null) return;
|
|
@@ -20084,7 +20410,7 @@ var listCommand4 = new Command102("list").description("List your bookmarks, newe
|
|
|
20084
20410
|
}
|
|
20085
20411
|
);
|
|
20086
20412
|
function pinToggle(name, description, action) {
|
|
20087
|
-
return new
|
|
20413
|
+
return new Command103(name).description(description).argument("<id>", "Bookmark id (from `taskmarket bookmark list`)").action(async (id) => {
|
|
20088
20414
|
const auth = await bookmarkAuth(action);
|
|
20089
20415
|
if (!auth) return;
|
|
20090
20416
|
try {
|
|
@@ -20099,7 +20425,7 @@ function pinToggle(name, description, action) {
|
|
|
20099
20425
|
}
|
|
20100
20426
|
});
|
|
20101
20427
|
}
|
|
20102
|
-
var countCommand = new
|
|
20428
|
+
var countCommand = new Command103("count").description("Count your saved bookmarks").option("--pinned", "Count only pinned bookmarks").action(async (opts) => {
|
|
20103
20429
|
const auth = await bookmarkAuth("Counting bookmarks");
|
|
20104
20430
|
if (!auth) return;
|
|
20105
20431
|
const params = new URLSearchParams();
|
|
@@ -20113,7 +20439,7 @@ var countCommand = new Command102("count").description("Count your saved bookmar
|
|
|
20113
20439
|
return renderFailure(error);
|
|
20114
20440
|
}
|
|
20115
20441
|
});
|
|
20116
|
-
var bookmarkCommand = new
|
|
20442
|
+
var bookmarkCommand = new Command103("bookmark").description(
|
|
20117
20443
|
"Save tasks, submissions and agents to your private list, and share collections of them"
|
|
20118
20444
|
);
|
|
20119
20445
|
bookmarkCommand.addCommand(addCommand);
|
|
@@ -20130,7 +20456,7 @@ bookmarkCommand.addCommand(collectionCommand);
|
|
|
20130
20456
|
|
|
20131
20457
|
// src/commands/skills/index.ts
|
|
20132
20458
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
20133
|
-
import { Command as
|
|
20459
|
+
import { Command as Command104 } from "commander";
|
|
20134
20460
|
|
|
20135
20461
|
// src/lib/skill-directory.ts
|
|
20136
20462
|
import { lstat, readdir, readFile as readFile3 } from "fs/promises";
|
|
@@ -20270,7 +20596,7 @@ var bundleOptions = (command) => command.requiredOption("--agent <agentId>", "Th
|
|
|
20270
20596
|
).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice");
|
|
20271
20597
|
var SIZE_NOTE = "The whole request, files included (binary assets as base64), must fit in 1 MiB; a larger one is refused before signing";
|
|
20272
20598
|
var createCommand2 = bundleOptions(
|
|
20273
|
-
new
|
|
20599
|
+
new Command104("create").description(
|
|
20274
20600
|
`Create a skill in your owner's library from a skill directory (SKILL.md, references, sandbox-only scripts and assets), as its first version. ${SIZE_NOTE}`
|
|
20275
20601
|
).argument("<dir>", "The skill directory, with SKILL.md at its root").option("--skill-id <uuid>", "The new skill ID (default: a new random ID)")
|
|
20276
20602
|
).action(async (dir, opts) => {
|
|
@@ -20288,7 +20614,7 @@ var createCommand2 = bundleOptions(
|
|
|
20288
20614
|
}
|
|
20289
20615
|
});
|
|
20290
20616
|
var versionCommand = bundleOptions(
|
|
20291
|
-
new
|
|
20617
|
+
new Command104("version").description(`Save a new version of a skill you authored from a skill directory. ${SIZE_NOTE}`).argument("<skillId>", "The skill ID").argument("<dir>", "The skill directory, with SKILL.md at its root")
|
|
20292
20618
|
).action(async (skillId, dir, opts) => {
|
|
20293
20619
|
try {
|
|
20294
20620
|
const { body, excluded } = await bundleWrite("version", dir, skillId, opts);
|
|
@@ -20305,7 +20631,7 @@ var versionCommand = bundleOptions(
|
|
|
20305
20631
|
return fail(error);
|
|
20306
20632
|
}
|
|
20307
20633
|
});
|
|
20308
|
-
var archiveCommand = new
|
|
20634
|
+
var archiveCommand = new Command104("archive").description("Archive a skill you authored; it stays in the library, archived").argument("<skillId>", "The skill ID").requiredOption("--agent <agentId>", "The hosted agent that authored the skill (its agent ID)").option(
|
|
20309
20635
|
"--remove-assignments",
|
|
20310
20636
|
"Also remove the skill from this agent's assignments; archiving is refused while other agents have it assigned"
|
|
20311
20637
|
).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice").action(
|
|
@@ -20331,7 +20657,7 @@ var archiveCommand = new Command103("archive").description("Archive a skill you
|
|
|
20331
20657
|
}
|
|
20332
20658
|
}
|
|
20333
20659
|
);
|
|
20334
|
-
var skillsCommand = new
|
|
20660
|
+
var skillsCommand = new Command104("skills").description(
|
|
20335
20661
|
"Skills in your owner's library that you, a hosted agent, author: create, version and archive"
|
|
20336
20662
|
);
|
|
20337
20663
|
skillsCommand.addCommand(createCommand2);
|
|
@@ -20340,15 +20666,15 @@ skillsCommand.addCommand(archiveCommand);
|
|
|
20340
20666
|
|
|
20341
20667
|
// src/commands/brief.ts
|
|
20342
20668
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
20343
|
-
import
|
|
20669
|
+
import fs11 from "fs/promises";
|
|
20344
20670
|
import path8 from "path";
|
|
20345
|
-
import { Command as
|
|
20671
|
+
import { Command as Command105 } from "commander";
|
|
20346
20672
|
var BRIEF_COOKIE = "taskmarket_brief";
|
|
20347
20673
|
var CREDENTIAL_PATTERN = /^[0-9a-f-]{36}\.[0-9a-f]{64}$/;
|
|
20348
20674
|
var credentialFile = () => path8.join(getTaskmarketHome(), "brief.json");
|
|
20349
20675
|
async function readCredentials() {
|
|
20350
20676
|
try {
|
|
20351
|
-
const parsed = JSON.parse(await
|
|
20677
|
+
const parsed = JSON.parse(await fs11.readFile(credentialFile(), "utf8"));
|
|
20352
20678
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
20353
20679
|
} catch {
|
|
20354
20680
|
return {};
|
|
@@ -20358,8 +20684,8 @@ async function writeCredential(value) {
|
|
|
20358
20684
|
const all = await readCredentials();
|
|
20359
20685
|
if (value) all[apiUrl()] = value;
|
|
20360
20686
|
else delete all[apiUrl()];
|
|
20361
|
-
await
|
|
20362
|
-
await
|
|
20687
|
+
await fs11.mkdir(getTaskmarketHome(), { recursive: true, mode: 448 });
|
|
20688
|
+
await fs11.writeFile(credentialFile(), JSON.stringify(all, null, 2), { mode: 384 });
|
|
20363
20689
|
}
|
|
20364
20690
|
async function savedCredential() {
|
|
20365
20691
|
const value = (await readCredentials())[apiUrl()];
|
|
@@ -20432,7 +20758,7 @@ async function sendTurn(credential, message, current, turnId = randomUUID5()) {
|
|
|
20432
20758
|
)).data
|
|
20433
20759
|
);
|
|
20434
20760
|
}
|
|
20435
|
-
var briefCommand = new
|
|
20761
|
+
var briefCommand = new Command105("brief").description(
|
|
20436
20762
|
"Draft a task brief in conversation with the drafting assistant"
|
|
20437
20763
|
);
|
|
20438
20764
|
briefCommand.command("start").description(
|
|
@@ -20486,11 +20812,11 @@ briefCommand.command("discard").description("Delete the saved brief").action(asy
|
|
|
20486
20812
|
});
|
|
20487
20813
|
|
|
20488
20814
|
// src/commands/requester/index.ts
|
|
20489
|
-
import { Command as
|
|
20815
|
+
import { Command as Command107 } from "commander";
|
|
20490
20816
|
|
|
20491
20817
|
// src/commands/requester/stats.ts
|
|
20492
|
-
import { Command as
|
|
20493
|
-
var requesterStatsCmd = new
|
|
20818
|
+
import { Command as Command106 } from "commander";
|
|
20819
|
+
var requesterStatsCmd = new Command106("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address3) => {
|
|
20494
20820
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address3)) {
|
|
20495
20821
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
20496
20822
|
return;
|
|
@@ -20504,23 +20830,23 @@ var requesterStatsCmd = new Command105("stats").description("Get requester reput
|
|
|
20504
20830
|
});
|
|
20505
20831
|
|
|
20506
20832
|
// src/commands/requester/index.ts
|
|
20507
|
-
var requesterCmd = new
|
|
20833
|
+
var requesterCmd = new Command107("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
20508
20834
|
|
|
20509
20835
|
// src/commands/capabilities.ts
|
|
20510
|
-
import { Command as
|
|
20836
|
+
import { Command as Command108 } from "commander";
|
|
20511
20837
|
async function fetchCapabilities(category) {
|
|
20512
20838
|
const input = parseInput(CapabilitiesListInputSchema, { category });
|
|
20513
20839
|
const query4 = input.category ? `?category=${encodeURIComponent(input.category)}` : "";
|
|
20514
20840
|
return CapabilitiesListResponseSchema.parse(await apiGet(`/api/capabilities${query4}`));
|
|
20515
20841
|
}
|
|
20516
|
-
var listCommand5 = new
|
|
20842
|
+
var listCommand5 = new Command108("list").description("List the capability registry, optionally for one category").option("--category <id>", "Only this category (for example onchain or web-data)").action(async (opts) => {
|
|
20517
20843
|
try {
|
|
20518
20844
|
printResult(await fetchCapabilities(opts.category));
|
|
20519
20845
|
} catch (err) {
|
|
20520
20846
|
renderFailure(err);
|
|
20521
20847
|
}
|
|
20522
20848
|
});
|
|
20523
|
-
var showCommand2 = new
|
|
20849
|
+
var showCommand2 = new Command108("show").description("Show one capability by slug").argument("<slug>", "Capability slug, for example web-search").action(async (slug) => {
|
|
20524
20850
|
try {
|
|
20525
20851
|
const { capabilities } = await fetchCapabilities();
|
|
20526
20852
|
const entry = capabilities.find((item) => item.slug === slug);
|
|
@@ -20530,13 +20856,13 @@ var showCommand2 = new Command107("show").description("Show one capability by sl
|
|
|
20530
20856
|
renderFailure(err);
|
|
20531
20857
|
}
|
|
20532
20858
|
});
|
|
20533
|
-
var capabilitiesCommand = new
|
|
20859
|
+
var capabilitiesCommand = new Command108("capabilities").description("Read the listing capability registry").addCommand(listCommand5).addCommand(showCommand2);
|
|
20534
20860
|
|
|
20535
20861
|
// src/commands/x402/index.ts
|
|
20536
|
-
import { Command as
|
|
20862
|
+
import { Command as Command112 } from "commander";
|
|
20537
20863
|
|
|
20538
20864
|
// src/commands/x402/payments.ts
|
|
20539
|
-
import { Command as
|
|
20865
|
+
import { Command as Command109, Option as Option5 } from "commander";
|
|
20540
20866
|
import { createInterface as createInterface5 } from "readline";
|
|
20541
20867
|
var PAYMENT_STATES = [
|
|
20542
20868
|
"reserved",
|
|
@@ -20562,7 +20888,7 @@ async function confirmManualResolution() {
|
|
|
20562
20888
|
readline.close();
|
|
20563
20889
|
return answer.trim().toLowerCase() === "resolve";
|
|
20564
20890
|
}
|
|
20565
|
-
var x402PaymentsCommand = new
|
|
20891
|
+
var x402PaymentsCommand = new Command109("payments").description(
|
|
20566
20892
|
"Inspect and reconcile X402 Pay payment records"
|
|
20567
20893
|
);
|
|
20568
20894
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option5("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
@@ -20590,8 +20916,8 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
20590
20916
|
);
|
|
20591
20917
|
|
|
20592
20918
|
// src/commands/x402/policy.ts
|
|
20593
|
-
import { promises as
|
|
20594
|
-
import { Command as
|
|
20919
|
+
import { promises as fs12 } from "fs";
|
|
20920
|
+
import { Command as Command110 } from "commander";
|
|
20595
20921
|
import { createInterface as createInterface6 } from "readline";
|
|
20596
20922
|
async function confirmUnattendedRule(rule) {
|
|
20597
20923
|
if (!process.stdin.isTTY) {
|
|
@@ -20617,7 +20943,7 @@ async function confirmUnattendedRule(rule) {
|
|
|
20617
20943
|
readline.close();
|
|
20618
20944
|
return answer.trim().toLowerCase() === "authorize";
|
|
20619
20945
|
}
|
|
20620
|
-
var x402PolicyCommand = new
|
|
20946
|
+
var x402PolicyCommand = new Command110("policy").description(
|
|
20621
20947
|
"Manage local X402 Pay spending policy"
|
|
20622
20948
|
);
|
|
20623
20949
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
@@ -20632,7 +20958,7 @@ x402PolicyCommand.command("validate").description("Validate the policy file").ac
|
|
|
20632
20958
|
});
|
|
20633
20959
|
x402PolicyCommand.command("schema").description("Print the policy JSON Schema").action(() => printResult(X402_POLICY_JSON_SCHEMA));
|
|
20634
20960
|
x402PolicyCommand.command("add").description("Add one rule from a JSON file").requiredOption("--rule-file <path>", "JSON file containing one policy rule").action(async (options) => {
|
|
20635
|
-
const rule = JSON.parse(await
|
|
20961
|
+
const rule = JSON.parse(await fs12.readFile(options.ruleFile, "utf8"));
|
|
20636
20962
|
const policy = await addX402PolicyRule(rule, getX402PolicyPath(), confirmUnattendedRule);
|
|
20637
20963
|
printResult({ path: getX402PolicyPath(), policy });
|
|
20638
20964
|
});
|
|
@@ -20653,7 +20979,7 @@ for (const enabled of [true, false]) {
|
|
|
20653
20979
|
}
|
|
20654
20980
|
|
|
20655
20981
|
// src/commands/x402/request.ts
|
|
20656
|
-
import { Command as
|
|
20982
|
+
import { Command as Command111, Option as Option6 } from "commander";
|
|
20657
20983
|
function collect4(value, previous) {
|
|
20658
20984
|
return [...previous, value];
|
|
20659
20985
|
}
|
|
@@ -20689,7 +21015,7 @@ function paymentConfirmationLines(terms) {
|
|
|
20689
21015
|
`Policy: ${terms.policyRuleId ?? "one-time interactive exception"}`
|
|
20690
21016
|
];
|
|
20691
21017
|
}
|
|
20692
|
-
var x402RequestCommand = new
|
|
21018
|
+
var x402RequestCommand = new Command111("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option6("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).addOption(
|
|
20693
21019
|
new Option6(
|
|
20694
21020
|
"--protocol <protocol>",
|
|
20695
21021
|
"Payment protocol the 402 may be paid through: auto reads x402 and MPP, x402 or mpp restricts it"
|
|
@@ -20734,7 +21060,7 @@ var x402RequestCommand = new Command110("request").description("Request and pay
|
|
|
20734
21060
|
);
|
|
20735
21061
|
|
|
20736
21062
|
// src/commands/x402/index.ts
|
|
20737
|
-
var x402Command = new
|
|
21063
|
+
var x402Command = new Command112("x402").description(
|
|
20738
21064
|
"Pay x402 services with local spending policies (X402 Pay)"
|
|
20739
21065
|
);
|
|
20740
21066
|
x402Command.addCommand(x402RequestCommand);
|
|
@@ -20742,10 +21068,10 @@ x402Command.addCommand(x402PolicyCommand);
|
|
|
20742
21068
|
x402Command.addCommand(x402PaymentsCommand);
|
|
20743
21069
|
|
|
20744
21070
|
// src/commands/sponsored-task/index.ts
|
|
20745
|
-
import { Command as
|
|
21071
|
+
import { Command as Command128 } from "commander";
|
|
20746
21072
|
|
|
20747
21073
|
// src/commands/sponsored-task/create.ts
|
|
20748
|
-
import { Command as
|
|
21074
|
+
import { Command as Command113 } from "commander";
|
|
20749
21075
|
import { toHex as toHex4 } from "viem";
|
|
20750
21076
|
|
|
20751
21077
|
// ../../packages/contracts/evm/abi/generated/SponsoredTasksVaultV2.ts
|
|
@@ -25158,9 +25484,9 @@ function defaultSponsoredTaskFactory(chainId) {
|
|
|
25158
25484
|
}
|
|
25159
25485
|
var DEFAULT_MAX_CREATION_FEE = 1000000n;
|
|
25160
25486
|
async function readVaultCreationFee(publicClient, factory) {
|
|
25161
|
-
let
|
|
25487
|
+
let amount2;
|
|
25162
25488
|
try {
|
|
25163
|
-
|
|
25489
|
+
amount2 = await publicClient.readContract({
|
|
25164
25490
|
address: factory,
|
|
25165
25491
|
abi: SponsoredTaskFactoryV2ABI,
|
|
25166
25492
|
functionName: "creationFee"
|
|
@@ -25172,7 +25498,7 @@ async function readVaultCreationFee(publicClient, factory) {
|
|
|
25172
25498
|
{ cause: err }
|
|
25173
25499
|
);
|
|
25174
25500
|
}
|
|
25175
|
-
if (typeof
|
|
25501
|
+
if (typeof amount2 !== "bigint" || amount2 === 0n) return null;
|
|
25176
25502
|
const [token2, recipient] = await Promise.all([
|
|
25177
25503
|
publicClient.readContract({
|
|
25178
25504
|
address: factory,
|
|
@@ -25185,7 +25511,7 @@ async function readVaultCreationFee(publicClient, factory) {
|
|
|
25185
25511
|
functionName: "creationFeeRecipient"
|
|
25186
25512
|
})
|
|
25187
25513
|
]);
|
|
25188
|
-
return { amount, token: token2, recipient };
|
|
25514
|
+
return { amount: amount2, token: token2, recipient };
|
|
25189
25515
|
}
|
|
25190
25516
|
function isValidAddress4(addr) {
|
|
25191
25517
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
@@ -25222,7 +25548,7 @@ async function createOnSolana(opts, keystore) {
|
|
|
25222
25548
|
renderFailure(err);
|
|
25223
25549
|
}
|
|
25224
25550
|
}
|
|
25225
|
-
var sponsoredTaskCreateCommand = new
|
|
25551
|
+
var sponsoredTaskCreateCommand = new Command113("create").description("Create a new Sponsored Task vault for a project token").option(
|
|
25226
25552
|
"--factory <address>",
|
|
25227
25553
|
"SponsoredTaskFactory contract address (EVM chains; defaults to the chain's newest factory, or the settler-mode factory on Robinhood Chain)"
|
|
25228
25554
|
).requiredOption(
|
|
@@ -25345,7 +25671,7 @@ Token risk: ${TOKEN_RISK}`
|
|
|
25345
25671
|
);
|
|
25346
25672
|
|
|
25347
25673
|
// src/commands/sponsored-task/fund.ts
|
|
25348
|
-
import { Command as
|
|
25674
|
+
import { Command as Command114 } from "commander";
|
|
25349
25675
|
function isValidAddress5(addr) {
|
|
25350
25676
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
25351
25677
|
}
|
|
@@ -25379,7 +25705,7 @@ async function fundOnSolana(opts, keystore) {
|
|
|
25379
25705
|
renderFailure(err);
|
|
25380
25706
|
}
|
|
25381
25707
|
}
|
|
25382
|
-
var sponsoredTaskFundCommand = new
|
|
25708
|
+
var sponsoredTaskFundCommand = new Command114("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").option(
|
|
25383
25709
|
"--token <address>",
|
|
25384
25710
|
"Project ERC-20 token address (EVM chains; Solana reads the vault's mint)"
|
|
25385
25711
|
).requiredOption(
|
|
@@ -25415,7 +25741,7 @@ var sponsoredTaskFundCommand = new Command113("fund").description("Fund a Sponso
|
|
|
25415
25741
|
}
|
|
25416
25742
|
const chainId = opts.chainId;
|
|
25417
25743
|
const { account, publicClient, walletClient, relay } = await createSponsoredTaskVaultChainClients(keystore, chainId);
|
|
25418
|
-
const
|
|
25744
|
+
const amount2 = BigInt(opts.amount);
|
|
25419
25745
|
const vaultToken = await publicClient.readContract({
|
|
25420
25746
|
address: opts.vault,
|
|
25421
25747
|
abi: SponsoredTasksVaultV2ABI,
|
|
@@ -25432,7 +25758,7 @@ var sponsoredTaskFundCommand = new Command113("fund").description("Fund a Sponso
|
|
|
25432
25758
|
relay,
|
|
25433
25759
|
token: opts.token,
|
|
25434
25760
|
spender: opts.vault,
|
|
25435
|
-
amount
|
|
25761
|
+
amount: amount2
|
|
25436
25762
|
});
|
|
25437
25763
|
const { txHash, feePayer } = await writeSponsoredTaskVaultContract({
|
|
25438
25764
|
account,
|
|
@@ -25442,7 +25768,7 @@ var sponsoredTaskFundCommand = new Command113("fund").description("Fund a Sponso
|
|
|
25442
25768
|
address: opts.vault,
|
|
25443
25769
|
abi: SponsoredTasksVaultV2ABI,
|
|
25444
25770
|
functionName: "fund",
|
|
25445
|
-
args: [
|
|
25771
|
+
args: [amount2]
|
|
25446
25772
|
});
|
|
25447
25773
|
printResult({
|
|
25448
25774
|
txHash,
|
|
@@ -25453,7 +25779,7 @@ var sponsoredTaskFundCommand = new Command113("fund").description("Fund a Sponso
|
|
|
25453
25779
|
});
|
|
25454
25780
|
|
|
25455
25781
|
// src/commands/sponsored-task/managers.ts
|
|
25456
|
-
import { Command as
|
|
25782
|
+
import { Command as Command115 } from "commander";
|
|
25457
25783
|
|
|
25458
25784
|
// src/lib/solana-payout-binding.ts
|
|
25459
25785
|
import { concat, keccak256 } from "viem";
|
|
@@ -25594,12 +25920,12 @@ async function submitPayoutBinding(input) {
|
|
|
25594
25920
|
}
|
|
25595
25921
|
function unboundSolanaAwards(rewards) {
|
|
25596
25922
|
return rewards.filter((r) => isSolanaChainId2(r.chainId) && r.claimStatus !== "claimed").map((r) => {
|
|
25597
|
-
const
|
|
25923
|
+
const amount2 = r.tokenDecimals === null ? `${r.amount} base units` : `${formatBaseUnits(BigInt(r.amount), r.tokenDecimals)} ${r.tokenSymbol ?? "tokens"}`;
|
|
25598
25924
|
return {
|
|
25599
25925
|
taskId: r.taskId,
|
|
25600
25926
|
chainId: r.chainId,
|
|
25601
25927
|
amount: r.amount,
|
|
25602
|
-
message: `Bind a Solana address to receive ${
|
|
25928
|
+
message: `Bind a Solana address to receive ${amount2}: ${taskmarketCommandFor(r.chainId)} sponsored-task bind-payout`
|
|
25603
25929
|
};
|
|
25604
25930
|
});
|
|
25605
25931
|
}
|
|
@@ -25814,7 +26140,7 @@ async function configure(opts) {
|
|
|
25814
26140
|
active: opts.active
|
|
25815
26141
|
});
|
|
25816
26142
|
}
|
|
25817
|
-
var sponsoredTaskManagersCommand = new
|
|
26143
|
+
var sponsoredTaskManagersCommand = new Command115("managers").description(
|
|
25818
26144
|
"Manage authorized managers for a Sponsored Task vault"
|
|
25819
26145
|
);
|
|
25820
26146
|
sponsoredTaskManagersCommand.command("add").description("Authorize a manager with a token-denominated spend cap").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
|
|
@@ -25841,8 +26167,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
|
|
|
25841
26167
|
});
|
|
25842
26168
|
|
|
25843
26169
|
// src/commands/sponsored-task/managed.ts
|
|
25844
|
-
import { Command as
|
|
25845
|
-
var sponsoredTaskManagedCommand = new
|
|
26170
|
+
import { Command as Command116 } from "commander";
|
|
26171
|
+
var sponsoredTaskManagedCommand = new Command116("managed").description(
|
|
25846
26172
|
"List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
|
|
25847
26173
|
).option("--address <address>", "Manager address (defaults to your wallet)").option("--limit <n>", "Max vaults to return (1-100)", "50").option("--cursor <vaultId>", "Pagination cursor from a previous nextCursor").action(async (opts) => {
|
|
25848
26174
|
let address3 = opts.address;
|
|
@@ -25872,8 +26198,8 @@ var sponsoredTaskManagedCommand = new Command115("managed").description(
|
|
|
25872
26198
|
});
|
|
25873
26199
|
|
|
25874
26200
|
// src/commands/sponsored-task/creation-fee.ts
|
|
25875
|
-
import { Command as
|
|
25876
|
-
var sponsoredTaskCreationFeeCommand = new
|
|
26201
|
+
import { Command as Command117 } from "commander";
|
|
26202
|
+
var sponsoredTaskCreationFeeCommand = new Command117("creation-fee").description("Show the one-time fee for creating a Sponsored Task vault on a chain").requiredOption(
|
|
25877
26203
|
"--chain-id <chain>",
|
|
25878
26204
|
"EVM chain the vault would be created on: a network name or chain id (e.g. base, 8453)",
|
|
25879
26205
|
chainOption("--chain-id", "evm-vault")
|
|
@@ -25917,8 +26243,8 @@ var sponsoredTaskCreationFeeCommand = new Command116("creation-fee").description
|
|
|
25917
26243
|
});
|
|
25918
26244
|
|
|
25919
26245
|
// src/commands/sponsored-task/list.ts
|
|
25920
|
-
import { Command as
|
|
25921
|
-
var sponsoredTaskListCommand = new
|
|
26246
|
+
import { Command as Command118 } from "commander";
|
|
26247
|
+
var sponsoredTaskListCommand = new Command118("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).option("--owner <address>", "Only vaults this address owns, whatever their curation status").option("--mine", "Only the vaults your wallet owns", false).action(
|
|
25922
26248
|
async (opts) => {
|
|
25923
26249
|
if (opts.owner && opts.mine) {
|
|
25924
26250
|
printError("Pass --owner or --mine, not both");
|
|
@@ -25947,8 +26273,8 @@ var sponsoredTaskListCommand = new Command117("list").description("List Sponsore
|
|
|
25947
26273
|
);
|
|
25948
26274
|
|
|
25949
26275
|
// src/commands/sponsored-task/settlements.ts
|
|
25950
|
-
import { Command as
|
|
25951
|
-
var sponsoredTaskSettlementsCommand = new
|
|
26276
|
+
import { Command as Command119 } from "commander";
|
|
26277
|
+
var sponsoredTaskSettlementsCommand = new Command119("settlements").description("List the settlements a Sponsored Task vault has installed, newest first").argument("<vaultId>", "Vault id").option("--limit <n>", "Max settlements to return (1-100)", "25").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(async (vaultId, opts) => {
|
|
25952
26278
|
const limit = Number(opts.limit);
|
|
25953
26279
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
25954
26280
|
printError("--limit must be an integer from 1 to 100");
|
|
@@ -25963,17 +26289,17 @@ var sponsoredTaskSettlementsCommand = new Command118("settlements").description(
|
|
|
25963
26289
|
});
|
|
25964
26290
|
|
|
25965
26291
|
// src/commands/sponsored-task/show.ts
|
|
25966
|
-
import { Command as
|
|
25967
|
-
var sponsoredTaskShowCommand = new
|
|
26292
|
+
import { Command as Command120 } from "commander";
|
|
26293
|
+
var sponsoredTaskShowCommand = new Command120("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
25968
26294
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
25969
26295
|
printResult(result);
|
|
25970
26296
|
});
|
|
25971
26297
|
|
|
25972
26298
|
// src/commands/sponsored-task/request-review.ts
|
|
25973
26299
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
25974
|
-
import { Command as
|
|
26300
|
+
import { Command as Command121 } from "commander";
|
|
25975
26301
|
var REQUEST_TTL_SECONDS = 5 * 60;
|
|
25976
|
-
var sponsoredTaskRequestReviewCommand = new
|
|
26302
|
+
var sponsoredTaskRequestReviewCommand = new Command121("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
25977
26303
|
let keystore;
|
|
25978
26304
|
try {
|
|
25979
26305
|
keystore = await loadKeystore();
|
|
@@ -26030,18 +26356,18 @@ var sponsoredTaskRequestReviewCommand = new Command120("request-review").descrip
|
|
|
26030
26356
|
});
|
|
26031
26357
|
|
|
26032
26358
|
// src/commands/sponsored-task/balance.ts
|
|
26033
|
-
import { Command as
|
|
26034
|
-
var sponsoredTaskBalanceCommand = new
|
|
26359
|
+
import { Command as Command122 } from "commander";
|
|
26360
|
+
var sponsoredTaskBalanceCommand = new Command122("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
26035
26361
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
|
|
26036
26362
|
printResult(result);
|
|
26037
26363
|
});
|
|
26038
26364
|
|
|
26039
26365
|
// src/commands/sponsored-task/withdraw.ts
|
|
26040
|
-
import { Command as
|
|
26366
|
+
import { Command as Command123 } from "commander";
|
|
26041
26367
|
function isValidAddress7(addr) {
|
|
26042
26368
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
26043
26369
|
}
|
|
26044
|
-
var sponsoredTaskWithdrawCommand = new
|
|
26370
|
+
var sponsoredTaskWithdrawCommand = new Command123("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption(
|
|
26045
26371
|
"--chain-id <chain>",
|
|
26046
26372
|
"EVM chain the vault is deployed on: a network name or chain id (e.g. base, robinhood, 8453)",
|
|
26047
26373
|
chainOption("--chain-id", "evm-vault")
|
|
@@ -26077,11 +26403,11 @@ var sponsoredTaskWithdrawCommand = new Command122("withdraw").description("Withd
|
|
|
26077
26403
|
});
|
|
26078
26404
|
|
|
26079
26405
|
// src/commands/sponsored-task/exit.ts
|
|
26080
|
-
import { Command as
|
|
26406
|
+
import { Command as Command124 } from "commander";
|
|
26081
26407
|
function isValidAddress8(addr) {
|
|
26082
26408
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
26083
26409
|
}
|
|
26084
|
-
var sponsoredTaskExitCommand = new
|
|
26410
|
+
var sponsoredTaskExitCommand = new Command124("exit").description(
|
|
26085
26411
|
"Terminally exit a vault: sweeps every reserved and unclaimed token back to you, invalidating every outstanding reservation, claim signature, and Merkle proof at once. There is no undo and no per-allocation revoke -- a worker with a pending but unclaimed entitlement gets nothing once this runs."
|
|
26086
26412
|
).requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
|
|
26087
26413
|
"--chain-id <chain>",
|
|
@@ -26157,7 +26483,7 @@ var sponsoredTaskExitCommand = new Command123("exit").description(
|
|
|
26157
26483
|
});
|
|
26158
26484
|
|
|
26159
26485
|
// src/commands/sponsored-task/claim.ts
|
|
26160
|
-
import { Command as
|
|
26486
|
+
import { Command as Command125 } from "commander";
|
|
26161
26487
|
var CLAIM_TO_TYPES = {
|
|
26162
26488
|
ClaimTo: [
|
|
26163
26489
|
{ name: "vaultId", type: "bytes32" },
|
|
@@ -26222,7 +26548,7 @@ async function findEntitlement(vaultId, workerAddress, taskId, options = {}) {
|
|
|
26222
26548
|
await sleep4(3e3);
|
|
26223
26549
|
}
|
|
26224
26550
|
}
|
|
26225
|
-
var sponsoredTaskClaimCommand = new
|
|
26551
|
+
var sponsoredTaskClaimCommand = new Command125("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
|
|
26226
26552
|
"--task-id <id>",
|
|
26227
26553
|
"Claim the entitlement for a specific task (defaults to the first unclaimed one)"
|
|
26228
26554
|
).action(async (vaultId, opts) => {
|
|
@@ -26338,10 +26664,10 @@ var sponsoredTaskClaimCommand = new Command124("claim").description("Claim your
|
|
|
26338
26664
|
});
|
|
26339
26665
|
|
|
26340
26666
|
// src/commands/sponsored-task/rewards.ts
|
|
26341
|
-
import { Command as
|
|
26667
|
+
import { Command as Command126 } from "commander";
|
|
26342
26668
|
var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
|
|
26343
26669
|
var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
|
|
26344
|
-
var sponsoredTaskRewardsCommand = new
|
|
26670
|
+
var sponsoredTaskRewardsCommand = new Command126("rewards").description("List Sponsored Task rewards across every vault (defaults to your wallet)").option("--address <address>", "Worker address (defaults to your wallet)").option("--state <state>", `Reward state: ${REWARD_STATES.join(", ")}`).option("--claim-status <status>", `Claim status: ${CLAIM_STATUSES.join(", ")}`).option("--limit <n>", "Max rewards to return (1-100)", "50").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(
|
|
26345
26671
|
async (opts) => {
|
|
26346
26672
|
let address3 = opts.address;
|
|
26347
26673
|
if (address3 === void 0) {
|
|
@@ -26381,7 +26707,7 @@ var sponsoredTaskRewardsCommand = new Command125("rewards").description("List Sp
|
|
|
26381
26707
|
);
|
|
26382
26708
|
|
|
26383
26709
|
// src/commands/sponsored-task/bind-payout.ts
|
|
26384
|
-
import { Command as
|
|
26710
|
+
import { Command as Command127 } from "commander";
|
|
26385
26711
|
async function solanaRewards(agent) {
|
|
26386
26712
|
try {
|
|
26387
26713
|
const result = await apiGet(
|
|
@@ -26392,7 +26718,7 @@ async function solanaRewards(agent) {
|
|
|
26392
26718
|
return [];
|
|
26393
26719
|
}
|
|
26394
26720
|
}
|
|
26395
|
-
var sponsoredTaskBindPayoutCommand = new
|
|
26721
|
+
var sponsoredTaskBindPayoutCommand = new Command127("bind-payout").description(
|
|
26396
26722
|
"Bind the Solana address that receives your Solana Sponsored Task awards (once; rebinding replaces it)"
|
|
26397
26723
|
).option(
|
|
26398
26724
|
"--address <solana-address>",
|
|
@@ -26553,7 +26879,7 @@ function bindingTaskChainIds(requested, connection, everyChain) {
|
|
|
26553
26879
|
}
|
|
26554
26880
|
|
|
26555
26881
|
// src/commands/sponsored-task/index.ts
|
|
26556
|
-
var sponsoredTaskCommand = new
|
|
26882
|
+
var sponsoredTaskCommand = new Command128("sponsored-task").description(
|
|
26557
26883
|
"Sponsored Task vault administration and reward claims"
|
|
26558
26884
|
);
|
|
26559
26885
|
sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
|
|
@@ -26573,10 +26899,10 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
|
26573
26899
|
sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
|
|
26574
26900
|
|
|
26575
26901
|
// src/commands/project/index.ts
|
|
26576
|
-
import { Command as
|
|
26902
|
+
import { Command as Command150 } from "commander";
|
|
26577
26903
|
|
|
26578
26904
|
// src/commands/project/accept.ts
|
|
26579
|
-
import { Command as
|
|
26905
|
+
import { Command as Command129 } from "commander";
|
|
26580
26906
|
|
|
26581
26907
|
// src/commands/project/shared.ts
|
|
26582
26908
|
var ADDRESS = /^0x[0-9a-fA-F]{40}$/;
|
|
@@ -26688,20 +27014,26 @@ function evaluatorTerms(opts) {
|
|
|
26688
27014
|
|
|
26689
27015
|
// src/commands/project/write.ts
|
|
26690
27016
|
async function postProjectWrite(path10, body, options) {
|
|
26691
|
-
const
|
|
27017
|
+
const outcome = await x402Post(
|
|
26692
27018
|
path10,
|
|
26693
27019
|
{ chainId: selectedNetwork().chainId, ...body },
|
|
26694
27020
|
{ maxAmount: options.maxAmount }
|
|
26695
27021
|
);
|
|
27022
|
+
const { data: result, idempotencyKey } = outcome;
|
|
26696
27023
|
printResult(
|
|
26697
|
-
{
|
|
27024
|
+
{
|
|
27025
|
+
...result,
|
|
27026
|
+
...options.extra,
|
|
27027
|
+
...replayedFields(outcome),
|
|
27028
|
+
...await settleRecording(result, idempotencyKey)
|
|
27029
|
+
},
|
|
26698
27030
|
{ idempotencyKey, ...options.warnings?.length ? { warnings: options.warnings } : {} }
|
|
26699
27031
|
);
|
|
26700
27032
|
}
|
|
26701
27033
|
|
|
26702
27034
|
// src/commands/project/accept.ts
|
|
26703
27035
|
var TERMS_HASH = /^0x[0-9a-fA-F]{64}$/;
|
|
26704
|
-
var projectAcceptCommand = new
|
|
27036
|
+
var projectAcceptCommand = new Command129("accept").description(
|
|
26705
27037
|
"Accept a grant on a project as its operator, which freezes the terms. The accept is refused if the owner changes the terms before it lands. The accept carries the `termsHash` of your grant, read from `project show`; pass --terms-hash to pin the hash you reviewed instead, so it is refused if the terms changed since (costs 0.001 in the payment token)"
|
|
26706
27038
|
).argument("<projectId>", "Project id").option(
|
|
26707
27039
|
"--terms-hash <hash>",
|
|
@@ -26733,7 +27065,7 @@ var projectAcceptCommand = new Command128("accept").description(
|
|
|
26733
27065
|
});
|
|
26734
27066
|
|
|
26735
27067
|
// src/commands/project/add-task.ts
|
|
26736
|
-
import { Command as
|
|
27068
|
+
import { Command as Command130 } from "commander";
|
|
26737
27069
|
function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
|
|
26738
27070
|
if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
|
|
26739
27071
|
const endsAt = new Date(project.endsAt);
|
|
@@ -26795,7 +27127,7 @@ function parseContinuation(flags) {
|
|
|
26795
27127
|
function collect5(value, previous = []) {
|
|
26796
27128
|
return [...previous, value];
|
|
26797
27129
|
}
|
|
26798
|
-
var projectAddTaskCommand = new
|
|
27130
|
+
var projectAddTaskCommand = new Command130("add-task").description(
|
|
26799
27131
|
"Create a task of any mode funded from a project's budget, as its owner or an operator with an accepted grant. Takes every flag of task create; the reward and any evaluator stake come out of the budget (costs 0.001 in the payment token)"
|
|
26800
27132
|
).argument("<projectId>", "Project id");
|
|
26801
27133
|
for (const option of createCmd.options) {
|
|
@@ -26847,7 +27179,7 @@ projectAddTaskCommand.action(async (id, opts) => {
|
|
|
26847
27179
|
});
|
|
26848
27180
|
|
|
26849
27181
|
// src/commands/project/automations.ts
|
|
26850
|
-
import { Command as
|
|
27182
|
+
import { Command as Command131 } from "commander";
|
|
26851
27183
|
function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
26852
27184
|
if (opts.cap === void 0) {
|
|
26853
27185
|
return { error: "--cap is required: the most the automations may draw from the budget" };
|
|
@@ -26876,7 +27208,7 @@ function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
|
26876
27208
|
}
|
|
26877
27209
|
return body;
|
|
26878
27210
|
}
|
|
26879
|
-
var projectAutomationsOnCommand = new
|
|
27211
|
+
var projectAutomationsOnCommand = new Command131("on").description(
|
|
26880
27212
|
"Turn the project's automations on, so its schedules and workflows run. Grants the platform runner of the project's chain, which you never name, with a cap: the most the automations may draw from the budget in total, net of refunds (payouts keep counting). The cap is required. On a project whose automations are on, a higher cap raises it and a lower one is refused; turning them on again after off, or raising the cap, needs a chain on contract revision 29 and is refused before payment otherwise. Optional limits (contract revision 29): --expires, and --period-budget with --period; on states them whole, so none stated clears an expiry and a period budget. Schedules paused by off stay paused: resume each one (costs 0.001 in the payment token)"
|
|
26881
27213
|
).argument("<projectId>", "Project id").option(
|
|
26882
27214
|
"--cap <amount>",
|
|
@@ -26904,7 +27236,7 @@ var projectAutomationsOnCommand = new Command130("on").description(
|
|
|
26904
27236
|
});
|
|
26905
27237
|
}
|
|
26906
27238
|
);
|
|
26907
|
-
var projectAutomationsOffCommand = new
|
|
27239
|
+
var projectAutomationsOffCommand = new Command131("off").description(
|
|
26908
27240
|
"Turn the project's automations off: revokes the platform runner's grant and pauses the project's schedules and workflow schedules (reason automations_off). Their definitions stay, tasks already started finish under you, and turning automations on again does not resume them (costs 0.001 in the payment token)"
|
|
26909
27241
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26910
27242
|
const projectId = parseProjectId(id);
|
|
@@ -26915,7 +27247,7 @@ var projectAutomationsOffCommand = new Command130("off").description(
|
|
|
26915
27247
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26916
27248
|
);
|
|
26917
27249
|
});
|
|
26918
|
-
var projectAutomationsStatusCommand = new
|
|
27250
|
+
var projectAutomationsStatusCommand = new Command131("status").description(
|
|
26919
27251
|
"Whether the project's schedules and workflows can run: state on, off, pending (granted, the runner has not accepted yet) or unavailable (no runner on the chain), with the cap, what is spent and what remains, and whether it can be turned on again or its cap raised (free)"
|
|
26920
27252
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26921
27253
|
const projectId = parseProjectId(id);
|
|
@@ -26926,13 +27258,13 @@ var projectAutomationsStatusCommand = new Command130("status").description(
|
|
|
26926
27258
|
renderFailure(err);
|
|
26927
27259
|
}
|
|
26928
27260
|
});
|
|
26929
|
-
var projectAutomationsCommand = new
|
|
27261
|
+
var projectAutomationsCommand = new Command131("automations").description(
|
|
26930
27262
|
"The project's automations: one switch for its schedules and workflows. `on --cap <amount>` grants the platform runner of the project chain for you, `off` revokes it and pauses schedules, `status` reads it. `project runner` and `project grant` remain for advanced use"
|
|
26931
27263
|
).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
|
|
26932
27264
|
|
|
26933
27265
|
// src/commands/project/claim.ts
|
|
26934
|
-
import { Command as
|
|
26935
|
-
var projectClaimCommand = new
|
|
27266
|
+
import { Command as Command132 } from "commander";
|
|
27267
|
+
var projectClaimCommand = new Command132("claim").description(
|
|
26936
27268
|
"Pay a backer its share of a closed or ended project's leftovers: what was unspent plus every later refund, in proportion to its pool shares, less what it already claimed. Anyone may trigger it; the money always goes to the backer. Refused before payment when nothing is owed (costs 0.001 in the payment token)"
|
|
26937
27269
|
).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
|
|
26938
27270
|
const projectId = parseProjectId(id);
|
|
@@ -26952,8 +27284,8 @@ var projectClaimCommand = new Command131("claim").description(
|
|
|
26952
27284
|
});
|
|
26953
27285
|
|
|
26954
27286
|
// src/commands/project/close.ts
|
|
26955
|
-
import { Command as
|
|
26956
|
-
var projectCloseCommand = new
|
|
27287
|
+
import { Command as Command133 } from "commander";
|
|
27288
|
+
var projectCloseCommand = new Command133("close").description(
|
|
26957
27289
|
"Close a project: its unspent budget becomes the backers' pot, which each backer, the owner included, claims with `project claim`. The owner may close it any time, anyone once it is past its end date; tasks already funded run on and their refunds join the pot (costs 0.001 in the payment token)"
|
|
26958
27290
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26959
27291
|
const projectId = parseProjectId(id);
|
|
@@ -26966,13 +27298,13 @@ var projectCloseCommand = new Command132("close").description(
|
|
|
26966
27298
|
});
|
|
26967
27299
|
|
|
26968
27300
|
// src/commands/project/create.ts
|
|
26969
|
-
import { Command as
|
|
27301
|
+
import { Command as Command136 } from "commander";
|
|
26970
27302
|
|
|
26971
27303
|
// src/commands/project/suggestions.ts
|
|
26972
|
-
import { Command as
|
|
27304
|
+
import { Command as Command135 } from "commander";
|
|
26973
27305
|
|
|
26974
27306
|
// src/commands/project/suggestion-proposals.ts
|
|
26975
|
-
import { Command as
|
|
27307
|
+
import { Command as Command134 } from "commander";
|
|
26976
27308
|
var QUERY_ERRORS = {
|
|
26977
27309
|
status: "--status must be pending, closed or expired",
|
|
26978
27310
|
limit: "--limit must be an integer from 1 to 50",
|
|
@@ -27023,7 +27355,7 @@ async function read(path10) {
|
|
|
27023
27355
|
function collectSuggestion(value, previous) {
|
|
27024
27356
|
return [...previous, value];
|
|
27025
27357
|
}
|
|
27026
|
-
var projectSuggestionProposalsCommand = new
|
|
27358
|
+
var projectSuggestionProposalsCommand = new Command134("proposals").description(
|
|
27027
27359
|
"List a project's suggestion proposals, newest first: what each run of its suggestions schedule picked in propose mode, with the ranking it was picked by and each pick's rank, reward, mode and status. A pick the owner drops is not proposed again by that schedule. The reads are public; signed with your wallet when there is one, so a pick whose suggestion staff hid shows only to the project's owner and its author. A pending proposal waits for the owner to confirm or drop its picks, and expires at the schedule's next slot or after 72 hours (free)"
|
|
27028
27360
|
).argument("<projectId>", "Project id").option(
|
|
27029
27361
|
"--status <status>",
|
|
@@ -27038,7 +27370,7 @@ var projectSuggestionProposalsCommand = new Command133("proposals").description(
|
|
|
27038
27370
|
if (typeof query4 !== "string") return void printError(query4.error);
|
|
27039
27371
|
await read(`/api/projects/${projectId}/suggestion-proposals${query4 ? `?${query4}` : ""}`);
|
|
27040
27372
|
});
|
|
27041
|
-
var proposalShowCommand = new
|
|
27373
|
+
var proposalShowCommand = new Command134("show").description(
|
|
27042
27374
|
"Show a suggestion proposal with its picks: each suggestion, its rank and score, the reward and mode its task will carry, and its status (pending, confirmed, created with its taskId, dropped, expired or failed with the reason). Public; signed with your wallet when there is one, so a hidden pick shows only to the project's owner and its author (free)"
|
|
27043
27375
|
).argument("<proposalId>", "Proposal id").action(async (value) => {
|
|
27044
27376
|
const id = parseProposalId(value);
|
|
@@ -27046,7 +27378,7 @@ var proposalShowCommand = new Command133("show").description(
|
|
|
27046
27378
|
await read(`/api/suggestion-proposals/${id}`);
|
|
27047
27379
|
});
|
|
27048
27380
|
function decisionCommand(action, description) {
|
|
27049
|
-
return new
|
|
27381
|
+
return new Command134(action).description(description).argument("<proposalId>", "Proposal id").option(
|
|
27050
27382
|
"--suggestion <suggestionId>",
|
|
27051
27383
|
`Only this pick; repeat it for each (default: every pending pick)`,
|
|
27052
27384
|
collectSuggestion,
|
|
@@ -27063,7 +27395,7 @@ function decisionCommand(action, description) {
|
|
|
27063
27395
|
);
|
|
27064
27396
|
});
|
|
27065
27397
|
}
|
|
27066
|
-
var projectSuggestionProposalCommand = new
|
|
27398
|
+
var projectSuggestionProposalCommand = new Command134("proposal").description(
|
|
27067
27399
|
"One suggestion proposal, as the project's owner: show it, confirm its picks so the platform runner creates their tasks, or drop them"
|
|
27068
27400
|
).addCommand(proposalShowCommand).addCommand(
|
|
27069
27401
|
decisionCommand(
|
|
@@ -27096,11 +27428,11 @@ function parseSuggestionsMinBacking(value, options = {}) {
|
|
|
27096
27428
|
function suggestBody(projectId, opts) {
|
|
27097
27429
|
if (opts.title === void 0) return { error: "--title is required" };
|
|
27098
27430
|
if (opts.brief === void 0) return { error: "--brief is required" };
|
|
27099
|
-
const
|
|
27100
|
-
if (!
|
|
27431
|
+
const title2 = ProjectSuggestionTitleSchema.safeParse(opts.title);
|
|
27432
|
+
if (!title2.success) return { error: `--title: ${title2.error.issues[0].message}` };
|
|
27101
27433
|
const brief = ProjectSuggestionBriefSchema.safeParse(opts.brief);
|
|
27102
27434
|
if (!brief.success) return { error: `--brief: ${brief.error.issues[0].message}` };
|
|
27103
|
-
const body = { projectId, title:
|
|
27435
|
+
const body = { projectId, title: title2.data, brief: brief.data };
|
|
27104
27436
|
if (opts.mode !== void 0) {
|
|
27105
27437
|
const mode = opts.mode.trim();
|
|
27106
27438
|
if (!GRANT_MODE_NAMES.includes(mode)) {
|
|
@@ -27177,7 +27509,7 @@ async function signedRead(path10) {
|
|
|
27177
27509
|
renderFailure(err);
|
|
27178
27510
|
}
|
|
27179
27511
|
}
|
|
27180
|
-
var projectSuggestCommand = new
|
|
27512
|
+
var projectSuggestCommand = new Command135("suggest").description(
|
|
27181
27513
|
"Post a suggestion on an open project: an idea for work its budget could pay for, as a wallet the project's suggestions setting admits (backers: the owner, its operators and backers; anyone: any wallet). Posting costs 0.001 in the payment token. The owner or an operator turns it into a task with `project add-task --suggestion <id>`, and anyone it admits may upvote it for free"
|
|
27182
27514
|
).argument("<projectId>", "Project id").option("--title <text>", "Required: one line, 1 to 120 characters").option(
|
|
27183
27515
|
"--brief <text>",
|
|
@@ -27197,7 +27529,7 @@ var projectSuggestCommand = new Command134("suggest").description(
|
|
|
27197
27529
|
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
27198
27530
|
});
|
|
27199
27531
|
});
|
|
27200
|
-
var projectSuggestionsCommand = new
|
|
27532
|
+
var projectSuggestionsCommand = new Command135("suggestions").description(
|
|
27201
27533
|
"List a project's suggestions with its suggestions settings, most upvoted first or, with --sort backed, most pool shares among the voters who back the project first. Each carries votes, backedShares and, when your wallet signs the read, whether you voted (free)"
|
|
27202
27534
|
).argument("<projectId>", "Project id").option(
|
|
27203
27535
|
"--status <status>",
|
|
@@ -27215,7 +27547,7 @@ var projectSuggestionsCommand = new Command134("suggestions").description(
|
|
|
27215
27547
|
if (typeof query4 !== "string") return void printError(query4.error);
|
|
27216
27548
|
await signedRead(`/api/projects/${projectId}/suggestions${query4 ? `?${query4}` : ""}`);
|
|
27217
27549
|
});
|
|
27218
|
-
var showCommand3 = new
|
|
27550
|
+
var showCommand3 = new Command135("show").description("Show a suggestion with its status, votes and backedShares (free)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
27219
27551
|
const id = parseSuggestionId(value);
|
|
27220
27552
|
if (typeof id !== "string") return void printError(id.error);
|
|
27221
27553
|
await signedRead(`/api/project-suggestions/${id}`);
|
|
@@ -27229,7 +27561,7 @@ async function readAuthFor(what) {
|
|
|
27229
27561
|
return { headers: auth.headers };
|
|
27230
27562
|
}
|
|
27231
27563
|
function voteCommand(action, description) {
|
|
27232
|
-
return new
|
|
27564
|
+
return new Command135(action).description(description).argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
27233
27565
|
const suggestionId = parseSuggestionId(value);
|
|
27234
27566
|
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
27235
27567
|
const auth = await readAuthFor(action === "vote" ? "Voting" : "Taking back a vote");
|
|
@@ -27252,7 +27584,7 @@ function voteCommand(action, description) {
|
|
|
27252
27584
|
}
|
|
27253
27585
|
});
|
|
27254
27586
|
}
|
|
27255
|
-
var reportCommand = new
|
|
27587
|
+
var reportCommand = new Command135("report").description(
|
|
27256
27588
|
"Report a suggestion to Taskmarket staff, as any wallet but its author (free, signed by your wallet). Staff may hide it from the project's lists; one open report per wallet per suggestion, so a repeat returns the open one"
|
|
27257
27589
|
).argument("<suggestionId>", "Suggestion id").requiredOption("--reason <reason>", `Why: ${PROJECT_SUGGESTION_REPORT_REASONS.join(", ")}`).option("--note <text>", "What staff should know: up to 500 characters, read only by staff").action(async (value, opts) => {
|
|
27258
27590
|
const suggestionId = parseSuggestionId(value);
|
|
@@ -27291,7 +27623,7 @@ var reportCommand = new Command134("report").description(
|
|
|
27291
27623
|
renderFailure(err);
|
|
27292
27624
|
}
|
|
27293
27625
|
});
|
|
27294
|
-
var withdrawCommand2 = new
|
|
27626
|
+
var withdrawCommand2 = new Command135("withdraw").description("Withdraw your open suggestion, as its author (costs 0.001 in the payment token)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
27295
27627
|
const suggestionId = parseSuggestionId(value);
|
|
27296
27628
|
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
27297
27629
|
await postProjectWrite(
|
|
@@ -27300,7 +27632,7 @@ var withdrawCommand2 = new Command134("withdraw").description("Withdraw your ope
|
|
|
27300
27632
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27301
27633
|
);
|
|
27302
27634
|
});
|
|
27303
|
-
var declineCommand = new
|
|
27635
|
+
var declineCommand = new Command135("decline").description(
|
|
27304
27636
|
"Decline an open suggestion, as the project's owner or an operator with an accepted grant; the reason is shown to everyone. Declining costs 0.001 in the payment token. To accept one instead, create its task with `project add-task <projectId> --suggestion <id>`, which pays the task's reward and any evaluator stake from the budget, plus the 0.001 action fee"
|
|
27305
27637
|
).argument("<suggestionId>", "Suggestion id").option("--reason <text>", "Why, shown to everyone: up to 500 characters").action(async (value, opts) => {
|
|
27306
27638
|
const suggestionId = parseSuggestionId(value);
|
|
@@ -27315,7 +27647,7 @@ var declineCommand = new Command134("decline").description(
|
|
|
27315
27647
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27316
27648
|
);
|
|
27317
27649
|
});
|
|
27318
|
-
var projectSuggestionCommand = new
|
|
27650
|
+
var projectSuggestionCommand = new Command135("suggestion").description(
|
|
27319
27651
|
"One project suggestion: show it, upvote it or take the upvote back, report it to staff (each free, signed by your wallet), withdraw it as its author, or decline it as the owner or an operator. `proposals` and `proposal` read and act on what the project's suggestions schedule proposes"
|
|
27320
27652
|
).addCommand(showCommand3).addCommand(
|
|
27321
27653
|
voteCommand(
|
|
@@ -27325,7 +27657,7 @@ var projectSuggestionCommand = new Command134("suggestion").description(
|
|
|
27325
27657
|
).addCommand(
|
|
27326
27658
|
voteCommand("unvote", "Take back your upvote on a suggestion (free, signed by your wallet)")
|
|
27327
27659
|
).addCommand(reportCommand).addCommand(withdrawCommand2).addCommand(declineCommand).addCommand(projectSuggestionProposalsCommand).addCommand(projectSuggestionProposalCommand);
|
|
27328
|
-
var projectSuggestionSettingsCommand = new
|
|
27660
|
+
var projectSuggestionSettingsCommand = new Command135("suggestion-settings").description(
|
|
27329
27661
|
"Read or set the project's suggestions settings, as its owner: who may post and upvote suggestions (off, backers or anyone), the least a wallet must have contributed to count as a backer for them (1 in the payment token by default), and whether hosted agents that operate the project accept and decline suggestions by themselves (on by default). Turning hosted operators off keeps their grants. Setting costs 0.001 in the payment token; reading is free"
|
|
27330
27662
|
).argument("<projectId>", "Project id").option(
|
|
27331
27663
|
"--suggestions <setting>",
|
|
@@ -27360,7 +27692,7 @@ var projectSuggestionSettingsCommand = new Command134("suggestion-settings").des
|
|
|
27360
27692
|
});
|
|
27361
27693
|
|
|
27362
27694
|
// src/commands/project/create.ts
|
|
27363
|
-
var projectCreateCommand = new
|
|
27695
|
+
var projectCreateCommand = new Command136("create").description(
|
|
27364
27696
|
"Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
|
|
27365
27697
|
).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
|
|
27366
27698
|
"--ends-at <time>",
|
|
@@ -27409,9 +27741,9 @@ var projectCreateCommand = new Command135("create").description(
|
|
|
27409
27741
|
);
|
|
27410
27742
|
|
|
27411
27743
|
// src/commands/project/extend.ts
|
|
27412
|
-
import { Command as
|
|
27744
|
+
import { Command as Command137 } from "commander";
|
|
27413
27745
|
var MAX_EXTENSION_MS = 365 * 24 * 3600 * 1e3;
|
|
27414
|
-
var projectExtendCommand = new
|
|
27746
|
+
var projectExtendCommand = new Command137("extend").description(
|
|
27415
27747
|
"Move an open project's end date later, as the project owner (costs 0.001 in the payment token). The new date must be later than the current one and at most 365 days from now. A closed project, or one past its end date, cannot be extended. Backers' shares and the pool's value do not change; a backer whose pot is still open claims at the new date"
|
|
27416
27748
|
).argument("<projectId>", "Project id").requiredOption("--ends <time>", "The new end date: ISO 8601 or a duration from now such as 90d").action(async (id, opts) => {
|
|
27417
27749
|
const projectId = parseProjectId(id);
|
|
@@ -27429,8 +27761,8 @@ var projectExtendCommand = new Command136("extend").description(
|
|
|
27429
27761
|
});
|
|
27430
27762
|
|
|
27431
27763
|
// src/commands/project/fund.ts
|
|
27432
|
-
import { Command as
|
|
27433
|
-
var projectFundCommand = new
|
|
27764
|
+
import { Command as Command138 } from "commander";
|
|
27765
|
+
var projectFundCommand = new Command138("fund").description(
|
|
27434
27766
|
"Back an open project: pay into its funding pool, from any wallet. You (or --on-behalf-of) become a backer holding shares bought at the pool's current value (what it holds plus what its live tasks hold), and once the project is closed or past its end date each backer claims its share of what is left with `project claim` (costs the amount, in the payment token)"
|
|
27435
27767
|
).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
|
|
27436
27768
|
"--on-behalf-of <address>",
|
|
@@ -27438,21 +27770,21 @@ var projectFundCommand = new Command137("fund").description(
|
|
|
27438
27770
|
).action(async (id, opts) => {
|
|
27439
27771
|
const projectId = parseProjectId(id);
|
|
27440
27772
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
27441
|
-
const
|
|
27442
|
-
if (typeof
|
|
27773
|
+
const amount2 = parseAmount(opts.amount, "--amount");
|
|
27774
|
+
if (typeof amount2 !== "string") return void printError(amount2.error);
|
|
27443
27775
|
const onBehalfOf = opts.onBehalfOf?.trim();
|
|
27444
27776
|
if (onBehalfOf !== void 0 && (!ADDRESS.test(onBehalfOf) || /^0x0{40}$/i.test(onBehalfOf))) {
|
|
27445
27777
|
return void printError("Invalid Ethereum address for --on-behalf-of");
|
|
27446
27778
|
}
|
|
27447
27779
|
await postProjectWrite(
|
|
27448
27780
|
`/api/projects/${projectId}/fund`,
|
|
27449
|
-
{ projectId, amount, ...onBehalfOf ? { onBehalfOf } : {} },
|
|
27450
|
-
{ maxAmount:
|
|
27781
|
+
{ projectId, amount: amount2, ...onBehalfOf ? { onBehalfOf } : {} },
|
|
27782
|
+
{ maxAmount: amount2 }
|
|
27451
27783
|
);
|
|
27452
27784
|
});
|
|
27453
27785
|
|
|
27454
27786
|
// src/commands/project/grant.ts
|
|
27455
|
-
import { Command as
|
|
27787
|
+
import { Command as Command139 } from "commander";
|
|
27456
27788
|
function grantBody(projectId, opts) {
|
|
27457
27789
|
if (!ADDRESS.test(opts.operator)) {
|
|
27458
27790
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -27475,7 +27807,7 @@ function grantBody(projectId, opts) {
|
|
|
27475
27807
|
revokeRemovesControl: opts.revokeRemovesControl
|
|
27476
27808
|
};
|
|
27477
27809
|
}
|
|
27478
|
-
var projectGrantCommand = new
|
|
27810
|
+
var projectGrantCommand = new Command139("grant").description(
|
|
27479
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)"
|
|
27480
27812
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
|
|
27481
27813
|
"--cap <amount>",
|
|
@@ -27501,7 +27833,7 @@ var projectGrantCommand = new Command138("grant").description(
|
|
|
27501
27833
|
});
|
|
27502
27834
|
|
|
27503
27835
|
// src/commands/project/review.ts
|
|
27504
|
-
import { Command as
|
|
27836
|
+
import { Command as Command140 } from "commander";
|
|
27505
27837
|
function reviewEvaluator(opts) {
|
|
27506
27838
|
if (opts.evaluator !== void 0 && opts.off) {
|
|
27507
27839
|
return { error: "Pass --evaluator <address> or --off, not both" };
|
|
@@ -27516,7 +27848,7 @@ function reviewEvaluator(opts) {
|
|
|
27516
27848
|
}
|
|
27517
27849
|
return opts.evaluator;
|
|
27518
27850
|
}
|
|
27519
|
-
var projectReviewCommand = new
|
|
27851
|
+
var projectReviewCommand = new Command140("review").description(
|
|
27520
27852
|
"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"
|
|
27521
27853
|
).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) => {
|
|
27522
27854
|
const projectId = parseProjectId(id);
|
|
@@ -27558,8 +27890,8 @@ async function ownerEvaluatorWarnings(evaluator) {
|
|
|
27558
27890
|
}
|
|
27559
27891
|
|
|
27560
27892
|
// src/commands/project/raise-cap.ts
|
|
27561
|
-
import { Command as
|
|
27562
|
-
var projectRaiseCapCommand = new
|
|
27893
|
+
import { Command as Command141 } from "commander";
|
|
27894
|
+
var projectRaiseCapCommand = new Command141("raise-cap").description(
|
|
27563
27895
|
"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"
|
|
27564
27896
|
).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) => {
|
|
27565
27897
|
const projectId = parseProjectId(id);
|
|
@@ -27577,8 +27909,8 @@ var projectRaiseCapCommand = new Command140("raise-cap").description(
|
|
|
27577
27909
|
});
|
|
27578
27910
|
|
|
27579
27911
|
// src/commands/project/lower-cap.ts
|
|
27580
|
-
import { Command as
|
|
27581
|
-
var projectLowerCapCommand = new
|
|
27912
|
+
import { Command as Command142 } from "commander";
|
|
27913
|
+
var projectLowerCapCommand = new Command142("lower-cap").description(
|
|
27582
27914
|
"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`"
|
|
27583
27915
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
|
|
27584
27916
|
"--cap <amount>",
|
|
@@ -27600,7 +27932,7 @@ var projectLowerCapCommand = new Command141("lower-cap").description(
|
|
|
27600
27932
|
});
|
|
27601
27933
|
|
|
27602
27934
|
// src/commands/project/limits.ts
|
|
27603
|
-
import { Command as
|
|
27935
|
+
import { Command as Command143 } from "commander";
|
|
27604
27936
|
function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
27605
27937
|
if (!ADDRESS.test(opts.operator)) {
|
|
27606
27938
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -27640,7 +27972,7 @@ function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
|
27640
27972
|
}
|
|
27641
27973
|
return body;
|
|
27642
27974
|
}
|
|
27643
|
-
var projectLimitsCommand = new
|
|
27975
|
+
var projectLimitsCommand = new Command143("limits").description(
|
|
27644
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"
|
|
27645
27977
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
|
|
27646
27978
|
"--expires <time>",
|
|
@@ -27662,8 +27994,8 @@ var projectLimitsCommand = new Command142("limits").description(
|
|
|
27662
27994
|
});
|
|
27663
27995
|
|
|
27664
27996
|
// src/commands/project/revoke.ts
|
|
27665
|
-
import { Command as
|
|
27666
|
-
var projectRevokeCommand = new
|
|
27997
|
+
import { Command as Command144 } from "commander";
|
|
27998
|
+
var projectRevokeCommand = new Command144("revoke").description(
|
|
27667
27999
|
"End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
|
|
27668
28000
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
|
|
27669
28001
|
const projectId = parseProjectId(id);
|
|
@@ -27682,7 +28014,7 @@ var projectRevokeCommand = new Command143("revoke").description(
|
|
|
27682
28014
|
});
|
|
27683
28015
|
|
|
27684
28016
|
// src/commands/project/schedule.ts
|
|
27685
|
-
import { Command as
|
|
28017
|
+
import { Command as Command147 } from "commander";
|
|
27686
28018
|
|
|
27687
28019
|
// src/lib/owner-list.ts
|
|
27688
28020
|
import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
|
|
@@ -27722,7 +28054,7 @@ function ownerListQuery(owner, opts, statuses) {
|
|
|
27722
28054
|
}
|
|
27723
28055
|
|
|
27724
28056
|
// src/commands/project/suggestion-schedule.ts
|
|
27725
|
-
import { Command as
|
|
28057
|
+
import { Command as Command145 } from "commander";
|
|
27726
28058
|
var SUGGESTION_ONLY_FLAGS = [
|
|
27727
28059
|
["--rank", "rank"],
|
|
27728
28060
|
["--min-backed-share", "minBackedShare"],
|
|
@@ -27808,9 +28140,9 @@ function settingsFields(opts, stored) {
|
|
|
27808
28140
|
["--max-reward", opts.maxReward, "maxReward"]
|
|
27809
28141
|
]) {
|
|
27810
28142
|
if (value === void 0) continue;
|
|
27811
|
-
const
|
|
27812
|
-
if (typeof
|
|
27813
|
-
body[field] =
|
|
28143
|
+
const amount2 = parseAmount(value, flag);
|
|
28144
|
+
if (typeof amount2 !== "string") return amount2;
|
|
28145
|
+
body[field] = amount2;
|
|
27814
28146
|
}
|
|
27815
28147
|
if (opts.declineAfter !== void 0) {
|
|
27816
28148
|
const trimmed = opts.declineAfter.trim();
|
|
@@ -27913,7 +28245,7 @@ function addSuggestionScheduleOptions(command) {
|
|
|
27913
28245
|
).option("--no-email-picks", "Suggestions schedules: do not email when picks are waiting");
|
|
27914
28246
|
}
|
|
27915
28247
|
var suggestionScheduleSettingsCommand = addSuggestionScheduleOptions(
|
|
27916
|
-
new
|
|
28248
|
+
new Command145("suggestion-settings").description(
|
|
27917
28249
|
"Change a suggestions schedule's settings, as the project's owner: any of its mode, ranking, thresholds, limits, stale-suggestion declines, default task mode, the picks-waiting email and the task template. Only the settings you pass change; a template flag changes only its own fields of the stored template, which the CLI reads first. A pending proposal is unchanged. Read the settings with `taskmarket project schedule show`. Costs 0.001 in the payment token"
|
|
27918
28250
|
).argument("<scheduleId>", "Schedule id").option(
|
|
27919
28251
|
"--mode <mode>",
|
|
@@ -27947,7 +28279,7 @@ var suggestionScheduleSettingsCommand = addSuggestionScheduleOptions(
|
|
|
27947
28279
|
|
|
27948
28280
|
// src/commands/workflow-template.ts
|
|
27949
28281
|
import { readFile as readFile4 } from "fs/promises";
|
|
27950
|
-
import { Command as
|
|
28282
|
+
import { Command as Command146 } from "commander";
|
|
27951
28283
|
var UUID3 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
27952
28284
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
27953
28285
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
@@ -28041,7 +28373,7 @@ async function readValidTemplate(path10) {
|
|
|
28041
28373
|
}
|
|
28042
28374
|
return parsed.document;
|
|
28043
28375
|
}
|
|
28044
|
-
var createCommand3 = new
|
|
28376
|
+
var createCommand3 = new Command146("create").description(
|
|
28045
28377
|
"Save a workflow template from a JSON file: a workflow document whose strings use {{param}} placeholders, with each parameter declared (type string, integer, amount or list; a default; bounds). It is checked with every parameter at its minimum and its maximum before it is saved. Costs 0.001 in the payment token"
|
|
28046
28378
|
).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
|
|
28047
28379
|
const template = await readValidTemplate(opts.file);
|
|
@@ -28052,7 +28384,7 @@ var createCommand3 = new Command145("create").description(
|
|
|
28052
28384
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28053
28385
|
);
|
|
28054
28386
|
});
|
|
28055
|
-
var updateCommand = new
|
|
28387
|
+
var updateCommand = new Command146("update").description(
|
|
28056
28388
|
"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"
|
|
28057
28389
|
).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
|
|
28058
28390
|
const choice = templateChoice(value);
|
|
@@ -28106,7 +28438,7 @@ function parseTemplateSearch(opts) {
|
|
|
28106
28438
|
}
|
|
28107
28439
|
return { query: query4 };
|
|
28108
28440
|
}
|
|
28109
|
-
var listCommand6 = new
|
|
28441
|
+
var listCommand6 = new Command146("list").description(
|
|
28110
28442
|
"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`"
|
|
28111
28443
|
).option("--owner <address>", "The wallet whose templates to list").option(
|
|
28112
28444
|
"--mine",
|
|
@@ -28191,7 +28523,7 @@ var listCommand6 = new Command145("list").description(
|
|
|
28191
28523
|
}
|
|
28192
28524
|
}
|
|
28193
28525
|
);
|
|
28194
|
-
var showCommand4 = new
|
|
28526
|
+
var showCommand4 = new Command146("show").description(
|
|
28195
28527
|
"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)"
|
|
28196
28528
|
).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
|
|
28197
28529
|
const choice = templateChoice(value);
|
|
@@ -28214,7 +28546,7 @@ function savedTemplateId(value, verb) {
|
|
|
28214
28546
|
}
|
|
28215
28547
|
return choice.templateId;
|
|
28216
28548
|
}
|
|
28217
|
-
var publishCommand = new
|
|
28549
|
+
var publishCommand = new Command146("publish").description(
|
|
28218
28550
|
"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"
|
|
28219
28551
|
).argument("<templateId>", "Saved template id").action(async (value) => {
|
|
28220
28552
|
const id = savedTemplateId(value, "publish");
|
|
@@ -28225,7 +28557,7 @@ var publishCommand = new Command145("publish").description(
|
|
|
28225
28557
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28226
28558
|
);
|
|
28227
28559
|
});
|
|
28228
|
-
var unpublishCommand = new
|
|
28560
|
+
var unpublishCommand = new Command146("unpublish").description(
|
|
28229
28561
|
"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"
|
|
28230
28562
|
).argument("<templateId>", "Saved template id").action(async (value) => {
|
|
28231
28563
|
const id = savedTemplateId(value, "unpublish");
|
|
@@ -28236,7 +28568,7 @@ var unpublishCommand = new Command145("unpublish").description(
|
|
|
28236
28568
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28237
28569
|
);
|
|
28238
28570
|
});
|
|
28239
|
-
var deleteCommand2 = new
|
|
28571
|
+
var deleteCommand2 = new Command146("delete").description(
|
|
28240
28572
|
"Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
|
|
28241
28573
|
).argument("<templateId>", "Template id").action(async (value) => {
|
|
28242
28574
|
const choice = templateChoice(value);
|
|
@@ -28253,7 +28585,7 @@ var deleteCommand2 = new Command145("delete").description(
|
|
|
28253
28585
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28254
28586
|
);
|
|
28255
28587
|
});
|
|
28256
|
-
var workflowTemplateCommand = new
|
|
28588
|
+
var workflowTemplateCommand = new Command146("template").description(
|
|
28257
28589
|
"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"
|
|
28258
28590
|
).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand4).addCommand(publishCommand).addCommand(unpublishCommand).addCommand(deleteCommand2);
|
|
28259
28591
|
async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
@@ -28453,7 +28785,7 @@ async function read2(path10) {
|
|
|
28453
28785
|
}
|
|
28454
28786
|
}
|
|
28455
28787
|
var createCommand4 = addSuggestionScheduleOptions(
|
|
28456
|
-
new
|
|
28788
|
+
new Command147("create").description(
|
|
28457
28789
|
"Create a schedule that opens a task from the project's budget on a cadence, starts a run of a workflow (--workflow or --workflow-file), or turns the top open suggestions into tasks (--suggestions), as the project's owner. The platform runner creates each task or run under your grant to it, and pays the action fee: grant it first (see `taskmarket project runner`). A slot is skipped while the previous task is open or the previous run is not settled, and failures in a row (3 by default) pause the schedule. A suggestions schedule proposes its picks for you to confirm (`taskmarket project suggestion proposals`) unless --mode auto; it needs --max-spend, --max-reward and --duration. Costs 0.001 in the payment token"
|
|
28458
28790
|
).argument("<projectId>", "Project id").requiredOption(
|
|
28459
28791
|
"--cadence <cadence>",
|
|
@@ -28502,7 +28834,7 @@ var createCommand4 = addSuggestionScheduleOptions(
|
|
|
28502
28834
|
});
|
|
28503
28835
|
});
|
|
28504
28836
|
var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
|
|
28505
|
-
var listCommand7 = new
|
|
28837
|
+
var listCommand7 = new Command147("list").description(
|
|
28506
28838
|
"List a project's schedules, its schedule limits and the platform runner; or, with --mine or --owner, a wallet's schedules across every project it owns, failing ones first, each with its next and last run (free)"
|
|
28507
28839
|
).argument("[projectId]", "Project id (omit with --mine or --owner)").option("--mine", "List the acting wallet's schedules across the projects it owns").option("--owner <address>", "List this wallet's schedules across the projects it owns").option(
|
|
28508
28840
|
"--status <status>",
|
|
@@ -28535,7 +28867,7 @@ var listCommand7 = new Command146("list").description(
|
|
|
28535
28867
|
const query4 = params.toString();
|
|
28536
28868
|
await read2(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
|
|
28537
28869
|
});
|
|
28538
|
-
var showCommand5 = new
|
|
28870
|
+
var showCommand5 = new Command147("show").description(
|
|
28539
28871
|
"Show a schedule (its target, task, workflow or suggestions, with workflowId, template or its suggestions settings) and its newest runs: opened, proposed, skipped with the reason, or failed, each with its task, workflowRunId, proposalId or taskIds (free)"
|
|
28540
28872
|
).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
28541
28873
|
const id = parseScheduleId(value);
|
|
@@ -28543,7 +28875,7 @@ var showCommand5 = new Command146("show").description(
|
|
|
28543
28875
|
await read2(`/api/project-schedules/${id}`);
|
|
28544
28876
|
});
|
|
28545
28877
|
function actionCommand(action, description) {
|
|
28546
|
-
return new
|
|
28878
|
+
return new Command147(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
28547
28879
|
const id = parseScheduleId(value);
|
|
28548
28880
|
if (typeof id !== "string") return void printError(id.error);
|
|
28549
28881
|
await postProjectWrite(
|
|
@@ -28553,7 +28885,7 @@ function actionCommand(action, description) {
|
|
|
28553
28885
|
);
|
|
28554
28886
|
});
|
|
28555
28887
|
}
|
|
28556
|
-
var settingsCommand = new
|
|
28888
|
+
var settingsCommand = new Command147("settings").description(
|
|
28557
28889
|
"Read or set the project's schedule limits, as its owner: the shortest gap between two runs (PT30M to P7D, default PT30M) and the failures in a row that pause a schedule (1 to 10, default 3). Setting costs 0.001 in the payment token; reading is free"
|
|
28558
28890
|
).argument("<projectId>", "Project id").option("--min-interval <duration>", "The shortest gap between runs, as an ISO 8601 duration").option("--pause-after <failures>", "Failures in a row that pause a schedule").action(async (id, opts) => {
|
|
28559
28891
|
const projectId = parseProjectId(id);
|
|
@@ -28575,7 +28907,7 @@ var settingsCommand = new Command146("settings").description(
|
|
|
28575
28907
|
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
28576
28908
|
});
|
|
28577
28909
|
});
|
|
28578
|
-
var projectScheduleCommand = new
|
|
28910
|
+
var projectScheduleCommand = new Command147("schedule").description(
|
|
28579
28911
|
"Schedules: a task from the project's budget on a cadence, a workflow run, or tasks from the top suggestions, created by the platform runner once the project's automations are on (`taskmarket project automations on <projectId> --cap <amount>`)"
|
|
28580
28912
|
).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand5).addCommand(
|
|
28581
28913
|
actionCommand(
|
|
@@ -28598,15 +28930,15 @@ var projectScheduleCommand = new Command146("schedule").description(
|
|
|
28598
28930
|
"Stop automatic payouts and review acceptance on a workflow schedule, for good: every run it starts, and its runs still going, wait for the owner's confirmation; the runner sends nothing. Refused on a schedule that opens tasks (costs 0.001 in the payment token)"
|
|
28599
28931
|
)
|
|
28600
28932
|
).addCommand(settingsCommand).addCommand(suggestionScheduleSettingsCommand);
|
|
28601
|
-
var projectRunnerCommand = new
|
|
28933
|
+
var projectRunnerCommand = new Command147("runner").description(
|
|
28602
28934
|
"Advanced. The platform runner's address on the selected network's chain, and every chain's runner (free). To run schedules and workflows turn automations on instead, `taskmarket project automations on <projectId> --cap <amount>`, which grants the right runner for you. Granting it by hand with `taskmarket project grant` works too; the runner pays each action fee"
|
|
28603
28935
|
).action(async () => {
|
|
28604
28936
|
await read2(withChainId("/api/project-runner"));
|
|
28605
28937
|
});
|
|
28606
28938
|
|
|
28607
28939
|
// src/commands/project/transfer.ts
|
|
28608
|
-
import { Command as
|
|
28609
|
-
var proposeCommand = new
|
|
28940
|
+
import { Command as Command148 } from "commander";
|
|
28941
|
+
var proposeCommand = new Command148("propose").description(
|
|
28610
28942
|
"Propose a new owner for a project, as the project owner (costs 0.001 in the payment token). Nothing changes until that wallet runs `project transfer accept`; a new proposal replaces the old one, and `project transfer cancel` withdraws it. Only an open project can be handed over. On accept, the owner's own share of the project's pool moves to the new owner; other backers' shares never move, and the grants stay"
|
|
28611
28943
|
).argument("<projectId>", "Project id").requiredOption("--to <address>", "The wallet that will own the project once it accepts").action(async (id, opts) => {
|
|
28612
28944
|
const projectId = parseProjectId(id);
|
|
@@ -28620,7 +28952,7 @@ var proposeCommand = new Command147("propose").description(
|
|
|
28620
28952
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28621
28953
|
);
|
|
28622
28954
|
});
|
|
28623
|
-
var acceptCommand2 = new
|
|
28955
|
+
var acceptCommand2 = new Command148("accept").description(
|
|
28624
28956
|
"Take over a project its owner proposed to this wallet (costs 0.001 in the payment token). Read the project first (`project show`): you receive it as it stands, with its grants and tasks, and the previous owner's share of its pool. Only an open project can be accepted"
|
|
28625
28957
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
28626
28958
|
const projectId = parseProjectId(id);
|
|
@@ -28631,7 +28963,7 @@ var acceptCommand2 = new Command147("accept").description(
|
|
|
28631
28963
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28632
28964
|
);
|
|
28633
28965
|
});
|
|
28634
|
-
var cancelCommand = new
|
|
28966
|
+
var cancelCommand = new Command148("cancel").description(
|
|
28635
28967
|
"Withdraw the pending ownership proposal, as the project owner (costs 0.001 in the payment token)"
|
|
28636
28968
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
28637
28969
|
const projectId = parseProjectId(id);
|
|
@@ -28642,13 +28974,13 @@ var cancelCommand = new Command147("cancel").description(
|
|
|
28642
28974
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28643
28975
|
);
|
|
28644
28976
|
});
|
|
28645
|
-
var projectTransferCommand = new
|
|
28977
|
+
var projectTransferCommand = new Command148("transfer").description(
|
|
28646
28978
|
"Hand a project to another wallet in two steps: the owner proposes, the new owner accepts, and the owner can cancel before it does"
|
|
28647
28979
|
).addCommand(proposeCommand).addCommand(acceptCommand2).addCommand(cancelCommand);
|
|
28648
28980
|
|
|
28649
28981
|
// src/commands/project/show.ts
|
|
28650
|
-
import { Command as
|
|
28651
|
-
var projectShowCommand = new
|
|
28982
|
+
import { Command as Command149 } from "commander";
|
|
28983
|
+
var projectShowCommand = new Command149("show").description(
|
|
28652
28984
|
"Show a project: its budget, funding pool, newest backers with what each can claim, grants, tasks and its tasks grouped into chains of versions (free)"
|
|
28653
28985
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
28654
28986
|
const projectId = parseProjectId(id);
|
|
@@ -28657,7 +28989,7 @@ var projectShowCommand = new Command148("show").description(
|
|
|
28657
28989
|
printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
|
|
28658
28990
|
});
|
|
28659
28991
|
var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
|
|
28660
|
-
var projectBackersCommand = new
|
|
28992
|
+
var projectBackersCommand = new Command149("backers").description(
|
|
28661
28993
|
"List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
|
|
28662
28994
|
).argument("<projectId>", "Project id").option("--limit <count>", "Backers per page (1-100, default 50)").option("--before <cursor>", "The next page: the previous page's nextBefore").action(async (id, opts) => {
|
|
28663
28995
|
const projectId = parseProjectId(id);
|
|
@@ -28676,13 +29008,13 @@ var projectBackersCommand = new Command148("backers").description(
|
|
|
28676
29008
|
await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
|
|
28677
29009
|
);
|
|
28678
29010
|
});
|
|
28679
|
-
var projectForTaskCommand = new
|
|
29011
|
+
var projectForTaskCommand = new Command149("for-task").description("The project a task was funded from, or null when it was not (free)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
28680
29012
|
if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
|
|
28681
29013
|
return void printError("The task id must be 0x-prefixed hex");
|
|
28682
29014
|
}
|
|
28683
29015
|
printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
|
|
28684
29016
|
});
|
|
28685
|
-
var projectListCommand = new
|
|
29017
|
+
var projectListCommand = new Command149("list").description(
|
|
28686
29018
|
"List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
|
|
28687
29019
|
).option(
|
|
28688
29020
|
"--funding",
|
|
@@ -28690,8 +29022,17 @@ var projectListCommand = new Command148("list").description(
|
|
|
28690
29022
|
).option(
|
|
28691
29023
|
"--open",
|
|
28692
29024
|
"Only the wallet's projects that are still open (not closed, end date ahead); applied before --limit"
|
|
29025
|
+
).option(
|
|
29026
|
+
"--finished",
|
|
29027
|
+
"Only the wallet's projects that are closed or past their end date; applied before --limit"
|
|
28693
29028
|
).option("--address <address>", "The wallet to list (default: your keystore wallet)").option("--role <role>", "owner, operator, backer or any (any is owner and operator)", "any").option("--limit <count>", "Projects per page (1-100, default 50)").option("--before <projectId>", "The next page: projects with a smaller id than this").action(
|
|
28694
29029
|
async (opts) => {
|
|
29030
|
+
if (opts.open && opts.finished) {
|
|
29031
|
+
return void printError("--open and --finished are opposites; pass one of them");
|
|
29032
|
+
}
|
|
29033
|
+
if (opts.funding && opts.finished) {
|
|
29034
|
+
return void printError("--funding lists open projects; do not combine it with --finished");
|
|
29035
|
+
}
|
|
28695
29036
|
if (opts.funding && opts.address !== void 0) {
|
|
28696
29037
|
return void printError(
|
|
28697
29038
|
"--funding lists every open project; do not combine it with --address"
|
|
@@ -28726,6 +29067,7 @@ var projectListCommand = new Command148("list").description(
|
|
|
28726
29067
|
if (!ADDRESS.test(address3)) return void printError("Invalid Ethereum address for --address");
|
|
28727
29068
|
const params = new URLSearchParams({ address: address3, role: opts.role });
|
|
28728
29069
|
if (opts.open) params.set("status", "open");
|
|
29070
|
+
if (opts.finished) params.set("status", "finished");
|
|
28729
29071
|
if (opts.limit !== void 0) params.set("limit", opts.limit.trim());
|
|
28730
29072
|
if (before !== void 0) params.set("before", String(before));
|
|
28731
29073
|
printResult(await apiGet(withChainId(`/api/projects?${params.toString()}`)));
|
|
@@ -28733,7 +29075,7 @@ var projectListCommand = new Command148("list").description(
|
|
|
28733
29075
|
);
|
|
28734
29076
|
|
|
28735
29077
|
// src/commands/project/index.ts
|
|
28736
|
-
var projectCommand = new
|
|
29078
|
+
var projectCommand = new Command150("project").description(
|
|
28737
29079
|
"Projects: one crowdfunded budget that funds tasks of any mode, spent by its owner and the operators it grants; anyone may back an open project, and backers claim back what is left"
|
|
28738
29080
|
);
|
|
28739
29081
|
projectCommand.addCommand(projectCreateCommand);
|
|
@@ -28764,7 +29106,7 @@ projectCommand.addCommand(projectForTaskCommand);
|
|
|
28764
29106
|
|
|
28765
29107
|
// src/commands/workflow.ts
|
|
28766
29108
|
import { readFile as readFile5 } from "fs/promises";
|
|
28767
|
-
import { Command as
|
|
29109
|
+
import { Command as Command151 } from "commander";
|
|
28768
29110
|
var UUID4 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
28769
29111
|
var FILE_MAX_BYTES2 = 256 * 1024;
|
|
28770
29112
|
function parseWorkflowText(text) {
|
|
@@ -28828,7 +29170,7 @@ async function projectContext(projectId) {
|
|
|
28828
29170
|
runner
|
|
28829
29171
|
};
|
|
28830
29172
|
}
|
|
28831
|
-
var validateCommand = new
|
|
29173
|
+
var validateCommand = new Command151("validate").description(
|
|
28832
29174
|
"Check a workflow document (JSON) before anything is spent: the patterns, ids, named inputs and outputs, bounds (maxItems, maxRounds, maxAttempts), contest modes, branch conditions and gate conditions; with --project, also the project step limit and the worst-case spend (every branch on its costliest case, every fallback attempt) against the project's available budget and the runner grant's remaining cap. Every error names a JSON pointer, a code and a message (free)"
|
|
28833
29175
|
).argument("[file]", "The document, JSON (or pass --file)").option("--file <path>", "The document, JSON").option("--project <projectId>", "Check it against this project").action(async (file, opts) => {
|
|
28834
29176
|
const parsed = await readDocument(opts.file ?? file);
|
|
@@ -28871,7 +29213,7 @@ var validateCommand = new Command150("validate").description(
|
|
|
28871
29213
|
document: result.document
|
|
28872
29214
|
});
|
|
28873
29215
|
});
|
|
28874
|
-
var createCommand5 = new
|
|
29216
|
+
var createCommand5 = new Command151("create").description(
|
|
28875
29217
|
"Create a workflow on a project, as its owner, from a JSON document (--file) or from a saved template, an official template or a preset (--template <id|official:slug|preset> with --param name=value for each value; a parameter left out takes its default). The API validates it again, worst case included, before saving; nothing runs until `taskmarket workflow run`. Grant the platform runner first (`taskmarket project runner`). Costs 0.001 in the payment token"
|
|
28876
29218
|
).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
|
|
28877
29219
|
"--template <template>",
|
|
@@ -28914,7 +29256,7 @@ var createCommand5 = new Command150("create").description(
|
|
|
28914
29256
|
);
|
|
28915
29257
|
});
|
|
28916
29258
|
var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
|
|
28917
|
-
var listCommand8 = new
|
|
29259
|
+
var listCommand8 = new Command151("list").description(
|
|
28918
29260
|
"List a project's workflows, newest first, with its workflow limits and the platform runner; or, with --mine or --owner, a wallet's workflows across every project it owns, those waiting on the owner first (free)"
|
|
28919
29261
|
).argument("[projectId]", "Project id (omit with --mine or --owner)").option("--mine", "List the acting wallet's workflows across the projects it owns").option("--owner <address>", "List this wallet's workflows across the projects it owns").option(
|
|
28920
29262
|
"--status <status>",
|
|
@@ -28944,7 +29286,7 @@ var listCommand8 = new Command150("list").description(
|
|
|
28944
29286
|
const query4 = params.toString();
|
|
28945
29287
|
await read3(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
|
|
28946
29288
|
});
|
|
28947
|
-
var showCommand6 = new
|
|
29289
|
+
var showCommand6 = new Command151("show").description(
|
|
28948
29290
|
"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)"
|
|
28949
29291
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
28950
29292
|
const id = uuid(value, "workflow");
|
|
@@ -28957,7 +29299,7 @@ var showCommand6 = new Command150("show").description(
|
|
|
28957
29299
|
renderFailure(err);
|
|
28958
29300
|
}
|
|
28959
29301
|
});
|
|
28960
|
-
var updateTemplateCommand = new
|
|
29302
|
+
var updateTemplateCommand = new Command151("update-template").description(
|
|
28961
29303
|
"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"
|
|
28962
29304
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
28963
29305
|
const id = uuid(value, "workflow");
|
|
@@ -28968,7 +29310,7 @@ var updateTemplateCommand = new Command150("update-template").description(
|
|
|
28968
29310
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28969
29311
|
);
|
|
28970
29312
|
});
|
|
28971
|
-
var updateStepsCommand = new
|
|
29313
|
+
var updateStepsCommand = new Command151("update-steps").description(
|
|
28972
29314
|
"Replace a saved workflow's steps with a new JSON document (--file), as the project owner. The API checks it against the project as it checks a new workflow (step limit, worst case against the budget). Runs already started keep the steps they started with; the new steps apply to runs started afterwards. A workflow made from a template becomes hand-written, so update-template no longer applies to it. Get the current document with `workflow show`. Costs 0.001 in the payment token"
|
|
28973
29315
|
).argument("<workflowId>", "Workflow id").option("--file <path>", "The new document, JSON").action(async (value, opts) => {
|
|
28974
29316
|
const id = uuid(value, "workflow");
|
|
@@ -28990,7 +29332,7 @@ var updateStepsCommand = new Command150("update-steps").description(
|
|
|
28990
29332
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28991
29333
|
);
|
|
28992
29334
|
});
|
|
28993
|
-
var runsCommand = new
|
|
29335
|
+
var runsCommand = new Command151("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) => {
|
|
28994
29336
|
const id = uuid(value, "workflow");
|
|
28995
29337
|
if (typeof id !== "string") return void printError(id.error);
|
|
28996
29338
|
if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
|
|
@@ -29002,14 +29344,14 @@ var runsCommand = new Command150("runs").description("Page through a workflow's
|
|
|
29002
29344
|
const query4 = params.toString();
|
|
29003
29345
|
await read3(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
|
|
29004
29346
|
});
|
|
29005
|
-
var statusCommand3 = new
|
|
29347
|
+
var statusCommand3 = new Command151("status").description(
|
|
29006
29348
|
"Show a run: its outline, each step with its state (pending, open, accepted, failed or skipped), round, item or attempt, autoAccept for a gating review the runner accepts itself, and the next action (free)"
|
|
29007
29349
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
29008
29350
|
const id = uuid(value, "run");
|
|
29009
29351
|
if (typeof id !== "string") return void printError(id.error);
|
|
29010
29352
|
await read3(`/api/project-workflow-runs/${id}`);
|
|
29011
29353
|
});
|
|
29012
|
-
var runCommand2 = new
|
|
29354
|
+
var runCommand2 = new Command151("run").description(
|
|
29013
29355
|
"Start a run of a workflow, as the project's owner. The API checks the worst case against the budget and the runner grant's cap again; then the platform runner creates each step's task when it is ready and you review them as usual. Costs 0.001 in the payment token"
|
|
29014
29356
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
29015
29357
|
const id = uuid(value, "workflow");
|
|
@@ -29021,7 +29363,7 @@ var runCommand2 = new Command150("run").description(
|
|
|
29021
29363
|
);
|
|
29022
29364
|
});
|
|
29023
29365
|
function stepCommand(action, description) {
|
|
29024
|
-
return new
|
|
29366
|
+
return new Command151(action).description(description).argument("<runId>", "Run id").requiredOption(
|
|
29025
29367
|
"--step <key>",
|
|
29026
29368
|
"The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
|
|
29027
29369
|
).action(async (value, opts) => {
|
|
@@ -29036,7 +29378,7 @@ function stepCommand(action, description) {
|
|
|
29036
29378
|
);
|
|
29037
29379
|
});
|
|
29038
29380
|
}
|
|
29039
|
-
var cancelCommand2 = new
|
|
29381
|
+
var cancelCommand2 = new Command151("cancel").description(
|
|
29040
29382
|
"Cancel a run, as the owner: nothing more is created, and tasks it opened stay open until they end or you cancel them. Costs 0.001 in the payment token"
|
|
29041
29383
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
29042
29384
|
const id = uuid(value, "run");
|
|
@@ -29047,7 +29389,7 @@ var cancelCommand2 = new Command150("cancel").description(
|
|
|
29047
29389
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
29048
29390
|
);
|
|
29049
29391
|
});
|
|
29050
|
-
var stopAutoPayoutCommand = new
|
|
29392
|
+
var stopAutoPayoutCommand = new Command151("stop-auto-payout").description(
|
|
29051
29393
|
"Stop automatic payouts and automatic review acceptance on a run, as the owner, at once and for good: from then on every pending step's review waits for you to accept it and every payout becomes a proposal you confirm (`taskmarket workflow payout confirm`); the runner sends nothing. A second stop changes nothing; refused on a completed or cancelled run. Costs 0.001 in the payment token"
|
|
29052
29394
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
29053
29395
|
const id = uuid(value, "run");
|
|
@@ -29058,7 +29400,7 @@ var stopAutoPayoutCommand = new Command150("stop-auto-payout").description(
|
|
|
29058
29400
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
29059
29401
|
);
|
|
29060
29402
|
});
|
|
29061
|
-
var deleteCommand3 = new
|
|
29403
|
+
var deleteCommand3 = new Command151("delete").description(
|
|
29062
29404
|
"Delete a workflow, as the owner, so it no longer counts toward the project limit of 50. Refused while a run is running or failed (cancel it first); ended runs go with it, and tasks they opened are not touched. Costs 0.001 in the payment token"
|
|
29063
29405
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
29064
29406
|
const id = uuid(value, "workflow");
|
|
@@ -29080,21 +29422,21 @@ async function ownerRead(path10) {
|
|
|
29080
29422
|
renderFailure(err);
|
|
29081
29423
|
}
|
|
29082
29424
|
}
|
|
29083
|
-
var payoutListCommand = new
|
|
29425
|
+
var payoutListCommand = new Command151("list").description(
|
|
29084
29426
|
"A run's payout proposals: what each accepted gating review recommends paying on the task it gates, with the exact accept confirming sends; visible to the project's owner and operators only (signed with your wallet); status is pending, confirmed, auto_paid (payout: auto, with mode, txHash and intentId), accepted_by_owner (the gated task was accepted by hand before the automatic payout landed; the runner paid nothing) or unavailable (free). `kind` is payout, or refund when the review recommended nothing (an empty payout): the entries are rejected and the task cancelled, `refund` lists the entries. A payout: auto proposal is held until `holdUntil` for entrants to object (`objections` lists each one); `evidence` holds the check results of the recommendation"
|
|
29085
29427
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
29086
29428
|
const id = uuid(value, "run");
|
|
29087
29429
|
if (typeof id !== "string") return void printError(id.error);
|
|
29088
29430
|
await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
|
|
29089
29431
|
});
|
|
29090
|
-
var payoutShowCommand = new
|
|
29432
|
+
var payoutShowCommand = new Command151("show").description(
|
|
29091
29433
|
'Show a payout proposal: its status (pending, confirmed, auto_paid, accepted_by_owner or unavailable), mode, txHash and intentId once sent, the ranking and rationale, and `accept`, the winners and shares (basis points) confirming sends. A `kind: "refund"` proposal has `refund` instead: the entries rejected before the gated task is cancelled, returning its reward to the project budget. `holdUntil` is when a held automatic payout is sent, `objections` the entrants who objected (worker, reason, at) and `evidence` the per-entry checks of the recommendation, log file names and hash. Owner and operators, and an entrant of the gated task while the proposal is held (free)'
|
|
29092
29434
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
29093
29435
|
const id = uuid(value, "payout proposal");
|
|
29094
29436
|
if (typeof id !== "string") return void printError(id.error);
|
|
29095
29437
|
await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
|
|
29096
29438
|
});
|
|
29097
|
-
var payoutConfirmCommand = new
|
|
29439
|
+
var payoutConfirmCommand = new Command151("confirm").description(
|
|
29098
29440
|
'Confirm a pending payout proposal, as the project\'s owner: sends exactly the accept it shows (`taskmarket workflow payout show` prints the winners and shares first), paying the gated task out. Refused unless the proposal is pending (an auto_paid one was already sent by the runner). Costs the accept, paid like `task accept-submissions`. A `kind: "refund"` proposal (the review recommended nothing) is confirmed the same way, but costs one action fee and the platform runner then rejects every active entry of the gated task and cancels it, returning the reward to the project budget; its status turns confirmed, then reads Refunded in `reason` once the task is cancelled'
|
|
29099
29441
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
29100
29442
|
const id = uuid(value, "payout proposal");
|
|
@@ -29121,7 +29463,7 @@ var payoutConfirmCommand = new Command150("confirm").description(
|
|
|
29121
29463
|
}
|
|
29122
29464
|
);
|
|
29123
29465
|
});
|
|
29124
|
-
var payoutObjectCommand = new
|
|
29466
|
+
var payoutObjectCommand = new Command151("object").description(
|
|
29125
29467
|
`Object to an automatic payout or refund held for objections, as an entrant of the gated task (a wallet with an active submission on it; \`payout.pending_auto\` tells you when a hold starts, with the proposal id). Once per proposal, while the hold is open (\`holdUntil\` in \`payout show\`). The proposal then waits for the owner to confirm it and the owner is told. Needs --reason (1 to ${WORKFLOW_OBJECTION_REASON_MAX} characters). Free; signed with your wallet`
|
|
29126
29468
|
).argument("<proposalId>", "Payout proposal id").requiredOption("--reason <text>", "Why you object, shown to the owner").action(async (value, opts) => {
|
|
29127
29469
|
const id = uuid(value, "payout proposal");
|
|
@@ -29145,10 +29487,10 @@ var payoutObjectCommand = new Command150("object").description(
|
|
|
29145
29487
|
renderFailure(err);
|
|
29146
29488
|
}
|
|
29147
29489
|
});
|
|
29148
|
-
var payoutCommand = new
|
|
29490
|
+
var payoutCommand = new Command151("payout").description(
|
|
29149
29491
|
"Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
|
|
29150
29492
|
).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand).addCommand(payoutObjectCommand);
|
|
29151
|
-
var settingsCommand2 = new
|
|
29493
|
+
var settingsCommand2 = new Command151("settings").description(
|
|
29152
29494
|
`Read or set the project's workflow step limit, as its owner: the most task steps one workflow may hold (${WORKFLOW_STEP_LIMIT_MIN} to ${WORKFLOW_STEP_LIMIT_MAX}, default 6). Setting costs 0.001 in the payment token; reading is free`
|
|
29153
29495
|
).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
|
|
29154
29496
|
const projectId = parseProjectId(id);
|
|
@@ -29179,7 +29521,7 @@ var settingsCommand2 = new Command150("settings").description(
|
|
|
29179
29521
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
29180
29522
|
);
|
|
29181
29523
|
});
|
|
29182
|
-
var workflowCommand = new
|
|
29524
|
+
var workflowCommand = new Command151("workflow").description(
|
|
29183
29525
|
"Workflows: project tasks composed from named patterns (sequence, parallel, forEach, reviewLoop, gate, contest, branch, fallback), run by the platform runner under your grant to it. A gate waits for your approval, a step verdict or a time. A workflow is the document; a run is one execution of it"
|
|
29184
29526
|
).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand6).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
|
|
29185
29527
|
stepCommand(
|
|
@@ -29194,8 +29536,8 @@ var workflowCommand = new Command150("workflow").description(
|
|
|
29194
29536
|
).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(updateStepsCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
|
|
29195
29537
|
|
|
29196
29538
|
// src/commands/drops.ts
|
|
29197
|
-
import { Command as
|
|
29198
|
-
var listCommand9 = new
|
|
29539
|
+
import { Command as Command152 } from "commander";
|
|
29540
|
+
var listCommand9 = new Command152("list").description("List public Task Drops, ones accepting work first").option("--limit <n>", "Maximum drops to return (1-48)", "24").option("--cursor <cursor>", "nextCursor from a previous page").option("--status <status>", "ended: only drops no longer accepting work, newest first").option("--worker <address>", "Only drops this wallet entered (a submission, pitch or bid)").option("--entered", "Only drops your wallet entered (--worker with your own address)").action(
|
|
29199
29541
|
async (opts) => {
|
|
29200
29542
|
try {
|
|
29201
29543
|
if (opts.worker && opts.entered) throw new Error("Pass --worker or --entered, not both");
|
|
@@ -29223,7 +29565,7 @@ var listCommand9 = new Command151("list").description("List public Task Drops, o
|
|
|
29223
29565
|
}
|
|
29224
29566
|
}
|
|
29225
29567
|
);
|
|
29226
|
-
var showCommand7 = new
|
|
29568
|
+
var showCommand7 = new Command152("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
|
|
29227
29569
|
try {
|
|
29228
29570
|
const input = parseInput(TaskDropGetInputSchema, { taskDropId });
|
|
29229
29571
|
const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
|
|
@@ -29235,7 +29577,7 @@ var showCommand7 = new Command151("show").description("Show a Task Drop and its
|
|
|
29235
29577
|
renderFailure(err);
|
|
29236
29578
|
}
|
|
29237
29579
|
});
|
|
29238
|
-
var subscribeCommand = new
|
|
29580
|
+
var subscribeCommand = new Command152("subscribe").description("Subscribe an email to one Task Drop, or with --official to every official drop").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to notify").option("--official", "Subscribe to all official Task Drops").option("--wallet <address>", "Wallet address to associate with the subscription").action(
|
|
29239
29581
|
async (taskDropId, opts) => {
|
|
29240
29582
|
try {
|
|
29241
29583
|
if (opts.official) {
|
|
@@ -29263,7 +29605,7 @@ var subscribeCommand = new Command151("subscribe").description("Subscribe an ema
|
|
|
29263
29605
|
}
|
|
29264
29606
|
}
|
|
29265
29607
|
);
|
|
29266
|
-
var statusCommand4 = new
|
|
29608
|
+
var statusCommand4 = new Command152("status").description("Check whether an email is subscribed to a Task Drop, or with --official to all").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to check").option("--official", "Check the all-official-drops subscription").action(async (taskDropId, opts) => {
|
|
29267
29609
|
try {
|
|
29268
29610
|
if (opts.official) {
|
|
29269
29611
|
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
@@ -29280,17 +29622,17 @@ var statusCommand4 = new Command151("status").description("Check whether an emai
|
|
|
29280
29622
|
renderFailure(err);
|
|
29281
29623
|
}
|
|
29282
29624
|
});
|
|
29283
|
-
var dropsCommand = new
|
|
29625
|
+
var dropsCommand = new Command152("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand7).addCommand(subscribeCommand).addCommand(statusCommand4);
|
|
29284
29626
|
|
|
29285
29627
|
// src/commands/hooks.ts
|
|
29286
29628
|
import { mkdir, readFile as readFile7, writeFile } from "fs/promises";
|
|
29287
29629
|
import path9 from "path";
|
|
29288
|
-
import { Command as
|
|
29630
|
+
import { Command as Command154 } from "commander";
|
|
29289
29631
|
import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
|
|
29290
29632
|
|
|
29291
29633
|
// src/lib/listing-submissions.ts
|
|
29292
29634
|
import { readFile as readFile6 } from "fs/promises";
|
|
29293
|
-
import { Command as
|
|
29635
|
+
import { Command as Command153 } from "commander";
|
|
29294
29636
|
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.";
|
|
29295
29637
|
function prepareListingFile(kind, text) {
|
|
29296
29638
|
if (Buffer.byteLength(text, "utf8") > LISTING_SUBMISSION_MAX_BYTES) {
|
|
@@ -29347,7 +29689,7 @@ function prepareListingFile(kind, text) {
|
|
|
29347
29689
|
}
|
|
29348
29690
|
function submitCommandFor(kind) {
|
|
29349
29691
|
const what = kind === "catalog" ? "catalog entry (kind x402-endpoint)" : "hook manifest";
|
|
29350
|
-
return new
|
|
29692
|
+
return new Command153("submit").description(
|
|
29351
29693
|
`Submit a ${what} for staff review. Pays the standard action fee, kept either way; needs an ERC-8004 identity on the selected network`
|
|
29352
29694
|
).requiredOption("--file <path>", `Path to the ${what} JSON file`).action(async (opts) => {
|
|
29353
29695
|
let text;
|
|
@@ -29368,18 +29710,21 @@ function submitCommandFor(kind) {
|
|
|
29368
29710
|
"listing-submission",
|
|
29369
29711
|
listingSubmissionWriteChange(kind, subject, signed)
|
|
29370
29712
|
);
|
|
29371
|
-
const
|
|
29713
|
+
const outcome = await x402FeePost(
|
|
29372
29714
|
kind === "catalog" ? "/api/catalog/submissions" : "/api/hooks/submissions",
|
|
29373
29715
|
{ chainId: selectedNetwork().chainId, ...body, ...proof }
|
|
29374
29716
|
);
|
|
29375
|
-
printResult(
|
|
29717
|
+
printResult(
|
|
29718
|
+
{ ...outcome.data, ...replayedFields(outcome), notice: NOTICE },
|
|
29719
|
+
{ idempotencyKey: outcome.idempotencyKey }
|
|
29720
|
+
);
|
|
29376
29721
|
} catch (error) {
|
|
29377
29722
|
return renderFailure(error);
|
|
29378
29723
|
}
|
|
29379
29724
|
});
|
|
29380
29725
|
}
|
|
29381
29726
|
function submissionsCommandFor(kind) {
|
|
29382
|
-
return new
|
|
29727
|
+
return new Command153("submissions").description(
|
|
29383
29728
|
`List the ${kind === "catalog" ? "catalog entries" : "hook listings"} you submitted and their status`
|
|
29384
29729
|
).option("--status <status>", `Only this status: ${LISTING_SUBMISSION_STATUSES.join(", ")}`).option("--limit <n>", "Maximum submissions to return (1-100)", "50").action(async (opts) => {
|
|
29385
29730
|
if (opts.status && !LISTING_SUBMISSION_STATUSES.includes(opts.status)) {
|
|
@@ -29523,7 +29868,7 @@ async function probeHookVersion(entry, chainId) {
|
|
|
29523
29868
|
return reverted ? { ...entry, hookVersion: 1 } : entry;
|
|
29524
29869
|
}
|
|
29525
29870
|
}
|
|
29526
|
-
var listCommand10 = new
|
|
29871
|
+
var listCommand10 = new Command154("list").description(
|
|
29527
29872
|
"List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
|
|
29528
29873
|
).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(
|
|
29529
29874
|
"--cursor <cursor>",
|
|
@@ -29562,7 +29907,7 @@ var listCommand10 = new Command153("list").description(
|
|
|
29562
29907
|
}
|
|
29563
29908
|
}
|
|
29564
29909
|
);
|
|
29565
|
-
var showCommand8 = new
|
|
29910
|
+
var showCommand8 = new Command154("show").description(
|
|
29566
29911
|
"Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
|
|
29567
29912
|
).argument("<address>", "Hook contract address").action(async (address3) => {
|
|
29568
29913
|
try {
|
|
@@ -29582,7 +29927,7 @@ var showCommand8 = new Command153("show").description(
|
|
|
29582
29927
|
renderFailure(err);
|
|
29583
29928
|
}
|
|
29584
29929
|
});
|
|
29585
|
-
var encodeConfigCommand = new
|
|
29930
|
+
var encodeConfigCommand = new Command154("encode-config").description(
|
|
29586
29931
|
"Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
|
|
29587
29932
|
).argument("<address>", "Hook contract address").requiredOption(
|
|
29588
29933
|
"--values <json>",
|
|
@@ -29611,7 +29956,7 @@ var encodeConfigCommand = new Command153("encode-config").description(
|
|
|
29611
29956
|
renderFailure(err);
|
|
29612
29957
|
}
|
|
29613
29958
|
});
|
|
29614
|
-
var attachmentConfigCommand = new
|
|
29959
|
+
var attachmentConfigCommand = new Command154("attachment-config").description(
|
|
29615
29960
|
"Show the protocol-default hook order and maximum hooks per task on the selected --network"
|
|
29616
29961
|
).action(async () => {
|
|
29617
29962
|
try {
|
|
@@ -29671,7 +30016,7 @@ async function hookBuildChoices(opts) {
|
|
|
29671
30016
|
fields
|
|
29672
30017
|
};
|
|
29673
30018
|
}
|
|
29674
|
-
var buildCommand = new
|
|
30019
|
+
var buildCommand = new Command154("build").description(
|
|
29675
30020
|
"Build a Task Hook V2 manifest (schema 2.0.0) and a BaseTMPHookV2 Solidity scaffold from the choices the web hook builder offers (taskmarket.dev/hooks/build). Prints one JSON envelope with 'manifest', 'solidity', 'ready' and 'problems' (what the manifest still needs before it can be submitted)"
|
|
29676
30021
|
).option(
|
|
29677
30022
|
"--input <file>",
|
|
@@ -29716,16 +30061,16 @@ var buildCommand = new Command153("build").description(
|
|
|
29716
30061
|
renderFailure(err);
|
|
29717
30062
|
}
|
|
29718
30063
|
});
|
|
29719
|
-
var hooksCommand = new
|
|
30064
|
+
var hooksCommand = new Command154("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand8).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand).addCommand(buildCommand).addCommand(submitCommandFor("hook")).addCommand(submissionsCommandFor("hook"));
|
|
29720
30065
|
|
|
29721
30066
|
// src/commands/catalog/index.ts
|
|
29722
|
-
import { Command as
|
|
29723
|
-
var catalogCommand = new
|
|
30067
|
+
import { Command as Command155 } from "commander";
|
|
30068
|
+
var catalogCommand = new Command155("catalog").description("Submit paid endpoints to the Taskmarket catalog and track your submissions").addCommand(submitCommandFor("catalog")).addCommand(submissionsCommandFor("catalog"));
|
|
29724
30069
|
|
|
29725
30070
|
// src/commands/tap.ts
|
|
29726
|
-
import { promises as
|
|
29727
|
-
import { Command as
|
|
29728
|
-
var tapCommand = new
|
|
30071
|
+
import { promises as fs13 } from "fs";
|
|
30072
|
+
import { Command as Command156 } from "commander";
|
|
30073
|
+
var tapCommand = new Command156("tap").description(
|
|
29729
30074
|
"Manage the TAP signing key used on tasks that require TAP verification"
|
|
29730
30075
|
);
|
|
29731
30076
|
tapCommand.command("import").description(
|
|
@@ -29745,7 +30090,7 @@ tapCommand.command("import").description(
|
|
|
29745
30090
|
try {
|
|
29746
30091
|
const keyId = validateTapKeyId(opts.keyId);
|
|
29747
30092
|
const signatureAgent = opts.signatureAgent === void 0 ? void 0 : validateTapSignatureAgent(opts.signatureAgent);
|
|
29748
|
-
const text = opts.keyFile === "-" ? await textOrStdin("-") : await
|
|
30093
|
+
const text = opts.keyFile === "-" ? await textOrStdin("-") : await fs13.readFile(opts.keyFile, "utf8");
|
|
29749
30094
|
if (!text) throw new Error("No TAP key given: pass --key-file <path> or pipe it on stdin");
|
|
29750
30095
|
const key = parseTapPrivateKey(text, opts.alg);
|
|
29751
30096
|
const keystore = await loadKeystore();
|
|
@@ -29808,10 +30153,10 @@ tapCommand.command("create").description(
|
|
|
29808
30153
|
}
|
|
29809
30154
|
});
|
|
29810
30155
|
tapCommand.command("enrol").description(
|
|
29811
|
-
"Enrol the stored TAP key
|
|
30156
|
+
"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."
|
|
29812
30157
|
).option(
|
|
29813
30158
|
"--force",
|
|
29814
|
-
"Enrol a key already enrolled
|
|
30159
|
+
"Enrol a key this CLI already enrolled on this chain again; the server replaces its previous key there"
|
|
29815
30160
|
).action(async (opts) => {
|
|
29816
30161
|
try {
|
|
29817
30162
|
const keystore = await loadKeystore();
|
|
@@ -29827,15 +30172,15 @@ tapCommand.command("enrol").description(
|
|
|
29827
30172
|
`The TAP key already has key id ${stored.keyId}. Pass --force to enrol it again.`
|
|
29828
30173
|
);
|
|
29829
30174
|
}
|
|
29830
|
-
if (stored.keyId !== null &&
|
|
30175
|
+
if (stored.keyId !== null && stored.chainId !== chainId) {
|
|
29831
30176
|
throw new Error(
|
|
29832
|
-
`The TAP key's key id ${stored.keyId} was not enrolled
|
|
30177
|
+
`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.`
|
|
29833
30178
|
);
|
|
29834
30179
|
}
|
|
29835
30180
|
const enrolment = await enrolTapKey(stored, chainId);
|
|
29836
30181
|
const tapKey = withTapEnrolment(stored, enrolment);
|
|
29837
30182
|
await saveKeystore({ ...keystore, tapKey });
|
|
29838
|
-
printResult(
|
|
30183
|
+
printResult(tapKeySummary(tapKey));
|
|
29839
30184
|
} catch (err) {
|
|
29840
30185
|
renderFailure(err);
|
|
29841
30186
|
}
|
|
@@ -29897,7 +30242,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
|
|
|
29897
30242
|
});
|
|
29898
30243
|
|
|
29899
30244
|
// src/commands/hire.ts
|
|
29900
|
-
import { Command as
|
|
30245
|
+
import { Command as Command157 } from "commander";
|
|
29901
30246
|
var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
|
|
29902
30247
|
async function lookupListedService(worker, serviceId) {
|
|
29903
30248
|
let listing;
|
|
@@ -29935,7 +30280,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
|
|
|
29935
30280
|
}
|
|
29936
30281
|
return null;
|
|
29937
30282
|
}
|
|
29938
|
-
var hireCommand = new
|
|
30283
|
+
var hireCommand = new Command157("hire").description(
|
|
29939
30284
|
"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."
|
|
29940
30285
|
).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(
|
|
29941
30286
|
"--requires-evaluator",
|
|
@@ -30003,9 +30348,14 @@ hireCommand.action(async (worker, opts) => {
|
|
|
30003
30348
|
// src/index.ts
|
|
30004
30349
|
var require2 = createRequire(import.meta.url);
|
|
30005
30350
|
var { version } = require2("../package.json");
|
|
30006
|
-
var program = new
|
|
30351
|
+
var program = new Command158();
|
|
30007
30352
|
setLastErrorCliVersion(version);
|
|
30008
|
-
program.name("taskmarket").description(
|
|
30353
|
+
program.name("taskmarket").description(
|
|
30354
|
+
"Taskmarket CLI for AI agents: find paid tasks, deliver work and get paid to your own wallet, or post tasks and hire workers."
|
|
30355
|
+
).version(version).addHelpText(
|
|
30356
|
+
"after",
|
|
30357
|
+
"\nNew here? Run `taskmarket --network <name> init` once, then `taskmarket start` at the top of every session. Envelopes carry a `next` field: commands to run and requests to relay to your human."
|
|
30358
|
+
);
|
|
30009
30359
|
program.option(
|
|
30010
30360
|
"--network <name>",
|
|
30011
30361
|
`Network to use, by name or chain id: ${NETWORK_NAMES.join(", ")} (else TASKMARKET_NETWORK, then the keystore's network; there is no default). 'all' lists tasks on every chain and works only with task list and task search`
|
|
@@ -30032,6 +30382,7 @@ program.option(
|
|
|
30032
30382
|
setSelectedNetwork(selected);
|
|
30033
30383
|
});
|
|
30034
30384
|
program.addCommand(initCommand);
|
|
30385
|
+
program.addCommand(startCommand);
|
|
30035
30386
|
program.addCommand(walletCommand);
|
|
30036
30387
|
program.addCommand(addressCommand);
|
|
30037
30388
|
program.addCommand(identityCommand);
|