@lucid-agents/taskmarket 1.32.1 → 1.34.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-TEZH6URZ.js → api-R76D244Y.js} +2 -2
- package/dist/{channels-ZNOTOJIS.js → channels-SVCU2MU5.js} +4 -4
- package/dist/{chunk-62QDQXS3.js → chunk-45GK5BHD.js} +8 -8
- package/dist/{chunk-CH3OZ5EM.js → chunk-54OR2JDT.js} +10 -6
- package/dist/{chunk-R6QEAGHK.js → chunk-B7W4G3EY.js} +1 -1
- package/dist/{chunk-FJ4EPHIN.js → chunk-BDKM5JMT.js} +1 -1
- package/dist/{chunk-QVP3VXGD.js → chunk-CHX7O7EU.js} +1 -1
- package/dist/{chunk-KC32V4AD.js → chunk-G3U2BQNC.js} +27 -5
- package/dist/{chunk-LT4DDAEZ.js → chunk-JRWRBSS2.js} +3 -3
- package/dist/{chunk-PSN4GDLD.js → chunk-KHDQRFHG.js} +5 -5
- package/dist/{chunk-6WOUTOR4.js → chunk-QAGDCIMU.js} +1692 -1518
- package/dist/{chunk-SPG5J4RN.js → chunk-WP7GXSKE.js} +3 -3
- package/dist/{chunk-CWANOJKR.js → chunk-YGSVDU2D.js} +3 -3
- package/dist/{chunk-OUV2RQSB.js → chunk-YHVP2UNE.js} +1 -1
- package/dist/{doctor-5KU2FAWD.js → doctor-IIVQFDIB.js} +8 -8
- package/dist/index.js +840 -251
- package/dist/{launch-RFRQPJAY.js → launch-INDP2HH3.js} +11 -11
- package/dist/pi-extensions/xgate.cjs +2946 -2801
- package/dist/{read-auth-PQ7DGWZC.js → read-auth-AGP3CUMT.js} +3 -3
- package/dist/{reconcile-ZTCPP3G5.js → reconcile-H3JIKN2X.js} +4 -4
- package/dist/{status-CDPRDSYZ.js → status-SARVECVT.js} +8 -8
- package/dist/{sync-pull-R7EBZKUG.js → sync-pull-IUPV57MU.js} +4 -4
- package/dist/{task-access-grants-H3RJAJ32.js → task-access-grants-HALV3NEO.js} +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
attestedWorkerAction,
|
|
6
6
|
claimTask,
|
|
7
7
|
cliTaskReadContext,
|
|
8
|
+
cliTaskTransport,
|
|
8
9
|
cliTaskWriteContext,
|
|
9
10
|
getTask,
|
|
10
11
|
getTaskTerms,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
listWorkerSubmissions,
|
|
14
15
|
submitTaskFiles,
|
|
15
16
|
taskRequirementsOf
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-45GK5BHD.js";
|
|
17
18
|
import {
|
|
18
19
|
ComputeCreditError,
|
|
19
20
|
applyComputeCreditSetup,
|
|
@@ -35,14 +36,14 @@ import {
|
|
|
35
36
|
refusedPaidWrite,
|
|
36
37
|
releasePendingComputePurchase,
|
|
37
38
|
resolvePendingComputePurchases
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-JRWRBSS2.js";
|
|
39
40
|
import {
|
|
40
41
|
signReadAuth
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-54OR2JDT.js";
|
|
42
43
|
import {
|
|
43
44
|
saveTaskAccessGrant,
|
|
44
45
|
taskAccessGrantHeaders
|
|
45
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-CHX7O7EU.js";
|
|
46
47
|
import {
|
|
47
48
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
48
49
|
X402PayError,
|
|
@@ -60,7 +61,7 @@ import {
|
|
|
60
61
|
setX402PolicyRuleEnabled,
|
|
61
62
|
signSponsoredTempoTransfer,
|
|
62
63
|
signTaskmarketFeePayment
|
|
63
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-YHVP2UNE.js";
|
|
64
65
|
import {
|
|
65
66
|
ALL_NETWORKS,
|
|
66
67
|
ApiError,
|
|
@@ -94,6 +95,7 @@ import {
|
|
|
94
95
|
isNetworkName,
|
|
95
96
|
isPendingApiError,
|
|
96
97
|
keystoreExists,
|
|
98
|
+
keystoreLoadFailure,
|
|
97
99
|
liveNetworkNames,
|
|
98
100
|
loadKeystore,
|
|
99
101
|
networkNameForChain,
|
|
@@ -122,7 +124,7 @@ import {
|
|
|
122
124
|
withErrorContext,
|
|
123
125
|
withIdempotentWrite,
|
|
124
126
|
withTapSignature
|
|
125
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-G3U2BQNC.js";
|
|
126
128
|
import {
|
|
127
129
|
AGENT_AVATAR_MAX_BYTES,
|
|
128
130
|
AGENT_HIRES_ROLES,
|
|
@@ -162,6 +164,7 @@ import {
|
|
|
162
164
|
EcosystemEventsInputSchema,
|
|
163
165
|
EthAddressSchema,
|
|
164
166
|
EvaluatorDirectoryResultSchema,
|
|
167
|
+
GRANT_MODE_NAMES,
|
|
165
168
|
HIRE_AGENT_AT_CAPACITY,
|
|
166
169
|
HIRE_AGENT_UNAVAILABLE,
|
|
167
170
|
HIRE_MAX_ACCEPT_WINDOW_SECS,
|
|
@@ -306,6 +309,7 @@ import {
|
|
|
306
309
|
isTerminalWalletBridgeStatus,
|
|
307
310
|
marketEventPreferenceChange,
|
|
308
311
|
needsYouKindForIntent,
|
|
312
|
+
normalizeReferenceCode,
|
|
309
313
|
parseIsoDurationSeconds,
|
|
310
314
|
parseScheduleCadence,
|
|
311
315
|
paymentTokenSymbol,
|
|
@@ -337,11 +341,11 @@ import {
|
|
|
337
341
|
vaultCallGasLimit7702,
|
|
338
342
|
verifierProviderId,
|
|
339
343
|
verifiersUnsupportedOnChain
|
|
340
|
-
} from "./chunk-
|
|
344
|
+
} from "./chunk-QAGDCIMU.js";
|
|
341
345
|
import "./chunk-S7SJMJ2I.js";
|
|
342
346
|
|
|
343
347
|
// src/index.ts
|
|
344
|
-
import { Command as
|
|
348
|
+
import { Command as Command151 } from "commander";
|
|
345
349
|
import { createRequire } from "module";
|
|
346
350
|
|
|
347
351
|
// src/commands/init.ts
|
|
@@ -9304,25 +9308,18 @@ var HOOK_V2_MANIFEST_ABI = [
|
|
|
9304
9308
|
var PAYOUT_GATE_ABI = [
|
|
9305
9309
|
{
|
|
9306
9310
|
type: "function",
|
|
9307
|
-
name: "
|
|
9311
|
+
name: "gateDetailsOf",
|
|
9308
9312
|
stateMutability: "view",
|
|
9309
9313
|
inputs: [{ name: "taskId", type: "bytes32" }],
|
|
9310
9314
|
outputs: [
|
|
9311
9315
|
{ name: "gatingTaskId", type: "bytes32" },
|
|
9312
9316
|
{ name: "deadline", type: "uint64" },
|
|
9317
|
+
{ name: "maxDeadline", type: "uint64" },
|
|
9313
9318
|
{ name: "gatingPaid", type: "bool" },
|
|
9319
|
+
{ name: "gatingFailed", type: "bool" },
|
|
9320
|
+
{ name: "relinked", type: "bool" },
|
|
9314
9321
|
{ name: "open", type: "bool" }
|
|
9315
9322
|
]
|
|
9316
|
-
},
|
|
9317
|
-
{
|
|
9318
|
-
type: "function",
|
|
9319
|
-
name: "linkGatingTask",
|
|
9320
|
-
stateMutability: "nonpayable",
|
|
9321
|
-
inputs: [
|
|
9322
|
-
{ name: "taskId", type: "bytes32" },
|
|
9323
|
-
{ name: "gatingTaskId", type: "bytes32" }
|
|
9324
|
-
],
|
|
9325
|
-
outputs: []
|
|
9326
9323
|
}
|
|
9327
9324
|
];
|
|
9328
9325
|
function parseDurationSeconds(raw) {
|
|
@@ -9362,13 +9359,16 @@ function payoutGateAddressOf(registry) {
|
|
|
9362
9359
|
return entry ? entry.address.toLowerCase() : null;
|
|
9363
9360
|
}
|
|
9364
9361
|
function payoutGateStatus(hook, gate) {
|
|
9365
|
-
const [gatingTaskId, deadline, gatingPaid, open] = gate;
|
|
9362
|
+
const [gatingTaskId, deadline, maxDeadline, gatingPaid, gatingFailed, relinked, open] = gate;
|
|
9366
9363
|
if (deadline === 0n) return null;
|
|
9367
9364
|
return {
|
|
9368
9365
|
hook: hook.toLowerCase(),
|
|
9369
9366
|
gatingTaskId: /^0x0{64}$/.test(gatingTaskId) ? null : gatingTaskId.toLowerCase(),
|
|
9370
9367
|
deadline: Number(deadline),
|
|
9368
|
+
maxDeadline: Number(maxDeadline),
|
|
9371
9369
|
gatingPaid,
|
|
9370
|
+
gatingFailed,
|
|
9371
|
+
relinked,
|
|
9372
9372
|
open
|
|
9373
9373
|
};
|
|
9374
9374
|
}
|
|
@@ -9479,7 +9479,7 @@ async function gateOfOn(hook, id, chainId) {
|
|
|
9479
9479
|
const gate = await chainReader(chainId).readContract({
|
|
9480
9480
|
address: hook,
|
|
9481
9481
|
abi: PAYOUT_GATE_ABI,
|
|
9482
|
-
functionName: "
|
|
9482
|
+
functionName: "gateDetailsOf",
|
|
9483
9483
|
args: [id]
|
|
9484
9484
|
});
|
|
9485
9485
|
return payoutGateStatus(hook, gate);
|
|
@@ -9522,8 +9522,15 @@ function linkGateRelayPath(taskId) {
|
|
|
9522
9522
|
function linkGateRelayBody(taskId, gatingTaskId) {
|
|
9523
9523
|
return { taskId, gatingTaskId };
|
|
9524
9524
|
}
|
|
9525
|
+
function extendGateRelayPath(taskId) {
|
|
9526
|
+
return `/api/tasks/${taskId}/extend-gate`;
|
|
9527
|
+
}
|
|
9528
|
+
function extendGateRelayBody(taskId, deadline) {
|
|
9529
|
+
return { taskId, deadline };
|
|
9530
|
+
}
|
|
9531
|
+
var SETTLED_GATE_MESSAGE = "a gate changes only before accept";
|
|
9525
9532
|
var linkGateCmd = new Command10("link-gate").description(
|
|
9526
|
-
"Link the task whose payout this task's payout gate waits on
|
|
9533
|
+
"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)"
|
|
9527
9534
|
).argument("<taskId>", "The gated task ID (0x-prefixed hex)").requiredOption("--gated-by <taskId>", "The gating task ID (0x-prefixed hex)").action(async (taskId, opts) => {
|
|
9528
9535
|
try {
|
|
9529
9536
|
const id = assertTaskId(taskId);
|
|
@@ -9534,23 +9541,87 @@ var linkGateCmd = new Command10("link-gate").description(
|
|
|
9534
9541
|
if (gatingTaskId === id.toLowerCase()) throw new Error("A task cannot gate itself");
|
|
9535
9542
|
const gate = await readPayoutGate(id);
|
|
9536
9543
|
if (!gate) throw new Error(`Task ${taskId} has no payout gate`);
|
|
9544
|
+
if (gate.open) {
|
|
9545
|
+
throw new Error(`The payout gate of ${taskId} is already open; it can no longer change`);
|
|
9546
|
+
}
|
|
9537
9547
|
if (gate.gatingTaskId) {
|
|
9538
|
-
|
|
9548
|
+
if (!gate.gatingFailed) {
|
|
9549
|
+
throw new Error(
|
|
9550
|
+
`Task ${taskId} is already gated by ${gate.gatingTaskId}, which has not been cancelled or expired; it is replaced only after it ends without paying out`
|
|
9551
|
+
);
|
|
9552
|
+
}
|
|
9553
|
+
if (gate.relinked) {
|
|
9554
|
+
throw new Error(
|
|
9555
|
+
`Task ${taskId} already used its one re-link; its payout gate opens at its deadline`
|
|
9556
|
+
);
|
|
9557
|
+
}
|
|
9539
9558
|
}
|
|
9540
|
-
const keystore = await loadKeystore();
|
|
9541
9559
|
const task = await getTask(cliTaskReadContext(), { taskId: id });
|
|
9542
9560
|
if (!task) throw new Error(`Task not found: ${taskId}`);
|
|
9543
|
-
if (
|
|
9561
|
+
if (SETTLED_STATUSES.has(task.status)) {
|
|
9562
|
+
throw new Error(`Task ${taskId} is ${task.status}; ${SETTLED_GATE_MESSAGE}`);
|
|
9563
|
+
}
|
|
9564
|
+
const { data: result, idempotencyKey } = await x402Post(
|
|
9565
|
+
linkGateRelayPath(id),
|
|
9566
|
+
linkGateRelayBody(id, gatingTaskId),
|
|
9567
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
9568
|
+
);
|
|
9569
|
+
printResult(
|
|
9570
|
+
{
|
|
9571
|
+
...result,
|
|
9572
|
+
taskId,
|
|
9573
|
+
...await settleRecording(result, idempotencyKey),
|
|
9574
|
+
payoutGate: {
|
|
9575
|
+
...gate,
|
|
9576
|
+
gatingTaskId,
|
|
9577
|
+
gatingFailed: false,
|
|
9578
|
+
relinked: Boolean(gate.gatingTaskId)
|
|
9579
|
+
}
|
|
9580
|
+
},
|
|
9581
|
+
{ idempotencyKey }
|
|
9582
|
+
);
|
|
9583
|
+
} catch (err) {
|
|
9584
|
+
renderFailure(err);
|
|
9585
|
+
}
|
|
9586
|
+
});
|
|
9587
|
+
function parseGateDeadline(raw, nowSecs) {
|
|
9588
|
+
const trimmed = raw.trim();
|
|
9589
|
+
if (/^\d{9,}$/.test(trimmed)) return Number(trimmed);
|
|
9590
|
+
return nowSecs + parseDurationSeconds(trimmed);
|
|
9591
|
+
}
|
|
9592
|
+
var extendGateCmd = new Command10("extend-gate").description(
|
|
9593
|
+
"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)"
|
|
9594
|
+
).argument("<taskId>", "The gated task ID (0x-prefixed hex)").requiredOption(
|
|
9595
|
+
"--deadline <when>",
|
|
9596
|
+
"The new deadline: a Unix timestamp in seconds, or a duration from now such as 48h or 7d"
|
|
9597
|
+
).action(async (taskId, opts) => {
|
|
9598
|
+
try {
|
|
9599
|
+
const id = assertTaskId(taskId);
|
|
9600
|
+
const gate = await readPayoutGate(id);
|
|
9601
|
+
if (!gate) throw new Error(`Task ${taskId} has no payout gate`);
|
|
9602
|
+
if (gate.open) {
|
|
9603
|
+
throw new Error(`The payout gate of ${taskId} is already open; it can no longer change`);
|
|
9604
|
+
}
|
|
9605
|
+
const deadline = parseGateDeadline(
|
|
9606
|
+
opts.deadline,
|
|
9607
|
+
await chainNowSecs(selectedNetwork().chainId)
|
|
9608
|
+
);
|
|
9609
|
+
if (deadline <= gate.deadline) {
|
|
9610
|
+
throw new Error(`--deadline must be later than the current deadline (${gate.deadline})`);
|
|
9611
|
+
}
|
|
9612
|
+
if (deadline > gate.maxDeadline) {
|
|
9544
9613
|
throw new Error(
|
|
9545
|
-
|
|
9614
|
+
`--deadline is past ${gate.maxDeadline}, the latest a gate may run (180 days after the task was created)`
|
|
9546
9615
|
);
|
|
9547
9616
|
}
|
|
9617
|
+
const task = await getTask(cliTaskReadContext(), { taskId: id });
|
|
9618
|
+
if (!task) throw new Error(`Task not found: ${taskId}`);
|
|
9548
9619
|
if (SETTLED_STATUSES.has(task.status)) {
|
|
9549
|
-
throw new Error(`Task ${taskId} is ${task.status};
|
|
9620
|
+
throw new Error(`Task ${taskId} is ${task.status}; ${SETTLED_GATE_MESSAGE}`);
|
|
9550
9621
|
}
|
|
9551
9622
|
const { data: result, idempotencyKey } = await x402Post(
|
|
9552
|
-
|
|
9553
|
-
|
|
9623
|
+
extendGateRelayPath(id),
|
|
9624
|
+
extendGateRelayBody(id, deadline),
|
|
9554
9625
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
9555
9626
|
);
|
|
9556
9627
|
printResult(
|
|
@@ -9558,7 +9629,7 @@ var linkGateCmd = new Command10("link-gate").description(
|
|
|
9558
9629
|
...result,
|
|
9559
9630
|
taskId,
|
|
9560
9631
|
...await settleRecording(result, idempotencyKey),
|
|
9561
|
-
payoutGate: { ...gate,
|
|
9632
|
+
payoutGate: { ...gate, deadline }
|
|
9562
9633
|
},
|
|
9563
9634
|
{ idempotencyKey }
|
|
9564
9635
|
);
|
|
@@ -10804,7 +10875,52 @@ var listCmd = new Command12("list").alias("search").description("List available
|
|
|
10804
10875
|
|
|
10805
10876
|
// src/commands/task/get.ts
|
|
10806
10877
|
import { Command as Command13 } from "commander";
|
|
10807
|
-
var
|
|
10878
|
+
var TASK_CODE_PREFIX = /^TSK-/i;
|
|
10879
|
+
function looksLikeTaskCode(value) {
|
|
10880
|
+
return TASK_CODE_PREFIX.test(value.trim());
|
|
10881
|
+
}
|
|
10882
|
+
function normalizeTaskCode(value) {
|
|
10883
|
+
const reference = normalizeReferenceCode(value);
|
|
10884
|
+
return reference?.entity === "task" ? reference.code : null;
|
|
10885
|
+
}
|
|
10886
|
+
async function resolveTaskCode(code) {
|
|
10887
|
+
const page = await listTasks(cliTaskReadContext(), { q: code, status: "ALL", limit: "2" });
|
|
10888
|
+
const match = page.tasks.find((task) => task.referenceCode?.toUpperCase() === code);
|
|
10889
|
+
return match?.id ?? null;
|
|
10890
|
+
}
|
|
10891
|
+
var getCmd = new Command13("get").description(
|
|
10892
|
+
"Get task details, by 0x task ID or by TSK- reference code (codes resolve only for listed tasks)"
|
|
10893
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex) or task reference code (TSK-XXXXXXXX)").action(async (taskRef) => {
|
|
10894
|
+
let taskId = taskRef;
|
|
10895
|
+
if (looksLikeTaskCode(taskRef)) {
|
|
10896
|
+
const code = normalizeTaskCode(taskRef);
|
|
10897
|
+
if (!code) {
|
|
10898
|
+
return void renderFailure(
|
|
10899
|
+
new Error(
|
|
10900
|
+
`Not a task reference code: ${taskRef.trim()}. A task code is TSK- followed by 8 letters and digits, e.g. TSK-4M0BXQ2E.`
|
|
10901
|
+
),
|
|
10902
|
+
{ details: { code: "invalid_task_code" } }
|
|
10903
|
+
);
|
|
10904
|
+
}
|
|
10905
|
+
let resolved;
|
|
10906
|
+
try {
|
|
10907
|
+
resolved = await resolveTaskCode(code);
|
|
10908
|
+
} catch (err) {
|
|
10909
|
+
return void renderFailure(err);
|
|
10910
|
+
}
|
|
10911
|
+
if (!resolved) {
|
|
10912
|
+
return void renderFailure(
|
|
10913
|
+
new Error(
|
|
10914
|
+
`No listed task has the code ${code}. A code only finds tasks in the public listing, so a private or unlisted task, a task from before the listing cutoff and a mistyped code all look the same here. If you have the task's 0x ID, run: taskmarket task get <taskId>`
|
|
10915
|
+
),
|
|
10916
|
+
{ details: { code: "task_code_not_found", taskCode: code } }
|
|
10917
|
+
);
|
|
10918
|
+
}
|
|
10919
|
+
taskId = resolved;
|
|
10920
|
+
}
|
|
10921
|
+
await printTask(taskId);
|
|
10922
|
+
});
|
|
10923
|
+
async function printTask(taskId) {
|
|
10808
10924
|
const task = await getTask(cliTaskReadContext(), { taskId });
|
|
10809
10925
|
if (!task) {
|
|
10810
10926
|
printError(
|
|
@@ -10820,7 +10936,7 @@ var getCmd = new Command13("get").description("Get task details").argument("<tas
|
|
|
10820
10936
|
...await payoutGateOf(taskId, task)
|
|
10821
10937
|
})
|
|
10822
10938
|
);
|
|
10823
|
-
}
|
|
10939
|
+
}
|
|
10824
10940
|
function winningSubmissionOf(task) {
|
|
10825
10941
|
const awards = task.awards ?? [];
|
|
10826
10942
|
const primary = awards.find((award) => award.isPrimary) ?? [...awards].sort((left, right) => left.rank - right.rank)[0];
|
|
@@ -10872,6 +10988,82 @@ async function termsAmountsAndDeadlines(taskId) {
|
|
|
10872
10988
|
// src/commands/task/submit.ts
|
|
10873
10989
|
import { Command as Command14, Option as Option2 } from "commander";
|
|
10874
10990
|
|
|
10991
|
+
// src/lib/stake-confirmation.ts
|
|
10992
|
+
async function confirmStakeTerms(action, taskId, yes) {
|
|
10993
|
+
if (yes) return true;
|
|
10994
|
+
let detail;
|
|
10995
|
+
try {
|
|
10996
|
+
detail = await getTaskTerms(cliTaskReadContext(), { taskId });
|
|
10997
|
+
} catch {
|
|
10998
|
+
return true;
|
|
10999
|
+
}
|
|
11000
|
+
if (!detail?.terms.stakeRequired) return true;
|
|
11001
|
+
if (detail.amounts.enforcedStakeAmount === "0") return true;
|
|
11002
|
+
const stakeAmount = detail.amounts.enforcedStakeAmount ?? detail.amounts.stakeAmount;
|
|
11003
|
+
renderFailure(
|
|
11004
|
+
new Error(
|
|
11005
|
+
`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.`
|
|
11006
|
+
),
|
|
11007
|
+
{
|
|
11008
|
+
details: {
|
|
11009
|
+
code: "stake_confirmation_required",
|
|
11010
|
+
terms: detail.terms,
|
|
11011
|
+
amounts: detail.amounts,
|
|
11012
|
+
deadlines: detail.deadlines
|
|
11013
|
+
}
|
|
11014
|
+
}
|
|
11015
|
+
);
|
|
11016
|
+
return false;
|
|
11017
|
+
}
|
|
11018
|
+
async function confirmStakeAffordable(address3, stake) {
|
|
11019
|
+
if (stake <= 0n) return true;
|
|
11020
|
+
let balance;
|
|
11021
|
+
try {
|
|
11022
|
+
const result = await apiGet(
|
|
11023
|
+
`/api/wallet/balance?address=${address3}&chainId=${selectedNetwork().chainId}`
|
|
11024
|
+
);
|
|
11025
|
+
if (typeof result?.balanceBaseUnits !== "string") return true;
|
|
11026
|
+
balance = BigInt(result.balanceBaseUnits);
|
|
11027
|
+
} catch {
|
|
11028
|
+
return true;
|
|
11029
|
+
}
|
|
11030
|
+
if (balance >= stake) return true;
|
|
11031
|
+
renderFailure(
|
|
11032
|
+
new Error(
|
|
11033
|
+
`This claim needs a stake of ${stake} base units, and the wallet holds ${balance}. Fund the wallet (taskmarket deposit), then claim again.`
|
|
11034
|
+
),
|
|
11035
|
+
{
|
|
11036
|
+
details: {
|
|
11037
|
+
code: "stake_balance_short",
|
|
11038
|
+
stakeAmount: stake.toString(),
|
|
11039
|
+
balance: balance.toString()
|
|
11040
|
+
}
|
|
11041
|
+
}
|
|
11042
|
+
);
|
|
11043
|
+
return false;
|
|
11044
|
+
}
|
|
11045
|
+
var UNVERIFIED_HOOK_CODE = "unverified_hook";
|
|
11046
|
+
async function confirmUnverifiedHooks(action, taskId, accepted, task) {
|
|
11047
|
+
if (accepted) return true;
|
|
11048
|
+
let read3 = task;
|
|
11049
|
+
if (read3 === void 0) {
|
|
11050
|
+
try {
|
|
11051
|
+
read3 = await getTask(cliTaskReadContext(), { taskId });
|
|
11052
|
+
} catch {
|
|
11053
|
+
return true;
|
|
11054
|
+
}
|
|
11055
|
+
}
|
|
11056
|
+
const hooks = [...read3?.unverifiedHooks ?? []];
|
|
11057
|
+
if (hooks.length === 0) return true;
|
|
11058
|
+
renderFailure(
|
|
11059
|
+
new Error(
|
|
11060
|
+
`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.`
|
|
11061
|
+
),
|
|
11062
|
+
{ details: { code: UNVERIFIED_HOOK_CODE, unverifiedHooks: hooks } }
|
|
11063
|
+
);
|
|
11064
|
+
return false;
|
|
11065
|
+
}
|
|
11066
|
+
|
|
10875
11067
|
// src/lib/task-network.ts
|
|
10876
11068
|
var WRONG_NETWORK_CODE = "wrong_network";
|
|
10877
11069
|
async function confirmTaskOnSelectedNetwork(taskId, task) {
|
|
@@ -10909,26 +11101,32 @@ function collectFile(value, previous) {
|
|
|
10909
11101
|
}
|
|
10910
11102
|
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(
|
|
10911
11103
|
new Option2("--role <role>", "Artifact role applied to all files").choices(["preview", "source", "final", "attachment"]).default("attachment")
|
|
10912
|
-
).
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
11104
|
+
).option(
|
|
11105
|
+
"--accept-unverified-hooks",
|
|
11106
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
11107
|
+
).action(
|
|
11108
|
+
async (taskId, opts) => {
|
|
11109
|
+
try {
|
|
11110
|
+
if (!opts.file || opts.file.length === 0) {
|
|
11111
|
+
printError("--file is required");
|
|
11112
|
+
return;
|
|
11113
|
+
}
|
|
11114
|
+
const submissionKey = resolveIdempotencyKey();
|
|
11115
|
+
if (!await confirmTaskOnSelectedNetwork(taskId)) return;
|
|
11116
|
+
if (!await confirmUnverifiedHooks("submit", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11117
|
+
const keystore = await loadKeystore();
|
|
11118
|
+
const { submissionId, idempotencyKey } = await submitTaskFiles(
|
|
11119
|
+
cliTaskWriteContext(keystore),
|
|
11120
|
+
{ taskId },
|
|
11121
|
+
opts.file.map((path8) => ({ path: path8, role: opts.role })),
|
|
11122
|
+
{ idempotencyKey: submissionKey }
|
|
11123
|
+
);
|
|
11124
|
+
printResult({ submissionId }, { idempotencyKey });
|
|
11125
|
+
} finally {
|
|
11126
|
+
submitCmd.setOptionValue("file", []);
|
|
10917
11127
|
}
|
|
10918
|
-
const submissionKey = resolveIdempotencyKey();
|
|
10919
|
-
if (!await confirmTaskOnSelectedNetwork(taskId)) return;
|
|
10920
|
-
const keystore = await loadKeystore();
|
|
10921
|
-
const { submissionId, idempotencyKey } = await submitTaskFiles(
|
|
10922
|
-
cliTaskWriteContext(keystore),
|
|
10923
|
-
{ taskId },
|
|
10924
|
-
opts.file.map((path8) => ({ path: path8, role: opts.role })),
|
|
10925
|
-
{ idempotencyKey: submissionKey }
|
|
10926
|
-
);
|
|
10927
|
-
printResult({ submissionId }, { idempotencyKey });
|
|
10928
|
-
} finally {
|
|
10929
|
-
submitCmd.setOptionValue("file", []);
|
|
10930
11128
|
}
|
|
10931
|
-
|
|
11129
|
+
);
|
|
10932
11130
|
|
|
10933
11131
|
// src/commands/task/accept.ts
|
|
10934
11132
|
import { Command as Command15 } from "commander";
|
|
@@ -11186,61 +11384,6 @@ function settlementActionCommand(spec) {
|
|
|
11186
11384
|
});
|
|
11187
11385
|
}
|
|
11188
11386
|
|
|
11189
|
-
// src/lib/stake-confirmation.ts
|
|
11190
|
-
async function confirmStakeTerms(action, taskId, yes) {
|
|
11191
|
-
if (yes) return true;
|
|
11192
|
-
let detail;
|
|
11193
|
-
try {
|
|
11194
|
-
detail = await getTaskTerms(cliTaskReadContext(), { taskId });
|
|
11195
|
-
} catch {
|
|
11196
|
-
return true;
|
|
11197
|
-
}
|
|
11198
|
-
if (!detail?.terms.stakeRequired) return true;
|
|
11199
|
-
if (detail.amounts.enforcedStakeAmount === "0") return true;
|
|
11200
|
-
const stakeAmount = detail.amounts.enforcedStakeAmount ?? detail.amounts.stakeAmount;
|
|
11201
|
-
renderFailure(
|
|
11202
|
-
new Error(
|
|
11203
|
-
`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.`
|
|
11204
|
-
),
|
|
11205
|
-
{
|
|
11206
|
-
details: {
|
|
11207
|
-
code: "stake_confirmation_required",
|
|
11208
|
-
terms: detail.terms,
|
|
11209
|
-
amounts: detail.amounts,
|
|
11210
|
-
deadlines: detail.deadlines
|
|
11211
|
-
}
|
|
11212
|
-
}
|
|
11213
|
-
);
|
|
11214
|
-
return false;
|
|
11215
|
-
}
|
|
11216
|
-
async function confirmStakeAffordable(address3, stake) {
|
|
11217
|
-
if (stake <= 0n) return true;
|
|
11218
|
-
let balance;
|
|
11219
|
-
try {
|
|
11220
|
-
const result = await apiGet(
|
|
11221
|
-
`/api/wallet/balance?address=${address3}&chainId=${selectedNetwork().chainId}`
|
|
11222
|
-
);
|
|
11223
|
-
if (typeof result?.balanceBaseUnits !== "string") return true;
|
|
11224
|
-
balance = BigInt(result.balanceBaseUnits);
|
|
11225
|
-
} catch {
|
|
11226
|
-
return true;
|
|
11227
|
-
}
|
|
11228
|
-
if (balance >= stake) return true;
|
|
11229
|
-
renderFailure(
|
|
11230
|
-
new Error(
|
|
11231
|
-
`This claim needs a stake of ${stake} base units, and the wallet holds ${balance}. Fund the wallet (taskmarket deposit), then claim again.`
|
|
11232
|
-
),
|
|
11233
|
-
{
|
|
11234
|
-
details: {
|
|
11235
|
-
code: "stake_balance_short",
|
|
11236
|
-
stakeAmount: stake.toString(),
|
|
11237
|
-
balance: balance.toString()
|
|
11238
|
-
}
|
|
11239
|
-
}
|
|
11240
|
-
);
|
|
11241
|
-
return false;
|
|
11242
|
-
}
|
|
11243
|
-
|
|
11244
11387
|
// src/commands/hires.ts
|
|
11245
11388
|
var ROLES = ["worker", "requester"];
|
|
11246
11389
|
function hireAnswerError(task, wallet, verb) {
|
|
@@ -11400,7 +11543,10 @@ var declineCmd = settlementActionCommand({
|
|
|
11400
11543
|
var hiresCommand = new Command19("hires").description("Hire offers made to you, and hires you made: list, accept, decline").addCommand(listCmd2).addCommand(acceptCmd2).addCommand(declineCmd);
|
|
11401
11544
|
|
|
11402
11545
|
// src/commands/task/claim.ts
|
|
11403
|
-
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").
|
|
11546
|
+
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(
|
|
11547
|
+
"--accept-unverified-hooks",
|
|
11548
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
11549
|
+
).action(async (taskId, opts) => {
|
|
11404
11550
|
const keystore = await loadKeystore();
|
|
11405
11551
|
const task = await getTask(cliTaskReadContext(), { taskId });
|
|
11406
11552
|
const atCapacity = await hireAcceptCapacityError(task, keystore.walletAddress);
|
|
@@ -11409,6 +11555,7 @@ var claimCmd = new Command20("claim").description("Claim a task as a worker").ar
|
|
|
11409
11555
|
details: { code: HIRE_AGENT_AT_CAPACITY }
|
|
11410
11556
|
});
|
|
11411
11557
|
}
|
|
11558
|
+
if (!await confirmUnverifiedHooks("claim", taskId, opts.acceptUnverifiedHooks, task)) return;
|
|
11412
11559
|
if (!await confirmStakeTerms("claim", taskId, opts.yes)) return;
|
|
11413
11560
|
const stake = task ? claimStakeToPost(task) : 0n;
|
|
11414
11561
|
if (!await confirmStakeAffordable(keystore.walletAddress, stake)) return;
|
|
@@ -11421,28 +11568,34 @@ var claimCmd = new Command20("claim").description("Claim a task as a worker").ar
|
|
|
11421
11568
|
|
|
11422
11569
|
// src/commands/task/pitch.ts
|
|
11423
11570
|
import { Command as Command21 } from "commander";
|
|
11424
|
-
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").
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
taskId,
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11571
|
+
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(
|
|
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
|
+
if (!await confirmUnverifiedHooks("pitch", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11577
|
+
if (!await confirmStakeTerms("pitch", taskId, opts.yes)) return;
|
|
11578
|
+
const keystore = await loadKeystore();
|
|
11579
|
+
const signature = await signMessage(buildPitchMessage(taskId), keystore);
|
|
11580
|
+
const { data: result, idempotencyKey } = await attestedWorkerAction(
|
|
11581
|
+
taskId,
|
|
11582
|
+
keystore,
|
|
11583
|
+
(tap) => x402Post(
|
|
11584
|
+
`/api/tasks/${taskId}/pitches`,
|
|
11585
|
+
{
|
|
11586
|
+
taskId,
|
|
11587
|
+
workerAddress: keystore.walletAddress,
|
|
11588
|
+
pitchText: opts.text,
|
|
11589
|
+
...opts.duration ? { estimatedDuration: parseInt(opts.duration, 10) } : {},
|
|
11590
|
+
signature
|
|
11591
|
+
},
|
|
11592
|
+
// TAP-signed, each round with its own nonce, when the task requires tap.
|
|
11593
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT, ...tap ? { tap } : {} }
|
|
11594
|
+
)
|
|
11595
|
+
);
|
|
11596
|
+
printResult({ pitchId: result.pitchId }, { idempotencyKey });
|
|
11597
|
+
}
|
|
11598
|
+
);
|
|
11446
11599
|
|
|
11447
11600
|
// src/commands/task/pitches.ts
|
|
11448
11601
|
import { Command as Command22 } from "commander";
|
|
@@ -11531,31 +11684,37 @@ var proofsCmd = new Command25("proofs").description("List proofs for a benchmark
|
|
|
11531
11684
|
|
|
11532
11685
|
// src/commands/task/bid.ts
|
|
11533
11686
|
import { Command as Command26 } from "commander";
|
|
11534
|
-
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").
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11687
|
+
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(
|
|
11688
|
+
"--accept-unverified-hooks",
|
|
11689
|
+
"Proceed although the task has a hook the hook registry does not list (it can refuse every submission)"
|
|
11690
|
+
).action(
|
|
11691
|
+
async (taskId, opts) => {
|
|
11692
|
+
let priceBaseUnits;
|
|
11693
|
+
try {
|
|
11694
|
+
priceBaseUnits = usdcToBaseUnits(opts.price);
|
|
11695
|
+
} catch (err) {
|
|
11696
|
+
renderFailure(withErrorContext(err, "Invalid --price"));
|
|
11697
|
+
return;
|
|
11698
|
+
}
|
|
11699
|
+
if (!await confirmUnverifiedHooks("bid", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11700
|
+
if (!await confirmStakeTerms("bid", taskId, opts.yes)) return;
|
|
11701
|
+
const path8 = `/api/tasks/${taskId}/bids`;
|
|
11702
|
+
const body = { taskId, price: priceBaseUnits };
|
|
11703
|
+
const task = await taskRequirementsOf(taskId);
|
|
11704
|
+
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
11705
|
+
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
11706
|
+
taskId,
|
|
11707
|
+
await loadKeystore(),
|
|
11708
|
+
async (tap) => x402Post(path8, body, {
|
|
11709
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
11710
|
+
headers: (await signReadAuth())?.headers ?? {},
|
|
11711
|
+
...tap ? { tap } : {}
|
|
11712
|
+
}),
|
|
11713
|
+
task
|
|
11714
|
+
) : await x402Post(path8, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
11715
|
+
printResult({ bidId: result.bidId }, { idempotencyKey });
|
|
11541
11716
|
}
|
|
11542
|
-
|
|
11543
|
-
const path8 = `/api/tasks/${taskId}/bids`;
|
|
11544
|
-
const body = { taskId, price: priceBaseUnits };
|
|
11545
|
-
const task = await taskRequirementsOf(taskId);
|
|
11546
|
-
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
11547
|
-
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
11548
|
-
taskId,
|
|
11549
|
-
await loadKeystore(),
|
|
11550
|
-
async (tap) => x402Post(path8, body, {
|
|
11551
|
-
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
11552
|
-
headers: (await signReadAuth())?.headers ?? {},
|
|
11553
|
-
...tap ? { tap } : {}
|
|
11554
|
-
}),
|
|
11555
|
-
task
|
|
11556
|
-
) : await x402Post(path8, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
11557
|
-
printResult({ bidId: result.bidId }, { idempotencyKey });
|
|
11558
|
-
});
|
|
11717
|
+
);
|
|
11559
11718
|
|
|
11560
11719
|
// src/commands/task/auction-accept.ts
|
|
11561
11720
|
import { Command as Command27 } from "commander";
|
|
@@ -12567,6 +12726,7 @@ taskCommand2.addCommand(listCmd);
|
|
|
12567
12726
|
taskCommand2.addCommand(getCmd);
|
|
12568
12727
|
taskCommand2.addCommand(payoutGateCmd);
|
|
12569
12728
|
taskCommand2.addCommand(linkGateCmd);
|
|
12729
|
+
taskCommand2.addCommand(extendGateCmd);
|
|
12570
12730
|
taskCommand2.addCommand(submitCmd);
|
|
12571
12731
|
taskCommand2.addCommand(acceptCmd);
|
|
12572
12732
|
taskCommand2.addCommand(acceptSubmissionsCmd);
|
|
@@ -12816,7 +12976,7 @@ async function runAgentCommand(options) {
|
|
|
12816
12976
|
try {
|
|
12817
12977
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
12818
12978
|
const pi = assertAgentCompatibility();
|
|
12819
|
-
const { runAgent } = await import("./launch-
|
|
12979
|
+
const { runAgent } = await import("./launch-INDP2HH3.js");
|
|
12820
12980
|
result = await runAgent({
|
|
12821
12981
|
model: options.model,
|
|
12822
12982
|
pi,
|
|
@@ -13250,13 +13410,13 @@ function agentManagementCommands() {
|
|
|
13250
13410
|
const status = new Command57("status").description(
|
|
13251
13411
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
13252
13412
|
).action(async () => {
|
|
13253
|
-
const { collectAgentStatus } = await import("./status-
|
|
13413
|
+
const { collectAgentStatus } = await import("./status-SARVECVT.js");
|
|
13254
13414
|
await run(() => collectAgentStatus());
|
|
13255
13415
|
});
|
|
13256
13416
|
const doctor = new Command57("doctor").description(
|
|
13257
13417
|
"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."
|
|
13258
13418
|
).action(async () => {
|
|
13259
|
-
const { runDoctor } = await import("./doctor-
|
|
13419
|
+
const { runDoctor } = await import("./doctor-IIVQFDIB.js");
|
|
13260
13420
|
const report = await run(() => runDoctor());
|
|
13261
13421
|
if (report && !report.ok) process.exitCode = 1;
|
|
13262
13422
|
});
|
|
@@ -13267,7 +13427,7 @@ function agentManagementCommands() {
|
|
|
13267
13427
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
13268
13428
|
).action(
|
|
13269
13429
|
async (invocationId, options) => {
|
|
13270
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
13430
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-H3JIKN2X.js");
|
|
13271
13431
|
const choice = { rail: options.rail, channel: options.channel };
|
|
13272
13432
|
if (invocationId !== void 0) {
|
|
13273
13433
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -13299,7 +13459,7 @@ function agentManagementCommands() {
|
|
|
13299
13459
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
13300
13460
|
);
|
|
13301
13461
|
}
|
|
13302
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
13462
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-SVCU2MU5.js");
|
|
13303
13463
|
const { rails } = await openAgentChannels();
|
|
13304
13464
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
13305
13465
|
return {
|
|
@@ -13319,8 +13479,8 @@ function agentManagementCommands() {
|
|
|
13319
13479
|
await run(async () => {
|
|
13320
13480
|
await requireExperimental();
|
|
13321
13481
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
13322
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
13323
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
13482
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-SVCU2MU5.js");
|
|
13483
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-H3JIKN2X.js");
|
|
13324
13484
|
const opened = await openAgentChannels();
|
|
13325
13485
|
const { rail, retired } = selectChannel(opened, options);
|
|
13326
13486
|
const result = await closeChannel(
|
|
@@ -13374,7 +13534,7 @@ function agentManagementCommands() {
|
|
|
13374
13534
|
async (options) => {
|
|
13375
13535
|
await run(async () => {
|
|
13376
13536
|
await requireExperimental();
|
|
13377
|
-
const { runPull } = await import("./sync-pull-
|
|
13537
|
+
const { runPull } = await import("./sync-pull-IUPV57MU.js");
|
|
13378
13538
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
13379
13539
|
return runPull(options, {
|
|
13380
13540
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -17281,6 +17441,7 @@ var EVENT_ID2 = /^\d{1,19}$/;
|
|
|
17281
17441
|
var RETRY_BASE_MS = 1e3;
|
|
17282
17442
|
var RETRY_MAX_MS = 3e4;
|
|
17283
17443
|
var RATE_LIMITED_WAIT_MS = 3e4;
|
|
17444
|
+
var RETRY_JITTER = 0.25;
|
|
17284
17445
|
var EARLY_EMPTY_MS = MARKET_EVENT_WAIT_MAX_MS / 5;
|
|
17285
17446
|
var EMPTY_BACKOFF_BASE_MS = 1e3;
|
|
17286
17447
|
var EMPTY_BACKOFF_MAX_MS = 15e3;
|
|
@@ -17318,12 +17479,17 @@ function query3(params) {
|
|
|
17318
17479
|
const text = search.toString();
|
|
17319
17480
|
return text ? `?${text}` : "";
|
|
17320
17481
|
}
|
|
17321
|
-
|
|
17322
|
-
|
|
17482
|
+
var CAUSE_MAX_CHARS = 200;
|
|
17483
|
+
function shortCause(cause) {
|
|
17484
|
+
return cause.length > CAUSE_MAX_CHARS ? `${cause.slice(0, CAUSE_MAX_CHARS)}...` : cause;
|
|
17485
|
+
}
|
|
17486
|
+
function couldNotSign(cause) {
|
|
17487
|
+
return `Could not sign the read-auth message with this keystore${cause ? ` (${shortCause(cause)})` : ""}.`;
|
|
17488
|
+
}
|
|
17489
|
+
async function readAuthHeaders(signal) {
|
|
17490
|
+
const auth = await signReadAuth(signal);
|
|
17323
17491
|
if (!auth) throw new Error("No keystore found. Run `taskmarket init` first.");
|
|
17324
|
-
if (Object.keys(auth.headers).length === 0)
|
|
17325
|
-
throw new Error("Could not sign the read-auth message with this keystore.");
|
|
17326
|
-
}
|
|
17492
|
+
if (Object.keys(auth.headers).length === 0) throw new Error(couldNotSign(auth.error));
|
|
17327
17493
|
return { wallet: auth.walletAddress, headers: auth.headers };
|
|
17328
17494
|
}
|
|
17329
17495
|
async function readHistory(options) {
|
|
@@ -17367,13 +17533,34 @@ function retryable(error) {
|
|
|
17367
17533
|
if (error instanceof ApiError) return error.status === 429 || error.status >= 500;
|
|
17368
17534
|
return error instanceof TypeError;
|
|
17369
17535
|
}
|
|
17536
|
+
function retryWaitMs(error, failures, random) {
|
|
17537
|
+
if (!retryable(error)) throw error;
|
|
17538
|
+
if (error instanceof ApiError && error.status === 429) {
|
|
17539
|
+
return jittered(RATE_LIMITED_WAIT_MS, random);
|
|
17540
|
+
}
|
|
17541
|
+
return backoffWaitMs(failures, random);
|
|
17542
|
+
}
|
|
17543
|
+
function backoffWaitMs(failures, random) {
|
|
17544
|
+
return jittered(Math.min(RETRY_BASE_MS * 2 ** failures, RETRY_MAX_MS), random);
|
|
17545
|
+
}
|
|
17546
|
+
function jittered(ms2, random) {
|
|
17547
|
+
return Math.round(ms2 * (1 + RETRY_JITTER * random()));
|
|
17548
|
+
}
|
|
17370
17549
|
async function followMarketEvents(options = {}) {
|
|
17371
17550
|
const { signal } = options;
|
|
17372
17551
|
const sleep4 = options.sleep ?? abortableSleep;
|
|
17373
17552
|
const now = options.now ?? Date.now;
|
|
17374
17553
|
const stopped = () => signal?.aborted === true || (options.shouldStop?.() ?? false);
|
|
17375
17554
|
const print = options.print ?? ((event) => printResult(event));
|
|
17376
|
-
const
|
|
17555
|
+
const random = options.random ?? Math.random;
|
|
17556
|
+
let auth;
|
|
17557
|
+
try {
|
|
17558
|
+
auth = await readAuthHeaders(signal);
|
|
17559
|
+
} catch (error) {
|
|
17560
|
+
if (signal?.aborted) return;
|
|
17561
|
+
throw error;
|
|
17562
|
+
}
|
|
17563
|
+
const { wallet, headers } = auth;
|
|
17377
17564
|
const network = selectedNetwork().name;
|
|
17378
17565
|
let cursor = options.since ?? await loadMarketEventCursor(wallet, network);
|
|
17379
17566
|
if (cursor === void 0) {
|
|
@@ -17407,9 +17594,7 @@ async function followMarketEvents(options = {}) {
|
|
|
17407
17594
|
failures = 0;
|
|
17408
17595
|
} catch (error) {
|
|
17409
17596
|
if (signal?.aborted) return;
|
|
17410
|
-
|
|
17411
|
-
const rateLimited = error instanceof ApiError && error.status === 429;
|
|
17412
|
-
const waitMs = rateLimited ? RATE_LIMITED_WAIT_MS : Math.min(RETRY_BASE_MS * 2 ** failures, RETRY_MAX_MS);
|
|
17597
|
+
const waitMs = retryWaitMs(error, failures, random);
|
|
17413
17598
|
failures += 1;
|
|
17414
17599
|
warn(
|
|
17415
17600
|
`Reading market events failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
|
|
@@ -17438,6 +17623,145 @@ async function followMarketEvents(options = {}) {
|
|
|
17438
17623
|
}
|
|
17439
17624
|
}
|
|
17440
17625
|
}
|
|
17626
|
+
var TASK_ID = /^0x[0-9a-fA-F]{1,64}$/;
|
|
17627
|
+
var TASK_FOLLOW_INTERVAL_MS = 5e3;
|
|
17628
|
+
var TASK_FOLLOW_PAGE_GAP_MS = 250;
|
|
17629
|
+
var SIGN_ATTEMPTS = 5;
|
|
17630
|
+
var SIGN_ATTEMPT_TIMEOUT_MS = 15e3;
|
|
17631
|
+
function parseTaskId(taskId) {
|
|
17632
|
+
if (!TASK_ID.test(taskId)) throw new Error("--task must be a task id (0x-prefixed hex)");
|
|
17633
|
+
return taskId;
|
|
17634
|
+
}
|
|
17635
|
+
async function signTaskFollow(startup) {
|
|
17636
|
+
const { signal } = startup;
|
|
17637
|
+
if (await checkTaskFollowKeystore() === "none") return null;
|
|
17638
|
+
for (let failures = 0; ; failures += 1) {
|
|
17639
|
+
if (startup.stopped()) return "stopped";
|
|
17640
|
+
const timeout = AbortSignal.timeout(startup.signTimeoutMs);
|
|
17641
|
+
const auth = await signReadAuth(signal ? AbortSignal.any([signal, timeout]) : timeout);
|
|
17642
|
+
if (signal?.aborted) return "stopped";
|
|
17643
|
+
if (auth === null) throw unreadableKeystore(await keystoreLoadFailure() ?? "it went away");
|
|
17644
|
+
if (Object.keys(auth.headers).length > 0) return auth;
|
|
17645
|
+
if (failures + 1 >= SIGN_ATTEMPTS) throw new Error(couldNotSign(auth.error));
|
|
17646
|
+
const waitMs = backoffWaitMs(failures, startup.random);
|
|
17647
|
+
warn(
|
|
17648
|
+
`Signing the read-auth message failed (${shortCause(auth.error ?? "no reason given")}); retrying in ${Math.round(waitMs / 1e3)}s`
|
|
17649
|
+
);
|
|
17650
|
+
await startup.sleep(waitMs, signal);
|
|
17651
|
+
}
|
|
17652
|
+
}
|
|
17653
|
+
var KEYSTORE_SIGNING_FIELDS = ["walletAddress", "deviceId", "apiToken", "encryptedKey"];
|
|
17654
|
+
async function checkTaskFollowKeystore() {
|
|
17655
|
+
let keystore;
|
|
17656
|
+
try {
|
|
17657
|
+
keystore = await loadKeystore();
|
|
17658
|
+
} catch {
|
|
17659
|
+
const failure = await keystoreLoadFailure();
|
|
17660
|
+
if (failure === null) return "none";
|
|
17661
|
+
throw unreadableKeystore(failure);
|
|
17662
|
+
}
|
|
17663
|
+
const fields = keystore ?? {};
|
|
17664
|
+
const missing = KEYSTORE_SIGNING_FIELDS.filter((field) => typeof fields[field] !== "string");
|
|
17665
|
+
if (missing.length > 0) {
|
|
17666
|
+
throw new Error(
|
|
17667
|
+
`The keystore is missing ${missing.join(", ")}, so this follow cannot read as your wallet.`
|
|
17668
|
+
);
|
|
17669
|
+
}
|
|
17670
|
+
return "present";
|
|
17671
|
+
}
|
|
17672
|
+
function unreadableKeystore(failure) {
|
|
17673
|
+
return new Error(
|
|
17674
|
+
`The keystore could not be checked or read (${failure}), so this follow cannot read as your wallet.`
|
|
17675
|
+
);
|
|
17676
|
+
}
|
|
17677
|
+
async function assertTaskVisible(taskId, auth, options) {
|
|
17678
|
+
const { signal } = options;
|
|
17679
|
+
const context = {
|
|
17680
|
+
...cliTaskReadContext(),
|
|
17681
|
+
readAuth: async () => auth,
|
|
17682
|
+
transport: {
|
|
17683
|
+
...cliTaskTransport,
|
|
17684
|
+
get: (path8, headers) => apiGet(path8, { headers, signal })
|
|
17685
|
+
}
|
|
17686
|
+
};
|
|
17687
|
+
let task;
|
|
17688
|
+
for (let failures = 0; ; failures += 1) {
|
|
17689
|
+
if (options.stopped()) return false;
|
|
17690
|
+
try {
|
|
17691
|
+
task = await getTask(context, { taskId });
|
|
17692
|
+
break;
|
|
17693
|
+
} catch (error) {
|
|
17694
|
+
if (signal?.aborted) return false;
|
|
17695
|
+
if (error instanceof ApiError && error.status === 404) break;
|
|
17696
|
+
const waitMs = retryWaitMs(error, failures, options.random);
|
|
17697
|
+
warn(
|
|
17698
|
+
`Reading the task failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
|
|
17699
|
+
);
|
|
17700
|
+
await options.sleep(waitMs, signal);
|
|
17701
|
+
}
|
|
17702
|
+
}
|
|
17703
|
+
if (signal?.aborted) return false;
|
|
17704
|
+
if (!task) {
|
|
17705
|
+
throw new Error(
|
|
17706
|
+
`Task not found: ${taskId} (or this is a private task you don't have access to -- if you have a password for it, run: taskmarket task unlock ${taskId} --password <password>)`
|
|
17707
|
+
);
|
|
17708
|
+
}
|
|
17709
|
+
return true;
|
|
17710
|
+
}
|
|
17711
|
+
async function followTaskMarketEvents(options) {
|
|
17712
|
+
const { signal, taskId } = options;
|
|
17713
|
+
const sleep4 = options.sleep ?? abortableSleep;
|
|
17714
|
+
const stopped = () => signal?.aborted === true || (options.shouldStop?.() ?? false);
|
|
17715
|
+
const print = options.print ?? ((event) => printResult(event));
|
|
17716
|
+
const random = options.random ?? Math.random;
|
|
17717
|
+
const pageSize = options.limit ?? MARKET_EVENT_PAGE_MAX;
|
|
17718
|
+
const startup = {
|
|
17719
|
+
signal,
|
|
17720
|
+
stopped,
|
|
17721
|
+
sleep: sleep4,
|
|
17722
|
+
random,
|
|
17723
|
+
signTimeoutMs: options.signTimeoutMs ?? SIGN_ATTEMPT_TIMEOUT_MS
|
|
17724
|
+
};
|
|
17725
|
+
const auth = await signTaskFollow(startup);
|
|
17726
|
+
if (auth === "stopped") return;
|
|
17727
|
+
const headers = auth?.headers ?? {};
|
|
17728
|
+
if (!await assertTaskVisible(taskId, auth, startup)) return;
|
|
17729
|
+
let cursor = options.since;
|
|
17730
|
+
let catchingUp = cursor === void 0;
|
|
17731
|
+
let failures = 0;
|
|
17732
|
+
while (!stopped()) {
|
|
17733
|
+
let page;
|
|
17734
|
+
try {
|
|
17735
|
+
page = await apiGet(
|
|
17736
|
+
`/api/market-events/tasks/${encodeURIComponent(taskId)}${query3({ since: cursor, limit: pageSize })}`,
|
|
17737
|
+
{ headers, signal }
|
|
17738
|
+
);
|
|
17739
|
+
failures = 0;
|
|
17740
|
+
} catch (error) {
|
|
17741
|
+
if (signal?.aborted) return;
|
|
17742
|
+
const waitMs = retryWaitMs(error, failures, random);
|
|
17743
|
+
failures += 1;
|
|
17744
|
+
warn(
|
|
17745
|
+
`Reading the task's events failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
|
|
17746
|
+
);
|
|
17747
|
+
await sleep4(waitMs, signal);
|
|
17748
|
+
continue;
|
|
17749
|
+
}
|
|
17750
|
+
const after = cursor === void 0 ? -1n : BigInt(cursor);
|
|
17751
|
+
const fresh = page.events.filter((event) => BigInt(event.id) > after);
|
|
17752
|
+
if (!catchingUp) {
|
|
17753
|
+
for (const event of fresh) print(event);
|
|
17754
|
+
}
|
|
17755
|
+
const last = fresh.at(-1)?.id;
|
|
17756
|
+
if (last !== void 0) cursor = last;
|
|
17757
|
+
if (page.events.length >= pageSize && fresh.length > 0) {
|
|
17758
|
+
if (!stopped()) await sleep4(TASK_FOLLOW_PAGE_GAP_MS, signal);
|
|
17759
|
+
continue;
|
|
17760
|
+
}
|
|
17761
|
+
catchingUp = false;
|
|
17762
|
+
if (!stopped()) await sleep4(TASK_FOLLOW_INTERVAL_MS, signal);
|
|
17763
|
+
}
|
|
17764
|
+
}
|
|
17441
17765
|
async function untilInterrupted(follow) {
|
|
17442
17766
|
const controller = new AbortController();
|
|
17443
17767
|
const stop = () => controller.abort();
|
|
@@ -17486,7 +17810,10 @@ function createSeenCommand() {
|
|
|
17486
17810
|
function createEventsCommand() {
|
|
17487
17811
|
return new Command78("events").description(
|
|
17488
17812
|
"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"
|
|
17489
|
-
).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(
|
|
17813
|
+
).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(
|
|
17814
|
+
"--task <taskId>",
|
|
17815
|
+
"One task's timeline instead of your own events; with --follow, its new events as they happen"
|
|
17816
|
+
).option("--newest", "Read your own events newest first, as the web Activity tab does").option("--before <id>", "With --newest, only events before this event id (the next page)").option(
|
|
17490
17817
|
"--follow",
|
|
17491
17818
|
"Keep reading: print each new event with your pending actions on its task, from a cursor stored under ~/.taskmarket"
|
|
17492
17819
|
).action(async (options) => {
|
|
@@ -17494,10 +17821,16 @@ function createEventsCommand() {
|
|
|
17494
17821
|
await readHistory(options);
|
|
17495
17822
|
return;
|
|
17496
17823
|
}
|
|
17497
|
-
if (options.task) throw new Error("--follow reads your own events; it cannot take --task");
|
|
17498
17824
|
assertOrderOptions(options);
|
|
17499
17825
|
const since = parseSince(options.since);
|
|
17500
17826
|
const limit = parseLimit(options.limit);
|
|
17827
|
+
if (options.task !== void 0) {
|
|
17828
|
+
const taskId = parseTaskId(options.task);
|
|
17829
|
+
await untilInterrupted(
|
|
17830
|
+
(signal) => followTaskMarketEvents({ taskId, since, limit, signal })
|
|
17831
|
+
);
|
|
17832
|
+
return;
|
|
17833
|
+
}
|
|
17501
17834
|
await untilInterrupted((signal) => followMarketEvents({ since, limit, signal }));
|
|
17502
17835
|
}).addCommand(createSeenCommand());
|
|
17503
17836
|
}
|
|
@@ -25147,7 +25480,7 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
|
25147
25480
|
sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
|
|
25148
25481
|
|
|
25149
25482
|
// src/commands/project/index.ts
|
|
25150
|
-
import { Command as
|
|
25483
|
+
import { Command as Command145 } from "commander";
|
|
25151
25484
|
|
|
25152
25485
|
// src/commands/project/accept.ts
|
|
25153
25486
|
import { Command as Command127 } from "commander";
|
|
@@ -25161,7 +25494,7 @@ function parseProjectId(value) {
|
|
|
25161
25494
|
return Number(value);
|
|
25162
25495
|
}
|
|
25163
25496
|
var DURATION = /^([0-9]+(?:\.[0-9]+)?)(h|d)$/;
|
|
25164
|
-
function parseEndsAt(value, now = /* @__PURE__ */ new Date()) {
|
|
25497
|
+
function parseEndsAt(value, now = /* @__PURE__ */ new Date(), flag = "--ends-at") {
|
|
25165
25498
|
const trimmed = value.trim();
|
|
25166
25499
|
const duration = DURATION.exec(trimmed);
|
|
25167
25500
|
let at;
|
|
@@ -25171,10 +25504,10 @@ function parseEndsAt(value, now = /* @__PURE__ */ new Date()) {
|
|
|
25171
25504
|
} else {
|
|
25172
25505
|
at = new Date(trimmed);
|
|
25173
25506
|
if (Number.isNaN(at.getTime()) || !/^\d{4}-\d{2}-\d{2}/.test(trimmed)) {
|
|
25174
|
-
return { error:
|
|
25507
|
+
return { error: `${flag} must be an ISO 8601 time or a duration such as 72h or 30d` };
|
|
25175
25508
|
}
|
|
25176
25509
|
}
|
|
25177
|
-
if (at.getTime() <= now.getTime()) return { error:
|
|
25510
|
+
if (at.getTime() <= now.getTime()) return { error: `${flag} must be in the future` };
|
|
25178
25511
|
return at.toISOString();
|
|
25179
25512
|
}
|
|
25180
25513
|
var MAX_TASK_GRACE_SECS = 90 * 24 * 3600;
|
|
@@ -25273,7 +25606,7 @@ function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date())
|
|
|
25273
25606
|
);
|
|
25274
25607
|
return { warning };
|
|
25275
25608
|
}
|
|
25276
|
-
var
|
|
25609
|
+
var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
|
|
25277
25610
|
var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
25278
25611
|
var INPUTS_MAX = 20;
|
|
25279
25612
|
function parseContinuation(flags) {
|
|
@@ -25285,7 +25618,7 @@ function parseContinuation(flags) {
|
|
|
25285
25618
|
return { continuation: null };
|
|
25286
25619
|
}
|
|
25287
25620
|
const parentTaskId = flags.parent.trim();
|
|
25288
|
-
if (!
|
|
25621
|
+
if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
|
|
25289
25622
|
const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
|
|
25290
25623
|
if (bad !== void 0) {
|
|
25291
25624
|
return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
|
|
@@ -25351,9 +25684,93 @@ projectAddTaskCommand.action(async (id, opts) => {
|
|
|
25351
25684
|
}
|
|
25352
25685
|
});
|
|
25353
25686
|
|
|
25354
|
-
// src/commands/project/
|
|
25687
|
+
// src/commands/project/automations.ts
|
|
25355
25688
|
import { Command as Command129 } from "commander";
|
|
25356
|
-
|
|
25689
|
+
function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
25690
|
+
if (opts.cap === void 0) {
|
|
25691
|
+
return { error: "--cap is required: the most the automations may draw from the budget" };
|
|
25692
|
+
}
|
|
25693
|
+
const cap = parseAmount(opts.cap, "--cap");
|
|
25694
|
+
if (typeof cap !== "string") return cap;
|
|
25695
|
+
if (BigInt(cap) <= 0n) return { error: "--cap must be greater than zero" };
|
|
25696
|
+
const body = { projectId, cap };
|
|
25697
|
+
if (opts.expires !== void 0) {
|
|
25698
|
+
const at = parseEndsAt(opts.expires, now, "--expires");
|
|
25699
|
+
if (typeof at !== "string") return at;
|
|
25700
|
+
body.expiresAt = Math.floor(new Date(at).getTime() / 1e3);
|
|
25701
|
+
}
|
|
25702
|
+
if (opts.periodBudget === void 0 !== (opts.period === void 0)) {
|
|
25703
|
+
return { error: "--period-budget and --period go together: pass both or neither" };
|
|
25704
|
+
}
|
|
25705
|
+
if (opts.periodBudget !== void 0 && opts.period !== void 0) {
|
|
25706
|
+
if (opts.period !== "weekly" && opts.period !== "monthly") {
|
|
25707
|
+
return { error: "--period must be weekly or monthly" };
|
|
25708
|
+
}
|
|
25709
|
+
const periodCap = parseAmount(opts.periodBudget, "--period-budget");
|
|
25710
|
+
if (typeof periodCap !== "string") return periodCap;
|
|
25711
|
+
if (BigInt(periodCap) <= 0n) return { error: "--period-budget must be greater than zero" };
|
|
25712
|
+
body.periodCap = periodCap;
|
|
25713
|
+
body.period = opts.period;
|
|
25714
|
+
}
|
|
25715
|
+
return body;
|
|
25716
|
+
}
|
|
25717
|
+
var projectAutomationsOnCommand = new Command129("on").description(
|
|
25718
|
+
"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)"
|
|
25719
|
+
).argument("<projectId>", "Project id").option(
|
|
25720
|
+
"--cap <amount>",
|
|
25721
|
+
"Required: the most the automations may draw from the budget in total, in the payment token (for example 150). Checked here so a missing cap is a JSON error"
|
|
25722
|
+
).option(
|
|
25723
|
+
"--expires <time>",
|
|
25724
|
+
"Optional limit: the automations cannot draw after this time, an ISO 8601 time or a duration such as 30d (contract revision 29 or later)"
|
|
25725
|
+
).option(
|
|
25726
|
+
"--period-budget <amount>",
|
|
25727
|
+
"Optional limit: the most the automations may draw in one period, in the payment token. Needs --period"
|
|
25728
|
+
).option(
|
|
25729
|
+
"--period <period>",
|
|
25730
|
+
"The period of --period-budget: weekly (7 days) or monthly (30 days)"
|
|
25731
|
+
).action(
|
|
25732
|
+
async (id, opts) => {
|
|
25733
|
+
const projectId = parseProjectId(id);
|
|
25734
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25735
|
+
const body = automationsOnBody(projectId, opts);
|
|
25736
|
+
if ("error" in body) return void printError(String(body.error));
|
|
25737
|
+
await postProjectWrite(`/api/projects/${projectId}/automations`, body, {
|
|
25738
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
25739
|
+
extra: {
|
|
25740
|
+
note: `The runner accepts the grant within moments; read it with: taskmarket project automations status ${projectId}`
|
|
25741
|
+
}
|
|
25742
|
+
});
|
|
25743
|
+
}
|
|
25744
|
+
);
|
|
25745
|
+
var projectAutomationsOffCommand = new Command129("off").description(
|
|
25746
|
+
"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)"
|
|
25747
|
+
).argument("<projectId>", "Project id").action(async (id) => {
|
|
25748
|
+
const projectId = parseProjectId(id);
|
|
25749
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25750
|
+
await postProjectWrite(
|
|
25751
|
+
`/api/projects/${projectId}/automations/off`,
|
|
25752
|
+
{ projectId },
|
|
25753
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25754
|
+
);
|
|
25755
|
+
});
|
|
25756
|
+
var projectAutomationsStatusCommand = new Command129("status").description(
|
|
25757
|
+
"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)"
|
|
25758
|
+
).argument("<projectId>", "Project id").action(async (id) => {
|
|
25759
|
+
const projectId = parseProjectId(id);
|
|
25760
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25761
|
+
try {
|
|
25762
|
+
printResult(await apiGet(withChainId(`/api/projects/${projectId}/automations`)));
|
|
25763
|
+
} catch (err) {
|
|
25764
|
+
renderFailure(err);
|
|
25765
|
+
}
|
|
25766
|
+
});
|
|
25767
|
+
var projectAutomationsCommand = new Command129("automations").description(
|
|
25768
|
+
"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"
|
|
25769
|
+
).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
|
|
25770
|
+
|
|
25771
|
+
// src/commands/project/claim.ts
|
|
25772
|
+
import { Command as Command130 } from "commander";
|
|
25773
|
+
var projectClaimCommand = new Command130("claim").description(
|
|
25357
25774
|
"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)"
|
|
25358
25775
|
).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
|
|
25359
25776
|
const projectId = parseProjectId(id);
|
|
@@ -25373,8 +25790,8 @@ var projectClaimCommand = new Command129("claim").description(
|
|
|
25373
25790
|
});
|
|
25374
25791
|
|
|
25375
25792
|
// src/commands/project/close.ts
|
|
25376
|
-
import { Command as
|
|
25377
|
-
var projectCloseCommand = new
|
|
25793
|
+
import { Command as Command131 } from "commander";
|
|
25794
|
+
var projectCloseCommand = new Command131("close").description(
|
|
25378
25795
|
"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)"
|
|
25379
25796
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
25380
25797
|
const projectId = parseProjectId(id);
|
|
@@ -25387,8 +25804,8 @@ var projectCloseCommand = new Command130("close").description(
|
|
|
25387
25804
|
});
|
|
25388
25805
|
|
|
25389
25806
|
// src/commands/project/create.ts
|
|
25390
|
-
import { Command as
|
|
25391
|
-
var projectCreateCommand = new
|
|
25807
|
+
import { Command as Command132 } from "commander";
|
|
25808
|
+
var projectCreateCommand = new Command132("create").description(
|
|
25392
25809
|
"Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
|
|
25393
25810
|
).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
|
|
25394
25811
|
"--ends-at <time>",
|
|
@@ -25422,9 +25839,29 @@ var projectCreateCommand = new Command131("create").description(
|
|
|
25422
25839
|
}
|
|
25423
25840
|
);
|
|
25424
25841
|
|
|
25842
|
+
// src/commands/project/extend.ts
|
|
25843
|
+
import { Command as Command133 } from "commander";
|
|
25844
|
+
var MAX_EXTENSION_MS = 365 * 24 * 3600 * 1e3;
|
|
25845
|
+
var projectExtendCommand = new Command133("extend").description(
|
|
25846
|
+
"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"
|
|
25847
|
+
).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) => {
|
|
25848
|
+
const projectId = parseProjectId(id);
|
|
25849
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25850
|
+
const endsAt = parseEndsAt(opts.ends, /* @__PURE__ */ new Date(), "--ends");
|
|
25851
|
+
if (typeof endsAt !== "string") return void printError(endsAt.error);
|
|
25852
|
+
if (new Date(endsAt).getTime() > Date.now() + MAX_EXTENSION_MS) {
|
|
25853
|
+
return void printError("--ends must be at most 365 days from now");
|
|
25854
|
+
}
|
|
25855
|
+
await postProjectWrite(
|
|
25856
|
+
`/api/projects/${projectId}/extend`,
|
|
25857
|
+
{ projectId, endsAt },
|
|
25858
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25859
|
+
);
|
|
25860
|
+
});
|
|
25861
|
+
|
|
25425
25862
|
// src/commands/project/fund.ts
|
|
25426
|
-
import { Command as
|
|
25427
|
-
var projectFundCommand = new
|
|
25863
|
+
import { Command as Command134 } from "commander";
|
|
25864
|
+
var projectFundCommand = new Command134("fund").description(
|
|
25428
25865
|
"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)"
|
|
25429
25866
|
).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
|
|
25430
25867
|
"--on-behalf-of <address>",
|
|
@@ -25446,7 +25883,7 @@ var projectFundCommand = new Command132("fund").description(
|
|
|
25446
25883
|
});
|
|
25447
25884
|
|
|
25448
25885
|
// src/commands/project/grant.ts
|
|
25449
|
-
import { Command as
|
|
25886
|
+
import { Command as Command135 } from "commander";
|
|
25450
25887
|
function grantBody(projectId, opts) {
|
|
25451
25888
|
if (!ADDRESS.test(opts.operator)) {
|
|
25452
25889
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -25469,8 +25906,8 @@ function grantBody(projectId, opts) {
|
|
|
25469
25906
|
revokeRemovesControl: opts.revokeRemovesControl
|
|
25470
25907
|
};
|
|
25471
25908
|
}
|
|
25472
|
-
var projectGrantCommand = new
|
|
25473
|
-
"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 (costs 0.001 in the payment token)"
|
|
25909
|
+
var projectGrantCommand = new Command135("grant").description(
|
|
25910
|
+
"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)"
|
|
25474
25911
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
|
|
25475
25912
|
"--cap <amount>",
|
|
25476
25913
|
"The most the operator's tasks may draw from the budget in total, net of refunds (payouts keep counting, refunds free it), in the payment token (default: no cap beyond the budget)"
|
|
@@ -25495,7 +25932,7 @@ var projectGrantCommand = new Command133("grant").description(
|
|
|
25495
25932
|
});
|
|
25496
25933
|
|
|
25497
25934
|
// src/commands/project/review.ts
|
|
25498
|
-
import { Command as
|
|
25935
|
+
import { Command as Command136 } from "commander";
|
|
25499
25936
|
function reviewEvaluator(opts) {
|
|
25500
25937
|
if (opts.evaluator !== void 0 && opts.off) {
|
|
25501
25938
|
return { error: "Pass --evaluator <address> or --off, not both" };
|
|
@@ -25510,7 +25947,7 @@ function reviewEvaluator(opts) {
|
|
|
25510
25947
|
}
|
|
25511
25948
|
return opts.evaluator;
|
|
25512
25949
|
}
|
|
25513
|
-
var projectReviewCommand = new
|
|
25950
|
+
var projectReviewCommand = new Command136("review").description(
|
|
25514
25951
|
"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"
|
|
25515
25952
|
).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) => {
|
|
25516
25953
|
const projectId = parseProjectId(id);
|
|
@@ -25551,9 +25988,113 @@ async function ownerEvaluatorWarnings(evaluator) {
|
|
|
25551
25988
|
];
|
|
25552
25989
|
}
|
|
25553
25990
|
|
|
25991
|
+
// src/commands/project/raise-cap.ts
|
|
25992
|
+
import { Command as Command137 } from "commander";
|
|
25993
|
+
var projectRaiseCapCommand = new Command137("raise-cap").description(
|
|
25994
|
+
"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"
|
|
25995
|
+
).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) => {
|
|
25996
|
+
const projectId = parseProjectId(id);
|
|
25997
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25998
|
+
if (!ADDRESS.test(opts.operator)) {
|
|
25999
|
+
return void printError("--operator must be a wallet address (0x + 40 hex chars)");
|
|
26000
|
+
}
|
|
26001
|
+
const cap = parseAmount(opts.cap, "--cap");
|
|
26002
|
+
if (typeof cap !== "string") return void printError(cap.error);
|
|
26003
|
+
await postProjectWrite(
|
|
26004
|
+
`/api/projects/${projectId}/grants/${opts.operator}/cap`,
|
|
26005
|
+
{ projectId, operator: opts.operator, cap },
|
|
26006
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26007
|
+
);
|
|
26008
|
+
});
|
|
26009
|
+
|
|
26010
|
+
// src/commands/project/lower-cap.ts
|
|
26011
|
+
import { Command as Command138 } from "commander";
|
|
26012
|
+
var projectLowerCapCommand = new Command138("lower-cap").description(
|
|
26013
|
+
"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`"
|
|
26014
|
+
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
|
|
26015
|
+
"--cap <amount>",
|
|
26016
|
+
"The new lifetime cap in the payment token, below the current cap"
|
|
26017
|
+
).action(async (id, opts) => {
|
|
26018
|
+
const projectId = parseProjectId(id);
|
|
26019
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26020
|
+
if (!ADDRESS.test(opts.operator)) {
|
|
26021
|
+
return void printError("--operator must be a wallet address (0x + 40 hex chars)");
|
|
26022
|
+
}
|
|
26023
|
+
const cap = parseAmount(opts.cap, "--cap");
|
|
26024
|
+
if (typeof cap !== "string") return void printError(cap.error);
|
|
26025
|
+
if (BigInt(cap) <= 0n) return void printError("--cap must be greater than zero");
|
|
26026
|
+
await postProjectWrite(
|
|
26027
|
+
`/api/projects/${projectId}/grants/${opts.operator}/cap/lower`,
|
|
26028
|
+
{ projectId, operator: opts.operator, cap },
|
|
26029
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26030
|
+
);
|
|
26031
|
+
});
|
|
26032
|
+
|
|
26033
|
+
// src/commands/project/limits.ts
|
|
26034
|
+
import { Command as Command139 } from "commander";
|
|
26035
|
+
function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
26036
|
+
if (!ADDRESS.test(opts.operator)) {
|
|
26037
|
+
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
26038
|
+
}
|
|
26039
|
+
const body = { projectId, operator: opts.operator };
|
|
26040
|
+
if (opts.expires !== void 0) {
|
|
26041
|
+
const at = parseEndsAt(opts.expires, now, "--expires");
|
|
26042
|
+
if (typeof at !== "string") return at;
|
|
26043
|
+
body.expiresAt = Math.floor(new Date(at).getTime() / 1e3);
|
|
26044
|
+
}
|
|
26045
|
+
if (opts.modes !== void 0) {
|
|
26046
|
+
const modes = opts.modes.split(",").map((m) => m.trim().toLowerCase());
|
|
26047
|
+
const unknown = modes.filter((m) => !GRANT_MODE_NAMES.includes(m));
|
|
26048
|
+
if (modes.length === 0 || unknown.length > 0) {
|
|
26049
|
+
return { error: `--modes takes a comma-separated list of: ${GRANT_MODE_NAMES.join(", ")}` };
|
|
26050
|
+
}
|
|
26051
|
+
body.allowedModes = [...new Set(modes)];
|
|
26052
|
+
}
|
|
26053
|
+
if (opts.maxReward !== void 0) {
|
|
26054
|
+
const max = parseAmount(opts.maxReward, "--max-reward");
|
|
26055
|
+
if (typeof max !== "string") return max;
|
|
26056
|
+
if (BigInt(max) <= 0n) return { error: "--max-reward must be greater than zero" };
|
|
26057
|
+
body.maxRewardPerTask = max;
|
|
26058
|
+
}
|
|
26059
|
+
if (opts.periodBudget === void 0 !== (opts.period === void 0)) {
|
|
26060
|
+
return { error: "--period-budget and --period go together: pass both or neither" };
|
|
26061
|
+
}
|
|
26062
|
+
if (opts.periodBudget !== void 0 && opts.period !== void 0) {
|
|
26063
|
+
if (opts.period !== "weekly" && opts.period !== "monthly") {
|
|
26064
|
+
return { error: "--period must be weekly or monthly" };
|
|
26065
|
+
}
|
|
26066
|
+
const periodCap = parseAmount(opts.periodBudget, "--period-budget");
|
|
26067
|
+
if (typeof periodCap !== "string") return periodCap;
|
|
26068
|
+
if (BigInt(periodCap) <= 0n) return { error: "--period-budget must be greater than zero" };
|
|
26069
|
+
body.periodCap = periodCap;
|
|
26070
|
+
body.period = opts.period;
|
|
26071
|
+
}
|
|
26072
|
+
return body;
|
|
26073
|
+
}
|
|
26074
|
+
var projectLimitsCommand = new Command139("limits").description(
|
|
26075
|
+
"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"
|
|
26076
|
+
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
|
|
26077
|
+
"--expires <time>",
|
|
26078
|
+
"The operator cannot draw after this time: ISO 8601 or a duration such as 30d"
|
|
26079
|
+
).option(
|
|
26080
|
+
"--modes <list>",
|
|
26081
|
+
`Task modes the operator may create, comma separated (${GRANT_MODE_NAMES.join(", ")}); default every mode`
|
|
26082
|
+
).option(
|
|
26083
|
+
"--max-reward <amount>",
|
|
26084
|
+
"The most one task may hold from the budget (reward plus evaluator stake), in the payment token"
|
|
26085
|
+
).option("--period-budget <amount>", "The most the operator may draw per period. Needs --period").option("--period <period>", "weekly (7 days) or monthly (30 days). Needs --period-budget").action(async (id, opts) => {
|
|
26086
|
+
const projectId = parseProjectId(id);
|
|
26087
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26088
|
+
const body = limitsBody(projectId, opts);
|
|
26089
|
+
if ("error" in body) return void printError(String(body.error));
|
|
26090
|
+
await postProjectWrite(`/api/projects/${projectId}/grants/${opts.operator}/limits`, body, {
|
|
26091
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26092
|
+
});
|
|
26093
|
+
});
|
|
26094
|
+
|
|
25554
26095
|
// src/commands/project/revoke.ts
|
|
25555
|
-
import { Command as
|
|
25556
|
-
var projectRevokeCommand = new
|
|
26096
|
+
import { Command as Command140 } from "commander";
|
|
26097
|
+
var projectRevokeCommand = new Command140("revoke").description(
|
|
25557
26098
|
"End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
|
|
25558
26099
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
|
|
25559
26100
|
const projectId = parseProjectId(id);
|
|
@@ -25572,7 +26113,7 @@ var projectRevokeCommand = new Command135("revoke").description(
|
|
|
25572
26113
|
});
|
|
25573
26114
|
|
|
25574
26115
|
// src/commands/project/schedule.ts
|
|
25575
|
-
import { Command as
|
|
26116
|
+
import { Command as Command142 } from "commander";
|
|
25576
26117
|
|
|
25577
26118
|
// src/lib/owner-list.ts
|
|
25578
26119
|
import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
|
|
@@ -25613,7 +26154,7 @@ function ownerListQuery(owner, opts, statuses) {
|
|
|
25613
26154
|
|
|
25614
26155
|
// src/commands/workflow-template.ts
|
|
25615
26156
|
import { readFile as readFile4 } from "fs/promises";
|
|
25616
|
-
import { Command as
|
|
26157
|
+
import { Command as Command141 } from "commander";
|
|
25617
26158
|
var UUID2 = /^[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}$/;
|
|
25618
26159
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
25619
26160
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
@@ -25704,7 +26245,7 @@ async function readValidTemplate(path8) {
|
|
|
25704
26245
|
}
|
|
25705
26246
|
return parsed.document;
|
|
25706
26247
|
}
|
|
25707
|
-
var createCommand3 = new
|
|
26248
|
+
var createCommand3 = new Command141("create").description(
|
|
25708
26249
|
"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"
|
|
25709
26250
|
).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
|
|
25710
26251
|
const template = await readValidTemplate(opts.file);
|
|
@@ -25715,7 +26256,7 @@ var createCommand3 = new Command136("create").description(
|
|
|
25715
26256
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25716
26257
|
);
|
|
25717
26258
|
});
|
|
25718
|
-
var updateCommand = new
|
|
26259
|
+
var updateCommand = new Command141("update").description(
|
|
25719
26260
|
"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"
|
|
25720
26261
|
).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
|
|
25721
26262
|
const choice = templateChoice(value);
|
|
@@ -25735,7 +26276,7 @@ var updateCommand = new Command136("update").description(
|
|
|
25735
26276
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25736
26277
|
);
|
|
25737
26278
|
});
|
|
25738
|
-
var listCommand6 = new
|
|
26279
|
+
var listCommand6 = new Command141("list").description(
|
|
25739
26280
|
"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)"
|
|
25740
26281
|
).option("--owner <address>", "The wallet whose templates to list").option(
|
|
25741
26282
|
"--mine",
|
|
@@ -25779,7 +26320,7 @@ var listCommand6 = new Command136("list").description(
|
|
|
25779
26320
|
renderFailure(err);
|
|
25780
26321
|
}
|
|
25781
26322
|
});
|
|
25782
|
-
var showCommand3 = new
|
|
26323
|
+
var showCommand3 = new Command141("show").description(
|
|
25783
26324
|
"Show a saved template, an official template (official:<slug>) or a preset (code, content, research): its parameters, steps and worst case (free)"
|
|
25784
26325
|
).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
|
|
25785
26326
|
const choice = templateChoice(value);
|
|
@@ -25792,7 +26333,7 @@ var showCommand3 = new Command136("show").description(
|
|
|
25792
26333
|
renderFailure(err);
|
|
25793
26334
|
}
|
|
25794
26335
|
});
|
|
25795
|
-
var deleteCommand2 = new
|
|
26336
|
+
var deleteCommand2 = new Command141("delete").description(
|
|
25796
26337
|
"Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
|
|
25797
26338
|
).argument("<templateId>", "Template id").action(async (value) => {
|
|
25798
26339
|
const choice = templateChoice(value);
|
|
@@ -25809,7 +26350,7 @@ var deleteCommand2 = new Command136("delete").description(
|
|
|
25809
26350
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25810
26351
|
);
|
|
25811
26352
|
});
|
|
25812
|
-
var workflowTemplateCommand = new
|
|
26353
|
+
var workflowTemplateCommand = new Command141("template").description(
|
|
25813
26354
|
"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"
|
|
25814
26355
|
).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand3).addCommand(deleteCommand2);
|
|
25815
26356
|
async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
@@ -26022,7 +26563,7 @@ async function read(path8) {
|
|
|
26022
26563
|
renderFailure(err);
|
|
26023
26564
|
}
|
|
26024
26565
|
}
|
|
26025
|
-
var createCommand4 = new
|
|
26566
|
+
var createCommand4 = new Command142("create").description(
|
|
26026
26567
|
"Create a schedule that opens a task from the project's budget on a cadence, or starts a run of a workflow (--workflow or --workflow-file), 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. Costs 0.001 in the payment token"
|
|
26027
26568
|
).argument("<projectId>", "Project id").requiredOption(
|
|
26028
26569
|
"--cadence <cadence>",
|
|
@@ -26061,7 +26602,7 @@ var createCommand4 = new Command137("create").description(
|
|
|
26061
26602
|
});
|
|
26062
26603
|
});
|
|
26063
26604
|
var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
|
|
26064
|
-
var listCommand7 = new
|
|
26605
|
+
var listCommand7 = new Command142("list").description(
|
|
26065
26606
|
"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)"
|
|
26066
26607
|
).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(
|
|
26067
26608
|
"--status <status>",
|
|
@@ -26094,7 +26635,7 @@ var listCommand7 = new Command137("list").description(
|
|
|
26094
26635
|
const query4 = params.toString();
|
|
26095
26636
|
await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
|
|
26096
26637
|
});
|
|
26097
|
-
var showCommand4 = new
|
|
26638
|
+
var showCommand4 = new Command142("show").description(
|
|
26098
26639
|
"Show a schedule (its target, task or workflow, with workflowId and template) and its newest runs: opened, skipped with the reason, or failed, each with its task or workflowRunId (free)"
|
|
26099
26640
|
).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
26100
26641
|
const id = scheduleId(value);
|
|
@@ -26102,7 +26643,7 @@ var showCommand4 = new Command137("show").description(
|
|
|
26102
26643
|
await read(`/api/project-schedules/${id}`);
|
|
26103
26644
|
});
|
|
26104
26645
|
function actionCommand(action, description) {
|
|
26105
|
-
return new
|
|
26646
|
+
return new Command142(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
26106
26647
|
const id = scheduleId(value);
|
|
26107
26648
|
if (typeof id !== "string") return void printError(id.error);
|
|
26108
26649
|
await postProjectWrite(
|
|
@@ -26112,7 +26653,7 @@ function actionCommand(action, description) {
|
|
|
26112
26653
|
);
|
|
26113
26654
|
});
|
|
26114
26655
|
}
|
|
26115
|
-
var settingsCommand = new
|
|
26656
|
+
var settingsCommand = new Command142("settings").description(
|
|
26116
26657
|
"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"
|
|
26117
26658
|
).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) => {
|
|
26118
26659
|
const projectId = parseProjectId(id);
|
|
@@ -26134,8 +26675,8 @@ var settingsCommand = new Command137("settings").description(
|
|
|
26134
26675
|
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26135
26676
|
});
|
|
26136
26677
|
});
|
|
26137
|
-
var projectScheduleCommand = new
|
|
26138
|
-
"Schedules: a task from the project's budget on a cadence, created by the platform runner
|
|
26678
|
+
var projectScheduleCommand = new Command142("schedule").description(
|
|
26679
|
+
"Schedules: a task from the project's budget on a cadence, created by the platform runner once the project's automations are on (`taskmarket project automations on <projectId> --cap <amount>`)"
|
|
26139
26680
|
).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand4).addCommand(
|
|
26140
26681
|
actionCommand(
|
|
26141
26682
|
"pause",
|
|
@@ -26157,15 +26698,57 @@ var projectScheduleCommand = new Command137("schedule").description(
|
|
|
26157
26698
|
"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)"
|
|
26158
26699
|
)
|
|
26159
26700
|
).addCommand(settingsCommand);
|
|
26160
|
-
var projectRunnerCommand = new
|
|
26161
|
-
"The platform runner's address on the selected network's chain, and every chain's runner (free).
|
|
26701
|
+
var projectRunnerCommand = new Command142("runner").description(
|
|
26702
|
+
"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"
|
|
26162
26703
|
).action(async () => {
|
|
26163
26704
|
await read(withChainId("/api/project-runner"));
|
|
26164
26705
|
});
|
|
26165
26706
|
|
|
26707
|
+
// src/commands/project/transfer.ts
|
|
26708
|
+
import { Command as Command143 } from "commander";
|
|
26709
|
+
var proposeCommand = new Command143("propose").description(
|
|
26710
|
+
"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"
|
|
26711
|
+
).argument("<projectId>", "Project id").requiredOption("--to <address>", "The wallet that will own the project once it accepts").action(async (id, opts) => {
|
|
26712
|
+
const projectId = parseProjectId(id);
|
|
26713
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26714
|
+
if (!ADDRESS.test(opts.to)) {
|
|
26715
|
+
return void printError("--to must be a wallet address (0x + 40 hex chars)");
|
|
26716
|
+
}
|
|
26717
|
+
await postProjectWrite(
|
|
26718
|
+
`/api/projects/${projectId}/owner/propose`,
|
|
26719
|
+
{ projectId, newOwner: opts.to },
|
|
26720
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26721
|
+
);
|
|
26722
|
+
});
|
|
26723
|
+
var acceptCommand2 = new Command143("accept").description(
|
|
26724
|
+
"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"
|
|
26725
|
+
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26726
|
+
const projectId = parseProjectId(id);
|
|
26727
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26728
|
+
await postProjectWrite(
|
|
26729
|
+
`/api/projects/${projectId}/owner/accept`,
|
|
26730
|
+
{ projectId },
|
|
26731
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26732
|
+
);
|
|
26733
|
+
});
|
|
26734
|
+
var cancelCommand = new Command143("cancel").description(
|
|
26735
|
+
"Withdraw the pending ownership proposal, as the project owner (costs 0.001 in the payment token)"
|
|
26736
|
+
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26737
|
+
const projectId = parseProjectId(id);
|
|
26738
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26739
|
+
await postProjectWrite(
|
|
26740
|
+
`/api/projects/${projectId}/owner/cancel`,
|
|
26741
|
+
{ projectId },
|
|
26742
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26743
|
+
);
|
|
26744
|
+
});
|
|
26745
|
+
var projectTransferCommand = new Command143("transfer").description(
|
|
26746
|
+
"Hand a project to another wallet in two steps: the owner proposes, the new owner accepts, and the owner can cancel before it does"
|
|
26747
|
+
).addCommand(proposeCommand).addCommand(acceptCommand2).addCommand(cancelCommand);
|
|
26748
|
+
|
|
26166
26749
|
// src/commands/project/show.ts
|
|
26167
|
-
import { Command as
|
|
26168
|
-
var projectShowCommand = new
|
|
26750
|
+
import { Command as Command144 } from "commander";
|
|
26751
|
+
var projectShowCommand = new Command144("show").description(
|
|
26169
26752
|
"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)"
|
|
26170
26753
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26171
26754
|
const projectId = parseProjectId(id);
|
|
@@ -26174,7 +26757,7 @@ var projectShowCommand = new Command138("show").description(
|
|
|
26174
26757
|
printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
|
|
26175
26758
|
});
|
|
26176
26759
|
var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
|
|
26177
|
-
var projectBackersCommand = new
|
|
26760
|
+
var projectBackersCommand = new Command144("backers").description(
|
|
26178
26761
|
"List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
|
|
26179
26762
|
).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) => {
|
|
26180
26763
|
const projectId = parseProjectId(id);
|
|
@@ -26193,13 +26776,13 @@ var projectBackersCommand = new Command138("backers").description(
|
|
|
26193
26776
|
await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
|
|
26194
26777
|
);
|
|
26195
26778
|
});
|
|
26196
|
-
var projectForTaskCommand = new
|
|
26779
|
+
var projectForTaskCommand = new Command144("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) => {
|
|
26197
26780
|
if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
|
|
26198
26781
|
return void printError("The task id must be 0x-prefixed hex");
|
|
26199
26782
|
}
|
|
26200
26783
|
printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
|
|
26201
26784
|
});
|
|
26202
|
-
var projectListCommand = new
|
|
26785
|
+
var projectListCommand = new Command144("list").description(
|
|
26203
26786
|
"List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
|
|
26204
26787
|
).option(
|
|
26205
26788
|
"--funding",
|
|
@@ -26250,7 +26833,7 @@ var projectListCommand = new Command138("list").description(
|
|
|
26250
26833
|
);
|
|
26251
26834
|
|
|
26252
26835
|
// src/commands/project/index.ts
|
|
26253
|
-
var projectCommand = new
|
|
26836
|
+
var projectCommand = new Command145("project").description(
|
|
26254
26837
|
"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"
|
|
26255
26838
|
);
|
|
26256
26839
|
projectCommand.addCommand(projectCreateCommand);
|
|
@@ -26259,7 +26842,13 @@ projectCommand.addCommand(projectAddTaskCommand);
|
|
|
26259
26842
|
projectCommand.addCommand(projectGrantCommand);
|
|
26260
26843
|
projectCommand.addCommand(projectAcceptCommand);
|
|
26261
26844
|
projectCommand.addCommand(projectRevokeCommand);
|
|
26845
|
+
projectCommand.addCommand(projectRaiseCapCommand);
|
|
26846
|
+
projectCommand.addCommand(projectLowerCapCommand);
|
|
26847
|
+
projectCommand.addCommand(projectLimitsCommand);
|
|
26848
|
+
projectCommand.addCommand(projectTransferCommand);
|
|
26849
|
+
projectCommand.addCommand(projectExtendCommand);
|
|
26262
26850
|
projectCommand.addCommand(projectReviewCommand);
|
|
26851
|
+
projectCommand.addCommand(projectAutomationsCommand);
|
|
26263
26852
|
projectCommand.addCommand(projectScheduleCommand);
|
|
26264
26853
|
projectCommand.addCommand(projectRunnerCommand);
|
|
26265
26854
|
projectCommand.addCommand(projectCloseCommand);
|
|
@@ -26271,7 +26860,7 @@ projectCommand.addCommand(projectForTaskCommand);
|
|
|
26271
26860
|
|
|
26272
26861
|
// src/commands/workflow.ts
|
|
26273
26862
|
import { readFile as readFile5 } from "fs/promises";
|
|
26274
|
-
import { Command as
|
|
26863
|
+
import { Command as Command146 } from "commander";
|
|
26275
26864
|
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}$/;
|
|
26276
26865
|
var FILE_MAX_BYTES2 = 256 * 1024;
|
|
26277
26866
|
function parseWorkflowText(text) {
|
|
@@ -26335,7 +26924,7 @@ async function projectContext(projectId) {
|
|
|
26335
26924
|
runner
|
|
26336
26925
|
};
|
|
26337
26926
|
}
|
|
26338
|
-
var validateCommand = new
|
|
26927
|
+
var validateCommand = new Command146("validate").description(
|
|
26339
26928
|
"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)"
|
|
26340
26929
|
).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) => {
|
|
26341
26930
|
const parsed = await readDocument(opts.file ?? file);
|
|
@@ -26378,7 +26967,7 @@ var validateCommand = new Command140("validate").description(
|
|
|
26378
26967
|
document: result.document
|
|
26379
26968
|
});
|
|
26380
26969
|
});
|
|
26381
|
-
var createCommand5 = new
|
|
26970
|
+
var createCommand5 = new Command146("create").description(
|
|
26382
26971
|
"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"
|
|
26383
26972
|
).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
|
|
26384
26973
|
"--template <template>",
|
|
@@ -26421,7 +27010,7 @@ var createCommand5 = new Command140("create").description(
|
|
|
26421
27010
|
);
|
|
26422
27011
|
});
|
|
26423
27012
|
var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
|
|
26424
|
-
var listCommand8 = new
|
|
27013
|
+
var listCommand8 = new Command146("list").description(
|
|
26425
27014
|
"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)"
|
|
26426
27015
|
).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(
|
|
26427
27016
|
"--status <status>",
|
|
@@ -26451,12 +27040,12 @@ var listCommand8 = new Command140("list").description(
|
|
|
26451
27040
|
const query4 = params.toString();
|
|
26452
27041
|
await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
|
|
26453
27042
|
});
|
|
26454
|
-
var showCommand5 = new
|
|
27043
|
+
var showCommand5 = new Command146("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26455
27044
|
const id = uuid(value, "workflow");
|
|
26456
27045
|
if (typeof id !== "string") return void printError(id.error);
|
|
26457
27046
|
await read2(`/api/project-workflows/${id}`);
|
|
26458
27047
|
});
|
|
26459
|
-
var runsCommand = new
|
|
27048
|
+
var runsCommand = new Command146("runs").description("Page through a workflow's runs, newest first (free)").argument("<workflowId>", "Workflow id").option("--limit <count>", "Runs per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (value, opts) => {
|
|
26460
27049
|
const id = uuid(value, "workflow");
|
|
26461
27050
|
if (typeof id !== "string") return void printError(id.error);
|
|
26462
27051
|
if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
|
|
@@ -26468,14 +27057,14 @@ var runsCommand = new Command140("runs").description("Page through a workflow's
|
|
|
26468
27057
|
const query4 = params.toString();
|
|
26469
27058
|
await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
|
|
26470
27059
|
});
|
|
26471
|
-
var statusCommand3 = new
|
|
27060
|
+
var statusCommand3 = new Command146("status").description(
|
|
26472
27061
|
"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)"
|
|
26473
27062
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26474
27063
|
const id = uuid(value, "run");
|
|
26475
27064
|
if (typeof id !== "string") return void printError(id.error);
|
|
26476
27065
|
await read2(`/api/project-workflow-runs/${id}`);
|
|
26477
27066
|
});
|
|
26478
|
-
var runCommand2 = new
|
|
27067
|
+
var runCommand2 = new Command146("run").description(
|
|
26479
27068
|
"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"
|
|
26480
27069
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26481
27070
|
const id = uuid(value, "workflow");
|
|
@@ -26487,7 +27076,7 @@ var runCommand2 = new Command140("run").description(
|
|
|
26487
27076
|
);
|
|
26488
27077
|
});
|
|
26489
27078
|
function stepCommand(action, description) {
|
|
26490
|
-
return new
|
|
27079
|
+
return new Command146(action).description(description).argument("<runId>", "Run id").requiredOption(
|
|
26491
27080
|
"--step <key>",
|
|
26492
27081
|
"The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
|
|
26493
27082
|
).action(async (value, opts) => {
|
|
@@ -26502,7 +27091,7 @@ function stepCommand(action, description) {
|
|
|
26502
27091
|
);
|
|
26503
27092
|
});
|
|
26504
27093
|
}
|
|
26505
|
-
var
|
|
27094
|
+
var cancelCommand2 = new Command146("cancel").description(
|
|
26506
27095
|
"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"
|
|
26507
27096
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26508
27097
|
const id = uuid(value, "run");
|
|
@@ -26513,7 +27102,7 @@ var cancelCommand = new Command140("cancel").description(
|
|
|
26513
27102
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26514
27103
|
);
|
|
26515
27104
|
});
|
|
26516
|
-
var stopAutoPayoutCommand = new
|
|
27105
|
+
var stopAutoPayoutCommand = new Command146("stop-auto-payout").description(
|
|
26517
27106
|
"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"
|
|
26518
27107
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26519
27108
|
const id = uuid(value, "run");
|
|
@@ -26524,7 +27113,7 @@ var stopAutoPayoutCommand = new Command140("stop-auto-payout").description(
|
|
|
26524
27113
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26525
27114
|
);
|
|
26526
27115
|
});
|
|
26527
|
-
var deleteCommand3 = new
|
|
27116
|
+
var deleteCommand3 = new Command146("delete").description(
|
|
26528
27117
|
"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"
|
|
26529
27118
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26530
27119
|
const id = uuid(value, "workflow");
|
|
@@ -26546,21 +27135,21 @@ async function ownerRead(path8) {
|
|
|
26546
27135
|
renderFailure(err);
|
|
26547
27136
|
}
|
|
26548
27137
|
}
|
|
26549
|
-
var payoutListCommand = new
|
|
27138
|
+
var payoutListCommand = new Command146("list").description(
|
|
26550
27139
|
"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) or unavailable (free)"
|
|
26551
27140
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26552
27141
|
const id = uuid(value, "run");
|
|
26553
27142
|
if (typeof id !== "string") return void printError(id.error);
|
|
26554
27143
|
await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
|
|
26555
27144
|
});
|
|
26556
|
-
var payoutShowCommand = new
|
|
27145
|
+
var payoutShowCommand = new Command146("show").description(
|
|
26557
27146
|
"Show a payout proposal: its status (pending, confirmed, auto_paid or unavailable), mode, txHash and intentId once sent, the ranking and rationale, and `accept`, the winners and shares (basis points) confirming sends; owner and operators only (free)"
|
|
26558
27147
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
26559
27148
|
const id = uuid(value, "payout proposal");
|
|
26560
27149
|
if (typeof id !== "string") return void printError(id.error);
|
|
26561
27150
|
await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
|
|
26562
27151
|
});
|
|
26563
|
-
var payoutConfirmCommand = new
|
|
27152
|
+
var payoutConfirmCommand = new Command146("confirm").description(
|
|
26564
27153
|
"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`"
|
|
26565
27154
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
26566
27155
|
const id = uuid(value, "payout proposal");
|
|
@@ -26583,10 +27172,10 @@ var payoutConfirmCommand = new Command140("confirm").description(
|
|
|
26583
27172
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT, extra: { accept: view.accept } }
|
|
26584
27173
|
);
|
|
26585
27174
|
});
|
|
26586
|
-
var payoutCommand = new
|
|
27175
|
+
var payoutCommand = new Command146("payout").description(
|
|
26587
27176
|
"Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
|
|
26588
27177
|
).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand);
|
|
26589
|
-
var settingsCommand2 = new
|
|
27178
|
+
var settingsCommand2 = new Command146("settings").description(
|
|
26590
27179
|
`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`
|
|
26591
27180
|
).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
|
|
26592
27181
|
const projectId = parseProjectId(id);
|
|
@@ -26617,7 +27206,7 @@ var settingsCommand2 = new Command140("settings").description(
|
|
|
26617
27206
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26618
27207
|
);
|
|
26619
27208
|
});
|
|
26620
|
-
var workflowCommand = new
|
|
27209
|
+
var workflowCommand = new Command146("workflow").description(
|
|
26621
27210
|
"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"
|
|
26622
27211
|
).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand5).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
|
|
26623
27212
|
stepCommand(
|
|
@@ -26629,11 +27218,11 @@ var workflowCommand = new Command140("workflow").description(
|
|
|
26629
27218
|
"retry",
|
|
26630
27219
|
"Retry a failed step the run waits on, as a new attempt, as the owner; a forEach that failed over_budget recounts its list, and one that failed too_many_items is refused (costs 0.001 in the payment token)"
|
|
26631
27220
|
)
|
|
26632
|
-
).addCommand(
|
|
27221
|
+
).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
|
|
26633
27222
|
|
|
26634
27223
|
// src/commands/drops.ts
|
|
26635
|
-
import { Command as
|
|
26636
|
-
var listCommand9 = new
|
|
27224
|
+
import { Command as Command147 } from "commander";
|
|
27225
|
+
var listCommand9 = new Command147("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").action(async (opts) => {
|
|
26637
27226
|
try {
|
|
26638
27227
|
const input = parseInput(TaskDropDirectoryInputSchema, {
|
|
26639
27228
|
limit: optionalInt(opts.limit),
|
|
@@ -26646,7 +27235,7 @@ var listCommand9 = new Command141("list").description("List public Task Drops, o
|
|
|
26646
27235
|
renderFailure(err);
|
|
26647
27236
|
}
|
|
26648
27237
|
});
|
|
26649
|
-
var showCommand6 = new
|
|
27238
|
+
var showCommand6 = new Command147("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
|
|
26650
27239
|
try {
|
|
26651
27240
|
const input = parseInput(TaskDropGetInputSchema, { taskDropId });
|
|
26652
27241
|
const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
|
|
@@ -26658,7 +27247,7 @@ var showCommand6 = new Command141("show").description("Show a Task Drop and its
|
|
|
26658
27247
|
renderFailure(err);
|
|
26659
27248
|
}
|
|
26660
27249
|
});
|
|
26661
|
-
var subscribeCommand = new
|
|
27250
|
+
var subscribeCommand = new Command147("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(
|
|
26662
27251
|
async (taskDropId, opts) => {
|
|
26663
27252
|
try {
|
|
26664
27253
|
if (opts.official) {
|
|
@@ -26686,7 +27275,7 @@ var subscribeCommand = new Command141("subscribe").description("Subscribe an ema
|
|
|
26686
27275
|
}
|
|
26687
27276
|
}
|
|
26688
27277
|
);
|
|
26689
|
-
var statusCommand4 = new
|
|
27278
|
+
var statusCommand4 = new Command147("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) => {
|
|
26690
27279
|
try {
|
|
26691
27280
|
if (opts.official) {
|
|
26692
27281
|
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
@@ -26703,10 +27292,10 @@ var statusCommand4 = new Command141("status").description("Check whether an emai
|
|
|
26703
27292
|
renderFailure(err);
|
|
26704
27293
|
}
|
|
26705
27294
|
});
|
|
26706
|
-
var dropsCommand = new
|
|
27295
|
+
var dropsCommand = new Command147("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
|
|
26707
27296
|
|
|
26708
27297
|
// src/commands/hooks.ts
|
|
26709
|
-
import { Command as
|
|
27298
|
+
import { Command as Command148 } from "commander";
|
|
26710
27299
|
import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
|
|
26711
27300
|
function withV2Declarations(entry) {
|
|
26712
27301
|
const mask = capabilitiesOf(entry);
|
|
@@ -26742,7 +27331,7 @@ async function probeHookVersion(entry, chainId) {
|
|
|
26742
27331
|
return reverted ? { ...entry, hookVersion: 1 } : entry;
|
|
26743
27332
|
}
|
|
26744
27333
|
}
|
|
26745
|
-
var listCommand10 = new
|
|
27334
|
+
var listCommand10 = new Command148("list").description(
|
|
26746
27335
|
"List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
|
|
26747
27336
|
).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(
|
|
26748
27337
|
"--cursor <cursor>",
|
|
@@ -26781,7 +27370,7 @@ var listCommand10 = new Command142("list").description(
|
|
|
26781
27370
|
}
|
|
26782
27371
|
}
|
|
26783
27372
|
);
|
|
26784
|
-
var showCommand7 = new
|
|
27373
|
+
var showCommand7 = new Command148("show").description(
|
|
26785
27374
|
"Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
|
|
26786
27375
|
).argument("<address>", "Hook contract address").action(async (address3) => {
|
|
26787
27376
|
try {
|
|
@@ -26801,7 +27390,7 @@ var showCommand7 = new Command142("show").description(
|
|
|
26801
27390
|
renderFailure(err);
|
|
26802
27391
|
}
|
|
26803
27392
|
});
|
|
26804
|
-
var encodeConfigCommand = new
|
|
27393
|
+
var encodeConfigCommand = new Command148("encode-config").description(
|
|
26805
27394
|
"Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
|
|
26806
27395
|
).argument("<address>", "Hook contract address").requiredOption(
|
|
26807
27396
|
"--values <json>",
|
|
@@ -26830,7 +27419,7 @@ var encodeConfigCommand = new Command142("encode-config").description(
|
|
|
26830
27419
|
renderFailure(err);
|
|
26831
27420
|
}
|
|
26832
27421
|
});
|
|
26833
|
-
var attachmentConfigCommand = new
|
|
27422
|
+
var attachmentConfigCommand = new Command148("attachment-config").description(
|
|
26834
27423
|
"Show the protocol-default hook order and maximum hooks per task on the selected --network"
|
|
26835
27424
|
).action(async () => {
|
|
26836
27425
|
try {
|
|
@@ -26839,12 +27428,12 @@ var attachmentConfigCommand = new Command142("attachment-config").description(
|
|
|
26839
27428
|
renderFailure(err);
|
|
26840
27429
|
}
|
|
26841
27430
|
});
|
|
26842
|
-
var hooksCommand = new
|
|
27431
|
+
var hooksCommand = new Command148("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand);
|
|
26843
27432
|
|
|
26844
27433
|
// src/commands/tap.ts
|
|
26845
27434
|
import { promises as fs11 } from "fs";
|
|
26846
|
-
import { Command as
|
|
26847
|
-
var tapCommand = new
|
|
27435
|
+
import { Command as Command149 } from "commander";
|
|
27436
|
+
var tapCommand = new Command149("tap").description(
|
|
26848
27437
|
"Manage the TAP signing key used on tasks that require TAP verification"
|
|
26849
27438
|
);
|
|
26850
27439
|
tapCommand.command("import").description(
|
|
@@ -27003,7 +27592,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
|
|
|
27003
27592
|
});
|
|
27004
27593
|
|
|
27005
27594
|
// src/commands/hire.ts
|
|
27006
|
-
import { Command as
|
|
27595
|
+
import { Command as Command150 } from "commander";
|
|
27007
27596
|
var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
|
|
27008
27597
|
async function lookupListedService(worker, serviceId) {
|
|
27009
27598
|
let listing;
|
|
@@ -27035,7 +27624,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
|
|
|
27035
27624
|
}
|
|
27036
27625
|
return null;
|
|
27037
27626
|
}
|
|
27038
|
-
var hireCommand = new
|
|
27627
|
+
var hireCommand = new Command150("hire").description(
|
|
27039
27628
|
"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."
|
|
27040
27629
|
).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(
|
|
27041
27630
|
"--requires-evaluator",
|
|
@@ -27098,7 +27687,7 @@ hireCommand.action(async (worker, opts) => {
|
|
|
27098
27687
|
// src/index.ts
|
|
27099
27688
|
var require2 = createRequire(import.meta.url);
|
|
27100
27689
|
var { version } = require2("../package.json");
|
|
27101
|
-
var program = new
|
|
27690
|
+
var program = new Command151();
|
|
27102
27691
|
setLastErrorCliVersion(version);
|
|
27103
27692
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
27104
27693
|
program.option(
|