@lucid-agents/taskmarket 1.33.0 → 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-J7LB2GAY.js → api-R76D244Y.js} +2 -2
- package/dist/{channels-XY4SSEBG.js → channels-SVCU2MU5.js} +4 -4
- package/dist/{chunk-KGU3CSYK.js → chunk-45GK5BHD.js} +8 -8
- package/dist/{chunk-ACKPSLIR.js → chunk-54OR2JDT.js} +10 -6
- package/dist/{chunk-BESAWMVS.js → chunk-B7W4G3EY.js} +1 -1
- package/dist/{chunk-ALTIKIGD.js → chunk-BDKM5JMT.js} +1 -1
- package/dist/{chunk-YUYW5N4U.js → chunk-CHX7O7EU.js} +1 -1
- package/dist/{chunk-QUIWYQZL.js → chunk-G3U2BQNC.js} +27 -5
- package/dist/{chunk-WVHSHZBK.js → chunk-JRWRBSS2.js} +3 -3
- package/dist/{chunk-VW7I7J5Q.js → chunk-KHDQRFHG.js} +5 -5
- package/dist/{chunk-TZH4XU62.js → chunk-QAGDCIMU.js} +1690 -1518
- package/dist/{chunk-E7HZKIUP.js → chunk-WP7GXSKE.js} +3 -3
- package/dist/{chunk-JZ3SUHWV.js → chunk-YGSVDU2D.js} +3 -3
- package/dist/{chunk-QQ4PHAPV.js → chunk-YHVP2UNE.js} +1 -1
- package/dist/{doctor-LHFMQ737.js → doctor-IIVQFDIB.js} +8 -8
- package/dist/index.js +677 -131
- package/dist/{launch-B2KFGY2L.js → launch-INDP2HH3.js} +11 -11
- package/dist/pi-extensions/xgate.cjs +2944 -2801
- package/dist/{read-auth-P2WTHPWW.js → read-auth-AGP3CUMT.js} +3 -3
- package/dist/{reconcile-7AIMC4P3.js → reconcile-H3JIKN2X.js} +4 -4
- package/dist/{status-6EYEBSQ6.js → status-SARVECVT.js} +8 -8
- package/dist/{sync-pull-XSIEQDGD.js → sync-pull-IUPV57MU.js} +4 -4
- package/dist/{task-access-grants-Z32WK3FJ.js → task-access-grants-HALV3NEO.js} +2 -2
- package/package.json +3 -3
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];
|
|
@@ -12610,6 +12726,7 @@ taskCommand2.addCommand(listCmd);
|
|
|
12610
12726
|
taskCommand2.addCommand(getCmd);
|
|
12611
12727
|
taskCommand2.addCommand(payoutGateCmd);
|
|
12612
12728
|
taskCommand2.addCommand(linkGateCmd);
|
|
12729
|
+
taskCommand2.addCommand(extendGateCmd);
|
|
12613
12730
|
taskCommand2.addCommand(submitCmd);
|
|
12614
12731
|
taskCommand2.addCommand(acceptCmd);
|
|
12615
12732
|
taskCommand2.addCommand(acceptSubmissionsCmd);
|
|
@@ -12859,7 +12976,7 @@ async function runAgentCommand(options) {
|
|
|
12859
12976
|
try {
|
|
12860
12977
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
12861
12978
|
const pi = assertAgentCompatibility();
|
|
12862
|
-
const { runAgent } = await import("./launch-
|
|
12979
|
+
const { runAgent } = await import("./launch-INDP2HH3.js");
|
|
12863
12980
|
result = await runAgent({
|
|
12864
12981
|
model: options.model,
|
|
12865
12982
|
pi,
|
|
@@ -13293,13 +13410,13 @@ function agentManagementCommands() {
|
|
|
13293
13410
|
const status = new Command57("status").description(
|
|
13294
13411
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
13295
13412
|
).action(async () => {
|
|
13296
|
-
const { collectAgentStatus } = await import("./status-
|
|
13413
|
+
const { collectAgentStatus } = await import("./status-SARVECVT.js");
|
|
13297
13414
|
await run(() => collectAgentStatus());
|
|
13298
13415
|
});
|
|
13299
13416
|
const doctor = new Command57("doctor").description(
|
|
13300
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."
|
|
13301
13418
|
).action(async () => {
|
|
13302
|
-
const { runDoctor } = await import("./doctor-
|
|
13419
|
+
const { runDoctor } = await import("./doctor-IIVQFDIB.js");
|
|
13303
13420
|
const report = await run(() => runDoctor());
|
|
13304
13421
|
if (report && !report.ok) process.exitCode = 1;
|
|
13305
13422
|
});
|
|
@@ -13310,7 +13427,7 @@ function agentManagementCommands() {
|
|
|
13310
13427
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
13311
13428
|
).action(
|
|
13312
13429
|
async (invocationId, options) => {
|
|
13313
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
13430
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-H3JIKN2X.js");
|
|
13314
13431
|
const choice = { rail: options.rail, channel: options.channel };
|
|
13315
13432
|
if (invocationId !== void 0) {
|
|
13316
13433
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -13342,7 +13459,7 @@ function agentManagementCommands() {
|
|
|
13342
13459
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
13343
13460
|
);
|
|
13344
13461
|
}
|
|
13345
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
13462
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-SVCU2MU5.js");
|
|
13346
13463
|
const { rails } = await openAgentChannels();
|
|
13347
13464
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
13348
13465
|
return {
|
|
@@ -13362,8 +13479,8 @@ function agentManagementCommands() {
|
|
|
13362
13479
|
await run(async () => {
|
|
13363
13480
|
await requireExperimental();
|
|
13364
13481
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
13365
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
13366
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
13482
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-SVCU2MU5.js");
|
|
13483
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-H3JIKN2X.js");
|
|
13367
13484
|
const opened = await openAgentChannels();
|
|
13368
13485
|
const { rail, retired } = selectChannel(opened, options);
|
|
13369
13486
|
const result = await closeChannel(
|
|
@@ -13417,7 +13534,7 @@ function agentManagementCommands() {
|
|
|
13417
13534
|
async (options) => {
|
|
13418
13535
|
await run(async () => {
|
|
13419
13536
|
await requireExperimental();
|
|
13420
|
-
const { runPull } = await import("./sync-pull-
|
|
13537
|
+
const { runPull } = await import("./sync-pull-IUPV57MU.js");
|
|
13421
13538
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
13422
13539
|
return runPull(options, {
|
|
13423
13540
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -17324,6 +17441,7 @@ var EVENT_ID2 = /^\d{1,19}$/;
|
|
|
17324
17441
|
var RETRY_BASE_MS = 1e3;
|
|
17325
17442
|
var RETRY_MAX_MS = 3e4;
|
|
17326
17443
|
var RATE_LIMITED_WAIT_MS = 3e4;
|
|
17444
|
+
var RETRY_JITTER = 0.25;
|
|
17327
17445
|
var EARLY_EMPTY_MS = MARKET_EVENT_WAIT_MAX_MS / 5;
|
|
17328
17446
|
var EMPTY_BACKOFF_BASE_MS = 1e3;
|
|
17329
17447
|
var EMPTY_BACKOFF_MAX_MS = 15e3;
|
|
@@ -17361,12 +17479,17 @@ function query3(params) {
|
|
|
17361
17479
|
const text = search.toString();
|
|
17362
17480
|
return text ? `?${text}` : "";
|
|
17363
17481
|
}
|
|
17364
|
-
|
|
17365
|
-
|
|
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);
|
|
17366
17491
|
if (!auth) throw new Error("No keystore found. Run `taskmarket init` first.");
|
|
17367
|
-
if (Object.keys(auth.headers).length === 0)
|
|
17368
|
-
throw new Error("Could not sign the read-auth message with this keystore.");
|
|
17369
|
-
}
|
|
17492
|
+
if (Object.keys(auth.headers).length === 0) throw new Error(couldNotSign(auth.error));
|
|
17370
17493
|
return { wallet: auth.walletAddress, headers: auth.headers };
|
|
17371
17494
|
}
|
|
17372
17495
|
async function readHistory(options) {
|
|
@@ -17410,13 +17533,34 @@ function retryable(error) {
|
|
|
17410
17533
|
if (error instanceof ApiError) return error.status === 429 || error.status >= 500;
|
|
17411
17534
|
return error instanceof TypeError;
|
|
17412
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
|
+
}
|
|
17413
17549
|
async function followMarketEvents(options = {}) {
|
|
17414
17550
|
const { signal } = options;
|
|
17415
17551
|
const sleep4 = options.sleep ?? abortableSleep;
|
|
17416
17552
|
const now = options.now ?? Date.now;
|
|
17417
17553
|
const stopped = () => signal?.aborted === true || (options.shouldStop?.() ?? false);
|
|
17418
17554
|
const print = options.print ?? ((event) => printResult(event));
|
|
17419
|
-
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;
|
|
17420
17564
|
const network = selectedNetwork().name;
|
|
17421
17565
|
let cursor = options.since ?? await loadMarketEventCursor(wallet, network);
|
|
17422
17566
|
if (cursor === void 0) {
|
|
@@ -17450,9 +17594,7 @@ async function followMarketEvents(options = {}) {
|
|
|
17450
17594
|
failures = 0;
|
|
17451
17595
|
} catch (error) {
|
|
17452
17596
|
if (signal?.aborted) return;
|
|
17453
|
-
|
|
17454
|
-
const rateLimited = error instanceof ApiError && error.status === 429;
|
|
17455
|
-
const waitMs = rateLimited ? RATE_LIMITED_WAIT_MS : Math.min(RETRY_BASE_MS * 2 ** failures, RETRY_MAX_MS);
|
|
17597
|
+
const waitMs = retryWaitMs(error, failures, random);
|
|
17456
17598
|
failures += 1;
|
|
17457
17599
|
warn(
|
|
17458
17600
|
`Reading market events failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
|
|
@@ -17481,6 +17623,145 @@ async function followMarketEvents(options = {}) {
|
|
|
17481
17623
|
}
|
|
17482
17624
|
}
|
|
17483
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
|
+
}
|
|
17484
17765
|
async function untilInterrupted(follow) {
|
|
17485
17766
|
const controller = new AbortController();
|
|
17486
17767
|
const stop = () => controller.abort();
|
|
@@ -17529,7 +17810,10 @@ function createSeenCommand() {
|
|
|
17529
17810
|
function createEventsCommand() {
|
|
17530
17811
|
return new Command78("events").description(
|
|
17531
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"
|
|
17532
|
-
).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(
|
|
17533
17817
|
"--follow",
|
|
17534
17818
|
"Keep reading: print each new event with your pending actions on its task, from a cursor stored under ~/.taskmarket"
|
|
17535
17819
|
).action(async (options) => {
|
|
@@ -17537,10 +17821,16 @@ function createEventsCommand() {
|
|
|
17537
17821
|
await readHistory(options);
|
|
17538
17822
|
return;
|
|
17539
17823
|
}
|
|
17540
|
-
if (options.task) throw new Error("--follow reads your own events; it cannot take --task");
|
|
17541
17824
|
assertOrderOptions(options);
|
|
17542
17825
|
const since = parseSince(options.since);
|
|
17543
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
|
+
}
|
|
17544
17834
|
await untilInterrupted((signal) => followMarketEvents({ since, limit, signal }));
|
|
17545
17835
|
}).addCommand(createSeenCommand());
|
|
17546
17836
|
}
|
|
@@ -25190,7 +25480,7 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
|
25190
25480
|
sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
|
|
25191
25481
|
|
|
25192
25482
|
// src/commands/project/index.ts
|
|
25193
|
-
import { Command as
|
|
25483
|
+
import { Command as Command145 } from "commander";
|
|
25194
25484
|
|
|
25195
25485
|
// src/commands/project/accept.ts
|
|
25196
25486
|
import { Command as Command127 } from "commander";
|
|
@@ -25204,7 +25494,7 @@ function parseProjectId(value) {
|
|
|
25204
25494
|
return Number(value);
|
|
25205
25495
|
}
|
|
25206
25496
|
var DURATION = /^([0-9]+(?:\.[0-9]+)?)(h|d)$/;
|
|
25207
|
-
function parseEndsAt(value, now = /* @__PURE__ */ new Date()) {
|
|
25497
|
+
function parseEndsAt(value, now = /* @__PURE__ */ new Date(), flag = "--ends-at") {
|
|
25208
25498
|
const trimmed = value.trim();
|
|
25209
25499
|
const duration = DURATION.exec(trimmed);
|
|
25210
25500
|
let at;
|
|
@@ -25214,10 +25504,10 @@ function parseEndsAt(value, now = /* @__PURE__ */ new Date()) {
|
|
|
25214
25504
|
} else {
|
|
25215
25505
|
at = new Date(trimmed);
|
|
25216
25506
|
if (Number.isNaN(at.getTime()) || !/^\d{4}-\d{2}-\d{2}/.test(trimmed)) {
|
|
25217
|
-
return { error:
|
|
25507
|
+
return { error: `${flag} must be an ISO 8601 time or a duration such as 72h or 30d` };
|
|
25218
25508
|
}
|
|
25219
25509
|
}
|
|
25220
|
-
if (at.getTime() <= now.getTime()) return { error:
|
|
25510
|
+
if (at.getTime() <= now.getTime()) return { error: `${flag} must be in the future` };
|
|
25221
25511
|
return at.toISOString();
|
|
25222
25512
|
}
|
|
25223
25513
|
var MAX_TASK_GRACE_SECS = 90 * 24 * 3600;
|
|
@@ -25316,7 +25606,7 @@ function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date())
|
|
|
25316
25606
|
);
|
|
25317
25607
|
return { warning };
|
|
25318
25608
|
}
|
|
25319
|
-
var
|
|
25609
|
+
var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
|
|
25320
25610
|
var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
25321
25611
|
var INPUTS_MAX = 20;
|
|
25322
25612
|
function parseContinuation(flags) {
|
|
@@ -25328,7 +25618,7 @@ function parseContinuation(flags) {
|
|
|
25328
25618
|
return { continuation: null };
|
|
25329
25619
|
}
|
|
25330
25620
|
const parentTaskId = flags.parent.trim();
|
|
25331
|
-
if (!
|
|
25621
|
+
if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
|
|
25332
25622
|
const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
|
|
25333
25623
|
if (bad !== void 0) {
|
|
25334
25624
|
return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
|
|
@@ -25394,9 +25684,93 @@ projectAddTaskCommand.action(async (id, opts) => {
|
|
|
25394
25684
|
}
|
|
25395
25685
|
});
|
|
25396
25686
|
|
|
25397
|
-
// src/commands/project/
|
|
25687
|
+
// src/commands/project/automations.ts
|
|
25398
25688
|
import { Command as Command129 } from "commander";
|
|
25399
|
-
|
|
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(
|
|
25400
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)"
|
|
25401
25775
|
).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
|
|
25402
25776
|
const projectId = parseProjectId(id);
|
|
@@ -25416,8 +25790,8 @@ var projectClaimCommand = new Command129("claim").description(
|
|
|
25416
25790
|
});
|
|
25417
25791
|
|
|
25418
25792
|
// src/commands/project/close.ts
|
|
25419
|
-
import { Command as
|
|
25420
|
-
var projectCloseCommand = new
|
|
25793
|
+
import { Command as Command131 } from "commander";
|
|
25794
|
+
var projectCloseCommand = new Command131("close").description(
|
|
25421
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)"
|
|
25422
25796
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
25423
25797
|
const projectId = parseProjectId(id);
|
|
@@ -25430,8 +25804,8 @@ var projectCloseCommand = new Command130("close").description(
|
|
|
25430
25804
|
});
|
|
25431
25805
|
|
|
25432
25806
|
// src/commands/project/create.ts
|
|
25433
|
-
import { Command as
|
|
25434
|
-
var projectCreateCommand = new
|
|
25807
|
+
import { Command as Command132 } from "commander";
|
|
25808
|
+
var projectCreateCommand = new Command132("create").description(
|
|
25435
25809
|
"Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
|
|
25436
25810
|
).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
|
|
25437
25811
|
"--ends-at <time>",
|
|
@@ -25465,9 +25839,29 @@ var projectCreateCommand = new Command131("create").description(
|
|
|
25465
25839
|
}
|
|
25466
25840
|
);
|
|
25467
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
|
+
|
|
25468
25862
|
// src/commands/project/fund.ts
|
|
25469
|
-
import { Command as
|
|
25470
|
-
var projectFundCommand = new
|
|
25863
|
+
import { Command as Command134 } from "commander";
|
|
25864
|
+
var projectFundCommand = new Command134("fund").description(
|
|
25471
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)"
|
|
25472
25866
|
).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
|
|
25473
25867
|
"--on-behalf-of <address>",
|
|
@@ -25489,7 +25883,7 @@ var projectFundCommand = new Command132("fund").description(
|
|
|
25489
25883
|
});
|
|
25490
25884
|
|
|
25491
25885
|
// src/commands/project/grant.ts
|
|
25492
|
-
import { Command as
|
|
25886
|
+
import { Command as Command135 } from "commander";
|
|
25493
25887
|
function grantBody(projectId, opts) {
|
|
25494
25888
|
if (!ADDRESS.test(opts.operator)) {
|
|
25495
25889
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -25512,8 +25906,8 @@ function grantBody(projectId, opts) {
|
|
|
25512
25906
|
revokeRemovesControl: opts.revokeRemovesControl
|
|
25513
25907
|
};
|
|
25514
25908
|
}
|
|
25515
|
-
var projectGrantCommand = new
|
|
25516
|
-
"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)"
|
|
25517
25911
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
|
|
25518
25912
|
"--cap <amount>",
|
|
25519
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)"
|
|
@@ -25538,7 +25932,7 @@ var projectGrantCommand = new Command133("grant").description(
|
|
|
25538
25932
|
});
|
|
25539
25933
|
|
|
25540
25934
|
// src/commands/project/review.ts
|
|
25541
|
-
import { Command as
|
|
25935
|
+
import { Command as Command136 } from "commander";
|
|
25542
25936
|
function reviewEvaluator(opts) {
|
|
25543
25937
|
if (opts.evaluator !== void 0 && opts.off) {
|
|
25544
25938
|
return { error: "Pass --evaluator <address> or --off, not both" };
|
|
@@ -25553,7 +25947,7 @@ function reviewEvaluator(opts) {
|
|
|
25553
25947
|
}
|
|
25554
25948
|
return opts.evaluator;
|
|
25555
25949
|
}
|
|
25556
|
-
var projectReviewCommand = new
|
|
25950
|
+
var projectReviewCommand = new Command136("review").description(
|
|
25557
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"
|
|
25558
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) => {
|
|
25559
25953
|
const projectId = parseProjectId(id);
|
|
@@ -25594,9 +25988,113 @@ async function ownerEvaluatorWarnings(evaluator) {
|
|
|
25594
25988
|
];
|
|
25595
25989
|
}
|
|
25596
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
|
+
|
|
25597
26095
|
// src/commands/project/revoke.ts
|
|
25598
|
-
import { Command as
|
|
25599
|
-
var projectRevokeCommand = new
|
|
26096
|
+
import { Command as Command140 } from "commander";
|
|
26097
|
+
var projectRevokeCommand = new Command140("revoke").description(
|
|
25600
26098
|
"End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
|
|
25601
26099
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
|
|
25602
26100
|
const projectId = parseProjectId(id);
|
|
@@ -25615,7 +26113,7 @@ var projectRevokeCommand = new Command135("revoke").description(
|
|
|
25615
26113
|
});
|
|
25616
26114
|
|
|
25617
26115
|
// src/commands/project/schedule.ts
|
|
25618
|
-
import { Command as
|
|
26116
|
+
import { Command as Command142 } from "commander";
|
|
25619
26117
|
|
|
25620
26118
|
// src/lib/owner-list.ts
|
|
25621
26119
|
import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
|
|
@@ -25656,7 +26154,7 @@ function ownerListQuery(owner, opts, statuses) {
|
|
|
25656
26154
|
|
|
25657
26155
|
// src/commands/workflow-template.ts
|
|
25658
26156
|
import { readFile as readFile4 } from "fs/promises";
|
|
25659
|
-
import { Command as
|
|
26157
|
+
import { Command as Command141 } from "commander";
|
|
25660
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}$/;
|
|
25661
26159
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
25662
26160
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
@@ -25747,7 +26245,7 @@ async function readValidTemplate(path8) {
|
|
|
25747
26245
|
}
|
|
25748
26246
|
return parsed.document;
|
|
25749
26247
|
}
|
|
25750
|
-
var createCommand3 = new
|
|
26248
|
+
var createCommand3 = new Command141("create").description(
|
|
25751
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"
|
|
25752
26250
|
).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
|
|
25753
26251
|
const template = await readValidTemplate(opts.file);
|
|
@@ -25758,7 +26256,7 @@ var createCommand3 = new Command136("create").description(
|
|
|
25758
26256
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25759
26257
|
);
|
|
25760
26258
|
});
|
|
25761
|
-
var updateCommand = new
|
|
26259
|
+
var updateCommand = new Command141("update").description(
|
|
25762
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"
|
|
25763
26261
|
).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
|
|
25764
26262
|
const choice = templateChoice(value);
|
|
@@ -25778,7 +26276,7 @@ var updateCommand = new Command136("update").description(
|
|
|
25778
26276
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25779
26277
|
);
|
|
25780
26278
|
});
|
|
25781
|
-
var listCommand6 = new
|
|
26279
|
+
var listCommand6 = new Command141("list").description(
|
|
25782
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)"
|
|
25783
26281
|
).option("--owner <address>", "The wallet whose templates to list").option(
|
|
25784
26282
|
"--mine",
|
|
@@ -25822,7 +26320,7 @@ var listCommand6 = new Command136("list").description(
|
|
|
25822
26320
|
renderFailure(err);
|
|
25823
26321
|
}
|
|
25824
26322
|
});
|
|
25825
|
-
var showCommand3 = new
|
|
26323
|
+
var showCommand3 = new Command141("show").description(
|
|
25826
26324
|
"Show a saved template, an official template (official:<slug>) or a preset (code, content, research): its parameters, steps and worst case (free)"
|
|
25827
26325
|
).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
|
|
25828
26326
|
const choice = templateChoice(value);
|
|
@@ -25835,7 +26333,7 @@ var showCommand3 = new Command136("show").description(
|
|
|
25835
26333
|
renderFailure(err);
|
|
25836
26334
|
}
|
|
25837
26335
|
});
|
|
25838
|
-
var deleteCommand2 = new
|
|
26336
|
+
var deleteCommand2 = new Command141("delete").description(
|
|
25839
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"
|
|
25840
26338
|
).argument("<templateId>", "Template id").action(async (value) => {
|
|
25841
26339
|
const choice = templateChoice(value);
|
|
@@ -25852,7 +26350,7 @@ var deleteCommand2 = new Command136("delete").description(
|
|
|
25852
26350
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25853
26351
|
);
|
|
25854
26352
|
});
|
|
25855
|
-
var workflowTemplateCommand = new
|
|
26353
|
+
var workflowTemplateCommand = new Command141("template").description(
|
|
25856
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"
|
|
25857
26355
|
).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand3).addCommand(deleteCommand2);
|
|
25858
26356
|
async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
@@ -26065,7 +26563,7 @@ async function read(path8) {
|
|
|
26065
26563
|
renderFailure(err);
|
|
26066
26564
|
}
|
|
26067
26565
|
}
|
|
26068
|
-
var createCommand4 = new
|
|
26566
|
+
var createCommand4 = new Command142("create").description(
|
|
26069
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"
|
|
26070
26568
|
).argument("<projectId>", "Project id").requiredOption(
|
|
26071
26569
|
"--cadence <cadence>",
|
|
@@ -26104,7 +26602,7 @@ var createCommand4 = new Command137("create").description(
|
|
|
26104
26602
|
});
|
|
26105
26603
|
});
|
|
26106
26604
|
var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
|
|
26107
|
-
var listCommand7 = new
|
|
26605
|
+
var listCommand7 = new Command142("list").description(
|
|
26108
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)"
|
|
26109
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(
|
|
26110
26608
|
"--status <status>",
|
|
@@ -26137,7 +26635,7 @@ var listCommand7 = new Command137("list").description(
|
|
|
26137
26635
|
const query4 = params.toString();
|
|
26138
26636
|
await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
|
|
26139
26637
|
});
|
|
26140
|
-
var showCommand4 = new
|
|
26638
|
+
var showCommand4 = new Command142("show").description(
|
|
26141
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)"
|
|
26142
26640
|
).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
26143
26641
|
const id = scheduleId(value);
|
|
@@ -26145,7 +26643,7 @@ var showCommand4 = new Command137("show").description(
|
|
|
26145
26643
|
await read(`/api/project-schedules/${id}`);
|
|
26146
26644
|
});
|
|
26147
26645
|
function actionCommand(action, description) {
|
|
26148
|
-
return new
|
|
26646
|
+
return new Command142(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
26149
26647
|
const id = scheduleId(value);
|
|
26150
26648
|
if (typeof id !== "string") return void printError(id.error);
|
|
26151
26649
|
await postProjectWrite(
|
|
@@ -26155,7 +26653,7 @@ function actionCommand(action, description) {
|
|
|
26155
26653
|
);
|
|
26156
26654
|
});
|
|
26157
26655
|
}
|
|
26158
|
-
var settingsCommand = new
|
|
26656
|
+
var settingsCommand = new Command142("settings").description(
|
|
26159
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"
|
|
26160
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) => {
|
|
26161
26659
|
const projectId = parseProjectId(id);
|
|
@@ -26177,8 +26675,8 @@ var settingsCommand = new Command137("settings").description(
|
|
|
26177
26675
|
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26178
26676
|
});
|
|
26179
26677
|
});
|
|
26180
|
-
var projectScheduleCommand = new
|
|
26181
|
-
"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>`)"
|
|
26182
26680
|
).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand4).addCommand(
|
|
26183
26681
|
actionCommand(
|
|
26184
26682
|
"pause",
|
|
@@ -26200,15 +26698,57 @@ var projectScheduleCommand = new Command137("schedule").description(
|
|
|
26200
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)"
|
|
26201
26699
|
)
|
|
26202
26700
|
).addCommand(settingsCommand);
|
|
26203
|
-
var projectRunnerCommand = new
|
|
26204
|
-
"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"
|
|
26205
26703
|
).action(async () => {
|
|
26206
26704
|
await read(withChainId("/api/project-runner"));
|
|
26207
26705
|
});
|
|
26208
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
|
+
|
|
26209
26749
|
// src/commands/project/show.ts
|
|
26210
|
-
import { Command as
|
|
26211
|
-
var projectShowCommand = new
|
|
26750
|
+
import { Command as Command144 } from "commander";
|
|
26751
|
+
var projectShowCommand = new Command144("show").description(
|
|
26212
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)"
|
|
26213
26753
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26214
26754
|
const projectId = parseProjectId(id);
|
|
@@ -26217,7 +26757,7 @@ var projectShowCommand = new Command138("show").description(
|
|
|
26217
26757
|
printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
|
|
26218
26758
|
});
|
|
26219
26759
|
var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
|
|
26220
|
-
var projectBackersCommand = new
|
|
26760
|
+
var projectBackersCommand = new Command144("backers").description(
|
|
26221
26761
|
"List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
|
|
26222
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) => {
|
|
26223
26763
|
const projectId = parseProjectId(id);
|
|
@@ -26236,13 +26776,13 @@ var projectBackersCommand = new Command138("backers").description(
|
|
|
26236
26776
|
await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
|
|
26237
26777
|
);
|
|
26238
26778
|
});
|
|
26239
|
-
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) => {
|
|
26240
26780
|
if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
|
|
26241
26781
|
return void printError("The task id must be 0x-prefixed hex");
|
|
26242
26782
|
}
|
|
26243
26783
|
printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
|
|
26244
26784
|
});
|
|
26245
|
-
var projectListCommand = new
|
|
26785
|
+
var projectListCommand = new Command144("list").description(
|
|
26246
26786
|
"List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
|
|
26247
26787
|
).option(
|
|
26248
26788
|
"--funding",
|
|
@@ -26293,7 +26833,7 @@ var projectListCommand = new Command138("list").description(
|
|
|
26293
26833
|
);
|
|
26294
26834
|
|
|
26295
26835
|
// src/commands/project/index.ts
|
|
26296
|
-
var projectCommand = new
|
|
26836
|
+
var projectCommand = new Command145("project").description(
|
|
26297
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"
|
|
26298
26838
|
);
|
|
26299
26839
|
projectCommand.addCommand(projectCreateCommand);
|
|
@@ -26302,7 +26842,13 @@ projectCommand.addCommand(projectAddTaskCommand);
|
|
|
26302
26842
|
projectCommand.addCommand(projectGrantCommand);
|
|
26303
26843
|
projectCommand.addCommand(projectAcceptCommand);
|
|
26304
26844
|
projectCommand.addCommand(projectRevokeCommand);
|
|
26845
|
+
projectCommand.addCommand(projectRaiseCapCommand);
|
|
26846
|
+
projectCommand.addCommand(projectLowerCapCommand);
|
|
26847
|
+
projectCommand.addCommand(projectLimitsCommand);
|
|
26848
|
+
projectCommand.addCommand(projectTransferCommand);
|
|
26849
|
+
projectCommand.addCommand(projectExtendCommand);
|
|
26305
26850
|
projectCommand.addCommand(projectReviewCommand);
|
|
26851
|
+
projectCommand.addCommand(projectAutomationsCommand);
|
|
26306
26852
|
projectCommand.addCommand(projectScheduleCommand);
|
|
26307
26853
|
projectCommand.addCommand(projectRunnerCommand);
|
|
26308
26854
|
projectCommand.addCommand(projectCloseCommand);
|
|
@@ -26314,7 +26860,7 @@ projectCommand.addCommand(projectForTaskCommand);
|
|
|
26314
26860
|
|
|
26315
26861
|
// src/commands/workflow.ts
|
|
26316
26862
|
import { readFile as readFile5 } from "fs/promises";
|
|
26317
|
-
import { Command as
|
|
26863
|
+
import { Command as Command146 } from "commander";
|
|
26318
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}$/;
|
|
26319
26865
|
var FILE_MAX_BYTES2 = 256 * 1024;
|
|
26320
26866
|
function parseWorkflowText(text) {
|
|
@@ -26378,7 +26924,7 @@ async function projectContext(projectId) {
|
|
|
26378
26924
|
runner
|
|
26379
26925
|
};
|
|
26380
26926
|
}
|
|
26381
|
-
var validateCommand = new
|
|
26927
|
+
var validateCommand = new Command146("validate").description(
|
|
26382
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)"
|
|
26383
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) => {
|
|
26384
26930
|
const parsed = await readDocument(opts.file ?? file);
|
|
@@ -26421,7 +26967,7 @@ var validateCommand = new Command140("validate").description(
|
|
|
26421
26967
|
document: result.document
|
|
26422
26968
|
});
|
|
26423
26969
|
});
|
|
26424
|
-
var createCommand5 = new
|
|
26970
|
+
var createCommand5 = new Command146("create").description(
|
|
26425
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"
|
|
26426
26972
|
).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
|
|
26427
26973
|
"--template <template>",
|
|
@@ -26464,7 +27010,7 @@ var createCommand5 = new Command140("create").description(
|
|
|
26464
27010
|
);
|
|
26465
27011
|
});
|
|
26466
27012
|
var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
|
|
26467
|
-
var listCommand8 = new
|
|
27013
|
+
var listCommand8 = new Command146("list").description(
|
|
26468
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)"
|
|
26469
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(
|
|
26470
27016
|
"--status <status>",
|
|
@@ -26494,12 +27040,12 @@ var listCommand8 = new Command140("list").description(
|
|
|
26494
27040
|
const query4 = params.toString();
|
|
26495
27041
|
await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
|
|
26496
27042
|
});
|
|
26497
|
-
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) => {
|
|
26498
27044
|
const id = uuid(value, "workflow");
|
|
26499
27045
|
if (typeof id !== "string") return void printError(id.error);
|
|
26500
27046
|
await read2(`/api/project-workflows/${id}`);
|
|
26501
27047
|
});
|
|
26502
|
-
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) => {
|
|
26503
27049
|
const id = uuid(value, "workflow");
|
|
26504
27050
|
if (typeof id !== "string") return void printError(id.error);
|
|
26505
27051
|
if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
|
|
@@ -26511,14 +27057,14 @@ var runsCommand = new Command140("runs").description("Page through a workflow's
|
|
|
26511
27057
|
const query4 = params.toString();
|
|
26512
27058
|
await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
|
|
26513
27059
|
});
|
|
26514
|
-
var statusCommand3 = new
|
|
27060
|
+
var statusCommand3 = new Command146("status").description(
|
|
26515
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)"
|
|
26516
27062
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26517
27063
|
const id = uuid(value, "run");
|
|
26518
27064
|
if (typeof id !== "string") return void printError(id.error);
|
|
26519
27065
|
await read2(`/api/project-workflow-runs/${id}`);
|
|
26520
27066
|
});
|
|
26521
|
-
var runCommand2 = new
|
|
27067
|
+
var runCommand2 = new Command146("run").description(
|
|
26522
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"
|
|
26523
27069
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26524
27070
|
const id = uuid(value, "workflow");
|
|
@@ -26530,7 +27076,7 @@ var runCommand2 = new Command140("run").description(
|
|
|
26530
27076
|
);
|
|
26531
27077
|
});
|
|
26532
27078
|
function stepCommand(action, description) {
|
|
26533
|
-
return new
|
|
27079
|
+
return new Command146(action).description(description).argument("<runId>", "Run id").requiredOption(
|
|
26534
27080
|
"--step <key>",
|
|
26535
27081
|
"The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
|
|
26536
27082
|
).action(async (value, opts) => {
|
|
@@ -26545,7 +27091,7 @@ function stepCommand(action, description) {
|
|
|
26545
27091
|
);
|
|
26546
27092
|
});
|
|
26547
27093
|
}
|
|
26548
|
-
var
|
|
27094
|
+
var cancelCommand2 = new Command146("cancel").description(
|
|
26549
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"
|
|
26550
27096
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26551
27097
|
const id = uuid(value, "run");
|
|
@@ -26556,7 +27102,7 @@ var cancelCommand = new Command140("cancel").description(
|
|
|
26556
27102
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26557
27103
|
);
|
|
26558
27104
|
});
|
|
26559
|
-
var stopAutoPayoutCommand = new
|
|
27105
|
+
var stopAutoPayoutCommand = new Command146("stop-auto-payout").description(
|
|
26560
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"
|
|
26561
27107
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26562
27108
|
const id = uuid(value, "run");
|
|
@@ -26567,7 +27113,7 @@ var stopAutoPayoutCommand = new Command140("stop-auto-payout").description(
|
|
|
26567
27113
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26568
27114
|
);
|
|
26569
27115
|
});
|
|
26570
|
-
var deleteCommand3 = new
|
|
27116
|
+
var deleteCommand3 = new Command146("delete").description(
|
|
26571
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"
|
|
26572
27118
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
26573
27119
|
const id = uuid(value, "workflow");
|
|
@@ -26589,21 +27135,21 @@ async function ownerRead(path8) {
|
|
|
26589
27135
|
renderFailure(err);
|
|
26590
27136
|
}
|
|
26591
27137
|
}
|
|
26592
|
-
var payoutListCommand = new
|
|
27138
|
+
var payoutListCommand = new Command146("list").description(
|
|
26593
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)"
|
|
26594
27140
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
26595
27141
|
const id = uuid(value, "run");
|
|
26596
27142
|
if (typeof id !== "string") return void printError(id.error);
|
|
26597
27143
|
await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
|
|
26598
27144
|
});
|
|
26599
|
-
var payoutShowCommand = new
|
|
27145
|
+
var payoutShowCommand = new Command146("show").description(
|
|
26600
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)"
|
|
26601
27147
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
26602
27148
|
const id = uuid(value, "payout proposal");
|
|
26603
27149
|
if (typeof id !== "string") return void printError(id.error);
|
|
26604
27150
|
await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
|
|
26605
27151
|
});
|
|
26606
|
-
var payoutConfirmCommand = new
|
|
27152
|
+
var payoutConfirmCommand = new Command146("confirm").description(
|
|
26607
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`"
|
|
26608
27154
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
26609
27155
|
const id = uuid(value, "payout proposal");
|
|
@@ -26626,10 +27172,10 @@ var payoutConfirmCommand = new Command140("confirm").description(
|
|
|
26626
27172
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT, extra: { accept: view.accept } }
|
|
26627
27173
|
);
|
|
26628
27174
|
});
|
|
26629
|
-
var payoutCommand = new
|
|
27175
|
+
var payoutCommand = new Command146("payout").description(
|
|
26630
27176
|
"Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
|
|
26631
27177
|
).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand);
|
|
26632
|
-
var settingsCommand2 = new
|
|
27178
|
+
var settingsCommand2 = new Command146("settings").description(
|
|
26633
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`
|
|
26634
27180
|
).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
|
|
26635
27181
|
const projectId = parseProjectId(id);
|
|
@@ -26660,7 +27206,7 @@ var settingsCommand2 = new Command140("settings").description(
|
|
|
26660
27206
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26661
27207
|
);
|
|
26662
27208
|
});
|
|
26663
|
-
var workflowCommand = new
|
|
27209
|
+
var workflowCommand = new Command146("workflow").description(
|
|
26664
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"
|
|
26665
27211
|
).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand5).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
|
|
26666
27212
|
stepCommand(
|
|
@@ -26672,11 +27218,11 @@ var workflowCommand = new Command140("workflow").description(
|
|
|
26672
27218
|
"retry",
|
|
26673
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)"
|
|
26674
27220
|
)
|
|
26675
|
-
).addCommand(
|
|
27221
|
+
).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
|
|
26676
27222
|
|
|
26677
27223
|
// src/commands/drops.ts
|
|
26678
|
-
import { Command as
|
|
26679
|
-
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) => {
|
|
26680
27226
|
try {
|
|
26681
27227
|
const input = parseInput(TaskDropDirectoryInputSchema, {
|
|
26682
27228
|
limit: optionalInt(opts.limit),
|
|
@@ -26689,7 +27235,7 @@ var listCommand9 = new Command141("list").description("List public Task Drops, o
|
|
|
26689
27235
|
renderFailure(err);
|
|
26690
27236
|
}
|
|
26691
27237
|
});
|
|
26692
|
-
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) => {
|
|
26693
27239
|
try {
|
|
26694
27240
|
const input = parseInput(TaskDropGetInputSchema, { taskDropId });
|
|
26695
27241
|
const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
|
|
@@ -26701,7 +27247,7 @@ var showCommand6 = new Command141("show").description("Show a Task Drop and its
|
|
|
26701
27247
|
renderFailure(err);
|
|
26702
27248
|
}
|
|
26703
27249
|
});
|
|
26704
|
-
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(
|
|
26705
27251
|
async (taskDropId, opts) => {
|
|
26706
27252
|
try {
|
|
26707
27253
|
if (opts.official) {
|
|
@@ -26729,7 +27275,7 @@ var subscribeCommand = new Command141("subscribe").description("Subscribe an ema
|
|
|
26729
27275
|
}
|
|
26730
27276
|
}
|
|
26731
27277
|
);
|
|
26732
|
-
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) => {
|
|
26733
27279
|
try {
|
|
26734
27280
|
if (opts.official) {
|
|
26735
27281
|
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
@@ -26746,10 +27292,10 @@ var statusCommand4 = new Command141("status").description("Check whether an emai
|
|
|
26746
27292
|
renderFailure(err);
|
|
26747
27293
|
}
|
|
26748
27294
|
});
|
|
26749
|
-
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);
|
|
26750
27296
|
|
|
26751
27297
|
// src/commands/hooks.ts
|
|
26752
|
-
import { Command as
|
|
27298
|
+
import { Command as Command148 } from "commander";
|
|
26753
27299
|
import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
|
|
26754
27300
|
function withV2Declarations(entry) {
|
|
26755
27301
|
const mask = capabilitiesOf(entry);
|
|
@@ -26785,7 +27331,7 @@ async function probeHookVersion(entry, chainId) {
|
|
|
26785
27331
|
return reverted ? { ...entry, hookVersion: 1 } : entry;
|
|
26786
27332
|
}
|
|
26787
27333
|
}
|
|
26788
|
-
var listCommand10 = new
|
|
27334
|
+
var listCommand10 = new Command148("list").description(
|
|
26789
27335
|
"List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
|
|
26790
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(
|
|
26791
27337
|
"--cursor <cursor>",
|
|
@@ -26824,7 +27370,7 @@ var listCommand10 = new Command142("list").description(
|
|
|
26824
27370
|
}
|
|
26825
27371
|
}
|
|
26826
27372
|
);
|
|
26827
|
-
var showCommand7 = new
|
|
27373
|
+
var showCommand7 = new Command148("show").description(
|
|
26828
27374
|
"Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
|
|
26829
27375
|
).argument("<address>", "Hook contract address").action(async (address3) => {
|
|
26830
27376
|
try {
|
|
@@ -26844,7 +27390,7 @@ var showCommand7 = new Command142("show").description(
|
|
|
26844
27390
|
renderFailure(err);
|
|
26845
27391
|
}
|
|
26846
27392
|
});
|
|
26847
|
-
var encodeConfigCommand = new
|
|
27393
|
+
var encodeConfigCommand = new Command148("encode-config").description(
|
|
26848
27394
|
"Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
|
|
26849
27395
|
).argument("<address>", "Hook contract address").requiredOption(
|
|
26850
27396
|
"--values <json>",
|
|
@@ -26873,7 +27419,7 @@ var encodeConfigCommand = new Command142("encode-config").description(
|
|
|
26873
27419
|
renderFailure(err);
|
|
26874
27420
|
}
|
|
26875
27421
|
});
|
|
26876
|
-
var attachmentConfigCommand = new
|
|
27422
|
+
var attachmentConfigCommand = new Command148("attachment-config").description(
|
|
26877
27423
|
"Show the protocol-default hook order and maximum hooks per task on the selected --network"
|
|
26878
27424
|
).action(async () => {
|
|
26879
27425
|
try {
|
|
@@ -26882,12 +27428,12 @@ var attachmentConfigCommand = new Command142("attachment-config").description(
|
|
|
26882
27428
|
renderFailure(err);
|
|
26883
27429
|
}
|
|
26884
27430
|
});
|
|
26885
|
-
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);
|
|
26886
27432
|
|
|
26887
27433
|
// src/commands/tap.ts
|
|
26888
27434
|
import { promises as fs11 } from "fs";
|
|
26889
|
-
import { Command as
|
|
26890
|
-
var tapCommand = new
|
|
27435
|
+
import { Command as Command149 } from "commander";
|
|
27436
|
+
var tapCommand = new Command149("tap").description(
|
|
26891
27437
|
"Manage the TAP signing key used on tasks that require TAP verification"
|
|
26892
27438
|
);
|
|
26893
27439
|
tapCommand.command("import").description(
|
|
@@ -27046,7 +27592,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
|
|
|
27046
27592
|
});
|
|
27047
27593
|
|
|
27048
27594
|
// src/commands/hire.ts
|
|
27049
|
-
import { Command as
|
|
27595
|
+
import { Command as Command150 } from "commander";
|
|
27050
27596
|
var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
|
|
27051
27597
|
async function lookupListedService(worker, serviceId) {
|
|
27052
27598
|
let listing;
|
|
@@ -27078,7 +27624,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
|
|
|
27078
27624
|
}
|
|
27079
27625
|
return null;
|
|
27080
27626
|
}
|
|
27081
|
-
var hireCommand = new
|
|
27627
|
+
var hireCommand = new Command150("hire").description(
|
|
27082
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."
|
|
27083
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(
|
|
27084
27630
|
"--requires-evaluator",
|
|
@@ -27141,7 +27687,7 @@ hireCommand.action(async (worker, opts) => {
|
|
|
27141
27687
|
// src/index.ts
|
|
27142
27688
|
var require2 = createRequire(import.meta.url);
|
|
27143
27689
|
var { version } = require2("../package.json");
|
|
27144
|
-
var program = new
|
|
27690
|
+
var program = new Command151();
|
|
27145
27691
|
setLastErrorCliVersion(version);
|
|
27146
27692
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
27147
27693
|
program.option(
|