@lucid-agents/taskmarket 1.32.0 → 1.33.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-E5UZ2QWE.js → api-J7LB2GAY.js} +2 -2
- package/dist/{channels-347BLVQI.js → channels-XY4SSEBG.js} +4 -4
- package/dist/{chunk-NFSTIKPI.js → chunk-ACKPSLIR.js} +2 -2
- package/dist/{chunk-FJ4EPHIN.js → chunk-ALTIKIGD.js} +1 -1
- package/dist/{chunk-R6QEAGHK.js → chunk-BESAWMVS.js} +1 -1
- package/dist/{chunk-OUUCDNIE.js → chunk-E7HZKIUP.js} +3 -3
- package/dist/{chunk-TSMFV7XG.js → chunk-JZ3SUHWV.js} +3 -3
- package/dist/{chunk-YSOV3WQK.js → chunk-KGU3CSYK.js} +8 -8
- package/dist/{chunk-OUV2RQSB.js → chunk-QQ4PHAPV.js} +1 -1
- package/dist/{chunk-34AFGDDW.js → chunk-QUIWYQZL.js} +2 -1
- package/dist/{chunk-6WOUTOR4.js → chunk-TZH4XU62.js} +2 -0
- package/dist/{chunk-XFCZYEKA.js → chunk-VW7I7J5Q.js} +5 -5
- package/dist/{chunk-EDZKOEOY.js → chunk-WVHSHZBK.js} +3 -3
- package/dist/{chunk-QVP3VXGD.js → chunk-YUYW5N4U.js} +1 -1
- package/dist/{doctor-BCC7R7AE.js → doctor-LHFMQ737.js} +8 -8
- package/dist/index.js +393 -219
- package/dist/{launch-BGOVTUPV.js → launch-B2KFGY2L.js} +11 -11
- package/dist/pi-extensions/xgate.cjs +2 -0
- package/dist/{read-auth-IBJWXGFC.js → read-auth-P2WTHPWW.js} +3 -3
- package/dist/{reconcile-CSMSM4OC.js → reconcile-7AIMC4P3.js} +4 -4
- package/dist/{status-O6GBRFDB.js → status-6EYEBSQ6.js} +8 -8
- package/dist/{sync-pull-765XDDFN.js → sync-pull-XSIEQDGD.js} +4 -4
- package/dist/{task-access-grants-H3RJAJ32.js → task-access-grants-Z32WK3FJ.js} +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
listWorkerSubmissions,
|
|
14
14
|
submitTaskFiles,
|
|
15
15
|
taskRequirementsOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KGU3CSYK.js";
|
|
17
17
|
import {
|
|
18
18
|
ComputeCreditError,
|
|
19
19
|
applyComputeCreditSetup,
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
refusedPaidWrite,
|
|
36
36
|
releasePendingComputePurchase,
|
|
37
37
|
resolvePendingComputePurchases
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WVHSHZBK.js";
|
|
39
39
|
import {
|
|
40
40
|
signReadAuth
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ACKPSLIR.js";
|
|
42
42
|
import {
|
|
43
43
|
saveTaskAccessGrant,
|
|
44
44
|
taskAccessGrantHeaders
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-YUYW5N4U.js";
|
|
46
46
|
import {
|
|
47
47
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
48
48
|
X402PayError,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
setX402PolicyRuleEnabled,
|
|
61
61
|
signSponsoredTempoTransfer,
|
|
62
62
|
signTaskmarketFeePayment
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-QQ4PHAPV.js";
|
|
64
64
|
import {
|
|
65
65
|
ALL_NETWORKS,
|
|
66
66
|
ApiError,
|
|
@@ -96,6 +96,7 @@ import {
|
|
|
96
96
|
keystoreExists,
|
|
97
97
|
liveNetworkNames,
|
|
98
98
|
loadKeystore,
|
|
99
|
+
networkNameForChain,
|
|
99
100
|
networkToStamp,
|
|
100
101
|
parseTapPrivateKey,
|
|
101
102
|
paymentProtocolOf,
|
|
@@ -121,7 +122,7 @@ import {
|
|
|
121
122
|
withErrorContext,
|
|
122
123
|
withIdempotentWrite,
|
|
123
124
|
withTapSignature
|
|
124
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-QUIWYQZL.js";
|
|
125
126
|
import {
|
|
126
127
|
AGENT_AVATAR_MAX_BYTES,
|
|
127
128
|
AGENT_HIRES_ROLES,
|
|
@@ -336,7 +337,7 @@ import {
|
|
|
336
337
|
vaultCallGasLimit7702,
|
|
337
338
|
verifierProviderId,
|
|
338
339
|
verifiersUnsupportedOnChain
|
|
339
|
-
} from "./chunk-
|
|
340
|
+
} from "./chunk-TZH4XU62.js";
|
|
340
341
|
import "./chunk-S7SJMJ2I.js";
|
|
341
342
|
|
|
342
343
|
// src/index.ts
|
|
@@ -8959,9 +8960,6 @@ var reviewCmd = createReviewCommand();
|
|
|
8959
8960
|
import { Command as Command11 } from "commander";
|
|
8960
8961
|
import { parseUnits } from "viem";
|
|
8961
8962
|
|
|
8962
|
-
// src/lib/fee-ceiling.ts
|
|
8963
|
-
var TASKMARKET_FEE_DEFAULT_CEILING = (BigInt(STANDARD_X402_ACTION_AMOUNT) * 2n).toString();
|
|
8964
|
-
|
|
8965
8963
|
// src/lib/x402.ts
|
|
8966
8964
|
var FACILITATOR_RETRIES = 2;
|
|
8967
8965
|
var MAX_RETRY_AFTER_SECONDS = 60;
|
|
@@ -9002,7 +9000,7 @@ async function x402Post(path8, body, options) {
|
|
|
9002
9000
|
const accept = selectTaskmarketFeeRequirement(requirements.accepts, {
|
|
9003
9001
|
network: chain.caip2,
|
|
9004
9002
|
asset: chain.payment.token,
|
|
9005
|
-
maxAmount: options
|
|
9003
|
+
maxAmount: options.maxAmount
|
|
9006
9004
|
});
|
|
9007
9005
|
const { header } = await signTaskmarketFeePayment({
|
|
9008
9006
|
resource: requirements.resource,
|
|
@@ -9460,6 +9458,9 @@ async function settleRecording(data, idempotencyKey, options = {}) {
|
|
|
9460
9458
|
};
|
|
9461
9459
|
}
|
|
9462
9460
|
|
|
9461
|
+
// src/lib/fee-ceiling.ts
|
|
9462
|
+
var ACTION_FEE_MAX_AMOUNT = (BigInt(STANDARD_X402_ACTION_AMOUNT) * 2n).toString();
|
|
9463
|
+
|
|
9463
9464
|
// src/commands/task/payout-gate.ts
|
|
9464
9465
|
var TASK_ID_RE2 = /^0x[0-9a-fA-F]{64}$/;
|
|
9465
9466
|
function assertTaskId(taskId) {
|
|
@@ -9549,7 +9550,8 @@ var linkGateCmd = new Command10("link-gate").description(
|
|
|
9549
9550
|
}
|
|
9550
9551
|
const { data: result, idempotencyKey } = await x402Post(
|
|
9551
9552
|
linkGateRelayPath(id),
|
|
9552
|
-
linkGateRelayBody(id, gatingTaskId)
|
|
9553
|
+
linkGateRelayBody(id, gatingTaskId),
|
|
9554
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
9553
9555
|
);
|
|
9554
9556
|
printResult(
|
|
9555
9557
|
{
|
|
@@ -10650,7 +10652,7 @@ async function runCreateTask(input, extra = {}) {
|
|
|
10650
10652
|
const { data: result, idempotencyKey } = await x402Post("/api/tasks", body, {
|
|
10651
10653
|
// Creating a task pays the reward plus any evaluator stake, exactly; never more. A project
|
|
10652
10654
|
// task pays only the action fee: its budget funds the reward and the stake.
|
|
10653
|
-
maxAmount: extra.projectId !== void 0 ?
|
|
10655
|
+
maxAmount: extra.projectId !== void 0 ? ACTION_FEE_MAX_AMOUNT : (BigInt(String(body.reward)) + BigInt(String(body.evaluatorStake ?? "0"))).toString()
|
|
10654
10656
|
});
|
|
10655
10657
|
const missing = [];
|
|
10656
10658
|
if (Array.isArray(result.hookAttachments)) {
|
|
@@ -10869,30 +10871,146 @@ async function termsAmountsAndDeadlines(taskId) {
|
|
|
10869
10871
|
|
|
10870
10872
|
// src/commands/task/submit.ts
|
|
10871
10873
|
import { Command as Command14, Option as Option2 } from "commander";
|
|
10874
|
+
|
|
10875
|
+
// src/lib/stake-confirmation.ts
|
|
10876
|
+
async function confirmStakeTerms(action, taskId, yes) {
|
|
10877
|
+
if (yes) return true;
|
|
10878
|
+
let detail;
|
|
10879
|
+
try {
|
|
10880
|
+
detail = await getTaskTerms(cliTaskReadContext(), { taskId });
|
|
10881
|
+
} catch {
|
|
10882
|
+
return true;
|
|
10883
|
+
}
|
|
10884
|
+
if (!detail?.terms.stakeRequired) return true;
|
|
10885
|
+
if (detail.amounts.enforcedStakeAmount === "0") return true;
|
|
10886
|
+
const stakeAmount = detail.amounts.enforcedStakeAmount ?? detail.amounts.stakeAmount;
|
|
10887
|
+
renderFailure(
|
|
10888
|
+
new Error(
|
|
10889
|
+
`This task requires a stake of ${stakeAmount} base units (${detail.terms.stakeBps} bps of the reward) to ${action}. Review the terms, then re-run with --yes to accept them.`
|
|
10890
|
+
),
|
|
10891
|
+
{
|
|
10892
|
+
details: {
|
|
10893
|
+
code: "stake_confirmation_required",
|
|
10894
|
+
terms: detail.terms,
|
|
10895
|
+
amounts: detail.amounts,
|
|
10896
|
+
deadlines: detail.deadlines
|
|
10897
|
+
}
|
|
10898
|
+
}
|
|
10899
|
+
);
|
|
10900
|
+
return false;
|
|
10901
|
+
}
|
|
10902
|
+
async function confirmStakeAffordable(address3, stake) {
|
|
10903
|
+
if (stake <= 0n) return true;
|
|
10904
|
+
let balance;
|
|
10905
|
+
try {
|
|
10906
|
+
const result = await apiGet(
|
|
10907
|
+
`/api/wallet/balance?address=${address3}&chainId=${selectedNetwork().chainId}`
|
|
10908
|
+
);
|
|
10909
|
+
if (typeof result?.balanceBaseUnits !== "string") return true;
|
|
10910
|
+
balance = BigInt(result.balanceBaseUnits);
|
|
10911
|
+
} catch {
|
|
10912
|
+
return true;
|
|
10913
|
+
}
|
|
10914
|
+
if (balance >= stake) return true;
|
|
10915
|
+
renderFailure(
|
|
10916
|
+
new Error(
|
|
10917
|
+
`This claim needs a stake of ${stake} base units, and the wallet holds ${balance}. Fund the wallet (taskmarket deposit), then claim again.`
|
|
10918
|
+
),
|
|
10919
|
+
{
|
|
10920
|
+
details: {
|
|
10921
|
+
code: "stake_balance_short",
|
|
10922
|
+
stakeAmount: stake.toString(),
|
|
10923
|
+
balance: balance.toString()
|
|
10924
|
+
}
|
|
10925
|
+
}
|
|
10926
|
+
);
|
|
10927
|
+
return false;
|
|
10928
|
+
}
|
|
10929
|
+
var UNVERIFIED_HOOK_CODE = "unverified_hook";
|
|
10930
|
+
async function confirmUnverifiedHooks(action, taskId, accepted, task) {
|
|
10931
|
+
if (accepted) return true;
|
|
10932
|
+
let read3 = task;
|
|
10933
|
+
if (read3 === void 0) {
|
|
10934
|
+
try {
|
|
10935
|
+
read3 = await getTask(cliTaskReadContext(), { taskId });
|
|
10936
|
+
} catch {
|
|
10937
|
+
return true;
|
|
10938
|
+
}
|
|
10939
|
+
}
|
|
10940
|
+
const hooks = [...read3?.unverifiedHooks ?? []];
|
|
10941
|
+
if (hooks.length === 0) return true;
|
|
10942
|
+
renderFailure(
|
|
10943
|
+
new Error(
|
|
10944
|
+
`This task has an unverified hook (${hooks.join(", ")}): it is not listed in the hook registry and can refuse every submission, so a stake can be lost. Re-run with --accept-unverified-hooks to ${action} at your own risk.`
|
|
10945
|
+
),
|
|
10946
|
+
{ details: { code: UNVERIFIED_HOOK_CODE, unverifiedHooks: hooks } }
|
|
10947
|
+
);
|
|
10948
|
+
return false;
|
|
10949
|
+
}
|
|
10950
|
+
|
|
10951
|
+
// src/lib/task-network.ts
|
|
10952
|
+
var WRONG_NETWORK_CODE = "wrong_network";
|
|
10953
|
+
async function confirmTaskOnSelectedNetwork(taskId, task) {
|
|
10954
|
+
let read3 = task;
|
|
10955
|
+
if (read3 === void 0) {
|
|
10956
|
+
try {
|
|
10957
|
+
read3 = await getTask(cliTaskReadContext(), { taskId });
|
|
10958
|
+
} catch {
|
|
10959
|
+
return true;
|
|
10960
|
+
}
|
|
10961
|
+
}
|
|
10962
|
+
const taskChainId = read3?.chainId;
|
|
10963
|
+
const network = selectedNetwork();
|
|
10964
|
+
if (typeof taskChainId !== "number" || taskChainId === network.chainId) return true;
|
|
10965
|
+
const taskNetwork = networkNameForChain(taskChainId) ?? null;
|
|
10966
|
+
renderFailure(
|
|
10967
|
+
new Error(
|
|
10968
|
+
`This task is on ${taskNetwork ?? `chain ${taskChainId}`}, but the selected network is ${network.name}. Re-run with ${taskmarketCommandFor(taskChainId)}.`
|
|
10969
|
+
),
|
|
10970
|
+
{
|
|
10971
|
+
details: {
|
|
10972
|
+
code: WRONG_NETWORK_CODE,
|
|
10973
|
+
taskChainId,
|
|
10974
|
+
taskNetwork,
|
|
10975
|
+
selectedNetwork: network.name
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10978
|
+
);
|
|
10979
|
+
return false;
|
|
10980
|
+
}
|
|
10981
|
+
|
|
10982
|
+
// src/commands/task/submit.ts
|
|
10872
10983
|
function collectFile(value, previous) {
|
|
10873
10984
|
return [...previous, value];
|
|
10874
10985
|
}
|
|
10875
10986
|
var submitCmd = new Command14("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(
|
|
10876
10987
|
new Option2("--role <role>", "Artifact role applied to all files").choices(["preview", "source", "final", "attachment"]).default("attachment")
|
|
10877
|
-
).
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10988
|
+
).option(
|
|
10989
|
+
"--accept-unverified-hooks",
|
|
10990
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
10991
|
+
).action(
|
|
10992
|
+
async (taskId, opts) => {
|
|
10993
|
+
try {
|
|
10994
|
+
if (!opts.file || opts.file.length === 0) {
|
|
10995
|
+
printError("--file is required");
|
|
10996
|
+
return;
|
|
10997
|
+
}
|
|
10998
|
+
const submissionKey = resolveIdempotencyKey();
|
|
10999
|
+
if (!await confirmTaskOnSelectedNetwork(taskId)) return;
|
|
11000
|
+
if (!await confirmUnverifiedHooks("submit", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11001
|
+
const keystore = await loadKeystore();
|
|
11002
|
+
const { submissionId, idempotencyKey } = await submitTaskFiles(
|
|
11003
|
+
cliTaskWriteContext(keystore),
|
|
11004
|
+
{ taskId },
|
|
11005
|
+
opts.file.map((path8) => ({ path: path8, role: opts.role })),
|
|
11006
|
+
{ idempotencyKey: submissionKey }
|
|
11007
|
+
);
|
|
11008
|
+
printResult({ submissionId }, { idempotencyKey });
|
|
11009
|
+
} finally {
|
|
11010
|
+
submitCmd.setOptionValue("file", []);
|
|
10882
11011
|
}
|
|
10883
|
-
const submissionKey = resolveIdempotencyKey();
|
|
10884
|
-
const keystore = await loadKeystore();
|
|
10885
|
-
const { submissionId, idempotencyKey } = await submitTaskFiles(
|
|
10886
|
-
cliTaskWriteContext(keystore),
|
|
10887
|
-
{ taskId },
|
|
10888
|
-
opts.file.map((path8) => ({ path: path8, role: opts.role })),
|
|
10889
|
-
{ idempotencyKey: submissionKey }
|
|
10890
|
-
);
|
|
10891
|
-
printResult({ submissionId }, { idempotencyKey });
|
|
10892
|
-
} finally {
|
|
10893
|
-
submitCmd.setOptionValue("file", []);
|
|
10894
11012
|
}
|
|
10895
|
-
|
|
11013
|
+
);
|
|
10896
11014
|
|
|
10897
11015
|
// src/commands/task/accept.ts
|
|
10898
11016
|
import { Command as Command15 } from "commander";
|
|
@@ -10964,11 +11082,15 @@ var acceptCmd = new Command15("accept").description(
|
|
|
10964
11082
|
printError(target.error);
|
|
10965
11083
|
return;
|
|
10966
11084
|
}
|
|
10967
|
-
const { data: result, idempotencyKey } = await x402Post(
|
|
10968
|
-
taskId
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
11085
|
+
const { data: result, idempotencyKey } = await x402Post(
|
|
11086
|
+
`/api/tasks/${taskId}/accept`,
|
|
11087
|
+
{
|
|
11088
|
+
taskId,
|
|
11089
|
+
worker: target.worker,
|
|
11090
|
+
...target.submissionId ? { submissionId: target.submissionId } : {}
|
|
11091
|
+
},
|
|
11092
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11093
|
+
);
|
|
10972
11094
|
printResult(
|
|
10973
11095
|
{
|
|
10974
11096
|
accepted: true,
|
|
@@ -11016,7 +11138,8 @@ var acceptSubmissionsCmd = new Command16("accept-submissions").description(
|
|
|
11016
11138
|
{
|
|
11017
11139
|
taskId,
|
|
11018
11140
|
winners
|
|
11019
|
-
}
|
|
11141
|
+
},
|
|
11142
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11020
11143
|
);
|
|
11021
11144
|
printResult(
|
|
11022
11145
|
{
|
|
@@ -11039,12 +11162,16 @@ var rateCmd = new Command17("rate").description("Rate a worker (costs 0.001 in t
|
|
|
11039
11162
|
printError("Rating must be between 0 and 100");
|
|
11040
11163
|
return;
|
|
11041
11164
|
}
|
|
11042
|
-
const { data: result, idempotencyKey } = await x402Post(
|
|
11043
|
-
taskId
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11165
|
+
const { data: result, idempotencyKey } = await x402Post(
|
|
11166
|
+
`/api/tasks/${taskId}/rate`,
|
|
11167
|
+
{
|
|
11168
|
+
taskId,
|
|
11169
|
+
worker: opts.worker,
|
|
11170
|
+
rating,
|
|
11171
|
+
...opts.feedback ? { feedbackText: opts.feedback } : {}
|
|
11172
|
+
},
|
|
11173
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11174
|
+
);
|
|
11048
11175
|
printResult(
|
|
11049
11176
|
{ feedbackId: result.feedbackId, ...await settleRecording(result, idempotencyKey) },
|
|
11050
11177
|
{ idempotencyKey }
|
|
@@ -11141,61 +11268,6 @@ function settlementActionCommand(spec) {
|
|
|
11141
11268
|
});
|
|
11142
11269
|
}
|
|
11143
11270
|
|
|
11144
|
-
// src/lib/stake-confirmation.ts
|
|
11145
|
-
async function confirmStakeTerms(action, taskId, yes) {
|
|
11146
|
-
if (yes) return true;
|
|
11147
|
-
let detail;
|
|
11148
|
-
try {
|
|
11149
|
-
detail = await getTaskTerms(cliTaskReadContext(), { taskId });
|
|
11150
|
-
} catch {
|
|
11151
|
-
return true;
|
|
11152
|
-
}
|
|
11153
|
-
if (!detail?.terms.stakeRequired) return true;
|
|
11154
|
-
if (detail.amounts.enforcedStakeAmount === "0") return true;
|
|
11155
|
-
const stakeAmount = detail.amounts.enforcedStakeAmount ?? detail.amounts.stakeAmount;
|
|
11156
|
-
renderFailure(
|
|
11157
|
-
new Error(
|
|
11158
|
-
`This task requires a stake of ${stakeAmount} base units (${detail.terms.stakeBps} bps of the reward) to ${action}. Review the terms, then re-run with --yes to accept them.`
|
|
11159
|
-
),
|
|
11160
|
-
{
|
|
11161
|
-
details: {
|
|
11162
|
-
code: "stake_confirmation_required",
|
|
11163
|
-
terms: detail.terms,
|
|
11164
|
-
amounts: detail.amounts,
|
|
11165
|
-
deadlines: detail.deadlines
|
|
11166
|
-
}
|
|
11167
|
-
}
|
|
11168
|
-
);
|
|
11169
|
-
return false;
|
|
11170
|
-
}
|
|
11171
|
-
async function confirmStakeAffordable(address3, stake) {
|
|
11172
|
-
if (stake <= 0n) return true;
|
|
11173
|
-
let balance;
|
|
11174
|
-
try {
|
|
11175
|
-
const result = await apiGet(
|
|
11176
|
-
`/api/wallet/balance?address=${address3}&chainId=${selectedNetwork().chainId}`
|
|
11177
|
-
);
|
|
11178
|
-
if (typeof result?.balanceBaseUnits !== "string") return true;
|
|
11179
|
-
balance = BigInt(result.balanceBaseUnits);
|
|
11180
|
-
} catch {
|
|
11181
|
-
return true;
|
|
11182
|
-
}
|
|
11183
|
-
if (balance >= stake) return true;
|
|
11184
|
-
renderFailure(
|
|
11185
|
-
new Error(
|
|
11186
|
-
`This claim needs a stake of ${stake} base units, and the wallet holds ${balance}. Fund the wallet (taskmarket deposit), then claim again.`
|
|
11187
|
-
),
|
|
11188
|
-
{
|
|
11189
|
-
details: {
|
|
11190
|
-
code: "stake_balance_short",
|
|
11191
|
-
stakeAmount: stake.toString(),
|
|
11192
|
-
balance: balance.toString()
|
|
11193
|
-
}
|
|
11194
|
-
}
|
|
11195
|
-
);
|
|
11196
|
-
return false;
|
|
11197
|
-
}
|
|
11198
|
-
|
|
11199
11271
|
// src/commands/hires.ts
|
|
11200
11272
|
var ROLES = ["worker", "requester"];
|
|
11201
11273
|
function hireAnswerError(task, wallet, verb) {
|
|
@@ -11355,7 +11427,10 @@ var declineCmd = settlementActionCommand({
|
|
|
11355
11427
|
var hiresCommand = new Command19("hires").description("Hire offers made to you, and hires you made: list, accept, decline").addCommand(listCmd2).addCommand(acceptCmd2).addCommand(declineCmd);
|
|
11356
11428
|
|
|
11357
11429
|
// src/commands/task/claim.ts
|
|
11358
|
-
var claimCmd = new Command20("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").
|
|
11430
|
+
var claimCmd = new Command20("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(
|
|
11431
|
+
"--accept-unverified-hooks",
|
|
11432
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
11433
|
+
).action(async (taskId, opts) => {
|
|
11359
11434
|
const keystore = await loadKeystore();
|
|
11360
11435
|
const task = await getTask(cliTaskReadContext(), { taskId });
|
|
11361
11436
|
const atCapacity = await hireAcceptCapacityError(task, keystore.walletAddress);
|
|
@@ -11364,6 +11439,7 @@ var claimCmd = new Command20("claim").description("Claim a task as a worker").ar
|
|
|
11364
11439
|
details: { code: HIRE_AGENT_AT_CAPACITY }
|
|
11365
11440
|
});
|
|
11366
11441
|
}
|
|
11442
|
+
if (!await confirmUnverifiedHooks("claim", taskId, opts.acceptUnverifiedHooks, task)) return;
|
|
11367
11443
|
if (!await confirmStakeTerms("claim", taskId, opts.yes)) return;
|
|
11368
11444
|
const stake = task ? claimStakeToPost(task) : 0n;
|
|
11369
11445
|
if (!await confirmStakeAffordable(keystore.walletAddress, stake)) return;
|
|
@@ -11376,27 +11452,34 @@ var claimCmd = new Command20("claim").description("Claim a task as a worker").ar
|
|
|
11376
11452
|
|
|
11377
11453
|
// src/commands/task/pitch.ts
|
|
11378
11454
|
import { Command as Command21 } from "commander";
|
|
11379
|
-
var pitchCmd = new Command21("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").
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
taskId,
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
}
|
|
11455
|
+
var pitchCmd = new Command21("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(
|
|
11456
|
+
"--accept-unverified-hooks",
|
|
11457
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
11458
|
+
).action(
|
|
11459
|
+
async (taskId, opts) => {
|
|
11460
|
+
if (!await confirmUnverifiedHooks("pitch", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11461
|
+
if (!await confirmStakeTerms("pitch", taskId, opts.yes)) return;
|
|
11462
|
+
const keystore = await loadKeystore();
|
|
11463
|
+
const signature = await signMessage(buildPitchMessage(taskId), keystore);
|
|
11464
|
+
const { data: result, idempotencyKey } = await attestedWorkerAction(
|
|
11465
|
+
taskId,
|
|
11466
|
+
keystore,
|
|
11467
|
+
(tap) => x402Post(
|
|
11468
|
+
`/api/tasks/${taskId}/pitches`,
|
|
11469
|
+
{
|
|
11470
|
+
taskId,
|
|
11471
|
+
workerAddress: keystore.walletAddress,
|
|
11472
|
+
pitchText: opts.text,
|
|
11473
|
+
...opts.duration ? { estimatedDuration: parseInt(opts.duration, 10) } : {},
|
|
11474
|
+
signature
|
|
11475
|
+
},
|
|
11476
|
+
// TAP-signed, each round with its own nonce, when the task requires tap.
|
|
11477
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT, ...tap ? { tap } : {} }
|
|
11478
|
+
)
|
|
11479
|
+
);
|
|
11480
|
+
printResult({ pitchId: result.pitchId }, { idempotencyKey });
|
|
11481
|
+
}
|
|
11482
|
+
);
|
|
11400
11483
|
|
|
11401
11484
|
// src/commands/task/pitches.ts
|
|
11402
11485
|
import { Command as Command22 } from "commander";
|
|
@@ -11427,12 +11510,16 @@ var selectWorkerCmd = new Command23("select-worker").description(
|
|
|
11427
11510
|
const keystore = await loadKeystore();
|
|
11428
11511
|
const message = buildSelectWorkerMessage(taskId, opts.pitch, opts.worker);
|
|
11429
11512
|
const signature = await signMessage(message, keystore);
|
|
11430
|
-
const { data: result, idempotencyKey } = await x402Post(
|
|
11431
|
-
taskId
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11513
|
+
const { data: result, idempotencyKey } = await x402Post(
|
|
11514
|
+
`/api/tasks/${taskId}/pitches/select`,
|
|
11515
|
+
{
|
|
11516
|
+
taskId,
|
|
11517
|
+
pitchId: opts.pitch,
|
|
11518
|
+
workerAddress: opts.worker,
|
|
11519
|
+
signature
|
|
11520
|
+
},
|
|
11521
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11522
|
+
);
|
|
11436
11523
|
printResult(
|
|
11437
11524
|
{ selected: true, ...await settleRecording(result, idempotencyKey) },
|
|
11438
11525
|
{ idempotencyKey }
|
|
@@ -11457,7 +11544,8 @@ var proofCmd = new Command24("proof").description("Submit a benchmark proof (cos
|
|
|
11457
11544
|
...opts.metric ? { metricValue: opts.metric } : {},
|
|
11458
11545
|
signature
|
|
11459
11546
|
},
|
|
11460
|
-
|
|
11547
|
+
// TAP-signed, each round with its own nonce, when the task requires tap.
|
|
11548
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT, ...tap ? { tap } : {} }
|
|
11461
11549
|
)
|
|
11462
11550
|
);
|
|
11463
11551
|
printResult({ proofId: result.proofId, submissionId: result.submissionId }, { idempotencyKey });
|
|
@@ -11480,30 +11568,37 @@ var proofsCmd = new Command25("proofs").description("List proofs for a benchmark
|
|
|
11480
11568
|
|
|
11481
11569
|
// src/commands/task/bid.ts
|
|
11482
11570
|
import { Command as Command26 } from "commander";
|
|
11483
|
-
var bidCmd = new Command26("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").
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11571
|
+
var bidCmd = new Command26("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(
|
|
11572
|
+
"--accept-unverified-hooks",
|
|
11573
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
11574
|
+
).action(
|
|
11575
|
+
async (taskId, opts) => {
|
|
11576
|
+
let priceBaseUnits;
|
|
11577
|
+
try {
|
|
11578
|
+
priceBaseUnits = usdcToBaseUnits(opts.price);
|
|
11579
|
+
} catch (err) {
|
|
11580
|
+
renderFailure(withErrorContext(err, "Invalid --price"));
|
|
11581
|
+
return;
|
|
11582
|
+
}
|
|
11583
|
+
if (!await confirmUnverifiedHooks("bid", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11584
|
+
if (!await confirmStakeTerms("bid", taskId, opts.yes)) return;
|
|
11585
|
+
const path8 = `/api/tasks/${taskId}/bids`;
|
|
11586
|
+
const body = { taskId, price: priceBaseUnits };
|
|
11587
|
+
const task = await taskRequirementsOf(taskId);
|
|
11588
|
+
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
11589
|
+
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
11590
|
+
taskId,
|
|
11591
|
+
await loadKeystore(),
|
|
11592
|
+
async (tap) => x402Post(path8, body, {
|
|
11593
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
11594
|
+
headers: (await signReadAuth())?.headers ?? {},
|
|
11595
|
+
...tap ? { tap } : {}
|
|
11596
|
+
}),
|
|
11597
|
+
task
|
|
11598
|
+
) : await x402Post(path8, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
11599
|
+
printResult({ bidId: result.bidId }, { idempotencyKey });
|
|
11490
11600
|
}
|
|
11491
|
-
|
|
11492
|
-
const path8 = `/api/tasks/${taskId}/bids`;
|
|
11493
|
-
const body = { taskId, price: priceBaseUnits };
|
|
11494
|
-
const task = await taskRequirementsOf(taskId);
|
|
11495
|
-
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
11496
|
-
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
11497
|
-
taskId,
|
|
11498
|
-
await loadKeystore(),
|
|
11499
|
-
async (tap) => x402Post(path8, body, {
|
|
11500
|
-
headers: (await signReadAuth())?.headers ?? {},
|
|
11501
|
-
...tap ? { tap } : {}
|
|
11502
|
-
}),
|
|
11503
|
-
task
|
|
11504
|
-
) : await x402Post(path8, body);
|
|
11505
|
-
printResult({ bidId: result.bidId }, { idempotencyKey });
|
|
11506
|
-
});
|
|
11601
|
+
);
|
|
11507
11602
|
|
|
11508
11603
|
// src/commands/task/auction-accept.ts
|
|
11509
11604
|
import { Command as Command27 } from "commander";
|
|
@@ -11527,11 +11622,12 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
|
|
|
11527
11622
|
taskId,
|
|
11528
11623
|
await loadKeystore(),
|
|
11529
11624
|
async (tap) => x402Post(path8, body, {
|
|
11625
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
11530
11626
|
headers: (await signReadAuth())?.headers ?? {},
|
|
11531
11627
|
...tap ? { tap } : {}
|
|
11532
11628
|
}),
|
|
11533
11629
|
task
|
|
11534
|
-
) : await x402Post(path8, body);
|
|
11630
|
+
) : await x402Post(path8, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
11535
11631
|
const { chainId } = selectedNetwork();
|
|
11536
11632
|
printResult(
|
|
11537
11633
|
{
|
|
@@ -11722,7 +11818,8 @@ var cancelCmd = new Command34("cancel").description(
|
|
|
11722
11818
|
}
|
|
11723
11819
|
const { data: result, idempotencyKey } = await x402Post(
|
|
11724
11820
|
`/api/tasks/${taskId}/cancel`,
|
|
11725
|
-
{ taskId }
|
|
11821
|
+
{ taskId },
|
|
11822
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11726
11823
|
);
|
|
11727
11824
|
printResult(
|
|
11728
11825
|
{ ...result, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -11743,7 +11840,8 @@ var refundExpiredCmd = new Command35("refund-expired").description(
|
|
|
11743
11840
|
try {
|
|
11744
11841
|
const { data: result, idempotencyKey } = await x402Post(
|
|
11745
11842
|
`/api/tasks/${taskId}/refund-expired`,
|
|
11746
|
-
{ taskId }
|
|
11843
|
+
{ taskId },
|
|
11844
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11747
11845
|
);
|
|
11748
11846
|
printResult(
|
|
11749
11847
|
{ ...result, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -11799,7 +11897,8 @@ var requesterTimeoutCmd = new Command36("requester-timeout").description(
|
|
|
11799
11897
|
try {
|
|
11800
11898
|
const { data: result, idempotencyKey } = await x402Post(
|
|
11801
11899
|
`/api/tasks/${taskId}/requester-timeout`,
|
|
11802
|
-
{ taskId }
|
|
11900
|
+
{ taskId },
|
|
11901
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11803
11902
|
);
|
|
11804
11903
|
printResult(
|
|
11805
11904
|
{ ...result, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -11826,7 +11925,8 @@ var rejectSubmissionCmd = new Command37("reject-submission").description(
|
|
|
11826
11925
|
{
|
|
11827
11926
|
taskId,
|
|
11828
11927
|
worker: opts.worker
|
|
11829
|
-
}
|
|
11928
|
+
},
|
|
11929
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11830
11930
|
);
|
|
11831
11931
|
printResult(
|
|
11832
11932
|
{ ...result, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -11873,7 +11973,8 @@ var rejectAllSubmissionsCmd = new Command38("reject-all-submissions").descriptio
|
|
|
11873
11973
|
try {
|
|
11874
11974
|
const { data: res, idempotencyKey } = await x402Post(
|
|
11875
11975
|
`/api/tasks/${taskId}/reject-submission`,
|
|
11876
|
-
{ taskId, worker }
|
|
11976
|
+
{ taskId, worker },
|
|
11977
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11877
11978
|
);
|
|
11878
11979
|
results.push({ worker, txHash: res.txHash, idempotencyKey });
|
|
11879
11980
|
} catch (err) {
|
|
@@ -11914,7 +12015,8 @@ var rejectAllSubmissionsCmd = new Command38("reject-all-submissions").descriptio
|
|
|
11914
12015
|
try {
|
|
11915
12016
|
({ data: cancelRes } = await x402Post(
|
|
11916
12017
|
`/api/tasks/${taskId}/cancel`,
|
|
11917
|
-
{ taskId }
|
|
12018
|
+
{ taskId },
|
|
12019
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
11918
12020
|
));
|
|
11919
12021
|
} catch (err) {
|
|
11920
12022
|
renderFailure(
|
|
@@ -12069,11 +12171,11 @@ var updateCmd = new Command40("update").description(
|
|
|
12069
12171
|
const { data: result, idempotencyKey } = await x402Post(
|
|
12070
12172
|
`/api/tasks/${taskId}/update`,
|
|
12071
12173
|
body,
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12174
|
+
// A reward increase is paid with the action fee, so the new reward bounds the extra. A
|
|
12175
|
+
// project task's increase comes from the project's budget: only the fee is paid.
|
|
12176
|
+
{
|
|
12177
|
+
maxAmount: body.reward === void 0 || projectId !== null ? ACTION_FEE_MAX_AMOUNT : (BigInt(ACTION_FEE_MAX_AMOUNT) + BigInt(String(body.reward))).toString()
|
|
12178
|
+
}
|
|
12077
12179
|
);
|
|
12078
12180
|
printResult(
|
|
12079
12181
|
projectId !== null && increase > 0n ? { ...result, projectTopUp: projectTopUp(projectId, increase, "reward increase") } : result,
|
|
@@ -12200,7 +12302,7 @@ var assignEvaluatorCmd = new Command42("assign-evaluator").description(
|
|
|
12200
12302
|
// The action fee plus the stake this command just confirmed; the fee alone when the
|
|
12201
12303
|
// project's budget pays the stake.
|
|
12202
12304
|
{
|
|
12203
|
-
maxAmount: (BigInt(
|
|
12305
|
+
maxAmount: (BigInt(ACTION_FEE_MAX_AMOUNT) + (projectId === null ? BigInt(evaluatorStake) : 0n)).toString()
|
|
12204
12306
|
}
|
|
12205
12307
|
);
|
|
12206
12308
|
printResult(
|
|
@@ -12269,7 +12371,8 @@ var evaluateCmd = new Command43("evaluate").description("Submit an evaluation ve
|
|
|
12269
12371
|
}
|
|
12270
12372
|
const { data: result, idempotencyKey } = await x402Post(
|
|
12271
12373
|
`/api/tasks/${taskId}/evaluate`,
|
|
12272
|
-
body
|
|
12374
|
+
body,
|
|
12375
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
12273
12376
|
);
|
|
12274
12377
|
printResult(
|
|
12275
12378
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -12284,7 +12387,7 @@ function collect2(val, prev) {
|
|
|
12284
12387
|
// src/commands/task/appeal.ts
|
|
12285
12388
|
import { Command as Command44 } from "commander";
|
|
12286
12389
|
var appealCmd = new Command44("appeal").description("Appeal an evaluator verdict while in Appealing state").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12287
|
-
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/appeal`, { taskId });
|
|
12390
|
+
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/appeal`, { taskId }, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
12288
12391
|
printResult(
|
|
12289
12392
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
12290
12393
|
{ idempotencyKey }
|
|
@@ -12294,7 +12397,7 @@ var appealCmd = new Command44("appeal").description("Appeal an evaluator verdict
|
|
|
12294
12397
|
// src/commands/task/evaluator-timeout.ts
|
|
12295
12398
|
import { Command as Command45 } from "commander";
|
|
12296
12399
|
var evaluatorTimeoutCmd = new Command45("evaluator-timeout").description("Trigger evaluator timeout after the evaluation window expires (anyone)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12297
|
-
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId });
|
|
12400
|
+
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId }, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
12298
12401
|
printResult(
|
|
12299
12402
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
12300
12403
|
{ idempotencyKey }
|
|
@@ -12356,7 +12459,8 @@ var resolveDisputeCmd = new Command47("resolve-dispute").description(
|
|
|
12356
12459
|
taskId,
|
|
12357
12460
|
verdict: opts.verdict,
|
|
12358
12461
|
awards
|
|
12359
|
-
}
|
|
12462
|
+
},
|
|
12463
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
12360
12464
|
);
|
|
12361
12465
|
printResult(
|
|
12362
12466
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -12755,7 +12859,7 @@ async function runAgentCommand(options) {
|
|
|
12755
12859
|
try {
|
|
12756
12860
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
12757
12861
|
const pi = assertAgentCompatibility();
|
|
12758
|
-
const { runAgent } = await import("./launch-
|
|
12862
|
+
const { runAgent } = await import("./launch-B2KFGY2L.js");
|
|
12759
12863
|
result = await runAgent({
|
|
12760
12864
|
model: options.model,
|
|
12761
12865
|
pi,
|
|
@@ -13189,13 +13293,13 @@ function agentManagementCommands() {
|
|
|
13189
13293
|
const status = new Command57("status").description(
|
|
13190
13294
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
13191
13295
|
).action(async () => {
|
|
13192
|
-
const { collectAgentStatus } = await import("./status-
|
|
13296
|
+
const { collectAgentStatus } = await import("./status-6EYEBSQ6.js");
|
|
13193
13297
|
await run(() => collectAgentStatus());
|
|
13194
13298
|
});
|
|
13195
13299
|
const doctor = new Command57("doctor").description(
|
|
13196
13300
|
"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."
|
|
13197
13301
|
).action(async () => {
|
|
13198
|
-
const { runDoctor } = await import("./doctor-
|
|
13302
|
+
const { runDoctor } = await import("./doctor-LHFMQ737.js");
|
|
13199
13303
|
const report = await run(() => runDoctor());
|
|
13200
13304
|
if (report && !report.ok) process.exitCode = 1;
|
|
13201
13305
|
});
|
|
@@ -13206,7 +13310,7 @@ function agentManagementCommands() {
|
|
|
13206
13310
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
13207
13311
|
).action(
|
|
13208
13312
|
async (invocationId, options) => {
|
|
13209
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
13313
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-7AIMC4P3.js");
|
|
13210
13314
|
const choice = { rail: options.rail, channel: options.channel };
|
|
13211
13315
|
if (invocationId !== void 0) {
|
|
13212
13316
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -13238,7 +13342,7 @@ function agentManagementCommands() {
|
|
|
13238
13342
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
13239
13343
|
);
|
|
13240
13344
|
}
|
|
13241
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
13345
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-XY4SSEBG.js");
|
|
13242
13346
|
const { rails } = await openAgentChannels();
|
|
13243
13347
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
13244
13348
|
return {
|
|
@@ -13258,8 +13362,8 @@ function agentManagementCommands() {
|
|
|
13258
13362
|
await run(async () => {
|
|
13259
13363
|
await requireExperimental();
|
|
13260
13364
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
13261
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
13262
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
13365
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-XY4SSEBG.js");
|
|
13366
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-7AIMC4P3.js");
|
|
13263
13367
|
const opened = await openAgentChannels();
|
|
13264
13368
|
const { rail, retired } = selectChannel(opened, options);
|
|
13265
13369
|
const result = await closeChannel(
|
|
@@ -13313,7 +13417,7 @@ function agentManagementCommands() {
|
|
|
13313
13417
|
async (options) => {
|
|
13314
13418
|
await run(async () => {
|
|
13315
13419
|
await requireExperimental();
|
|
13316
|
-
const { runPull } = await import("./sync-pull-
|
|
13420
|
+
const { runPull } = await import("./sync-pull-XSIEQDGD.js");
|
|
13317
13421
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
13318
13422
|
return runPull(options, {
|
|
13319
13423
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -25143,11 +25247,11 @@ async function postProjectWrite(path8, body, options) {
|
|
|
25143
25247
|
const { data: result, idempotencyKey } = await x402Post(
|
|
25144
25248
|
path8,
|
|
25145
25249
|
{ chainId: selectedNetwork().chainId, ...body },
|
|
25146
|
-
|
|
25250
|
+
{ maxAmount: options.maxAmount }
|
|
25147
25251
|
);
|
|
25148
25252
|
printResult(
|
|
25149
|
-
{ ...result, ...options
|
|
25150
|
-
{ idempotencyKey, ...options
|
|
25253
|
+
{ ...result, ...options.extra, ...await settleRecording(result, idempotencyKey) },
|
|
25254
|
+
{ idempotencyKey, ...options.warnings?.length ? { warnings: options.warnings } : {} }
|
|
25151
25255
|
);
|
|
25152
25256
|
}
|
|
25153
25257
|
|
|
@@ -25177,7 +25281,11 @@ var projectAcceptCommand = new Command127("accept").description(
|
|
|
25177
25281
|
if (!mine) return void printError("No grant to this wallet on the project");
|
|
25178
25282
|
termsHash = mine.termsHash;
|
|
25179
25283
|
}
|
|
25180
|
-
await postProjectWrite(
|
|
25284
|
+
await postProjectWrite(
|
|
25285
|
+
`/api/projects/${projectId}/grants/accept`,
|
|
25286
|
+
{ projectId, termsHash },
|
|
25287
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25288
|
+
);
|
|
25181
25289
|
});
|
|
25182
25290
|
|
|
25183
25291
|
// src/commands/project/add-task.ts
|
|
@@ -25297,10 +25405,14 @@ var projectClaimCommand = new Command129("claim").description(
|
|
|
25297
25405
|
if (backer !== void 0 && (!ADDRESS.test(backer) || /^0x0{40}$/i.test(backer))) {
|
|
25298
25406
|
return void printError("Invalid Ethereum address for --backer");
|
|
25299
25407
|
}
|
|
25300
|
-
await postProjectWrite(
|
|
25301
|
-
projectId
|
|
25302
|
-
|
|
25303
|
-
|
|
25408
|
+
await postProjectWrite(
|
|
25409
|
+
`/api/projects/${projectId}/claim`,
|
|
25410
|
+
{
|
|
25411
|
+
projectId,
|
|
25412
|
+
...backer ? { backer } : {}
|
|
25413
|
+
},
|
|
25414
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25415
|
+
);
|
|
25304
25416
|
});
|
|
25305
25417
|
|
|
25306
25418
|
// src/commands/project/close.ts
|
|
@@ -25310,7 +25422,11 @@ var projectCloseCommand = new Command130("close").description(
|
|
|
25310
25422
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
25311
25423
|
const projectId = parseProjectId(id);
|
|
25312
25424
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25313
|
-
await postProjectWrite(
|
|
25425
|
+
await postProjectWrite(
|
|
25426
|
+
`/api/projects/${projectId}/close`,
|
|
25427
|
+
{ projectId },
|
|
25428
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25429
|
+
);
|
|
25314
25430
|
});
|
|
25315
25431
|
|
|
25316
25432
|
// src/commands/project/create.ts
|
|
@@ -25416,7 +25532,9 @@ var projectGrantCommand = new Command133("grant").description(
|
|
|
25416
25532
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25417
25533
|
const body = grantBody(projectId, opts);
|
|
25418
25534
|
if ("error" in body) return void printError(String(body.error));
|
|
25419
|
-
await postProjectWrite(`/api/projects/${projectId}/grants`, body
|
|
25535
|
+
await postProjectWrite(`/api/projects/${projectId}/grants`, body, {
|
|
25536
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
25537
|
+
});
|
|
25420
25538
|
});
|
|
25421
25539
|
|
|
25422
25540
|
// src/commands/project/review.ts
|
|
@@ -25455,7 +25573,7 @@ var projectReviewCommand = new Command134("review").description(
|
|
|
25455
25573
|
await postProjectWrite(
|
|
25456
25574
|
`/api/projects/${projectId}/review`,
|
|
25457
25575
|
{ projectId, evaluator },
|
|
25458
|
-
{ warnings: await ownerEvaluatorWarnings(evaluator) }
|
|
25576
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT, warnings: await ownerEvaluatorWarnings(evaluator) }
|
|
25459
25577
|
);
|
|
25460
25578
|
});
|
|
25461
25579
|
async function ownerEvaluatorWarnings(evaluator) {
|
|
@@ -25486,10 +25604,14 @@ var projectRevokeCommand = new Command135("revoke").description(
|
|
|
25486
25604
|
if (!ADDRESS.test(opts.operator)) {
|
|
25487
25605
|
return void printError("--operator must be a wallet address (0x + 40 hex chars)");
|
|
25488
25606
|
}
|
|
25489
|
-
await postProjectWrite(
|
|
25490
|
-
projectId
|
|
25491
|
-
|
|
25492
|
-
|
|
25607
|
+
await postProjectWrite(
|
|
25608
|
+
`/api/projects/${projectId}/grants/${opts.operator}/revoke`,
|
|
25609
|
+
{
|
|
25610
|
+
projectId,
|
|
25611
|
+
operator: opts.operator
|
|
25612
|
+
},
|
|
25613
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25614
|
+
);
|
|
25493
25615
|
});
|
|
25494
25616
|
|
|
25495
25617
|
// src/commands/project/schedule.ts
|
|
@@ -25630,7 +25752,11 @@ var createCommand3 = new Command136("create").description(
|
|
|
25630
25752
|
).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
|
|
25631
25753
|
const template = await readValidTemplate(opts.file);
|
|
25632
25754
|
if (!template) return;
|
|
25633
|
-
await postProjectWrite(
|
|
25755
|
+
await postProjectWrite(
|
|
25756
|
+
"/api/project-workflow-templates",
|
|
25757
|
+
{ template },
|
|
25758
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25759
|
+
);
|
|
25634
25760
|
});
|
|
25635
25761
|
var updateCommand = new Command136("update").description(
|
|
25636
25762
|
"Replace a saved template with a JSON file, as the wallet that saved it; workflows already made from it keep their document. Costs 0.001 in the payment token"
|
|
@@ -25643,10 +25769,14 @@ var updateCommand = new Command136("update").description(
|
|
|
25643
25769
|
}
|
|
25644
25770
|
const template = await readValidTemplate(opts.file);
|
|
25645
25771
|
if (!template) return;
|
|
25646
|
-
await postProjectWrite(
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
|
|
25772
|
+
await postProjectWrite(
|
|
25773
|
+
`/api/project-workflow-templates/${choice.templateId}/update`,
|
|
25774
|
+
{
|
|
25775
|
+
templateId: choice.templateId,
|
|
25776
|
+
template
|
|
25777
|
+
},
|
|
25778
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25779
|
+
);
|
|
25650
25780
|
});
|
|
25651
25781
|
var listCommand6 = new Command136("list").description(
|
|
25652
25782
|
"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)"
|
|
@@ -25714,9 +25844,13 @@ var deleteCommand2 = new Command136("delete").description(
|
|
|
25714
25844
|
"Presets and official templates are read-only; delete takes a saved template id (UUID)"
|
|
25715
25845
|
);
|
|
25716
25846
|
}
|
|
25717
|
-
await postProjectWrite(
|
|
25718
|
-
|
|
25719
|
-
|
|
25847
|
+
await postProjectWrite(
|
|
25848
|
+
`/api/project-workflow-templates/${choice.templateId}/delete`,
|
|
25849
|
+
{
|
|
25850
|
+
templateId: choice.templateId
|
|
25851
|
+
},
|
|
25852
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25853
|
+
);
|
|
25720
25854
|
});
|
|
25721
25855
|
var workflowTemplateCommand = new Command136("template").description(
|
|
25722
25856
|
"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"
|
|
@@ -25726,11 +25860,15 @@ async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
|
25726
25860
|
if ("error" in choice) return void printError(choice.error);
|
|
25727
25861
|
const parsed = parseParams(pairs);
|
|
25728
25862
|
if ("error" in parsed) return void printError(parsed.error);
|
|
25729
|
-
await postProjectWrite(
|
|
25730
|
-
projectId
|
|
25731
|
-
|
|
25732
|
-
|
|
25733
|
-
|
|
25863
|
+
await postProjectWrite(
|
|
25864
|
+
`/api/projects/${projectId}/workflows/from-template`,
|
|
25865
|
+
{
|
|
25866
|
+
projectId,
|
|
25867
|
+
...choice,
|
|
25868
|
+
params: parsed.params
|
|
25869
|
+
},
|
|
25870
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25871
|
+
);
|
|
25734
25872
|
}
|
|
25735
25873
|
|
|
25736
25874
|
// src/commands/project/schedule.ts
|
|
@@ -25961,7 +26099,9 @@ var createCommand4 = new Command137("create").description(
|
|
|
25961
26099
|
if (workflow !== null && "error" in workflow) return void printError(workflow.error);
|
|
25962
26100
|
const body = scheduleCreateBody(projectId, opts, workflow ?? void 0);
|
|
25963
26101
|
if ("error" in body) return void printError(String(body.error));
|
|
25964
|
-
await postProjectWrite(`/api/projects/${projectId}/schedules`, body
|
|
26102
|
+
await postProjectWrite(`/api/projects/${projectId}/schedules`, body, {
|
|
26103
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26104
|
+
});
|
|
25965
26105
|
});
|
|
25966
26106
|
var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
|
|
25967
26107
|
var listCommand7 = new Command137("list").description(
|
|
@@ -26008,7 +26148,11 @@ function actionCommand(action, description) {
|
|
|
26008
26148
|
return new Command137(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
26009
26149
|
const id = scheduleId(value);
|
|
26010
26150
|
if (typeof id !== "string") return void printError(id.error);
|
|
26011
|
-
await postProjectWrite(
|
|
26151
|
+
await postProjectWrite(
|
|
26152
|
+
`/api/project-schedules/${id}/${action}`,
|
|
26153
|
+
{ scheduleId: id },
|
|
26154
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26155
|
+
);
|
|
26012
26156
|
});
|
|
26013
26157
|
}
|
|
26014
26158
|
var settingsCommand = new Command137("settings").description(
|
|
@@ -26029,7 +26173,9 @@ var settingsCommand = new Command137("settings").description(
|
|
|
26029
26173
|
return;
|
|
26030
26174
|
}
|
|
26031
26175
|
if ("error" in body) return void printError(String(body.error));
|
|
26032
|
-
await postProjectWrite(`/api/projects/${projectId}/schedules/settings`, body
|
|
26176
|
+
await postProjectWrite(`/api/projects/${projectId}/schedules/settings`, body, {
|
|
26177
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26178
|
+
});
|
|
26033
26179
|
});
|
|
26034
26180
|
var projectScheduleCommand = new Command137("schedule").description(
|
|
26035
26181
|
"Schedules: a task from the project's budget on a cadence, created by the platform runner under your grant to it"
|
|
@@ -26308,10 +26454,14 @@ var createCommand5 = new Command140("create").description(
|
|
|
26308
26454
|
}
|
|
26309
26455
|
);
|
|
26310
26456
|
}
|
|
26311
|
-
await postProjectWrite(
|
|
26312
|
-
projectId
|
|
26313
|
-
|
|
26314
|
-
|
|
26457
|
+
await postProjectWrite(
|
|
26458
|
+
`/api/projects/${projectId}/workflows`,
|
|
26459
|
+
{
|
|
26460
|
+
projectId,
|
|
26461
|
+
document: parsed.document
|
|
26462
|
+
},
|
|
26463
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26464
|
+
);
|
|
26315
26465
|
});
|
|
26316
26466
|
var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
|
|
26317
26467
|
var listCommand8 = new Command140("list").description(
|
|
@@ -26373,7 +26523,11 @@ var runCommand2 = new Command140("run").description(
|
|
|
26373
26523
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26374
26524
|
const id = uuid(value, "workflow");
|
|
26375
26525
|
if (typeof id !== "string") return void printError(id.error);
|
|
26376
|
-
await postProjectWrite(
|
|
26526
|
+
await postProjectWrite(
|
|
26527
|
+
`/api/project-workflows/${id}/runs`,
|
|
26528
|
+
{ workflowId: id },
|
|
26529
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26530
|
+
);
|
|
26377
26531
|
});
|
|
26378
26532
|
function stepCommand(action, description) {
|
|
26379
26533
|
return new Command140(action).description(description).argument("<runId>", "Run id").requiredOption(
|
|
@@ -26384,7 +26538,11 @@ function stepCommand(action, description) {
|
|
|
26384
26538
|
if (typeof id !== "string") return void printError(id.error);
|
|
26385
26539
|
const step = stepKey(opts.step);
|
|
26386
26540
|
if (typeof step !== "string") return void printError(step.error);
|
|
26387
|
-
await postProjectWrite(
|
|
26541
|
+
await postProjectWrite(
|
|
26542
|
+
`/api/project-workflow-runs/${id}/${action}`,
|
|
26543
|
+
{ runId: id, step },
|
|
26544
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26545
|
+
);
|
|
26388
26546
|
});
|
|
26389
26547
|
}
|
|
26390
26548
|
var cancelCommand = new Command140("cancel").description(
|
|
@@ -26392,21 +26550,33 @@ var cancelCommand = new Command140("cancel").description(
|
|
|
26392
26550
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26393
26551
|
const id = uuid(value, "run");
|
|
26394
26552
|
if (typeof id !== "string") return void printError(id.error);
|
|
26395
|
-
await postProjectWrite(
|
|
26553
|
+
await postProjectWrite(
|
|
26554
|
+
`/api/project-workflow-runs/${id}/cancel`,
|
|
26555
|
+
{ runId: id },
|
|
26556
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26557
|
+
);
|
|
26396
26558
|
});
|
|
26397
26559
|
var stopAutoPayoutCommand = new Command140("stop-auto-payout").description(
|
|
26398
26560
|
"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"
|
|
26399
26561
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26400
26562
|
const id = uuid(value, "run");
|
|
26401
26563
|
if (typeof id !== "string") return void printError(id.error);
|
|
26402
|
-
await postProjectWrite(
|
|
26564
|
+
await postProjectWrite(
|
|
26565
|
+
`/api/project-workflow-runs/${id}/stop-auto-payout`,
|
|
26566
|
+
{ runId: id },
|
|
26567
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26568
|
+
);
|
|
26403
26569
|
});
|
|
26404
26570
|
var deleteCommand3 = new Command140("delete").description(
|
|
26405
26571
|
"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"
|
|
26406
26572
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26407
26573
|
const id = uuid(value, "workflow");
|
|
26408
26574
|
if (typeof id !== "string") return void printError(id.error);
|
|
26409
|
-
await postProjectWrite(
|
|
26575
|
+
await postProjectWrite(
|
|
26576
|
+
`/api/project-workflows/${id}/delete`,
|
|
26577
|
+
{ workflowId: id },
|
|
26578
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26579
|
+
);
|
|
26410
26580
|
});
|
|
26411
26581
|
async function ownerGet(path8) {
|
|
26412
26582
|
const auth = await signReadAuth();
|
|
@@ -26453,7 +26623,7 @@ var payoutConfirmCommand = new Command140("confirm").description(
|
|
|
26453
26623
|
await postProjectWrite(
|
|
26454
26624
|
`/api/project-workflow-payouts/${id}/confirm`,
|
|
26455
26625
|
{ proposalId: id },
|
|
26456
|
-
{ extra: { accept: view.accept } }
|
|
26626
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT, extra: { accept: view.accept } }
|
|
26457
26627
|
);
|
|
26458
26628
|
});
|
|
26459
26629
|
var payoutCommand = new Command140("payout").description(
|
|
@@ -26481,10 +26651,14 @@ var settingsCommand2 = new Command140("settings").description(
|
|
|
26481
26651
|
`--step-limit must be an integer from ${WORKFLOW_STEP_LIMIT_MIN} to ${WORKFLOW_STEP_LIMIT_MAX}`
|
|
26482
26652
|
);
|
|
26483
26653
|
}
|
|
26484
|
-
await postProjectWrite(
|
|
26485
|
-
projectId
|
|
26486
|
-
|
|
26487
|
-
|
|
26654
|
+
await postProjectWrite(
|
|
26655
|
+
`/api/projects/${projectId}/workflows/settings`,
|
|
26656
|
+
{
|
|
26657
|
+
projectId,
|
|
26658
|
+
stepLimit: limit
|
|
26659
|
+
},
|
|
26660
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26661
|
+
);
|
|
26488
26662
|
});
|
|
26489
26663
|
var workflowCommand = new Command140("workflow").description(
|
|
26490
26664
|
"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"
|