@lucid-agents/taskmarket 1.40.0 → 1.42.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/THIRD_PARTY_NOTICES.md +150 -288
- package/dist/agent-compatibility.json +1 -1
- package/dist/{api-KVJC2YUT.js → api-4I33LJ7A.js} +2 -2
- package/dist/{channels-C7RATT4R.js → channels-456WXKVT.js} +4 -4
- package/dist/{chunk-HDXVDIQQ.js → chunk-3FI5KV44.js} +1 -1
- package/dist/{chunk-DQ7VOFP7.js → chunk-4Q67KT6T.js} +5 -5
- package/dist/{chunk-QEDLNQCE.js → chunk-5IOQEQH3.js} +1 -1
- package/dist/{chunk-HWOVMACE.js → chunk-ASZ3YR77.js} +2 -2
- package/dist/{chunk-JAJCNNGK.js → chunk-HWDFJ5N7.js} +1 -1
- package/dist/{chunk-6QUUNUR4.js → chunk-I7OL2FMA.js} +14 -9
- package/dist/{chunk-KOV37V5R.js → chunk-IN6WPBUK.js} +3 -3
- package/dist/{chunk-H6EGL76J.js → chunk-JOVLOWPY.js} +5362 -7370
- package/dist/{chunk-IILD5VXU.js → chunk-L67V45XI.js} +1 -1
- package/dist/{chunk-I56PQUGS.js → chunk-QRMNHEUF.js} +3 -3
- package/dist/{chunk-PQCZDREC.js → chunk-UTTATTGM.js} +1 -1
- package/dist/{chunk-LPW4GUD5.js → chunk-UXZ5ZDBF.js} +3 -3
- package/dist/{doctor-22BCAXSE.js → doctor-K4RKUTXL.js} +8 -8
- package/dist/index.js +1690 -809
- package/dist/{launch-CGOA6WTU.js → launch-RL4BS22J.js} +11 -11
- package/dist/pi-extensions/xgate.cjs +10458 -84178
- package/dist/{read-auth-XV4SH3GF.js → read-auth-YC7ZM7J3.js} +3 -3
- package/dist/{reconcile-7ZG7SJM2.js → reconcile-ZFFNXOD7.js} +4 -4
- package/dist/{status-VODVEYZK.js → status-IZ7ZTA5D.js} +8 -8
- package/dist/{sync-pull-3EZWIMNV.js → sync-pull-Q7W6IPWN.js} +4 -4
- package/dist/{task-access-grants-J3RR2BKM.js → task-access-grants-4T4IPSVF.js} +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listWorkerSubmissions,
|
|
15
15
|
submitTaskFiles,
|
|
16
16
|
taskRequirementsOf
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-I7OL2FMA.js";
|
|
18
18
|
import {
|
|
19
19
|
ComputeCreditError,
|
|
20
20
|
applyComputeCreditSetup,
|
|
@@ -37,14 +37,14 @@ import {
|
|
|
37
37
|
releasePendingComputePurchase,
|
|
38
38
|
resolvePendingComputePurchases,
|
|
39
39
|
x402FeePost
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-UXZ5ZDBF.js";
|
|
41
41
|
import {
|
|
42
42
|
signReadAuth
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-ASZ3YR77.js";
|
|
44
44
|
import {
|
|
45
45
|
saveTaskAccessGrant,
|
|
46
46
|
taskAccessGrantHeaders
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-L67V45XI.js";
|
|
48
48
|
import {
|
|
49
49
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
50
50
|
X402PayError,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
setX402PolicyRuleEnabled,
|
|
63
63
|
signSponsoredTempoTransfer,
|
|
64
64
|
signTaskmarketFeePayment
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-5IOQEQH3.js";
|
|
66
66
|
import {
|
|
67
67
|
ALL_NETWORKS,
|
|
68
68
|
ApiError,
|
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
withErrorContext,
|
|
126
126
|
withIdempotentWrite,
|
|
127
127
|
withTapSignature
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-3FI5KV44.js";
|
|
129
129
|
import {
|
|
130
130
|
AGENT_AVATAR_MAX_BYTES,
|
|
131
131
|
AGENT_HIRES_ROLES,
|
|
@@ -159,6 +159,7 @@ import {
|
|
|
159
159
|
CrossChainFundingConfigOutputSchema,
|
|
160
160
|
DEFAULT_EVALUATION_WINDOW_HOURS,
|
|
161
161
|
DEFAULT_TERMS_BOUNDS,
|
|
162
|
+
DEFAULT_TEST_GLOBS,
|
|
162
163
|
DiscoveryFilterSchema,
|
|
163
164
|
EMAIL_SEND_SUBJECT_MAX_LENGTH,
|
|
164
165
|
ENTRY_POINT_GET_NONCE_ABI,
|
|
@@ -196,6 +197,7 @@ import {
|
|
|
196
197
|
PROJECT_SUGGESTIONS_LIST_DEFAULT,
|
|
197
198
|
PROJECT_SUGGESTIONS_LIST_MAX,
|
|
198
199
|
PROJECT_SUGGESTIONS_SETTINGS,
|
|
200
|
+
PROJECT_SUGGESTION_REPORT_REASONS,
|
|
199
201
|
PROJECT_SUGGESTION_SORTS,
|
|
200
202
|
PROJECT_SUGGESTION_STATUSES,
|
|
201
203
|
PUBLIC_BUG_REPORT_SORTS,
|
|
@@ -207,6 +209,8 @@ import {
|
|
|
207
209
|
ProjectSuggestionBriefSchema,
|
|
208
210
|
ProjectSuggestionDeclineSchema,
|
|
209
211
|
ProjectSuggestionIdSchema,
|
|
212
|
+
ProjectSuggestionReportNoteSchema,
|
|
213
|
+
ProjectSuggestionReportReasonSchema,
|
|
210
214
|
ProjectSuggestionTitleSchema,
|
|
211
215
|
READ_AUTH_ADDRESS_HEADER,
|
|
212
216
|
READ_AUTH_SIGNATURE_HEADER,
|
|
@@ -219,6 +223,8 @@ import {
|
|
|
219
223
|
SOLANA_CHAIN_IDS,
|
|
220
224
|
SPONSORED_VAULT_7702,
|
|
221
225
|
STANDARD_X402_ACTION_AMOUNT,
|
|
226
|
+
SUGGESTION_PROPOSAL_STATUSES,
|
|
227
|
+
SUGGESTION_SCHEDULE_MAX_TASKS_PER_RUN,
|
|
222
228
|
SetMarketEventPreferenceInputSchema,
|
|
223
229
|
SponsoredTaskRewardStateSchema,
|
|
224
230
|
SponsoredTaskWorkerRewardClaimStatusSchema,
|
|
@@ -242,6 +248,11 @@ import {
|
|
|
242
248
|
SubmissionReviewStartPayloadSchema,
|
|
243
249
|
SubmissionReviewTaskInputSchema,
|
|
244
250
|
SubmitBugReportInputSchema,
|
|
251
|
+
SuggestionProposalConfirmSchema,
|
|
252
|
+
SuggestionProposalsListInputSchema,
|
|
253
|
+
SuggestionScheduleConfigSchema,
|
|
254
|
+
SuggestionScheduleSettingsSchema,
|
|
255
|
+
TASK_HIDDEN_CHECKS_COMMITMENT_PATTERN,
|
|
245
256
|
TASK_TEMPLATE_IDS,
|
|
246
257
|
TaskActionQueueInputSchema,
|
|
247
258
|
TaskCapabilitiesSchema,
|
|
@@ -263,6 +274,7 @@ import {
|
|
|
263
274
|
USER_SKILL_SANDBOX_LIMITS,
|
|
264
275
|
WALLET_BRIDGE_ORIGIN_CHAIN_ID,
|
|
265
276
|
WALLET_BRIDGE_TEMPO_CHAIN_ID,
|
|
277
|
+
WORKFLOW_OBJECTION_REASON_MAX,
|
|
266
278
|
WORKFLOW_PRESET_NAMES,
|
|
267
279
|
WORKFLOW_STEP_LIMIT_MAX,
|
|
268
280
|
WORKFLOW_STEP_LIMIT_MIN,
|
|
@@ -303,13 +315,17 @@ import {
|
|
|
303
315
|
coreChains,
|
|
304
316
|
dreamsToUsd,
|
|
305
317
|
evaluationWindowError,
|
|
318
|
+
extractLiterals,
|
|
319
|
+
extractTaskChecks,
|
|
306
320
|
findHiddenCharacters,
|
|
307
321
|
findTemplate,
|
|
308
322
|
formatDreams,
|
|
309
323
|
formatPaymentAmount,
|
|
324
|
+
formatTaskChecksErrors,
|
|
310
325
|
formatUsdcBaseUnits,
|
|
311
326
|
getAgentName,
|
|
312
327
|
getTaskmarketHome,
|
|
328
|
+
hiddenChecksResult,
|
|
313
329
|
hireAcceptAtCapacity,
|
|
314
330
|
hireAcceptAtCapacityMessage,
|
|
315
331
|
hireSelectAtCapacityMessage,
|
|
@@ -327,6 +343,7 @@ import {
|
|
|
327
343
|
isTerminalWalletBridgeStatus,
|
|
328
344
|
listingSubmissionWriteChange,
|
|
329
345
|
marketEventPreferenceChange,
|
|
346
|
+
matchesAnyGlob,
|
|
330
347
|
needsYouKindForIntent,
|
|
331
348
|
normalizeReferenceCode,
|
|
332
349
|
normalizeWorkflowTemplateTags,
|
|
@@ -341,6 +358,8 @@ import {
|
|
|
341
358
|
requirementUnavailable,
|
|
342
359
|
requirementValues,
|
|
343
360
|
resolveTaskTerms,
|
|
361
|
+
runDataChecks,
|
|
362
|
+
runPatchChecks,
|
|
344
363
|
settlementActionExpiresAt,
|
|
345
364
|
settlementActionRequiresExpiry,
|
|
346
365
|
settlerModeContracts,
|
|
@@ -349,6 +368,7 @@ import {
|
|
|
349
368
|
splitUserSkill,
|
|
350
369
|
sponsoredVaultRelayKind,
|
|
351
370
|
svmChain,
|
|
371
|
+
taskChecksPassed,
|
|
352
372
|
taskTemplates,
|
|
353
373
|
taskmarketChain,
|
|
354
374
|
unknownCapabilityMessage,
|
|
@@ -356,16 +376,18 @@ import {
|
|
|
356
376
|
userSkillArchiveWriteChange,
|
|
357
377
|
userSkillCreateWriteChange,
|
|
358
378
|
userSkillVersionWriteChange,
|
|
379
|
+
validateTaskChecks,
|
|
359
380
|
validateWorkflowDocument,
|
|
360
381
|
validateWorkflowTemplate,
|
|
361
382
|
vaultCallGasLimit7702,
|
|
362
383
|
verifierProviderId,
|
|
363
|
-
verifiersUnsupportedOnChain
|
|
364
|
-
|
|
384
|
+
verifiersUnsupportedOnChain,
|
|
385
|
+
viemChainFor
|
|
386
|
+
} from "./chunk-JOVLOWPY.js";
|
|
365
387
|
import "./chunk-S7SJMJ2I.js";
|
|
366
388
|
|
|
367
389
|
// src/index.ts
|
|
368
|
-
import { Command as
|
|
390
|
+
import { Command as Command158 } from "commander";
|
|
369
391
|
import { createRequire } from "module";
|
|
370
392
|
|
|
371
393
|
// src/commands/init.ts
|
|
@@ -3904,8 +3926,8 @@ function addRaceContender(contender) {
|
|
|
3904
3926
|
const record = { deferreds, settled: false };
|
|
3905
3927
|
Promise.resolve(contender).then(
|
|
3906
3928
|
(value) => {
|
|
3907
|
-
for (const { resolve } of deferreds) {
|
|
3908
|
-
|
|
3929
|
+
for (const { resolve: resolve2 } of deferreds) {
|
|
3930
|
+
resolve2(value);
|
|
3909
3931
|
}
|
|
3910
3932
|
deferreds.clear();
|
|
3911
3933
|
record.settled = true;
|
|
@@ -3923,11 +3945,11 @@ function addRaceContender(contender) {
|
|
|
3923
3945
|
var wm = /* @__PURE__ */ new WeakMap();
|
|
3924
3946
|
async function safeRace(contenders) {
|
|
3925
3947
|
let deferred;
|
|
3926
|
-
const result = new Promise((
|
|
3927
|
-
deferred = { reject, resolve };
|
|
3948
|
+
const result = new Promise((resolve2, reject) => {
|
|
3949
|
+
deferred = { reject, resolve: resolve2 };
|
|
3928
3950
|
for (const contender of contenders) {
|
|
3929
3951
|
if (!isObject(contender)) {
|
|
3930
|
-
Promise.resolve(contender).then(
|
|
3952
|
+
Promise.resolve(contender).then(resolve2, reject);
|
|
3931
3953
|
continue;
|
|
3932
3954
|
}
|
|
3933
3955
|
let record = wm.get(contender);
|
|
@@ -3936,7 +3958,7 @@ async function safeRace(contenders) {
|
|
|
3936
3958
|
record.deferreds.add(deferred);
|
|
3937
3959
|
wm.set(contender, record);
|
|
3938
3960
|
} else if (record.settled) {
|
|
3939
|
-
Promise.resolve(contender).then(
|
|
3961
|
+
Promise.resolve(contender).then(resolve2, reject);
|
|
3940
3962
|
} else {
|
|
3941
3963
|
record.deferreds.add(deferred);
|
|
3942
3964
|
}
|
|
@@ -5342,7 +5364,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
|
5342
5364
|
coalescedRequest.numConsumers++;
|
|
5343
5365
|
if (signal) {
|
|
5344
5366
|
const responsePromise = coalescedRequest.responsePromise;
|
|
5345
|
-
return await new Promise((
|
|
5367
|
+
return await new Promise((resolve2, reject) => {
|
|
5346
5368
|
const handleAbort = () => {
|
|
5347
5369
|
signal.removeEventListener("abort", handleAbort);
|
|
5348
5370
|
coalescedRequest.numConsumers -= 1;
|
|
@@ -5355,7 +5377,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
|
5355
5377
|
reject(signal.reason);
|
|
5356
5378
|
};
|
|
5357
5379
|
signal.addEventListener("abort", handleAbort);
|
|
5358
|
-
responsePromise.then(
|
|
5380
|
+
responsePromise.then(resolve2).catch(reject).finally(() => {
|
|
5359
5381
|
signal.removeEventListener("abort", handleAbort);
|
|
5360
5382
|
});
|
|
5361
5383
|
});
|
|
@@ -7475,11 +7497,11 @@ async function tryRegisterEmail(deviceId, apiToken, username, explicit, warnings
|
|
|
7475
7497
|
function terminalIo() {
|
|
7476
7498
|
return {
|
|
7477
7499
|
interactive: Boolean(process.stdin.isTTY && process.stderr.isTTY),
|
|
7478
|
-
ask: (question) => new Promise((
|
|
7500
|
+
ask: (question) => new Promise((resolve2) => {
|
|
7479
7501
|
const rl = createInterface2({ input: process.stdin, output: process.stderr });
|
|
7480
7502
|
rl.question(question, (answer) => {
|
|
7481
7503
|
rl.close();
|
|
7482
|
-
|
|
7504
|
+
resolve2(answer);
|
|
7483
7505
|
});
|
|
7484
7506
|
})
|
|
7485
7507
|
};
|
|
@@ -7789,7 +7811,7 @@ function resolveSponsoredTaskChain(chainId, env = process.env) {
|
|
|
7789
7811
|
throw new Error(`Chain ${chainId} is not a Taskmarket chain`);
|
|
7790
7812
|
}
|
|
7791
7813
|
const entry = taskmarketChain(chainId);
|
|
7792
|
-
const viemChain =
|
|
7814
|
+
const viemChain = viemChainFor(chainId);
|
|
7793
7815
|
const rpcOverride = env["TASKMARKET_RPC_URL"]?.trim();
|
|
7794
7816
|
const rpcUrl = rpcOverride || entry.publicRpcUrl;
|
|
7795
7817
|
const rpcSource = rpcOverride ? "TASKMARKET_RPC_URL" : "registry";
|
|
@@ -7937,7 +7959,7 @@ async function approveSponsoredTaskSpend(input) {
|
|
|
7937
7959
|
`Approval confirmed but the RPC endpoint still reports an allowance of ${allowance}; retry once the endpoint catches up`
|
|
7938
7960
|
);
|
|
7939
7961
|
}
|
|
7940
|
-
await new Promise((
|
|
7962
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollIntervalMs));
|
|
7941
7963
|
}
|
|
7942
7964
|
}
|
|
7943
7965
|
|
|
@@ -8429,7 +8451,7 @@ var searchCommand = new Command8("search").description(
|
|
|
8429
8451
|
});
|
|
8430
8452
|
|
|
8431
8453
|
// src/commands/task/index.ts
|
|
8432
|
-
import { Command as
|
|
8454
|
+
import { Command as Command56 } from "commander";
|
|
8433
8455
|
|
|
8434
8456
|
// src/commands/task/review.ts
|
|
8435
8457
|
import { readFile, stat } from "fs/promises";
|
|
@@ -8458,7 +8480,7 @@ var taskPath = (taskId) => `/api/tasks/${encodeURIComponent(taskId)}`;
|
|
|
8458
8480
|
var runPath = (runId) => `/api/submission-reviews/${encodeURIComponent(runId)}`;
|
|
8459
8481
|
function createSubmissionReviewClient(options) {
|
|
8460
8482
|
const now = options.now ?? Date.now;
|
|
8461
|
-
const sleep4 = options.sleep ?? ((ms2) => new Promise((
|
|
8483
|
+
const sleep4 = options.sleep ?? ((ms2) => new Promise((resolve2) => setTimeout(resolve2, ms2)));
|
|
8462
8484
|
let headersPromise;
|
|
8463
8485
|
const headers = () => headersPromise ??= (async () => {
|
|
8464
8486
|
const signer = await options.signer();
|
|
@@ -8995,7 +9017,7 @@ function retryAfterMs(res) {
|
|
|
8995
9017
|
return Math.min(wait, MAX_RETRY_AFTER_SECONDS) * 1e3;
|
|
8996
9018
|
}
|
|
8997
9019
|
async function x402Post(path9, body, options) {
|
|
8998
|
-
const sleep4 = options?.sleep ?? ((ms2) => new Promise((
|
|
9020
|
+
const sleep4 = options?.sleep ?? ((ms2) => new Promise((resolve2) => setTimeout(resolve2, ms2)));
|
|
8999
9021
|
if (paymentProtocolOf(selectedNetwork().chainId) === "mpp")
|
|
9000
9022
|
return mppPost(path9, body, options);
|
|
9001
9023
|
const keystore = await loadKeystore();
|
|
@@ -9049,12 +9071,12 @@ async function x402Post(path9, body, options) {
|
|
|
9049
9071
|
body: request.body
|
|
9050
9072
|
});
|
|
9051
9073
|
if (r2.ok) return { data: await r2.json(), idempotencyKey };
|
|
9052
|
-
const
|
|
9053
|
-
if (r2.status === 503 && apiErrorEnvelopeOf(
|
|
9074
|
+
const read4 = await readFailureBody(r2);
|
|
9075
|
+
if (r2.status === 503 && apiErrorEnvelopeOf(read4.body)?.reason === "facilitator_unavailable" && attempt < FACILITATOR_RETRIES) {
|
|
9054
9076
|
await sleep4(retryAfterMs(r2));
|
|
9055
9077
|
continue;
|
|
9056
9078
|
}
|
|
9057
|
-
throw failedAfterPayment(path9, r2.status,
|
|
9079
|
+
throw failedAfterPayment(path9, r2.status, read4, idempotencyKey);
|
|
9058
9080
|
}
|
|
9059
9081
|
});
|
|
9060
9082
|
}
|
|
@@ -9438,7 +9460,7 @@ function taskGateCandidates(task) {
|
|
|
9438
9460
|
// src/lib/recording.ts
|
|
9439
9461
|
var RECORDING_POLL_INTERVAL_MS = 3e3;
|
|
9440
9462
|
var RECORDING_POLL_TIMEOUT_MS = 75e3;
|
|
9441
|
-
var sleepFor = (ms2) => new Promise((
|
|
9463
|
+
var sleepFor = (ms2) => new Promise((resolve2) => setTimeout(resolve2, ms2));
|
|
9442
9464
|
async function settleRecording(data, idempotencyKey, options = {}) {
|
|
9443
9465
|
if (!isRecordingPendingResponse(data)) return {};
|
|
9444
9466
|
const { txHash, intentId } = data;
|
|
@@ -11067,10 +11089,10 @@ var UNVERIFIED_HOOK_CODE = "unverified_hook";
|
|
|
11067
11089
|
var UNVERIFIED_HOOK_CHECK_FAILED_CODE = "unverified_hook_check_failed";
|
|
11068
11090
|
async function confirmUnverifiedHooks(action, taskId, accepted, task) {
|
|
11069
11091
|
if (accepted) return true;
|
|
11070
|
-
let
|
|
11071
|
-
if (
|
|
11092
|
+
let read4 = task;
|
|
11093
|
+
if (read4 === void 0) {
|
|
11072
11094
|
try {
|
|
11073
|
-
|
|
11095
|
+
read4 = await getTask(cliTaskReadContext(), { taskId });
|
|
11074
11096
|
} catch (error) {
|
|
11075
11097
|
renderFailure(
|
|
11076
11098
|
new Error(
|
|
@@ -11086,7 +11108,7 @@ async function confirmUnverifiedHooks(action, taskId, accepted, task) {
|
|
|
11086
11108
|
return false;
|
|
11087
11109
|
}
|
|
11088
11110
|
}
|
|
11089
|
-
const hooks = [...
|
|
11111
|
+
const hooks = [...read4?.unverifiedHooks ?? []];
|
|
11090
11112
|
if (hooks.length === 0) return true;
|
|
11091
11113
|
renderFailure(
|
|
11092
11114
|
new Error(
|
|
@@ -11100,15 +11122,15 @@ async function confirmUnverifiedHooks(action, taskId, accepted, task) {
|
|
|
11100
11122
|
// src/lib/task-network.ts
|
|
11101
11123
|
var WRONG_NETWORK_CODE = "wrong_network";
|
|
11102
11124
|
async function confirmTaskOnSelectedNetwork(taskId, task) {
|
|
11103
|
-
let
|
|
11104
|
-
if (
|
|
11125
|
+
let read4 = task;
|
|
11126
|
+
if (read4 === void 0) {
|
|
11105
11127
|
try {
|
|
11106
|
-
|
|
11128
|
+
read4 = await getTask(cliTaskReadContext(), { taskId });
|
|
11107
11129
|
} catch {
|
|
11108
11130
|
return true;
|
|
11109
11131
|
}
|
|
11110
11132
|
}
|
|
11111
|
-
const taskChainId =
|
|
11133
|
+
const taskChainId = read4?.chainId;
|
|
11112
11134
|
const network = selectedNetwork();
|
|
11113
11135
|
if (typeof taskChainId !== "number" || taskChainId === network.chainId) return true;
|
|
11114
11136
|
const taskNetwork = networkNameForChain(taskChainId) ?? null;
|
|
@@ -11794,25 +11816,49 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
|
|
|
11794
11816
|
|
|
11795
11817
|
// src/commands/task/submissions.ts
|
|
11796
11818
|
import { Command as Command28 } from "commander";
|
|
11819
|
+
import { z as z3 } from "zod";
|
|
11820
|
+
var SubmissionPageSchema = TaskChildListSchema.pick({ cursor: true }).extend({
|
|
11821
|
+
limit: TaskChildListSchema.shape.limit.removeDefault().optional(),
|
|
11822
|
+
ids: z3.string().transform(
|
|
11823
|
+
(value) => value.split(",").map((id) => id.trim()).filter(Boolean)
|
|
11824
|
+
).pipe(z3.array(z3.string().uuid().toLowerCase()).min(1).max(50)).optional()
|
|
11825
|
+
});
|
|
11797
11826
|
var submissionsCmd = new Command28("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
|
|
11798
11827
|
"--passed-check <provider>",
|
|
11799
11828
|
"Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, tap:identity:verified or tap:identity:known"
|
|
11800
|
-
).
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
)
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11829
|
+
).option("--limit <n>", "Page size (1-500); without it every submission is listed").option("--cursor <id>", "Last returned id; read the following page").option("--ids <ids>", "Only these submissions: comma-separated ids (at most 50)").action(
|
|
11830
|
+
async (taskId, opts) => {
|
|
11831
|
+
const passedCheck = parseRequirementFilter(opts.passedCheck, CHECK_FILTER, "--passed-check");
|
|
11832
|
+
if ("error" in passedCheck) return void printError(passedCheck.error);
|
|
11833
|
+
const page = SubmissionPageSchema.safeParse({
|
|
11834
|
+
limit: opts.limit,
|
|
11835
|
+
cursor: opts.cursor,
|
|
11836
|
+
ids: opts.ids
|
|
11837
|
+
});
|
|
11838
|
+
if (!page.success) {
|
|
11839
|
+
return void printError(
|
|
11840
|
+
`Invalid paging options: ${page.error.issues.map((issue) => `--${issue.path.join(".")} ${issue.message}`).join("; ")}`
|
|
11841
|
+
);
|
|
11842
|
+
}
|
|
11843
|
+
let subs;
|
|
11844
|
+
try {
|
|
11845
|
+
subs = await listTaskSubmissions(
|
|
11846
|
+
cliTaskReadContext(),
|
|
11847
|
+
{ taskId },
|
|
11848
|
+
{
|
|
11849
|
+
...passedCheck.value ? { passedCheck: passedCheck.value } : {},
|
|
11850
|
+
...page.data.limit !== void 0 ? { limit: page.data.limit } : {},
|
|
11851
|
+
...page.data.cursor ? { cursor: page.data.cursor } : {},
|
|
11852
|
+
...page.data.ids ? { ids: page.data.ids } : {}
|
|
11853
|
+
}
|
|
11854
|
+
);
|
|
11855
|
+
} catch (err) {
|
|
11856
|
+
renderFailure(err, { fallback: "Failed to fetch submissions." });
|
|
11857
|
+
return;
|
|
11858
|
+
}
|
|
11859
|
+
printResult(withChainNames(subs));
|
|
11813
11860
|
}
|
|
11814
|
-
|
|
11815
|
-
});
|
|
11861
|
+
);
|
|
11816
11862
|
|
|
11817
11863
|
// src/commands/task/claims.ts
|
|
11818
11864
|
import { Command as Command29 } from "commander";
|
|
@@ -12727,6 +12773,363 @@ var templateCmd = new Command53("template").description(
|
|
|
12727
12773
|
"Browse the curated task templates; create from one with `task create --template <id>`"
|
|
12728
12774
|
).addCommand(listCmd3).addCommand(showCmd);
|
|
12729
12775
|
|
|
12776
|
+
// src/commands/task/precheck.ts
|
|
12777
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
12778
|
+
import { Command as Command54 } from "commander";
|
|
12779
|
+
|
|
12780
|
+
// src/lib/task-precheck.ts
|
|
12781
|
+
import { spawnSync } from "child_process";
|
|
12782
|
+
import {
|
|
12783
|
+
cpSync,
|
|
12784
|
+
existsSync,
|
|
12785
|
+
mkdtempSync,
|
|
12786
|
+
readdirSync,
|
|
12787
|
+
readFileSync,
|
|
12788
|
+
rmSync,
|
|
12789
|
+
statSync
|
|
12790
|
+
} from "fs";
|
|
12791
|
+
import { tmpdir } from "os";
|
|
12792
|
+
import { basename, join, resolve } from "path";
|
|
12793
|
+
var OUTPUT_TAIL = 300;
|
|
12794
|
+
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
12795
|
+
function tail(text) {
|
|
12796
|
+
const t = (text ?? "").trim();
|
|
12797
|
+
return t.length > OUTPUT_TAIL ? "..." + t.slice(-OUTPUT_TAIL) : t;
|
|
12798
|
+
}
|
|
12799
|
+
function patchApplies(dir, patch) {
|
|
12800
|
+
const run2 = spawnSync("git", ["apply", "--check", resolve(patch)], {
|
|
12801
|
+
cwd: dir,
|
|
12802
|
+
encoding: "utf8",
|
|
12803
|
+
maxBuffer: MAX_BUFFER
|
|
12804
|
+
});
|
|
12805
|
+
if (run2.error) return { applied: false, detail: `git could not run: ${run2.error.message}` };
|
|
12806
|
+
return run2.status === 0 ? { applied: true, detail: "the patch applies cleanly" } : { applied: false, detail: tail(run2.stderr) || `git apply --check exited ${run2.status}` };
|
|
12807
|
+
}
|
|
12808
|
+
function runCommandCheck(check, cwd, env = process.env) {
|
|
12809
|
+
const [cmd, ...args] = check.cmd;
|
|
12810
|
+
const run2 = spawnSync(cmd, args, {
|
|
12811
|
+
cwd,
|
|
12812
|
+
env,
|
|
12813
|
+
encoding: "utf8",
|
|
12814
|
+
timeout: check.timeoutS * 1e3,
|
|
12815
|
+
killSignal: "SIGKILL",
|
|
12816
|
+
maxBuffer: MAX_BUFFER
|
|
12817
|
+
});
|
|
12818
|
+
if (run2.error) {
|
|
12819
|
+
const code = run2.error.code;
|
|
12820
|
+
if (code === "ETIMEDOUT") {
|
|
12821
|
+
return { passed: false, detail: `timed out after ${check.timeoutS}s` };
|
|
12822
|
+
}
|
|
12823
|
+
return { passed: false, detail: `could not run: ${run2.error.message}` };
|
|
12824
|
+
}
|
|
12825
|
+
if (run2.status === 0) return { passed: true, detail: "exit 0" };
|
|
12826
|
+
const out = tail(run2.stderr) || tail(run2.stdout);
|
|
12827
|
+
return {
|
|
12828
|
+
passed: false,
|
|
12829
|
+
detail: `exit ${run2.status ?? run2.signal}${out ? `: ${out}` : ""}`
|
|
12830
|
+
};
|
|
12831
|
+
}
|
|
12832
|
+
function commandChecks(spec) {
|
|
12833
|
+
return spec.checks.filter(
|
|
12834
|
+
(c) => c.kind === "command"
|
|
12835
|
+
);
|
|
12836
|
+
}
|
|
12837
|
+
function runCliChecks(spec, engineResults, target, options) {
|
|
12838
|
+
const byId = /* @__PURE__ */ new Map();
|
|
12839
|
+
let work = null;
|
|
12840
|
+
let patchOk = null;
|
|
12841
|
+
try {
|
|
12842
|
+
const needsWork = options.yes && commandChecks(spec).length > 0;
|
|
12843
|
+
if (needsWork) {
|
|
12844
|
+
work = mkdtempSync(join(tmpdir(), "taskmarket-precheck-"));
|
|
12845
|
+
if (target.dir) {
|
|
12846
|
+
cpSync(resolve(target.dir), work, { recursive: true });
|
|
12847
|
+
if (target.patch) {
|
|
12848
|
+
const run2 = spawnSync("git", ["apply", resolve(target.patch)], {
|
|
12849
|
+
cwd: work,
|
|
12850
|
+
encoding: "utf8"
|
|
12851
|
+
});
|
|
12852
|
+
patchOk = run2.status === 0 ? { applied: true, detail: "applied" } : { applied: false, detail: tail(run2.stderr) || "git apply failed" };
|
|
12853
|
+
}
|
|
12854
|
+
} else if (target.file) {
|
|
12855
|
+
cpSync(resolve(target.file), join(work, basename(target.file)));
|
|
12856
|
+
}
|
|
12857
|
+
}
|
|
12858
|
+
for (const check of spec.checks) {
|
|
12859
|
+
if (check.kind === "patch_applies") {
|
|
12860
|
+
let result;
|
|
12861
|
+
if (!target.dir || !target.patch) {
|
|
12862
|
+
result = {
|
|
12863
|
+
id: check.id,
|
|
12864
|
+
kind: check.kind,
|
|
12865
|
+
passed: false,
|
|
12866
|
+
skipped: true,
|
|
12867
|
+
detail: "pass --dir <checkout> and --patch <file> to test the patch"
|
|
12868
|
+
};
|
|
12869
|
+
} else {
|
|
12870
|
+
const r = patchApplies(target.dir, target.patch);
|
|
12871
|
+
result = { id: check.id, kind: check.kind, passed: r.applied, detail: r.detail };
|
|
12872
|
+
}
|
|
12873
|
+
byId.set(check.id, result);
|
|
12874
|
+
} else if (check.kind === "command") {
|
|
12875
|
+
if (!options.yes) {
|
|
12876
|
+
byId.set(check.id, {
|
|
12877
|
+
id: check.id,
|
|
12878
|
+
kind: check.kind,
|
|
12879
|
+
passed: false,
|
|
12880
|
+
skipped: true,
|
|
12881
|
+
detail: "pass --yes to run commands"
|
|
12882
|
+
});
|
|
12883
|
+
} else if (patchOk && !patchOk.applied) {
|
|
12884
|
+
byId.set(check.id, {
|
|
12885
|
+
id: check.id,
|
|
12886
|
+
kind: check.kind,
|
|
12887
|
+
passed: false,
|
|
12888
|
+
detail: `the patch did not apply, so the command did not run: ${patchOk.detail}`
|
|
12889
|
+
});
|
|
12890
|
+
} else {
|
|
12891
|
+
const env = {
|
|
12892
|
+
...process.env,
|
|
12893
|
+
...target.file ? { TASKMARKET_DELIVERABLE: join(work, basename(target.file)) } : {}
|
|
12894
|
+
};
|
|
12895
|
+
const r = runCommandCheck(check, work, env);
|
|
12896
|
+
byId.set(check.id, { id: check.id, kind: check.kind, ...r });
|
|
12897
|
+
}
|
|
12898
|
+
}
|
|
12899
|
+
}
|
|
12900
|
+
} finally {
|
|
12901
|
+
if (work && existsSync(work)) rmSync(work, { recursive: true, force: true });
|
|
12902
|
+
}
|
|
12903
|
+
return engineResults.map((r) => byId.get(r.id) ?? r);
|
|
12904
|
+
}
|
|
12905
|
+
function isDirectory(path9) {
|
|
12906
|
+
try {
|
|
12907
|
+
return statSync(path9).isDirectory();
|
|
12908
|
+
} catch {
|
|
12909
|
+
return false;
|
|
12910
|
+
}
|
|
12911
|
+
}
|
|
12912
|
+
var LITERAL_FILE_LIMIT = 2e3;
|
|
12913
|
+
var LITERAL_BYTES_LIMIT = 1024 * 1024;
|
|
12914
|
+
var SKIPPED_DIRS = /* @__PURE__ */ new Set([
|
|
12915
|
+
".git",
|
|
12916
|
+
"node_modules",
|
|
12917
|
+
"target",
|
|
12918
|
+
"dist",
|
|
12919
|
+
"build",
|
|
12920
|
+
".venv",
|
|
12921
|
+
"__pycache__"
|
|
12922
|
+
]);
|
|
12923
|
+
function collectTestLiterals(dir, paths) {
|
|
12924
|
+
const globs = paths ?? DEFAULT_TEST_GLOBS;
|
|
12925
|
+
const root = resolve(dir);
|
|
12926
|
+
const found = /* @__PURE__ */ new Set();
|
|
12927
|
+
let visited = 0;
|
|
12928
|
+
const walk2 = (rel) => {
|
|
12929
|
+
let names;
|
|
12930
|
+
try {
|
|
12931
|
+
names = readdirSync(join(root, rel)).sort();
|
|
12932
|
+
} catch {
|
|
12933
|
+
return;
|
|
12934
|
+
}
|
|
12935
|
+
for (const name of names) {
|
|
12936
|
+
if (visited >= LITERAL_FILE_LIMIT) return;
|
|
12937
|
+
const next = rel === "" ? name : `${rel}/${name}`;
|
|
12938
|
+
let info;
|
|
12939
|
+
try {
|
|
12940
|
+
info = statSync(join(root, next));
|
|
12941
|
+
} catch {
|
|
12942
|
+
continue;
|
|
12943
|
+
}
|
|
12944
|
+
if (info.isDirectory()) {
|
|
12945
|
+
if (!SKIPPED_DIRS.has(name)) walk2(next);
|
|
12946
|
+
} else if (info.isFile() && info.size <= LITERAL_BYTES_LIMIT && matchesAnyGlob(next, globs)) {
|
|
12947
|
+
visited++;
|
|
12948
|
+
try {
|
|
12949
|
+
for (const lit of extractLiterals(readFileSync(join(root, next), "utf8"))) found.add(lit);
|
|
12950
|
+
} catch {
|
|
12951
|
+
}
|
|
12952
|
+
}
|
|
12953
|
+
}
|
|
12954
|
+
};
|
|
12955
|
+
walk2("");
|
|
12956
|
+
return [...found].sort();
|
|
12957
|
+
}
|
|
12958
|
+
|
|
12959
|
+
// src/commands/task/precheck.ts
|
|
12960
|
+
async function specOf(taskId) {
|
|
12961
|
+
const task = await getTask(cliTaskReadContext(), { taskId });
|
|
12962
|
+
if (!task) {
|
|
12963
|
+
return `Task not found: ${taskId} (or this is a private task you don't have access to)`;
|
|
12964
|
+
}
|
|
12965
|
+
if (task.checks) return task.checks;
|
|
12966
|
+
const found = extractTaskChecks(task.description ?? "");
|
|
12967
|
+
if (found && !found.ok) {
|
|
12968
|
+
return `The task's taskmarket-checks block is invalid: ${formatTaskChecksErrors(found.errors)}`;
|
|
12969
|
+
}
|
|
12970
|
+
if (!found) return `Task ${taskId} has no taskmarket-checks block, so there is nothing to check`;
|
|
12971
|
+
return found.spec;
|
|
12972
|
+
}
|
|
12973
|
+
var precheckCmd = new Command54("precheck").description(
|
|
12974
|
+
"Run a task's public checks on your own deliverable before you submit: --file for a file, --dir (and --patch) for a patch against a checked-out repository"
|
|
12975
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--file <path>", "The deliverable file (file deliverables)").option("--dir <path>", "The checked-out repository (patch deliverables)").option("--patch <file>", "The patch to test against --dir (patch deliverables)").option("--yes", "Run the task's command checks on this machine (they are the requester's)").action(
|
|
12976
|
+
async (taskId, opts) => {
|
|
12977
|
+
try {
|
|
12978
|
+
const spec = await specOf(taskId);
|
|
12979
|
+
if (typeof spec === "string") return printError(spec);
|
|
12980
|
+
const deliverable = spec.deliverable;
|
|
12981
|
+
let engine;
|
|
12982
|
+
if (deliverable.type === "file") {
|
|
12983
|
+
if (!opts.file)
|
|
12984
|
+
return printError("This task takes a file deliverable: pass --file <path>");
|
|
12985
|
+
if (opts.dir || opts.patch) {
|
|
12986
|
+
return printError(
|
|
12987
|
+
"--dir and --patch are for patch deliverables; this task takes a file"
|
|
12988
|
+
);
|
|
12989
|
+
}
|
|
12990
|
+
let bytes;
|
|
12991
|
+
try {
|
|
12992
|
+
bytes = readFileSync2(opts.file);
|
|
12993
|
+
} catch (error) {
|
|
12994
|
+
return renderFailure(
|
|
12995
|
+
new Error(`Cannot read ${opts.file}: ${error.message}`)
|
|
12996
|
+
);
|
|
12997
|
+
}
|
|
12998
|
+
engine = runDataChecks(spec, { bytes });
|
|
12999
|
+
} else {
|
|
13000
|
+
if (!opts.dir) {
|
|
13001
|
+
return printError(
|
|
13002
|
+
"This task takes a patch deliverable: pass --dir <checkout> and --patch <file>"
|
|
13003
|
+
);
|
|
13004
|
+
}
|
|
13005
|
+
if (opts.file)
|
|
13006
|
+
return printError("--file is for file deliverables; this task takes a patch");
|
|
13007
|
+
if (!isDirectory(opts.dir)) return printError(`Not a directory: ${opts.dir}`);
|
|
13008
|
+
let patchText = null;
|
|
13009
|
+
if (opts.patch) {
|
|
13010
|
+
try {
|
|
13011
|
+
patchText = readFileSync2(opts.patch, "utf8");
|
|
13012
|
+
} catch (error) {
|
|
13013
|
+
return renderFailure(
|
|
13014
|
+
new Error(`Cannot read ${opts.patch}: ${error.message}`)
|
|
13015
|
+
);
|
|
13016
|
+
}
|
|
13017
|
+
}
|
|
13018
|
+
if (patchText === null) {
|
|
13019
|
+
engine = runDataChecks(spec, { text: "" });
|
|
13020
|
+
} else {
|
|
13021
|
+
const specials = spec.checks.flatMap(
|
|
13022
|
+
(c) => c.kind === "no_test_special_casing" ? [c] : []
|
|
13023
|
+
);
|
|
13024
|
+
const literals = /* @__PURE__ */ new Set();
|
|
13025
|
+
for (const c of specials) {
|
|
13026
|
+
for (const lit of collectTestLiterals(opts.dir, c.paths)) literals.add(lit);
|
|
13027
|
+
}
|
|
13028
|
+
engine = runPatchChecks(spec, {
|
|
13029
|
+
patch: patchText,
|
|
13030
|
+
testLiterals: specials.length > 0 ? [...literals].sort() : void 0
|
|
13031
|
+
});
|
|
13032
|
+
}
|
|
13033
|
+
}
|
|
13034
|
+
const commands = commandChecks(spec);
|
|
13035
|
+
if (opts.yes && commands.length > 0) {
|
|
13036
|
+
process.stderr.write(
|
|
13037
|
+
"Running the requester's commands on this machine:\n" + commands.map((c) => ` ${c.id}: ${c.cmd.join(" ")}
|
|
13038
|
+
`).join("") + (spec.environment?.network === "none" ? "The task expects no network; this run does not enforce that.\n" : "")
|
|
13039
|
+
);
|
|
13040
|
+
}
|
|
13041
|
+
const results = runCliChecks(
|
|
13042
|
+
spec,
|
|
13043
|
+
engine,
|
|
13044
|
+
{ file: opts.file, dir: opts.dir, patch: opts.patch },
|
|
13045
|
+
{ yes: opts.yes === true }
|
|
13046
|
+
);
|
|
13047
|
+
const hidden = hiddenChecksResult(spec);
|
|
13048
|
+
const all = hidden ? [...results, hidden] : results;
|
|
13049
|
+
printResult({
|
|
13050
|
+
taskId,
|
|
13051
|
+
passed: taskChecksPassed(all),
|
|
13052
|
+
skipped: results.filter((r) => r.skipped).length,
|
|
13053
|
+
warnings: results.filter((r) => r.warning).length,
|
|
13054
|
+
results: all,
|
|
13055
|
+
...spec.environment?.image || spec.environment?.setup?.length ? {
|
|
13056
|
+
note: "Precheck runs on this machine. The declared image and setup are not applied; the verifier runs the checks in that environment."
|
|
13057
|
+
} : {}
|
|
13058
|
+
});
|
|
13059
|
+
} catch (error) {
|
|
13060
|
+
renderFailure(error, { fallback: "Precheck failed." });
|
|
13061
|
+
}
|
|
13062
|
+
}
|
|
13063
|
+
);
|
|
13064
|
+
|
|
13065
|
+
// src/commands/task/checks.ts
|
|
13066
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
13067
|
+
import { Command as Command55 } from "commander";
|
|
13068
|
+
|
|
13069
|
+
// src/lib/task-hidden-checks.ts
|
|
13070
|
+
import { createHash } from "crypto";
|
|
13071
|
+
function hiddenChecksCommitment(bytes) {
|
|
13072
|
+
return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
13073
|
+
}
|
|
13074
|
+
function readHiddenChecksFile(bytes) {
|
|
13075
|
+
let value;
|
|
13076
|
+
try {
|
|
13077
|
+
value = JSON.parse(new TextDecoder("utf-8").decode(bytes));
|
|
13078
|
+
} catch (error) {
|
|
13079
|
+
return { valid: false, error: `The file is not valid JSON: ${error.message}` };
|
|
13080
|
+
}
|
|
13081
|
+
if (typeof value === "object" && value !== null && "hiddenChecks" in value) {
|
|
13082
|
+
return { valid: false, error: "A hidden checks file cannot itself carry hiddenChecks" };
|
|
13083
|
+
}
|
|
13084
|
+
const result = validateTaskChecks(value);
|
|
13085
|
+
if (!result.ok) {
|
|
13086
|
+
return {
|
|
13087
|
+
valid: false,
|
|
13088
|
+
error: `Not a valid taskmarket.checks/1 spec: ${formatTaskChecksErrors(result.errors)}`
|
|
13089
|
+
};
|
|
13090
|
+
}
|
|
13091
|
+
return { valid: true, count: result.spec.checks.length };
|
|
13092
|
+
}
|
|
13093
|
+
function isCommitment(value) {
|
|
13094
|
+
return TASK_HIDDEN_CHECKS_COMMITMENT_PATTERN.test(value);
|
|
13095
|
+
}
|
|
13096
|
+
|
|
13097
|
+
// src/commands/task/checks.ts
|
|
13098
|
+
function readBytes(path9) {
|
|
13099
|
+
try {
|
|
13100
|
+
return readFileSync3(path9);
|
|
13101
|
+
} catch (error) {
|
|
13102
|
+
return `Cannot read ${path9}: ${error.message}`;
|
|
13103
|
+
}
|
|
13104
|
+
}
|
|
13105
|
+
var commitCmd = new Command55("commit").description(
|
|
13106
|
+
"Commit to a hidden checks file: validates it and prints { commitment, count }. Put both in the public spec's hiddenChecks, then encrypt the file to each verifier with `taskmarket encrypt`"
|
|
13107
|
+
).requiredOption("--file <path>", "The hidden checks file (a taskmarket.checks/1 spec)").action((opts) => {
|
|
13108
|
+
const bytes = readBytes(opts.file);
|
|
13109
|
+
if (typeof bytes === "string") return void printError(bytes);
|
|
13110
|
+
const file = readHiddenChecksFile(bytes);
|
|
13111
|
+
if (!file.valid) return void printError(file.error);
|
|
13112
|
+
printResult({ commitment: hiddenChecksCommitment(bytes), count: file.count });
|
|
13113
|
+
});
|
|
13114
|
+
var verifyCmd = new Command55("verify").description("Check a decrypted hidden checks file against the commitment in the public spec").requiredOption("--file <path>", "The decrypted hidden checks file").requiredOption("--commitment <sha256:...>", "The spec's hiddenChecks.commitment").action((opts) => {
|
|
13115
|
+
if (!isCommitment(opts.commitment)) {
|
|
13116
|
+
return void printError("--commitment must look like sha256:<64 lowercase hex characters>");
|
|
13117
|
+
}
|
|
13118
|
+
const bytes = readBytes(opts.file);
|
|
13119
|
+
if (typeof bytes === "string") return void printError(bytes);
|
|
13120
|
+
const actual = hiddenChecksCommitment(bytes);
|
|
13121
|
+
const file = readHiddenChecksFile(bytes);
|
|
13122
|
+
printResult({
|
|
13123
|
+
matches: actual === opts.commitment,
|
|
13124
|
+
commitment: actual,
|
|
13125
|
+
expected: opts.commitment,
|
|
13126
|
+
count: file.valid ? file.count : null
|
|
13127
|
+
});
|
|
13128
|
+
});
|
|
13129
|
+
var checksCmd = new Command55("checks").description(
|
|
13130
|
+
"Hidden checks: commit to a private checks file and verify it against the commitment"
|
|
13131
|
+
).addCommand(commitCmd).addCommand(verifyCmd);
|
|
13132
|
+
|
|
12730
13133
|
// src/commands/task/settlement-actions.ts
|
|
12731
13134
|
var releaseCmd = settlementActionCommand({
|
|
12732
13135
|
name: "release",
|
|
@@ -12752,11 +13155,13 @@ var settleCmd = settlementActionCommand({
|
|
|
12752
13155
|
});
|
|
12753
13156
|
|
|
12754
13157
|
// src/commands/task/index.ts
|
|
12755
|
-
var taskCommand2 = new
|
|
13158
|
+
var taskCommand2 = new Command56("task").description("Manage tasks");
|
|
12756
13159
|
taskCommand2.addCommand(createCmd);
|
|
12757
13160
|
taskCommand2.addCommand(templateCmd);
|
|
12758
13161
|
taskCommand2.addCommand(listCmd);
|
|
12759
13162
|
taskCommand2.addCommand(getCmd);
|
|
13163
|
+
taskCommand2.addCommand(precheckCmd);
|
|
13164
|
+
taskCommand2.addCommand(checksCmd);
|
|
12760
13165
|
taskCommand2.addCommand(payoutGateCmd);
|
|
12761
13166
|
taskCommand2.addCommand(linkGateCmd);
|
|
12762
13167
|
taskCommand2.addCommand(extendGateCmd);
|
|
@@ -12804,10 +13209,10 @@ taskCommand2.addCommand(reviewCmd, { hidden: true });
|
|
|
12804
13209
|
taskCommand2.addCommand(startReviewCmd);
|
|
12805
13210
|
|
|
12806
13211
|
// src/commands/agent/index.ts
|
|
12807
|
-
import { Command as
|
|
13212
|
+
import { Command as Command60, Option as Option4 } from "commander";
|
|
12808
13213
|
|
|
12809
13214
|
// src/commands/agent/credits.ts
|
|
12810
|
-
import { Command as
|
|
13215
|
+
import { Command as Command57 } from "commander";
|
|
12811
13216
|
|
|
12812
13217
|
// src/lib/tty-confirm.ts
|
|
12813
13218
|
import { createInterface as createInterface3 } from "readline";
|
|
@@ -12819,7 +13224,7 @@ async function confirmAtTerminal(lines, unattended) {
|
|
|
12819
13224
|
`);
|
|
12820
13225
|
const readline = createInterface3({ input: process.stdin, output: process.stderr });
|
|
12821
13226
|
const answer = await new Promise(
|
|
12822
|
-
(
|
|
13227
|
+
(resolve2) => readline.question("Type yes to approve: ", resolve2)
|
|
12823
13228
|
);
|
|
12824
13229
|
readline.close();
|
|
12825
13230
|
return answer.trim().toLowerCase() === "yes";
|
|
@@ -12860,7 +13265,7 @@ function setupLines(plan, pricing) {
|
|
|
12860
13265
|
...rateLines(pricing)
|
|
12861
13266
|
];
|
|
12862
13267
|
}
|
|
12863
|
-
var setupCommand = new
|
|
13268
|
+
var setupCommand = new Command57("setup").description(
|
|
12864
13269
|
"Approve the compute allocation that pays for sandboxes: daily and monthly caps, and optional auto-top-up"
|
|
12865
13270
|
).requiredOption("--per-day <usd>", "Most compute credit bought in one UTC day, in USD").requiredOption("--per-month <usd>", "Most compute credit bought in one UTC month, in USD").option("--total <usd>", "Most this allocation ever buys, in USD (default: 12 months)").option(
|
|
12866
13271
|
"--auto-top-up-below <credits>",
|
|
@@ -12897,7 +13302,7 @@ var setupCommand = new Command55("setup").description(
|
|
|
12897
13302
|
printResult({ config, caps: plan.caps, autoTopUp: plan.autoTopUp ?? null });
|
|
12898
13303
|
}
|
|
12899
13304
|
);
|
|
12900
|
-
var buyCommand = new
|
|
13305
|
+
var buyCommand = new Command57("buy").description("Buy compute credit over x402 from the compute allocation, after showing the rate").option("--amount <usd>", "Purchase size in whole USD (see `credits status` for the sizes)").option("--yes", "Skip the confirmation prompt (the allocation caps still apply)").action(async (options) => {
|
|
12901
13306
|
const config = await loadComputeCreditConfig();
|
|
12902
13307
|
if (!config) {
|
|
12903
13308
|
throw new ComputeCreditError(
|
|
@@ -12927,17 +13332,17 @@ var buyCommand = new Command55("buy").description("Buy compute credit over x402
|
|
|
12927
13332
|
rate: { rateCardVersion: pricing.rateCardVersion, usdPerCredit: pricing.usdPerCredit }
|
|
12928
13333
|
});
|
|
12929
13334
|
});
|
|
12930
|
-
var statusCommand2 = new
|
|
13335
|
+
var statusCommand2 = new Command57("status").description(
|
|
12931
13336
|
"Show compute credit balance, rate, recent debits and purchases, and the caps; an approved auto-top-up runs when the balance is below its threshold"
|
|
12932
13337
|
).action(async () => {
|
|
12933
13338
|
printResult(await computeCreditStatus());
|
|
12934
13339
|
});
|
|
12935
|
-
var checkCommand = new
|
|
13340
|
+
var checkCommand = new Command57("check").description(
|
|
12936
13341
|
"Check the compute credit balance and, when auto-top-up was approved and the balance is low, buy one chunk"
|
|
12937
13342
|
).action(async () => {
|
|
12938
13343
|
printResult(await checkComputeBalance());
|
|
12939
13344
|
});
|
|
12940
|
-
var reconcileCommand = new
|
|
13345
|
+
var reconcileCommand = new Command57("reconcile").description(
|
|
12941
13346
|
"Settle purchases whose outcome was lost, by their idempotency key; never pays again"
|
|
12942
13347
|
).option(
|
|
12943
13348
|
"--release <key>",
|
|
@@ -12984,10 +13389,10 @@ var reconcileCommand = new Command55("reconcile").description(
|
|
|
12984
13389
|
...recoveryError === void 0 ? {} : { recoveryError }
|
|
12985
13390
|
});
|
|
12986
13391
|
});
|
|
12987
|
-
var disableAutoTopUpCommand = new
|
|
13392
|
+
var disableAutoTopUpCommand = new Command57("disable-auto-top-up").description("Turn off auto-top-up and close its allocation").action(async () => {
|
|
12988
13393
|
printResult({ config: await disableComputeAutoTopUp() });
|
|
12989
13394
|
});
|
|
12990
|
-
var agentCreditsCommand = new
|
|
13395
|
+
var agentCreditsCommand = new Command57("credits").description("Prepaid compute credit for agent sandboxes, bought over x402").addCommand(setupCommand).addCommand(buyCommand).addCommand(statusCommand2).addCommand(checkCommand).addCommand(reconcileCommand).addCommand(disableAutoTopUpCommand);
|
|
12991
13396
|
|
|
12992
13397
|
// src/commands/agent/launch.ts
|
|
12993
13398
|
var EXPERIMENTAL_AGENT_ENV = "TASKMARKET_EXPERIMENTAL_AGENT";
|
|
@@ -13009,7 +13414,7 @@ async function runAgentCommand(options) {
|
|
|
13009
13414
|
try {
|
|
13010
13415
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
13011
13416
|
const pi = assertAgentCompatibility();
|
|
13012
|
-
const { runAgent } = await import("./launch-
|
|
13417
|
+
const { runAgent } = await import("./launch-RL4BS22J.js");
|
|
13013
13418
|
result = await runAgent({
|
|
13014
13419
|
model: options.model,
|
|
13015
13420
|
pi,
|
|
@@ -13040,10 +13445,10 @@ async function runAgentCommand(options) {
|
|
|
13040
13445
|
}
|
|
13041
13446
|
|
|
13042
13447
|
// src/commands/agent/listing.ts
|
|
13043
|
-
import { createHash, randomBytes as randomBytes4 } from "crypto";
|
|
13448
|
+
import { createHash as createHash2, randomBytes as randomBytes4 } from "crypto";
|
|
13044
13449
|
import { readFile as readFile2 } from "fs/promises";
|
|
13045
13450
|
import { extname } from "path";
|
|
13046
|
-
import { Command as
|
|
13451
|
+
import { Command as Command58, Option as Option3 } from "commander";
|
|
13047
13452
|
var WRITE_TTL_SECONDS2 = 5 * 60;
|
|
13048
13453
|
var HOUR = 3600;
|
|
13049
13454
|
var LISTING_UNTRUSTED_FIELDS = [
|
|
@@ -13150,7 +13555,7 @@ async function sendAvatar(file) {
|
|
|
13150
13555
|
const bytes = await readFile2(file);
|
|
13151
13556
|
if (bytes.length > AGENT_AVATAR_MAX_BYTES) throw new Error("--avatar must be at most 1 MB");
|
|
13152
13557
|
image = bytes.toString("base64");
|
|
13153
|
-
imageSha256 =
|
|
13558
|
+
imageSha256 = createHash2("sha256").update(bytes).digest("hex");
|
|
13154
13559
|
}
|
|
13155
13560
|
const keystore = await loadKeystore();
|
|
13156
13561
|
const nonce = `0x${randomBytes4(32).toString("hex")}`;
|
|
@@ -13176,7 +13581,7 @@ async function ownListing() {
|
|
|
13176
13581
|
const keystore = await loadKeystore();
|
|
13177
13582
|
return fetchListing(keystore.walletAddress);
|
|
13178
13583
|
}
|
|
13179
|
-
var profileCommand = new
|
|
13584
|
+
var profileCommand = new Command58("profile").description(
|
|
13180
13585
|
"Your listing's profile: name, description, roles, specialties and capabilities"
|
|
13181
13586
|
);
|
|
13182
13587
|
profileCommand.command("set").description(
|
|
@@ -13328,7 +13733,7 @@ function addServiceOptions(command) {
|
|
|
13328
13733
|
"fixed or quote: a hire of this service must name an evaluator before it is accepted"
|
|
13329
13734
|
).option("--no-requires-evaluator", "fixed or quote: hires need no evaluator (the default)");
|
|
13330
13735
|
}
|
|
13331
|
-
var serviceCommand = new
|
|
13736
|
+
var serviceCommand = new Command58("service").description(
|
|
13332
13737
|
"Your listing services: the priced offers requesters hire you for"
|
|
13333
13738
|
);
|
|
13334
13739
|
addServiceOptions(
|
|
@@ -13370,7 +13775,7 @@ serviceCommand.command("remove").description("Remove a service from your listing
|
|
|
13370
13775
|
renderFailure(err);
|
|
13371
13776
|
}
|
|
13372
13777
|
});
|
|
13373
|
-
var availabilityCommand = new
|
|
13778
|
+
var availabilityCommand = new Command58("availability").description(
|
|
13374
13779
|
"Open your listing for hires or pause it (services stay visible but cannot be hired), and set your capacity"
|
|
13375
13780
|
).argument("[state]", "open or paused; keeps the saved state when left out").option("--capacity <n>", 'Most hires in progress at once, or "none" for no limit').action(async (state, opts) => {
|
|
13376
13781
|
try {
|
|
@@ -13390,7 +13795,7 @@ var availabilityCommand = new Command56("availability").description(
|
|
|
13390
13795
|
renderFailure(err);
|
|
13391
13796
|
}
|
|
13392
13797
|
});
|
|
13393
|
-
var listingCommand = new
|
|
13798
|
+
var listingCommand = new Command58("listing").description(
|
|
13394
13799
|
"Show your listing, or another worker's, with whether it is taking hires now and each service's track record on the selected --network"
|
|
13395
13800
|
).argument("[address]", "Wallet address; your own when left out").action(async (address3) => {
|
|
13396
13801
|
try {
|
|
@@ -13417,7 +13822,7 @@ function agentListingCommands() {
|
|
|
13417
13822
|
}
|
|
13418
13823
|
|
|
13419
13824
|
// src/commands/agent/manage.ts
|
|
13420
|
-
import { Command as
|
|
13825
|
+
import { Command as Command59 } from "commander";
|
|
13421
13826
|
async function run(work) {
|
|
13422
13827
|
try {
|
|
13423
13828
|
const value = await work();
|
|
@@ -13440,27 +13845,27 @@ async function requireExperimental() {
|
|
|
13440
13845
|
);
|
|
13441
13846
|
}
|
|
13442
13847
|
function agentManagementCommands() {
|
|
13443
|
-
const status = new
|
|
13848
|
+
const status = new Command59("status").description(
|
|
13444
13849
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
13445
13850
|
).action(async () => {
|
|
13446
|
-
const { collectAgentStatus } = await import("./status-
|
|
13851
|
+
const { collectAgentStatus } = await import("./status-IZ7ZTA5D.js");
|
|
13447
13852
|
await run(() => collectAgentStatus());
|
|
13448
13853
|
});
|
|
13449
|
-
const doctor = new
|
|
13854
|
+
const doctor = new Command59("doctor").description(
|
|
13450
13855
|
"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."
|
|
13451
13856
|
).action(async () => {
|
|
13452
|
-
const { runDoctor } = await import("./doctor-
|
|
13857
|
+
const { runDoctor } = await import("./doctor-K4RKUTXL.js");
|
|
13453
13858
|
const report = await run(() => runDoctor());
|
|
13454
13859
|
if (report && !report.ok) process.exitCode = 1;
|
|
13455
13860
|
});
|
|
13456
|
-
const reconcile = new
|
|
13861
|
+
const reconcile = new Command59("reconcile").description(
|
|
13457
13862
|
"Decide an agent purchase whose outcome is unknown, by its invocation ID; or, with --channel or --rail, everything one channel still has open. Never sends anything again."
|
|
13458
13863
|
).argument("[invocation-id]", "The purchase, as status or the agent named it").option("--rail <id>", "Reconcile the open purchases of this rail's channel").option(
|
|
13459
13864
|
"--channel <channel-id>",
|
|
13460
13865
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
13461
13866
|
).action(
|
|
13462
13867
|
async (invocationId, options) => {
|
|
13463
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
13868
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-ZFFNXOD7.js");
|
|
13464
13869
|
const choice = { rail: options.rail, channel: options.channel };
|
|
13465
13870
|
if (invocationId !== void 0) {
|
|
13466
13871
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -13478,7 +13883,7 @@ function agentManagementCommands() {
|
|
|
13478
13883
|
});
|
|
13479
13884
|
}
|
|
13480
13885
|
);
|
|
13481
|
-
const topup = new
|
|
13886
|
+
const topup = new Command59("topup").description(
|
|
13482
13887
|
"Check a channel top-up against the approved budget: within it, the channel deposits by itself with the next turn that needs funds; over it, a new approval is needed"
|
|
13483
13888
|
).requiredOption("--amount <usdc>", "Top-up in USDC, e.g. 5 or 2.50").option("--rail <id>", "The rail to top up (required when the policy has more than one)").action(async (options) => {
|
|
13484
13889
|
await run(async () => {
|
|
@@ -13492,7 +13897,7 @@ function agentManagementCommands() {
|
|
|
13492
13897
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
13493
13898
|
);
|
|
13494
13899
|
}
|
|
13495
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
13900
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-456WXKVT.js");
|
|
13496
13901
|
const { rails } = await openAgentChannels();
|
|
13497
13902
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
13498
13903
|
return {
|
|
@@ -13503,7 +13908,7 @@ function agentManagementCommands() {
|
|
|
13503
13908
|
};
|
|
13504
13909
|
});
|
|
13505
13910
|
});
|
|
13506
|
-
const close = new
|
|
13911
|
+
const close = new Command59("close").description(
|
|
13507
13912
|
"Close the agent's channel and refund its unused balance cooperatively; checks an earlier close instead of sending it again"
|
|
13508
13913
|
).option("--rail <id>", "The rail to close (required when the policy has more than one)").option(
|
|
13509
13914
|
"--channel <channel-id>",
|
|
@@ -13512,8 +13917,8 @@ function agentManagementCommands() {
|
|
|
13512
13917
|
await run(async () => {
|
|
13513
13918
|
await requireExperimental();
|
|
13514
13919
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
13515
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
13516
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
13920
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-456WXKVT.js");
|
|
13921
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-ZFFNXOD7.js");
|
|
13517
13922
|
const opened = await openAgentChannels();
|
|
13518
13923
|
const { rail, retired } = selectChannel(opened, options);
|
|
13519
13924
|
const result = await closeChannel(
|
|
@@ -13544,7 +13949,7 @@ function agentManagementCommands() {
|
|
|
13544
13949
|
};
|
|
13545
13950
|
});
|
|
13546
13951
|
});
|
|
13547
|
-
const pull = new
|
|
13952
|
+
const pull = new Command59("pull").description(
|
|
13548
13953
|
"After a session: review the changes the agent left in its sandbox (saved when the session ended; the sandbox is not resumed) and apply them to this project on approval. Conflicts with your local edits and host configuration are listed, never applied. Inside a session use /pull."
|
|
13549
13954
|
).option("--diff", "Print the full diff").option("--apply", "Apply the clean changes without asking").option(
|
|
13550
13955
|
"--overwrite <path>",
|
|
@@ -13567,7 +13972,7 @@ function agentManagementCommands() {
|
|
|
13567
13972
|
async (options) => {
|
|
13568
13973
|
await run(async () => {
|
|
13569
13974
|
await requireExperimental();
|
|
13570
|
-
const { runPull } = await import("./sync-pull-
|
|
13975
|
+
const { runPull } = await import("./sync-pull-Q7W6IPWN.js");
|
|
13571
13976
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
13572
13977
|
return runPull(options, {
|
|
13573
13978
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -13585,7 +13990,7 @@ function agentManagementCommands() {
|
|
|
13585
13990
|
|
|
13586
13991
|
// src/commands/agent/index.ts
|
|
13587
13992
|
var experimental = agentCommandEnabled();
|
|
13588
|
-
var agentCommand = new
|
|
13993
|
+
var agentCommand = new Command60("agent").description(
|
|
13589
13994
|
experimental ? "The Taskmarket agent and the compute it runs on. Without a subcommand (experimental), open Pi's interactive coding agent in this project, with paid xgate inference from your wallet and tools in your cloud sandbox" : "The Taskmarket agent and the compute it runs on"
|
|
13590
13995
|
).addOption(
|
|
13591
13996
|
new Option4("--model <id>", "Start on one model from your approved spending policy").hideHelp(
|
|
@@ -13622,7 +14027,7 @@ for (const command of agentManagementCommands()) {
|
|
|
13622
14027
|
}
|
|
13623
14028
|
|
|
13624
14029
|
// src/commands/agents.ts
|
|
13625
|
-
import { Command as
|
|
14030
|
+
import { Command as Command61 } from "commander";
|
|
13626
14031
|
var MIN_RATINGS = ["3", "4", "4.5"];
|
|
13627
14032
|
var MIN_TASKS = ["5", "10", "50"];
|
|
13628
14033
|
var AVAILABILITIES = ["available", "unavailable", "any"];
|
|
@@ -13632,9 +14037,9 @@ function allowListed(flag, value, allowed) {
|
|
|
13632
14037
|
throw new Error(`${flag} must be one of: ${allowed.join(", ")}`);
|
|
13633
14038
|
}
|
|
13634
14039
|
}
|
|
13635
|
-
var agentsCommand = new
|
|
14040
|
+
var agentsCommand = new Command61("agents").description("Browse the worker directory (agents and humans) on the selected --network").enablePositionalOptions().option(
|
|
13636
14041
|
"--sort <order>",
|
|
13637
|
-
"Sort order: reputation (top rated), tasks
|
|
14042
|
+
"Sort order: reputation (top rated), tasks, hires (most hired: completed reserved, quote and request hires) or volume (settled earnings)",
|
|
13638
14043
|
"reputation"
|
|
13639
14044
|
).option("--specialty <specialty>", "Filter listed workers by specialty, as a label or slug").option("--skill <tag>", "Deprecated alias of --specialty").option(
|
|
13640
14045
|
"--capability <slug>",
|
|
@@ -13878,7 +14283,7 @@ agentsCommand.command("report").description("Report a worker's listing, or one o
|
|
|
13878
14283
|
});
|
|
13879
14284
|
|
|
13880
14285
|
// src/commands/dashboard.ts
|
|
13881
|
-
import { Command as
|
|
14286
|
+
import { Command as Command62 } from "commander";
|
|
13882
14287
|
|
|
13883
14288
|
// src/lib/dashboard.ts
|
|
13884
14289
|
var DASHBOARD_LIST_LIMIT = 5;
|
|
@@ -14068,14 +14473,14 @@ function buildWorkflows(workflows, schedules, limit = DASHBOARD_LIST_LIMIT) {
|
|
|
14068
14473
|
// src/commands/dashboard.ts
|
|
14069
14474
|
var PROJECTS_READ_LIMIT = 25;
|
|
14070
14475
|
var SWARM_NOTE = "Hosted agents are managed in the web app (/dashboard/swarm) and need a web sign-in, so the CLI does not read them.";
|
|
14071
|
-
async function settle(
|
|
14476
|
+
async function settle(read4) {
|
|
14072
14477
|
try {
|
|
14073
|
-
return { value: await
|
|
14478
|
+
return { value: await read4(), error: null };
|
|
14074
14479
|
} catch (error) {
|
|
14075
14480
|
return { value: null, error: error instanceof Error ? error.message : String(error) };
|
|
14076
14481
|
}
|
|
14077
14482
|
}
|
|
14078
|
-
var dashboardCommand = new
|
|
14483
|
+
var dashboardCommand = new Command62("dashboard").description(
|
|
14079
14484
|
"Show your home base: what needs you, your money, tasks you posted and work you do, projects and workflows, and recent activity"
|
|
14080
14485
|
).action(async () => {
|
|
14081
14486
|
const auth = await signReadAuth();
|
|
@@ -14184,8 +14589,8 @@ var dashboardCommand = new Command60("dashboard").description(
|
|
|
14184
14589
|
});
|
|
14185
14590
|
|
|
14186
14591
|
// src/commands/inbox.ts
|
|
14187
|
-
import { Command as
|
|
14188
|
-
var inboxCommand = new
|
|
14592
|
+
import { Command as Command63 } from "commander";
|
|
14593
|
+
var inboxCommand = new Command63("inbox").description(
|
|
14189
14594
|
"Show what you need to do now, then tasks you created, tasks you are working on, and private tasks you were invited to"
|
|
14190
14595
|
).option(
|
|
14191
14596
|
"--limit <n>",
|
|
@@ -14328,21 +14733,21 @@ var inboxCommand = new Command61("inbox").description(
|
|
|
14328
14733
|
);
|
|
14329
14734
|
|
|
14330
14735
|
// src/commands/deposit.ts
|
|
14331
|
-
import { Command as
|
|
14736
|
+
import { Command as Command64 } from "commander";
|
|
14332
14737
|
|
|
14333
14738
|
// src/lib/relay-bridge.ts
|
|
14334
|
-
import { z as
|
|
14739
|
+
import { z as z4 } from "zod";
|
|
14335
14740
|
var RELAY_API_BASE_URL = "https://api.relay.link";
|
|
14336
|
-
var RelayQuoteResponseSchema =
|
|
14337
|
-
requestId:
|
|
14338
|
-
steps:
|
|
14339
|
-
|
|
14340
|
-
depositAddress:
|
|
14741
|
+
var RelayQuoteResponseSchema = z4.object({
|
|
14742
|
+
requestId: z4.string().min(1),
|
|
14743
|
+
steps: z4.array(
|
|
14744
|
+
z4.object({
|
|
14745
|
+
depositAddress: z4.string().regex(/^0x[a-fA-F0-9]{40}$/).optional()
|
|
14341
14746
|
})
|
|
14342
14747
|
).optional(),
|
|
14343
|
-
details:
|
|
14344
|
-
currencyOut:
|
|
14345
|
-
amount:
|
|
14748
|
+
details: z4.object({
|
|
14749
|
+
currencyOut: z4.object({
|
|
14750
|
+
amount: z4.string().regex(/^[0-9]+$/).optional()
|
|
14346
14751
|
}).optional()
|
|
14347
14752
|
}).optional()
|
|
14348
14753
|
});
|
|
@@ -14411,7 +14816,7 @@ async function fundingOptionsFor(chainId) {
|
|
|
14411
14816
|
note: "Run `taskmarket deposit --relay-route <routeId> --amount <n>` for a Relay deposit address. Fiat funding: see issue #2720."
|
|
14412
14817
|
};
|
|
14413
14818
|
}
|
|
14414
|
-
var depositCommand = new
|
|
14819
|
+
var depositCommand = new Command64("deposit").description(
|
|
14415
14820
|
"Show wallet address, network info and cross-chain funding options for the selected --network"
|
|
14416
14821
|
).option(
|
|
14417
14822
|
"--relay-route <routeId>",
|
|
@@ -14501,10 +14906,10 @@ var depositCommand = new Command62("deposit").description(
|
|
|
14501
14906
|
});
|
|
14502
14907
|
|
|
14503
14908
|
// src/commands/wallet/index.ts
|
|
14504
|
-
import { Command as
|
|
14909
|
+
import { Command as Command75 } from "commander";
|
|
14505
14910
|
|
|
14506
14911
|
// src/commands/wallet/balance.ts
|
|
14507
|
-
import { Command as
|
|
14912
|
+
import { Command as Command65 } from "commander";
|
|
14508
14913
|
function balancePath(address3, chainId) {
|
|
14509
14914
|
return `/api/wallet/balance?address=${address3}&chainId=${chainId}`;
|
|
14510
14915
|
}
|
|
@@ -14538,7 +14943,7 @@ async function allChainBalances(address3) {
|
|
|
14538
14943
|
);
|
|
14539
14944
|
return { address: address3, chains };
|
|
14540
14945
|
}
|
|
14541
|
-
var walletBalanceCommand = new
|
|
14946
|
+
var walletBalanceCommand = new Command65("balance").description("Show the wallet's payment-token balance on the selected network").option("--address <addr>", "Address to check (defaults to own wallet)").option(
|
|
14542
14947
|
"--all-chains",
|
|
14543
14948
|
"Show the balance on every chain the selected deployment serves, one entry per chain"
|
|
14544
14949
|
).option(
|
|
@@ -14578,7 +14983,7 @@ var walletBalanceCommand = new Command63("balance").description("Show the wallet
|
|
|
14578
14983
|
);
|
|
14579
14984
|
|
|
14580
14985
|
// src/commands/wallet/import.ts
|
|
14581
|
-
import { Command as
|
|
14986
|
+
import { Command as Command66 } from "commander";
|
|
14582
14987
|
import { createInterface as createInterface4 } from "readline";
|
|
14583
14988
|
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
14584
14989
|
function normalizePrivateKey(raw) {
|
|
@@ -14589,7 +14994,7 @@ function normalizePrivateKey(raw) {
|
|
|
14589
14994
|
return `0x${hex3}`;
|
|
14590
14995
|
}
|
|
14591
14996
|
function promptHiddenInput(prompt) {
|
|
14592
|
-
return new Promise((
|
|
14997
|
+
return new Promise((resolve2) => {
|
|
14593
14998
|
const rl = createInterface4({
|
|
14594
14999
|
input: process.stdin,
|
|
14595
15000
|
output: process.stderr,
|
|
@@ -14609,7 +15014,7 @@ function promptHiddenInput(prompt) {
|
|
|
14609
15014
|
muted.muted = false;
|
|
14610
15015
|
process.stderr.write("\n");
|
|
14611
15016
|
rl.close();
|
|
14612
|
-
|
|
15017
|
+
resolve2(answer);
|
|
14613
15018
|
});
|
|
14614
15019
|
});
|
|
14615
15020
|
}
|
|
@@ -14652,7 +15057,7 @@ async function importSolanaWallet(flagKey) {
|
|
|
14652
15057
|
{ warnings: argvKeyWarnings(keySource) }
|
|
14653
15058
|
);
|
|
14654
15059
|
}
|
|
14655
|
-
var walletImportCommand = new
|
|
15060
|
+
var walletImportCommand = new Command66("import").description("Import an existing private key as the agent wallet").option(
|
|
14656
15061
|
"--key <privateKey>",
|
|
14657
15062
|
"Private key to import (64 hex chars, with or without 0x prefix; with --solana, a base58 or JSON-array Solana secret key)"
|
|
14658
15063
|
).option(
|
|
@@ -14743,7 +15148,7 @@ var walletImportCommand = new Command64("import").description("Import an existin
|
|
|
14743
15148
|
|
|
14744
15149
|
// src/commands/wallet/set-withdrawal-address.ts
|
|
14745
15150
|
import { randomBytes as randomBytes5 } from "crypto";
|
|
14746
|
-
import { Command as
|
|
15151
|
+
import { Command as Command67 } from "commander";
|
|
14747
15152
|
|
|
14748
15153
|
// src/lib/withdrawal-pin.ts
|
|
14749
15154
|
var WithdrawalAddressMismatchError = class extends Error {
|
|
@@ -14820,7 +15225,7 @@ var SIGNATURE_TTL_SECONDS = 5 * 60;
|
|
|
14820
15225
|
function isValidAddress(addr) {
|
|
14821
15226
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
14822
15227
|
}
|
|
14823
|
-
var setWithdrawalAddressCommand = new
|
|
15228
|
+
var setWithdrawalAddressCommand = new Command67("set-withdrawal-address").description(
|
|
14824
15229
|
"Set the withdrawal address for payment-token withdrawals on the selected network (once per chain, free)"
|
|
14825
15230
|
).argument("<address>", "Ethereum address to receive withdrawals").action(async (address3) => {
|
|
14826
15231
|
if (!isValidAddress(address3)) {
|
|
@@ -14881,8 +15286,8 @@ var setWithdrawalAddressCommand = new Command65("set-withdrawal-address").descri
|
|
|
14881
15286
|
});
|
|
14882
15287
|
|
|
14883
15288
|
// src/commands/wallet/get-withdrawal-address.ts
|
|
14884
|
-
import { Command as
|
|
14885
|
-
var getWithdrawalAddressCommand = new
|
|
15289
|
+
import { Command as Command68 } from "commander";
|
|
15290
|
+
var getWithdrawalAddressCommand = new Command68("get-withdrawal-address").description(
|
|
14886
15291
|
"Show the withdrawal address registered on the selected network, if any (the address is per chain)"
|
|
14887
15292
|
).option("--address <addr>", "Wallet address to check (defaults to own wallet)").action(async (opts) => {
|
|
14888
15293
|
let address3 = opts.address;
|
|
@@ -14898,14 +15303,14 @@ var getWithdrawalAddressCommand = new Command66("get-withdrawal-address").descri
|
|
|
14898
15303
|
});
|
|
14899
15304
|
|
|
14900
15305
|
// src/commands/wallet/change-withdrawal-address.ts
|
|
14901
|
-
import { Command as
|
|
15306
|
+
import { Command as Command69 } from "commander";
|
|
14902
15307
|
function isValidAddress2(addr) {
|
|
14903
15308
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
14904
15309
|
}
|
|
14905
15310
|
function isValidRecoveryCode(code) {
|
|
14906
15311
|
return /^\d{8}$/.test(code);
|
|
14907
15312
|
}
|
|
14908
|
-
var changeWithdrawalAddressCommand = new
|
|
15313
|
+
var changeWithdrawalAddressCommand = new Command69("change-withdrawal-address").description(
|
|
14909
15314
|
"Change the selected network's withdrawal address using that chain's account recovery code (RFC-0012)"
|
|
14910
15315
|
).argument("<recovery-code>", "The 8-digit account recovery code from set-withdrawal-address").argument("<new-address>", "New Ethereum address to receive withdrawals").action(async (recoveryCode, newAddress) => {
|
|
14911
15316
|
if (!isValidRecoveryCode(recoveryCode)) {
|
|
@@ -14957,8 +15362,8 @@ var changeWithdrawalAddressCommand = new Command67("change-withdrawal-address").
|
|
|
14957
15362
|
});
|
|
14958
15363
|
|
|
14959
15364
|
// src/commands/wallet/sync-withdrawal-address.ts
|
|
14960
|
-
import { Command as
|
|
14961
|
-
var syncWithdrawalAddressCommand = new
|
|
15365
|
+
import { Command as Command70 } from "commander";
|
|
15366
|
+
var syncWithdrawalAddressCommand = new Command70("sync-withdrawal-address").description(
|
|
14962
15367
|
"Accept the selected network's withdrawal address registered on the server as the locally pinned one (after a change made elsewhere, e.g. on the web)"
|
|
14963
15368
|
).action(async () => {
|
|
14964
15369
|
let keystore;
|
|
@@ -14991,8 +15396,8 @@ var syncWithdrawalAddressCommand = new Command68("sync-withdrawal-address").desc
|
|
|
14991
15396
|
});
|
|
14992
15397
|
|
|
14993
15398
|
// src/commands/wallet/reveal-recovery-code.ts
|
|
14994
|
-
import { Command as
|
|
14995
|
-
var revealRecoveryCodeCommand = new
|
|
15399
|
+
import { Command as Command71 } from "commander";
|
|
15400
|
+
var revealRecoveryCodeCommand = new Command71("reveal-recovery-code").description(
|
|
14996
15401
|
"One-time reveal of the selected network's account recovery code, if one has not been generated yet"
|
|
14997
15402
|
).action(async () => {
|
|
14998
15403
|
let keystore;
|
|
@@ -15031,8 +15436,8 @@ var revealRecoveryCodeCommand = new Command69("reveal-recovery-code").descriptio
|
|
|
15031
15436
|
});
|
|
15032
15437
|
|
|
15033
15438
|
// src/commands/wallet/publish-key.ts
|
|
15034
|
-
import { Command as
|
|
15035
|
-
var publishKeyCommand = new
|
|
15439
|
+
import { Command as Command72 } from "commander";
|
|
15440
|
+
var publishKeyCommand = new Command72("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
15036
15441
|
let keystore;
|
|
15037
15442
|
try {
|
|
15038
15443
|
keystore = await loadKeystore();
|
|
@@ -15052,7 +15457,7 @@ var publishKeyCommand = new Command70("publish-key").description("Publish your s
|
|
|
15052
15457
|
});
|
|
15053
15458
|
|
|
15054
15459
|
// src/commands/wallet/withdraw-dreams.ts
|
|
15055
|
-
import { Command as
|
|
15460
|
+
import { Command as Command73 } from "commander";
|
|
15056
15461
|
import { toHex } from "viem";
|
|
15057
15462
|
var AUTHORIZATION_VALIDITY_SECONDS = 300;
|
|
15058
15463
|
function isValidAddress3(addr) {
|
|
@@ -15074,7 +15479,7 @@ function withdrawalTargets(balance, hook) {
|
|
|
15074
15479
|
targets: hooks.filter((entry) => BigInt(entry.claimableBaseUnits) > 0n).map((entry) => ({ hookAddress: entry.hookAddress, send: true }))
|
|
15075
15480
|
};
|
|
15076
15481
|
}
|
|
15077
|
-
var withdrawDreamsCommand = new
|
|
15482
|
+
var withdrawDreamsCommand = new Command73("withdraw-dreams").description(
|
|
15078
15483
|
"Withdraw accumulated DREAMS rewards to the withdrawal address: one signed withdrawal from each reward hook holding a balance, or from --hook alone"
|
|
15079
15484
|
).option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").option("--hook <address>", "Withdraw from this reward hook only").action(async (opts) => {
|
|
15080
15485
|
let keystore;
|
|
@@ -15195,7 +15600,7 @@ var withdrawDreamsCommand = new Command71("withdraw-dreams").description(
|
|
|
15195
15600
|
});
|
|
15196
15601
|
|
|
15197
15602
|
// src/commands/wallet/bridge.ts
|
|
15198
|
-
import { Command as
|
|
15603
|
+
import { Command as Command74 } from "commander";
|
|
15199
15604
|
import { toHex as toHex2 } from "viem";
|
|
15200
15605
|
var USDC_TYPES = {
|
|
15201
15606
|
TransferWithAuthorization: [
|
|
@@ -15213,7 +15618,7 @@ function progress(message) {
|
|
|
15213
15618
|
`);
|
|
15214
15619
|
}
|
|
15215
15620
|
function sleep(ms2) {
|
|
15216
|
-
return new Promise((
|
|
15621
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms2));
|
|
15217
15622
|
}
|
|
15218
15623
|
function sameAddress2(a, b) {
|
|
15219
15624
|
return a.toLowerCase() === b.toLowerCase();
|
|
@@ -15239,7 +15644,7 @@ async function pollBridgeStatus(requestId) {
|
|
|
15239
15644
|
await sleep(bridgeTiming.intervalMs);
|
|
15240
15645
|
}
|
|
15241
15646
|
}
|
|
15242
|
-
var walletBridgeCommand = new
|
|
15647
|
+
var walletBridgeCommand = new Command74("bridge").description(
|
|
15243
15648
|
"Move free USDC on Base to OUSD at the same address on Tempo (gasless, through Relay)"
|
|
15244
15649
|
).requiredOption("--to <chain>", 'Destination chain (only "tempo")').option(
|
|
15245
15650
|
"--recipient <address>",
|
|
@@ -15378,7 +15783,7 @@ var walletBridgeCommand = new Command72("bridge").description(
|
|
|
15378
15783
|
});
|
|
15379
15784
|
|
|
15380
15785
|
// src/commands/wallet/index.ts
|
|
15381
|
-
var walletCommand = new
|
|
15786
|
+
var walletCommand = new Command75("wallet").description("Wallet management commands");
|
|
15382
15787
|
walletCommand.addCommand(walletBalanceCommand);
|
|
15383
15788
|
walletCommand.addCommand(walletImportCommand);
|
|
15384
15789
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
@@ -15391,7 +15796,7 @@ walletCommand.addCommand(withdrawDreamsCommand);
|
|
|
15391
15796
|
walletCommand.addCommand(walletBridgeCommand);
|
|
15392
15797
|
|
|
15393
15798
|
// src/commands/withdraw.ts
|
|
15394
|
-
import { Command as
|
|
15799
|
+
import { Command as Command76 } from "commander";
|
|
15395
15800
|
import { toHex as toHex3 } from "viem";
|
|
15396
15801
|
|
|
15397
15802
|
// src/lib/solana-relay.ts
|
|
@@ -15449,7 +15854,7 @@ async function waitForSolanaSignature(rpc, signature, { timeoutMs = CONFIRM_TIME
|
|
|
15449
15854
|
if (status?.confirmationStatus === "confirmed" || status?.confirmationStatus === "finalized")
|
|
15450
15855
|
return true;
|
|
15451
15856
|
if (Date.now() >= deadline) return false;
|
|
15452
|
-
await new Promise((
|
|
15857
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollMs));
|
|
15453
15858
|
}
|
|
15454
15859
|
}
|
|
15455
15860
|
async function relaySolanaInstructions(input) {
|
|
@@ -15570,7 +15975,7 @@ var USDC_TYPES2 = {
|
|
|
15570
15975
|
{ name: "nonce", type: "bytes32" }
|
|
15571
15976
|
]
|
|
15572
15977
|
};
|
|
15573
|
-
var withdrawCommand = new
|
|
15978
|
+
var withdrawCommand = new Command76("withdraw").description(
|
|
15574
15979
|
"Withdraw the payment token (USDC on Base, OUSD on Tempo) to the registered withdrawal address"
|
|
15575
15980
|
).argument("<amount>", "Amount in whole tokens (e.g. 5 for 5 USDC or 5 OUSD)").option("--solana", "Send an SPL token from the agent's Solana wallet instead").option("--mint <address>", "With --solana: the SPL Token or Token-2022 mint to send").option("--to <address>", "With --solana: the Solana address to send to").option("--solana-cluster <cluster>", "With --solana: mainnet-beta or devnet").option("--yes", "With --solana: send without the terminal confirmation").action(async (amount, opts) => {
|
|
15576
15981
|
if (opts.solana) {
|
|
@@ -15659,9 +16064,9 @@ var withdrawCommand = new Command74("withdraw").description(
|
|
|
15659
16064
|
});
|
|
15660
16065
|
|
|
15661
16066
|
// src/commands/encrypt.ts
|
|
15662
|
-
import { Command as
|
|
16067
|
+
import { Command as Command77 } from "commander";
|
|
15663
16068
|
import { promises as fs2 } from "fs";
|
|
15664
|
-
var encryptCommand = new
|
|
16069
|
+
var encryptCommand = new Command77("encrypt").description("Encrypt a file with ECIES using wallet keys").argument("<file>", "Path to the file to encrypt").option("--recipient <address>", "Recipient wallet address (default: self)").option("--output <path>", "Output path (default: <file>.enc)").action(async (file, opts) => {
|
|
15665
16070
|
let plaintext;
|
|
15666
16071
|
try {
|
|
15667
16072
|
plaintext = await fs2.readFile(file);
|
|
@@ -15709,9 +16114,9 @@ var encryptCommand = new Command75("encrypt").description("Encrypt a file with E
|
|
|
15709
16114
|
});
|
|
15710
16115
|
|
|
15711
16116
|
// src/commands/decrypt.ts
|
|
15712
|
-
import { Command as
|
|
16117
|
+
import { Command as Command78 } from "commander";
|
|
15713
16118
|
import { promises as fs3 } from "fs";
|
|
15714
|
-
var decryptCommand = new
|
|
16119
|
+
var decryptCommand = new Command78("decrypt").description("Decrypt a file using your wallet key").argument("<file>", "Path to the encrypted file").option("--output <path>", "Output path (default: strips .enc, otherwise appends .dec)").action(async (file, opts) => {
|
|
15715
16120
|
let ciphertext;
|
|
15716
16121
|
try {
|
|
15717
16122
|
ciphertext = await fs3.readFile(file);
|
|
@@ -15751,7 +16156,7 @@ var decryptCommand = new Command76("decrypt").description("Decrypt a file using
|
|
|
15751
16156
|
});
|
|
15752
16157
|
|
|
15753
16158
|
// src/commands/xmtp.ts
|
|
15754
|
-
import { Command as
|
|
16159
|
+
import { Command as Command79 } from "commander";
|
|
15755
16160
|
|
|
15756
16161
|
// src/lib/xmtp-client.ts
|
|
15757
16162
|
import fs6 from "fs";
|
|
@@ -15789,12 +16194,12 @@ function decodeEnvelope(raw) {
|
|
|
15789
16194
|
var XmtpQueryManager = class {
|
|
15790
16195
|
pending = /* @__PURE__ */ new Map();
|
|
15791
16196
|
waitForResponse(requestId, timeoutMs) {
|
|
15792
|
-
return new Promise((
|
|
16197
|
+
return new Promise((resolve2, reject) => {
|
|
15793
16198
|
const timeout = setTimeout(() => {
|
|
15794
16199
|
this.pending.delete(requestId);
|
|
15795
16200
|
reject(new Error(`XMTP query timed out after ${timeoutMs}ms`));
|
|
15796
16201
|
}, timeoutMs);
|
|
15797
|
-
this.pending.set(requestId, { resolve, reject, timeout });
|
|
16202
|
+
this.pending.set(requestId, { resolve: resolve2, reject, timeout });
|
|
15798
16203
|
});
|
|
15799
16204
|
}
|
|
15800
16205
|
resolveResponse(envelope) {
|
|
@@ -16060,7 +16465,7 @@ function shouldHandleEnvelope(envelope, options) {
|
|
|
16060
16465
|
return true;
|
|
16061
16466
|
}
|
|
16062
16467
|
function sleep2(ms2) {
|
|
16063
|
-
return new Promise((
|
|
16468
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms2));
|
|
16064
16469
|
}
|
|
16065
16470
|
async function runStreamWithReconnect(options) {
|
|
16066
16471
|
const maxReconnectAttempts = options.maxReconnectAttempts ?? Number.POSITIVE_INFINITY;
|
|
@@ -16197,9 +16602,9 @@ async function createDevClient(input) {
|
|
|
16197
16602
|
let offset = 0;
|
|
16198
16603
|
let live = false;
|
|
16199
16604
|
while (!options?.signal?.aborted) {
|
|
16200
|
-
const
|
|
16201
|
-
offset =
|
|
16202
|
-
for (const message of
|
|
16605
|
+
const read4 = fileBus.readFrom(inboxId, offset);
|
|
16606
|
+
offset = read4.offset;
|
|
16607
|
+
for (const message of read4.messages) {
|
|
16203
16608
|
if (options?.peerInboxId) {
|
|
16204
16609
|
if (message.conversationId !== devConversationId(inboxId, options.peerInboxId)) {
|
|
16205
16610
|
continue;
|
|
@@ -16214,7 +16619,7 @@ async function createDevClient(input) {
|
|
|
16214
16619
|
live = true;
|
|
16215
16620
|
options?.onLive?.();
|
|
16216
16621
|
}
|
|
16217
|
-
await new Promise((
|
|
16622
|
+
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
16218
16623
|
}
|
|
16219
16624
|
return;
|
|
16220
16625
|
}
|
|
@@ -16229,7 +16634,7 @@ async function createDevClient(input) {
|
|
|
16229
16634
|
}
|
|
16230
16635
|
continue;
|
|
16231
16636
|
}
|
|
16232
|
-
await new Promise((
|
|
16637
|
+
await new Promise((resolve2) => setTimeout(resolve2, 250));
|
|
16233
16638
|
}
|
|
16234
16639
|
},
|
|
16235
16640
|
async setConsentState(_inboxId, _state) {
|
|
@@ -16360,7 +16765,7 @@ function toTransportError(error, fallbackMessage) {
|
|
|
16360
16765
|
return new XmtpTransportError(message, category, error);
|
|
16361
16766
|
}
|
|
16362
16767
|
function sleep3(ms2) {
|
|
16363
|
-
return new Promise((
|
|
16768
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms2));
|
|
16364
16769
|
}
|
|
16365
16770
|
function parseRetryAttempts() {
|
|
16366
16771
|
const raw = process.env.TASKMARKET_XMTP_SEND_MAX_ATTEMPTS;
|
|
@@ -16459,7 +16864,7 @@ async function sendViaConversation(client, toInboxId, body) {
|
|
|
16459
16864
|
);
|
|
16460
16865
|
}
|
|
16461
16866
|
function callAsync(operation) {
|
|
16462
|
-
return new Promise((
|
|
16867
|
+
return new Promise((resolve2) => resolve2(operation()));
|
|
16463
16868
|
}
|
|
16464
16869
|
async function sendWithSdkClient(client, toInboxId, body) {
|
|
16465
16870
|
const clientObject = asObject(client);
|
|
@@ -17165,7 +17570,7 @@ function senderInboxIdFor(keystore, client) {
|
|
|
17165
17570
|
}
|
|
17166
17571
|
return client.inboxId;
|
|
17167
17572
|
}
|
|
17168
|
-
var xmtpCommand = new
|
|
17573
|
+
var xmtpCommand = new Command79("xmtp").description("Manage XMTP messaging for this agent");
|
|
17169
17574
|
xmtpCommand.hook("preAction", () => {
|
|
17170
17575
|
if (resolveXmtpEnv() !== "memory") assertXmtpSupported();
|
|
17171
17576
|
});
|
|
@@ -17430,7 +17835,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
17430
17835
|
});
|
|
17431
17836
|
|
|
17432
17837
|
// src/commands/daemon.ts
|
|
17433
|
-
import { Command as
|
|
17838
|
+
import { Command as Command81 } from "commander";
|
|
17434
17839
|
|
|
17435
17840
|
// src/lib/market-event-settings-auth.ts
|
|
17436
17841
|
function signMarketEventSettingsWrite(change) {
|
|
@@ -17438,7 +17843,7 @@ function signMarketEventSettingsWrite(change) {
|
|
|
17438
17843
|
}
|
|
17439
17844
|
|
|
17440
17845
|
// src/commands/events.ts
|
|
17441
|
-
import { Command as
|
|
17846
|
+
import { Command as Command80 } from "commander";
|
|
17442
17847
|
|
|
17443
17848
|
// src/lib/market-event-cursor.ts
|
|
17444
17849
|
import { promises as fs7 } from "fs";
|
|
@@ -17548,15 +17953,15 @@ function warn(message) {
|
|
|
17548
17953
|
`);
|
|
17549
17954
|
}
|
|
17550
17955
|
function abortableSleep(ms2, signal) {
|
|
17551
|
-
return new Promise((
|
|
17956
|
+
return new Promise((resolve2) => {
|
|
17552
17957
|
if (signal?.aborted) {
|
|
17553
|
-
|
|
17958
|
+
resolve2();
|
|
17554
17959
|
return;
|
|
17555
17960
|
}
|
|
17556
17961
|
const done = () => {
|
|
17557
17962
|
clearTimeout(timer);
|
|
17558
17963
|
signal?.removeEventListener("abort", done);
|
|
17559
|
-
|
|
17964
|
+
resolve2();
|
|
17560
17965
|
};
|
|
17561
17966
|
const timer = setTimeout(done, ms2);
|
|
17562
17967
|
signal?.addEventListener("abort", done, { once: true });
|
|
@@ -17834,14 +18239,14 @@ async function readOrMarkSeen(options) {
|
|
|
17834
18239
|
printResult(data, { idempotencyKey });
|
|
17835
18240
|
}
|
|
17836
18241
|
function createSeenCommand() {
|
|
17837
|
-
return new
|
|
18242
|
+
return new Command80("seen").description(
|
|
17838
18243
|
"Show the newest event you have seen and how many are unread (the web Inbox's Activity count); --mark moves it forward"
|
|
17839
18244
|
).option("--mark <id>", "Mark events up to this event id as seen, or `latest` for all of them").action(async (options) => {
|
|
17840
18245
|
await readOrMarkSeen(options);
|
|
17841
18246
|
});
|
|
17842
18247
|
}
|
|
17843
18248
|
function createEventsCommand() {
|
|
17844
|
-
return new
|
|
18249
|
+
return new Command80("events").description(
|
|
17845
18250
|
"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"
|
|
17846
18251
|
).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(
|
|
17847
18252
|
"--task <taskId>",
|
|
@@ -17935,15 +18340,15 @@ var EMAIL_POLL_INTERVAL_MS = 6e4;
|
|
|
17935
18340
|
var EMAIL_RETRY_MAX_MS = 15 * 6e4;
|
|
17936
18341
|
var MAX_CURSOR_IDS = 100;
|
|
17937
18342
|
function abortableSleep2(ms2, signal) {
|
|
17938
|
-
return new Promise((
|
|
18343
|
+
return new Promise((resolve2) => {
|
|
17939
18344
|
if (signal?.aborted) {
|
|
17940
|
-
|
|
18345
|
+
resolve2();
|
|
17941
18346
|
return;
|
|
17942
18347
|
}
|
|
17943
18348
|
const done = () => {
|
|
17944
18349
|
clearTimeout(timer);
|
|
17945
18350
|
signal?.removeEventListener("abort", done);
|
|
17946
|
-
|
|
18351
|
+
resolve2();
|
|
17947
18352
|
};
|
|
17948
18353
|
const timer = setTimeout(done, ms2);
|
|
17949
18354
|
signal?.addEventListener("abort", done, { once: true });
|
|
@@ -17962,7 +18367,7 @@ async function followEmails(options) {
|
|
|
17962
18367
|
const sleep4 = options.sleep ?? abortableSleep2;
|
|
17963
18368
|
const network = selectedNetwork().name;
|
|
17964
18369
|
const headers = { "x-taskmarket-api-token": options.apiToken };
|
|
17965
|
-
const
|
|
18370
|
+
const read4 = async (limit, offset) => {
|
|
17966
18371
|
const params = new URLSearchParams({
|
|
17967
18372
|
deviceId: options.deviceId,
|
|
17968
18373
|
limit: String(limit),
|
|
@@ -17984,14 +18389,14 @@ async function followEmails(options) {
|
|
|
17984
18389
|
}
|
|
17985
18390
|
try {
|
|
17986
18391
|
if (cursor === void 0) {
|
|
17987
|
-
const [newest] = await
|
|
18392
|
+
const [newest] = await read4(1, 0);
|
|
17988
18393
|
cursor = newest ? { receivedAt: newest.receivedAt, ids: [newest.id] } : { receivedAt: null, ids: [] };
|
|
17989
18394
|
await saveEmailCursor(walletAddress, network, cursor);
|
|
17990
18395
|
} else {
|
|
17991
18396
|
const fresh = [];
|
|
17992
18397
|
let reachedCursor = false;
|
|
17993
18398
|
for (let pageIndex = 0; pageIndex < EMAIL_MAX_PAGES; pageIndex += 1) {
|
|
17994
|
-
const page = await
|
|
18399
|
+
const page = await read4(EMAIL_PAGE_SIZE, pageIndex * EMAIL_PAGE_SIZE);
|
|
17995
18400
|
for (const email of page) {
|
|
17996
18401
|
if (isAfter(email, cursor)) {
|
|
17997
18402
|
if (!fresh.some((seen) => seen.id === email.id)) fresh.push(email);
|
|
@@ -18207,20 +18612,20 @@ async function storeTaskFilters(json) {
|
|
|
18207
18612
|
printResult({ source: "market", type: "discovery.filter", ...data }, { idempotencyKey });
|
|
18208
18613
|
}
|
|
18209
18614
|
function sleepOrAbort(ms2, signal) {
|
|
18210
|
-
return new Promise((
|
|
18211
|
-
const id = setTimeout(
|
|
18615
|
+
return new Promise((resolve2) => {
|
|
18616
|
+
const id = setTimeout(resolve2, ms2);
|
|
18212
18617
|
signal.addEventListener(
|
|
18213
18618
|
"abort",
|
|
18214
18619
|
() => {
|
|
18215
18620
|
clearTimeout(id);
|
|
18216
|
-
|
|
18621
|
+
resolve2();
|
|
18217
18622
|
},
|
|
18218
18623
|
{ once: true }
|
|
18219
18624
|
);
|
|
18220
18625
|
});
|
|
18221
18626
|
}
|
|
18222
18627
|
function createDaemonCommand(seams = {}) {
|
|
18223
|
-
return new
|
|
18628
|
+
return new Command81("daemon").description(
|
|
18224
18629
|
"The one long-running process for everything that reaches your agent: your market events from a stored cursor, your inbound XMTP messages and the mail to your agent email, one JSON line each, marked with its source"
|
|
18225
18630
|
).option("--heartbeat-interval <ms>", "Heartbeat interval in milliseconds", "1800000").option(
|
|
18226
18631
|
"--task-filters <json>",
|
|
@@ -18399,10 +18804,10 @@ function createDaemonCommand(seams = {}) {
|
|
|
18399
18804
|
var daemonCommand = createDaemonCommand();
|
|
18400
18805
|
|
|
18401
18806
|
// src/commands/events-filter.ts
|
|
18402
|
-
import { Command as
|
|
18807
|
+
import { Command as Command83 } from "commander";
|
|
18403
18808
|
|
|
18404
18809
|
// src/commands/events-settings.ts
|
|
18405
|
-
import { Command as
|
|
18810
|
+
import { Command as Command82 } from "commander";
|
|
18406
18811
|
var PREFERENCES_PATH = "/api/market-events/preferences";
|
|
18407
18812
|
var CHANNEL_OPTION = [
|
|
18408
18813
|
"--channel <channel>",
|
|
@@ -18420,7 +18825,7 @@ async function walletHeaders() {
|
|
|
18420
18825
|
function parseChannel(channel) {
|
|
18421
18826
|
return parseInput(MarketEventWalletChannelSchema, channel ?? "email");
|
|
18422
18827
|
}
|
|
18423
|
-
var listCommand = new
|
|
18828
|
+
var listCommand = new Command82("list").description(
|
|
18424
18829
|
"Show which event types reach this wallet on one channel (email by default); locked types cannot be turned off"
|
|
18425
18830
|
).option(...CHANNEL_OPTION).action(async (options) => {
|
|
18426
18831
|
try {
|
|
@@ -18434,7 +18839,7 @@ var listCommand = new Command80("list").description(
|
|
|
18434
18839
|
}
|
|
18435
18840
|
});
|
|
18436
18841
|
function setCommand(name, enabled, description) {
|
|
18437
|
-
return new
|
|
18842
|
+
return new Command82(name).description(description).argument("<type>", "Event type, e.g. task.invited (see `taskmarket events settings list`)").option(...CHANNEL_OPTION).action(async (type, options) => {
|
|
18438
18843
|
try {
|
|
18439
18844
|
const channel = parseChannel(options.channel);
|
|
18440
18845
|
const body = parseInput(SetMarketEventPreferenceInputSchema, { type, enabled });
|
|
@@ -18454,7 +18859,7 @@ function setCommand(name, enabled, description) {
|
|
|
18454
18859
|
}
|
|
18455
18860
|
});
|
|
18456
18861
|
}
|
|
18457
|
-
var eventsSettingsCommand = new
|
|
18862
|
+
var eventsSettingsCommand = new Command82("settings").description(
|
|
18458
18863
|
"Choose which market events reach this wallet by email or as in-app notices in the web app"
|
|
18459
18864
|
).addCommand(listCommand).addCommand(setCommand("on", true, "Turn an event type on for this wallet on one channel")).addCommand(
|
|
18460
18865
|
setCommand(
|
|
@@ -18508,7 +18913,7 @@ function mergeFilter(current, options) {
|
|
|
18508
18913
|
}
|
|
18509
18914
|
return { filter: parsed.data };
|
|
18510
18915
|
}
|
|
18511
|
-
var eventsFilterCommand = new
|
|
18916
|
+
var eventsFilterCommand = new Command83("filter").description(
|
|
18512
18917
|
"Read or set this wallet's discovery filter: which newly listed tasks are announced to it as task.listed events"
|
|
18513
18918
|
).option("--enable", "Turn discovery on").option("--disable", "Turn discovery off: no task.listed events at all").option(
|
|
18514
18919
|
"--modes <list>",
|
|
@@ -18570,11 +18975,11 @@ function attachEventsFilter(program2) {
|
|
|
18570
18975
|
}
|
|
18571
18976
|
|
|
18572
18977
|
// src/commands/email/index.ts
|
|
18573
|
-
import { Command as
|
|
18978
|
+
import { Command as Command92 } from "commander";
|
|
18574
18979
|
|
|
18575
18980
|
// src/commands/email/register.ts
|
|
18576
|
-
import { Command as
|
|
18577
|
-
var registerCommand = new
|
|
18981
|
+
import { Command as Command84 } from "commander";
|
|
18982
|
+
var registerCommand = new Command84("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
|
|
18578
18983
|
const check = await apiGet(
|
|
18579
18984
|
`/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
|
|
18580
18985
|
);
|
|
@@ -18595,8 +19000,8 @@ var registerCommand = new Command82("register").description("Register an email a
|
|
|
18595
19000
|
});
|
|
18596
19001
|
|
|
18597
19002
|
// src/commands/email/inbox.ts
|
|
18598
|
-
import { Command as
|
|
18599
|
-
var inboxCommand2 = new
|
|
19003
|
+
import { Command as Command85 } from "commander";
|
|
19004
|
+
var inboxCommand2 = new Command85("inbox").description("List emails in your inbox").option("--limit <n>", "Number of emails to return", "20").option("--unread", "Show only unread emails").action(async (opts) => {
|
|
18600
19005
|
const keystore = await loadKeystore();
|
|
18601
19006
|
const params = new URLSearchParams({
|
|
18602
19007
|
deviceId: keystore.deviceId,
|
|
@@ -18612,8 +19017,8 @@ var inboxCommand2 = new Command83("inbox").description("List emails in your inbo
|
|
|
18612
19017
|
});
|
|
18613
19018
|
|
|
18614
19019
|
// src/commands/email/read.ts
|
|
18615
|
-
import { Command as
|
|
18616
|
-
var readCommand = new
|
|
19020
|
+
import { Command as Command86 } from "commander";
|
|
19021
|
+
var readCommand = new Command86("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
|
|
18617
19022
|
const keystore = await loadKeystore();
|
|
18618
19023
|
const params = new URLSearchParams({
|
|
18619
19024
|
deviceId: keystore.deviceId,
|
|
@@ -18626,8 +19031,8 @@ var readCommand = new Command84("read").description("Read an email by ID (marks
|
|
|
18626
19031
|
});
|
|
18627
19032
|
|
|
18628
19033
|
// src/commands/email/send.ts
|
|
18629
|
-
import { Command as
|
|
18630
|
-
var sendCommand = new
|
|
19034
|
+
import { Command as Command87 } from "commander";
|
|
19035
|
+
var sendCommand = new Command87("send").description("Send an email").requiredOption("--to <address>", "Recipient email address").requiredOption("--subject <subject>", "Email subject").requiredOption("--body <text>", "Email body text").action(async (opts) => {
|
|
18631
19036
|
const keystore = await loadKeystore();
|
|
18632
19037
|
const { data: result, idempotencyKey } = await apiPost("/api/emails/send", {
|
|
18633
19038
|
deviceId: keystore.deviceId,
|
|
@@ -18640,8 +19045,8 @@ var sendCommand = new Command85("send").description("Send an email").requiredOpt
|
|
|
18640
19045
|
});
|
|
18641
19046
|
|
|
18642
19047
|
// src/commands/email/reply.ts
|
|
18643
|
-
import { Command as
|
|
18644
|
-
var replyCommand = new
|
|
19048
|
+
import { Command as Command88 } from "commander";
|
|
19049
|
+
var replyCommand = new Command88("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
|
|
18645
19050
|
const keystore = await loadKeystore();
|
|
18646
19051
|
const params = new URLSearchParams({
|
|
18647
19052
|
deviceId: keystore.deviceId,
|
|
@@ -18667,8 +19072,8 @@ var replyCommand = new Command86("reply").description("Reply to an email").argum
|
|
|
18667
19072
|
});
|
|
18668
19073
|
|
|
18669
19074
|
// src/commands/email/delete.ts
|
|
18670
|
-
import { Command as
|
|
18671
|
-
var deleteCommand = new
|
|
19075
|
+
import { Command as Command89 } from "commander";
|
|
19076
|
+
var deleteCommand = new Command89("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
18672
19077
|
const keystore = await loadKeystore();
|
|
18673
19078
|
const { data: result, idempotencyKey } = await apiPost(
|
|
18674
19079
|
"/api/emails/delete",
|
|
@@ -18682,16 +19087,16 @@ var deleteCommand = new Command87("delete").description("Delete an email by ID")
|
|
|
18682
19087
|
});
|
|
18683
19088
|
|
|
18684
19089
|
// src/commands/email/address.ts
|
|
18685
|
-
import { Command as
|
|
18686
|
-
var addressCommand3 = new
|
|
19090
|
+
import { Command as Command90 } from "commander";
|
|
19091
|
+
var addressCommand3 = new Command90("address").description("Show your registered email address").action(async () => {
|
|
18687
19092
|
const keystore = await loadKeystore();
|
|
18688
19093
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
18689
19094
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
18690
19095
|
});
|
|
18691
19096
|
|
|
18692
19097
|
// src/commands/email/mark-read.ts
|
|
18693
|
-
import { Command as
|
|
18694
|
-
async function setReadStatus(id,
|
|
19098
|
+
import { Command as Command91 } from "commander";
|
|
19099
|
+
async function setReadStatus(id, read4) {
|
|
18695
19100
|
const keystore = await loadKeystore();
|
|
18696
19101
|
const { data: result, idempotencyKey } = await apiPost(
|
|
18697
19102
|
"/api/emails/mark-read",
|
|
@@ -18699,17 +19104,17 @@ async function setReadStatus(id, read3) {
|
|
|
18699
19104
|
deviceId: keystore.deviceId,
|
|
18700
19105
|
apiToken: keystore.apiToken,
|
|
18701
19106
|
id,
|
|
18702
|
-
read:
|
|
19107
|
+
read: read4
|
|
18703
19108
|
}
|
|
18704
19109
|
);
|
|
18705
19110
|
printResult({ id: result.id, isRead: result.isRead }, { idempotencyKey });
|
|
18706
19111
|
}
|
|
18707
|
-
var markReadCommand = new
|
|
19112
|
+
var markReadCommand = new Command91("mark-read").description("Mark an email as read or unread").argument("<id>", "Email ID").option("--unread", "Mark as unread instead of read").action(async (id, opts) => {
|
|
18708
19113
|
await setReadStatus(id, !opts.unread);
|
|
18709
19114
|
});
|
|
18710
19115
|
|
|
18711
19116
|
// src/commands/email/index.ts
|
|
18712
|
-
var emailCommand = new
|
|
19117
|
+
var emailCommand = new Command92("email").description("Email management commands");
|
|
18713
19118
|
emailCommand.addCommand(registerCommand);
|
|
18714
19119
|
emailCommand.addCommand(inboxCommand2);
|
|
18715
19120
|
emailCommand.addCommand(readCommand);
|
|
@@ -18720,10 +19125,10 @@ emailCommand.addCommand(addressCommand3);
|
|
|
18720
19125
|
emailCommand.addCommand(markReadCommand);
|
|
18721
19126
|
|
|
18722
19127
|
// src/commands/bug/index.ts
|
|
18723
|
-
import { Command as
|
|
19128
|
+
import { Command as Command101 } from "commander";
|
|
18724
19129
|
|
|
18725
19130
|
// src/commands/bug/browse.ts
|
|
18726
|
-
import { Command as
|
|
19131
|
+
import { Command as Command93 } from "commander";
|
|
18727
19132
|
|
|
18728
19133
|
// src/commands/bug/known-problem.ts
|
|
18729
19134
|
async function fetchKnownProblem() {
|
|
@@ -18736,7 +19141,7 @@ async function fetchKnownProblem() {
|
|
|
18736
19141
|
}
|
|
18737
19142
|
|
|
18738
19143
|
// src/commands/bug/browse.ts
|
|
18739
|
-
var browseCommand = new
|
|
19144
|
+
var browseCommand = new Command93("browse").description(
|
|
18740
19145
|
"Browse public bug reports, to check whether a bug is already known; no wallet needed"
|
|
18741
19146
|
).option("--query <text>", "Only reports whose title or description contains this text").option("--status <status>", `Only reports with this status: ${BUG_REPORT_STATUSES.join(", ")}`).option("--sort <order>", `Order: ${PUBLIC_BUG_REPORT_SORTS.join(", ")}`, "newest").option("--limit <n>", "Maximum reports to return (1-100)", "50").option("--offset <n>", "Skip this many reports, for paging", "0").action(
|
|
18742
19147
|
async (opts) => {
|
|
@@ -18783,7 +19188,7 @@ var browseCommand = new Command91("browse").description(
|
|
|
18783
19188
|
);
|
|
18784
19189
|
|
|
18785
19190
|
// src/commands/bug/comment.ts
|
|
18786
|
-
import { Command as
|
|
19191
|
+
import { Command as Command94 } from "commander";
|
|
18787
19192
|
|
|
18788
19193
|
// src/lib/stdin.ts
|
|
18789
19194
|
var STDIN_FIRST_BYTE_MS = 5e3;
|
|
@@ -18793,7 +19198,7 @@ async function readStdin(firstByteMs) {
|
|
|
18793
19198
|
let timer;
|
|
18794
19199
|
const first = await Promise.race([
|
|
18795
19200
|
iterator.next(),
|
|
18796
|
-
...firstByteMs === void 0 ? [] : [new Promise((
|
|
19201
|
+
...firstByteMs === void 0 ? [] : [new Promise((resolve2) => timer = setTimeout(() => resolve2(null), firstByteMs))]
|
|
18797
19202
|
]);
|
|
18798
19203
|
clearTimeout(timer);
|
|
18799
19204
|
if (first === null) {
|
|
@@ -18837,7 +19242,7 @@ async function resolveBugReportId(ref) {
|
|
|
18837
19242
|
}
|
|
18838
19243
|
|
|
18839
19244
|
// src/commands/bug/comment.ts
|
|
18840
|
-
var commentCommand = new
|
|
19245
|
+
var commentCommand = new Command94("comment").description(
|
|
18841
19246
|
"Comment on a public bug report. Comments are public: never include keys, seed phrases or other private data"
|
|
18842
19247
|
).argument("<report>", BUG_REPORT_REF_HELP).argument("[message]", 'Your comment; read from stdin when omitted or "-"').option("--agent <id>", "Your agent id, shown with the comment").action(async (report, message, opts) => {
|
|
18843
19248
|
const ref = parseBugReportRef(report);
|
|
@@ -18883,8 +19288,8 @@ var commentCommand = new Command92("comment").description(
|
|
|
18883
19288
|
});
|
|
18884
19289
|
|
|
18885
19290
|
// src/commands/bug/list.ts
|
|
18886
|
-
import { Command as
|
|
18887
|
-
var listCommand2 = new
|
|
19291
|
+
import { Command as Command95 } from "commander";
|
|
19292
|
+
var listCommand2 = new Command95("list").description("List the bug reports you submitted and their status").option("--status <status>", `Only reports with this status: ${BUG_REPORT_STATUSES.join(", ")}`).option("--limit <n>", "Maximum reports to return (1-100)", "50").action(async (opts) => {
|
|
18888
19293
|
if (opts.status && !BUG_REPORT_STATUSES.includes(opts.status)) {
|
|
18889
19294
|
printError(`--status must be one of ${BUG_REPORT_STATUSES.join(", ")}`);
|
|
18890
19295
|
return;
|
|
@@ -18915,8 +19320,8 @@ var listCommand2 = new Command93("list").description("List the bug reports you s
|
|
|
18915
19320
|
});
|
|
18916
19321
|
|
|
18917
19322
|
// src/commands/bug/me-too.ts
|
|
18918
|
-
import { Command as
|
|
18919
|
-
var meTooCommand = new
|
|
19323
|
+
import { Command as Command96 } from "commander";
|
|
19324
|
+
var meTooCommand = new Command96("me-too").description("Say you hit a public bug report too; counted once per wallet").argument("<report>", BUG_REPORT_REF_HELP).action(async (report) => {
|
|
18920
19325
|
const ref = parseBugReportRef(report);
|
|
18921
19326
|
if (!ref) {
|
|
18922
19327
|
printError(BUG_REPORT_REF_ERROR);
|
|
@@ -18940,8 +19345,8 @@ var meTooCommand = new Command94("me-too").description("Say you hit a public bug
|
|
|
18940
19345
|
});
|
|
18941
19346
|
|
|
18942
19347
|
// src/commands/bug/reply.ts
|
|
18943
|
-
import { Command as
|
|
18944
|
-
var replyCommand2 = new
|
|
19348
|
+
import { Command as Command97 } from "commander";
|
|
19349
|
+
var replyCommand2 = new Command97("reply").description(
|
|
18945
19350
|
"Reply to Taskmarket staff on one of your bug reports; a reply does not change its status"
|
|
18946
19351
|
).argument("<id>", "Bug report id").argument("[message]", 'Your reply; read from stdin when omitted or "-"').action(async (id, message) => {
|
|
18947
19352
|
const body = await textOrStdin(message);
|
|
@@ -18975,8 +19380,8 @@ var replyCommand2 = new Command95("reply").description(
|
|
|
18975
19380
|
});
|
|
18976
19381
|
|
|
18977
19382
|
// src/commands/bug/show.ts
|
|
18978
|
-
import { Command as
|
|
18979
|
-
var showCommand = new
|
|
19383
|
+
import { Command as Command98 } from "commander";
|
|
19384
|
+
var showCommand = new Command98("show").description(
|
|
18980
19385
|
"Show a public bug report by its number (#N, no wallet needed), or one of your own by its id with messages from staff"
|
|
18981
19386
|
).argument("<report>", "Public number (#N) of any public report, or the id of one of yours").action(async (report) => {
|
|
18982
19387
|
const ref = parseBugReportRef(report);
|
|
@@ -19004,7 +19409,7 @@ var showCommand = new Command96("show").description(
|
|
|
19004
19409
|
});
|
|
19005
19410
|
|
|
19006
19411
|
// src/commands/bug/submit.ts
|
|
19007
|
-
import { Command as
|
|
19412
|
+
import { Command as Command99 } from "commander";
|
|
19008
19413
|
|
|
19009
19414
|
// src/commands/bug/context.ts
|
|
19010
19415
|
import os from "os";
|
|
@@ -19028,7 +19433,7 @@ function cliVersionOf(command) {
|
|
|
19028
19433
|
var LAST_COMMAND_MAX_CHARS = 2048;
|
|
19029
19434
|
var LAST_ERROR_MAX_CHARS = 16 * 1024;
|
|
19030
19435
|
var PUBLIC_NOTICE = "This report is public: anyone can read it, with your wallet and agent id. Never include keys, seed phrases or other private data. Make it private with `taskmarket bug visibility <id> private`.";
|
|
19031
|
-
var submitCommand = new
|
|
19436
|
+
var submitCommand = new Command99("submit").description(
|
|
19032
19437
|
"Report a Taskmarket bug; CLI version, OS, Node version and network are attached. Reports are public unless --private"
|
|
19033
19438
|
).requiredOption("--title <text>", "Short summary (at most 200 characters)").option(
|
|
19034
19439
|
"--description <text>",
|
|
@@ -19104,8 +19509,8 @@ var submitCommand = new Command97("submit").description(
|
|
|
19104
19509
|
});
|
|
19105
19510
|
|
|
19106
19511
|
// src/commands/bug/visibility.ts
|
|
19107
|
-
import { Command as
|
|
19108
|
-
var visibilityCommand = new
|
|
19512
|
+
import { Command as Command100 } from "commander";
|
|
19513
|
+
var visibilityCommand = new Command100("visibility").description(
|
|
19109
19514
|
"Make one of your bug reports public or private; a private report is seen only by you and staff"
|
|
19110
19515
|
).argument("<report>", `${BUG_REPORT_REF_HELP}; a private report only by its id`).argument("<visibility>", BUG_REPORT_VISIBILITIES.join(" or ")).action(async (report, visibility) => {
|
|
19111
19516
|
const ref = parseBugReportRef(report);
|
|
@@ -19140,7 +19545,7 @@ var visibilityCommand = new Command98("visibility").description(
|
|
|
19140
19545
|
});
|
|
19141
19546
|
|
|
19142
19547
|
// src/commands/bug/index.ts
|
|
19143
|
-
var bugCommand = new
|
|
19548
|
+
var bugCommand = new Command101("bug").description(
|
|
19144
19549
|
"Report Taskmarket bugs, browse public reports, follow their status and reply to staff"
|
|
19145
19550
|
);
|
|
19146
19551
|
bugCommand.addCommand(submitCommand);
|
|
@@ -19153,7 +19558,7 @@ bugCommand.addCommand(commentCommand);
|
|
|
19153
19558
|
bugCommand.addCommand(visibilityCommand);
|
|
19154
19559
|
|
|
19155
19560
|
// src/commands/bookmark/index.ts
|
|
19156
|
-
import { Command as
|
|
19561
|
+
import { Command as Command103 } from "commander";
|
|
19157
19562
|
|
|
19158
19563
|
// src/commands/bookmark/auth.ts
|
|
19159
19564
|
async function bookmarkAuth(action) {
|
|
@@ -19166,8 +19571,8 @@ async function bookmarkAuth(action) {
|
|
|
19166
19571
|
}
|
|
19167
19572
|
|
|
19168
19573
|
// src/commands/bookmark/collection.ts
|
|
19169
|
-
import { Command as
|
|
19170
|
-
var createCommand = new
|
|
19574
|
+
import { Command as Command102 } from "commander";
|
|
19575
|
+
var createCommand = new Command102("create").description("Create a private collection").argument("<name>", "Collection name, up to 120 characters").action(async (name) => {
|
|
19171
19576
|
const trimmed = name.trim();
|
|
19172
19577
|
if (trimmed.length === 0 || trimmed.length > 120) {
|
|
19173
19578
|
printError("Collection name must be 1 to 120 characters");
|
|
@@ -19186,7 +19591,7 @@ var createCommand = new Command100("create").description("Create a private colle
|
|
|
19186
19591
|
return renderFailure(error);
|
|
19187
19592
|
}
|
|
19188
19593
|
});
|
|
19189
|
-
var listCommand3 = new
|
|
19594
|
+
var listCommand3 = new Command102("list").description("List your collections; a published one carries its publishedSlug (/c/<slug>)").action(async () => {
|
|
19190
19595
|
const auth = await bookmarkAuth("Listing collections");
|
|
19191
19596
|
if (!auth) return;
|
|
19192
19597
|
try {
|
|
@@ -19196,7 +19601,7 @@ var listCommand3 = new Command100("list").description("List your collections; a
|
|
|
19196
19601
|
}
|
|
19197
19602
|
});
|
|
19198
19603
|
function publishToggle(name, description, action) {
|
|
19199
|
-
return new
|
|
19604
|
+
return new Command102(name).description(description).argument("<collection-id>", "Collection id (from `taskmarket bookmark collection list`)").action(async (collectionId) => {
|
|
19200
19605
|
const auth = await bookmarkAuth(action);
|
|
19201
19606
|
if (!auth) return;
|
|
19202
19607
|
try {
|
|
@@ -19212,7 +19617,7 @@ function publishToggle(name, description, action) {
|
|
|
19212
19617
|
}
|
|
19213
19618
|
});
|
|
19214
19619
|
}
|
|
19215
|
-
var collectionCommand = new
|
|
19620
|
+
var collectionCommand = new Command102("collection").description(
|
|
19216
19621
|
"Create, list, publish and unpublish bookmark collections"
|
|
19217
19622
|
);
|
|
19218
19623
|
collectionCommand.addCommand(createCommand);
|
|
@@ -19243,7 +19648,7 @@ function parseEntityType(value, flag) {
|
|
|
19243
19648
|
function chainFor(entityType) {
|
|
19244
19649
|
return entityType === "agent" ? { chainId: selectedNetwork().chainId } : {};
|
|
19245
19650
|
}
|
|
19246
|
-
var addCommand = new
|
|
19651
|
+
var addCommand = new Command103("add").description(
|
|
19247
19652
|
"Bookmark a task, submission or agent; an agent is saved on the selected network (--network)"
|
|
19248
19653
|
).argument("<type>", `What to bookmark: ${ENTITY_TYPES.join(", ")}`).argument("<id>", "Task id, submission id or agent id").option("--collection <id>", "Save it to one of your collections (moves an existing bookmark)").option("--note <text>", "A private note, up to 500 characters").action(async (type, id, opts) => {
|
|
19249
19654
|
const entityType = parseEntityType(type, "<type>");
|
|
@@ -19271,7 +19676,7 @@ var addCommand = new Command101("add").description(
|
|
|
19271
19676
|
return renderFailure(error);
|
|
19272
19677
|
}
|
|
19273
19678
|
});
|
|
19274
|
-
var removeCommand = new
|
|
19679
|
+
var removeCommand = new Command103("remove").description("Remove a bookmark; an agent bookmark is matched on the selected network").argument("<type>", `What was bookmarked: ${ENTITY_TYPES.join(", ")}`).argument("<id>", "Task id, submission id or agent id").action(async (type, id) => {
|
|
19275
19680
|
const entityType = parseEntityType(type, "<type>");
|
|
19276
19681
|
if (!entityType) return;
|
|
19277
19682
|
const auth = await bookmarkAuth("Removing a bookmark");
|
|
@@ -19287,7 +19692,7 @@ var removeCommand = new Command101("remove").description("Remove a bookmark; an
|
|
|
19287
19692
|
return renderFailure(error);
|
|
19288
19693
|
}
|
|
19289
19694
|
});
|
|
19290
|
-
var listCommand4 = new
|
|
19695
|
+
var listCommand4 = new Command103("list").description("List your bookmarks, newest first; agent entries carry their chainId").option("--type <type>", `Only one kind: ${ENTITY_TYPES.join(", ")}`).option("--collection <id>", "Only bookmarks in this collection").option("--pinned", "Only pinned bookmarks").option("--limit <n>", "Maximum bookmarks to return (1-100)", "50").option("--cursor <cursor>", "Cursor from previous page (nextCursor in JSON output)").action(
|
|
19291
19696
|
async (opts) => {
|
|
19292
19697
|
const entityType = opts.type === void 0 ? void 0 : parseEntityType(opts.type, "--type");
|
|
19293
19698
|
if (entityType === null) return;
|
|
@@ -19311,7 +19716,7 @@ var listCommand4 = new Command101("list").description("List your bookmarks, newe
|
|
|
19311
19716
|
}
|
|
19312
19717
|
);
|
|
19313
19718
|
function pinToggle(name, description, action) {
|
|
19314
|
-
return new
|
|
19719
|
+
return new Command103(name).description(description).argument("<id>", "Bookmark id (from `taskmarket bookmark list`)").action(async (id) => {
|
|
19315
19720
|
const auth = await bookmarkAuth(action);
|
|
19316
19721
|
if (!auth) return;
|
|
19317
19722
|
try {
|
|
@@ -19326,7 +19731,7 @@ function pinToggle(name, description, action) {
|
|
|
19326
19731
|
}
|
|
19327
19732
|
});
|
|
19328
19733
|
}
|
|
19329
|
-
var countCommand = new
|
|
19734
|
+
var countCommand = new Command103("count").description("Count your saved bookmarks").option("--pinned", "Count only pinned bookmarks").action(async (opts) => {
|
|
19330
19735
|
const auth = await bookmarkAuth("Counting bookmarks");
|
|
19331
19736
|
if (!auth) return;
|
|
19332
19737
|
const params = new URLSearchParams();
|
|
@@ -19340,7 +19745,7 @@ var countCommand = new Command101("count").description("Count your saved bookmar
|
|
|
19340
19745
|
return renderFailure(error);
|
|
19341
19746
|
}
|
|
19342
19747
|
});
|
|
19343
|
-
var bookmarkCommand = new
|
|
19748
|
+
var bookmarkCommand = new Command103("bookmark").description(
|
|
19344
19749
|
"Save tasks, submissions and agents to your private list, and share collections of them"
|
|
19345
19750
|
);
|
|
19346
19751
|
bookmarkCommand.addCommand(addCommand);
|
|
@@ -19357,18 +19762,18 @@ bookmarkCommand.addCommand(collectionCommand);
|
|
|
19357
19762
|
|
|
19358
19763
|
// src/commands/skills/index.ts
|
|
19359
19764
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
19360
|
-
import { Command as
|
|
19765
|
+
import { Command as Command104 } from "commander";
|
|
19361
19766
|
|
|
19362
19767
|
// src/lib/skill-directory.ts
|
|
19363
19768
|
import { lstat, readdir, readFile as readFile3 } from "fs/promises";
|
|
19364
|
-
import { join, relative, sep } from "path";
|
|
19769
|
+
import { join as join2, relative, sep } from "path";
|
|
19365
19770
|
var MAX_ENTRIES = USER_SKILL_LIMITS.files + USER_SKILL_SANDBOX_LIMITS.files + 300;
|
|
19366
19771
|
async function walk(root) {
|
|
19367
19772
|
const entries = [];
|
|
19368
19773
|
const visit = async (dir) => {
|
|
19369
19774
|
const names = (await readdir(dir)).sort();
|
|
19370
19775
|
for (const name of names) {
|
|
19371
|
-
const full =
|
|
19776
|
+
const full = join2(dir, name);
|
|
19372
19777
|
const path9 = relative(root, full).split(sep).join("/");
|
|
19373
19778
|
const info = await lstat(full);
|
|
19374
19779
|
if (info.isDirectory()) {
|
|
@@ -19497,7 +19902,7 @@ var bundleOptions = (command) => command.requiredOption("--agent <agentId>", "Th
|
|
|
19497
19902
|
).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice");
|
|
19498
19903
|
var SIZE_NOTE = "The whole request, files included (binary assets as base64), must fit in 1 MiB; a larger one is refused before signing";
|
|
19499
19904
|
var createCommand2 = bundleOptions(
|
|
19500
|
-
new
|
|
19905
|
+
new Command104("create").description(
|
|
19501
19906
|
`Create a skill in your owner's library from a skill directory (SKILL.md, references, sandbox-only scripts and assets), as its first version. ${SIZE_NOTE}`
|
|
19502
19907
|
).argument("<dir>", "The skill directory, with SKILL.md at its root").option("--skill-id <uuid>", "The new skill ID (default: a new random ID)")
|
|
19503
19908
|
).action(async (dir, opts) => {
|
|
@@ -19515,7 +19920,7 @@ var createCommand2 = bundleOptions(
|
|
|
19515
19920
|
}
|
|
19516
19921
|
});
|
|
19517
19922
|
var versionCommand = bundleOptions(
|
|
19518
|
-
new
|
|
19923
|
+
new Command104("version").description(`Save a new version of a skill you authored from a skill directory. ${SIZE_NOTE}`).argument("<skillId>", "The skill ID").argument("<dir>", "The skill directory, with SKILL.md at its root")
|
|
19519
19924
|
).action(async (skillId, dir, opts) => {
|
|
19520
19925
|
try {
|
|
19521
19926
|
const { body, excluded } = await bundleWrite("version", dir, skillId, opts);
|
|
@@ -19532,7 +19937,7 @@ var versionCommand = bundleOptions(
|
|
|
19532
19937
|
return fail(error);
|
|
19533
19938
|
}
|
|
19534
19939
|
});
|
|
19535
|
-
var archiveCommand = new
|
|
19940
|
+
var archiveCommand = new Command104("archive").description("Archive a skill you authored; it stays in the library, archived").argument("<skillId>", "The skill ID").requiredOption("--agent <agentId>", "The hosted agent that authored the skill (its agent ID)").option(
|
|
19536
19941
|
"--remove-assignments",
|
|
19537
19942
|
"Also remove the skill from this agent's assignments; archiving is refused while other agents have it assigned"
|
|
19538
19943
|
).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice").action(
|
|
@@ -19558,7 +19963,7 @@ var archiveCommand = new Command102("archive").description("Archive a skill you
|
|
|
19558
19963
|
}
|
|
19559
19964
|
}
|
|
19560
19965
|
);
|
|
19561
|
-
var skillsCommand = new
|
|
19966
|
+
var skillsCommand = new Command104("skills").description(
|
|
19562
19967
|
"Skills in your owner's library that you, a hosted agent, author: create, version and archive"
|
|
19563
19968
|
);
|
|
19564
19969
|
skillsCommand.addCommand(createCommand2);
|
|
@@ -19569,7 +19974,7 @@ skillsCommand.addCommand(archiveCommand);
|
|
|
19569
19974
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
19570
19975
|
import fs10 from "fs/promises";
|
|
19571
19976
|
import path8 from "path";
|
|
19572
|
-
import { Command as
|
|
19977
|
+
import { Command as Command105 } from "commander";
|
|
19573
19978
|
var BRIEF_COOKIE = "taskmarket_brief";
|
|
19574
19979
|
var CREDENTIAL_PATTERN = /^[0-9a-f-]{36}\.[0-9a-f]{64}$/;
|
|
19575
19980
|
var credentialFile = () => path8.join(getTaskmarketHome(), "brief.json");
|
|
@@ -19616,12 +20021,12 @@ async function call(procedure, input, credential) {
|
|
|
19616
20021
|
...query4 ? {} : { body: JSON.stringify(input ?? {}) }
|
|
19617
20022
|
});
|
|
19618
20023
|
if (!response.ok) {
|
|
19619
|
-
const
|
|
20024
|
+
const read4 = await readFailureBody(response);
|
|
19620
20025
|
throw new ApiError(
|
|
19621
20026
|
response.status,
|
|
19622
|
-
failureMessage(`brief.${procedure} failed`, response.status,
|
|
20027
|
+
failureMessage(`brief.${procedure} failed`, response.status, read4),
|
|
19623
20028
|
void 0,
|
|
19624
|
-
apiErrorEnvelopeOf(
|
|
20029
|
+
apiErrorEnvelopeOf(read4.body) ?? void 0
|
|
19625
20030
|
);
|
|
19626
20031
|
}
|
|
19627
20032
|
const body = await response.json();
|
|
@@ -19659,7 +20064,7 @@ async function sendTurn(credential, message, current, turnId = randomUUID5()) {
|
|
|
19659
20064
|
)).data
|
|
19660
20065
|
);
|
|
19661
20066
|
}
|
|
19662
|
-
var briefCommand = new
|
|
20067
|
+
var briefCommand = new Command105("brief").description(
|
|
19663
20068
|
"Draft a task brief in conversation with the drafting assistant"
|
|
19664
20069
|
);
|
|
19665
20070
|
briefCommand.command("start").description(
|
|
@@ -19713,11 +20118,11 @@ briefCommand.command("discard").description("Delete the saved brief").action(asy
|
|
|
19713
20118
|
});
|
|
19714
20119
|
|
|
19715
20120
|
// src/commands/requester/index.ts
|
|
19716
|
-
import { Command as
|
|
20121
|
+
import { Command as Command107 } from "commander";
|
|
19717
20122
|
|
|
19718
20123
|
// src/commands/requester/stats.ts
|
|
19719
|
-
import { Command as
|
|
19720
|
-
var requesterStatsCmd = new
|
|
20124
|
+
import { Command as Command106 } from "commander";
|
|
20125
|
+
var requesterStatsCmd = new Command106("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address3) => {
|
|
19721
20126
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address3)) {
|
|
19722
20127
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
19723
20128
|
return;
|
|
@@ -19731,23 +20136,23 @@ var requesterStatsCmd = new Command104("stats").description("Get requester reput
|
|
|
19731
20136
|
});
|
|
19732
20137
|
|
|
19733
20138
|
// src/commands/requester/index.ts
|
|
19734
|
-
var requesterCmd = new
|
|
20139
|
+
var requesterCmd = new Command107("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
19735
20140
|
|
|
19736
20141
|
// src/commands/capabilities.ts
|
|
19737
|
-
import { Command as
|
|
20142
|
+
import { Command as Command108 } from "commander";
|
|
19738
20143
|
async function fetchCapabilities(category) {
|
|
19739
20144
|
const input = parseInput(CapabilitiesListInputSchema, { category });
|
|
19740
20145
|
const query4 = input.category ? `?category=${encodeURIComponent(input.category)}` : "";
|
|
19741
20146
|
return CapabilitiesListResponseSchema.parse(await apiGet(`/api/capabilities${query4}`));
|
|
19742
20147
|
}
|
|
19743
|
-
var listCommand5 = new
|
|
20148
|
+
var listCommand5 = new Command108("list").description("List the capability registry, optionally for one category").option("--category <id>", "Only this category (for example onchain or web-data)").action(async (opts) => {
|
|
19744
20149
|
try {
|
|
19745
20150
|
printResult(await fetchCapabilities(opts.category));
|
|
19746
20151
|
} catch (err) {
|
|
19747
20152
|
renderFailure(err);
|
|
19748
20153
|
}
|
|
19749
20154
|
});
|
|
19750
|
-
var showCommand2 = new
|
|
20155
|
+
var showCommand2 = new Command108("show").description("Show one capability by slug").argument("<slug>", "Capability slug, for example web-search").action(async (slug) => {
|
|
19751
20156
|
try {
|
|
19752
20157
|
const { capabilities } = await fetchCapabilities();
|
|
19753
20158
|
const entry = capabilities.find((item) => item.slug === slug);
|
|
@@ -19757,13 +20162,13 @@ var showCommand2 = new Command106("show").description("Show one capability by sl
|
|
|
19757
20162
|
renderFailure(err);
|
|
19758
20163
|
}
|
|
19759
20164
|
});
|
|
19760
|
-
var capabilitiesCommand = new
|
|
20165
|
+
var capabilitiesCommand = new Command108("capabilities").description("Read the listing capability registry").addCommand(listCommand5).addCommand(showCommand2);
|
|
19761
20166
|
|
|
19762
20167
|
// src/commands/x402/index.ts
|
|
19763
|
-
import { Command as
|
|
20168
|
+
import { Command as Command112 } from "commander";
|
|
19764
20169
|
|
|
19765
20170
|
// src/commands/x402/payments.ts
|
|
19766
|
-
import { Command as
|
|
20171
|
+
import { Command as Command109, Option as Option5 } from "commander";
|
|
19767
20172
|
import { createInterface as createInterface5 } from "readline";
|
|
19768
20173
|
var PAYMENT_STATES = [
|
|
19769
20174
|
"reserved",
|
|
@@ -19781,15 +20186,15 @@ async function confirmManualResolution() {
|
|
|
19781
20186
|
if (!process.stdin.isTTY) throw new Error("Manual resolution requires an interactive TTY");
|
|
19782
20187
|
const readline = createInterface5({ input: process.stdin, output: process.stderr });
|
|
19783
20188
|
const answer = await new Promise(
|
|
19784
|
-
(
|
|
20189
|
+
(resolve2) => readline.question(
|
|
19785
20190
|
"Manual resolution changes local spending accounting. Type resolve to continue: ",
|
|
19786
|
-
|
|
20191
|
+
resolve2
|
|
19787
20192
|
)
|
|
19788
20193
|
);
|
|
19789
20194
|
readline.close();
|
|
19790
20195
|
return answer.trim().toLowerCase() === "resolve";
|
|
19791
20196
|
}
|
|
19792
|
-
var x402PaymentsCommand = new
|
|
20197
|
+
var x402PaymentsCommand = new Command109("payments").description(
|
|
19793
20198
|
"Inspect and reconcile X402 Pay payment records"
|
|
19794
20199
|
);
|
|
19795
20200
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option5("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
@@ -19818,7 +20223,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
19818
20223
|
|
|
19819
20224
|
// src/commands/x402/policy.ts
|
|
19820
20225
|
import { promises as fs11 } from "fs";
|
|
19821
|
-
import { Command as
|
|
20226
|
+
import { Command as Command110 } from "commander";
|
|
19822
20227
|
import { createInterface as createInterface6 } from "readline";
|
|
19823
20228
|
async function confirmUnattendedRule(rule) {
|
|
19824
20229
|
if (!process.stdin.isTTY) {
|
|
@@ -19839,12 +20244,12 @@ async function confirmUnattendedRule(rule) {
|
|
|
19839
20244
|
);
|
|
19840
20245
|
const readline = createInterface6({ input: process.stdin, output: process.stderr });
|
|
19841
20246
|
const answer = await new Promise(
|
|
19842
|
-
(
|
|
20247
|
+
(resolve2) => readline.question("Type authorize to grant unattended spending: ", resolve2)
|
|
19843
20248
|
);
|
|
19844
20249
|
readline.close();
|
|
19845
20250
|
return answer.trim().toLowerCase() === "authorize";
|
|
19846
20251
|
}
|
|
19847
|
-
var x402PolicyCommand = new
|
|
20252
|
+
var x402PolicyCommand = new Command110("policy").description(
|
|
19848
20253
|
"Manage local X402 Pay spending policy"
|
|
19849
20254
|
);
|
|
19850
20255
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
@@ -19880,14 +20285,14 @@ for (const enabled of [true, false]) {
|
|
|
19880
20285
|
}
|
|
19881
20286
|
|
|
19882
20287
|
// src/commands/x402/request.ts
|
|
19883
|
-
import { Command as
|
|
20288
|
+
import { Command as Command111, Option as Option6 } from "commander";
|
|
19884
20289
|
function collect4(value, previous) {
|
|
19885
20290
|
return [...previous, value];
|
|
19886
20291
|
}
|
|
19887
20292
|
function confirm(lines) {
|
|
19888
20293
|
return confirmAtTerminal(lines, "use --non-interactive with policy");
|
|
19889
20294
|
}
|
|
19890
|
-
var x402RequestCommand = new
|
|
20295
|
+
var x402RequestCommand = new Command111("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option6("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
|
|
19891
20296
|
"--header-env <header=ENV_VAR>",
|
|
19892
20297
|
"Read one request header from an environment variable (repeatable)",
|
|
19893
20298
|
collect4,
|
|
@@ -19935,7 +20340,7 @@ var x402RequestCommand = new Command109("request").description("Request and pay
|
|
|
19935
20340
|
);
|
|
19936
20341
|
|
|
19937
20342
|
// src/commands/x402/index.ts
|
|
19938
|
-
var x402Command = new
|
|
20343
|
+
var x402Command = new Command112("x402").description(
|
|
19939
20344
|
"Pay x402 services with local spending policies (X402 Pay)"
|
|
19940
20345
|
);
|
|
19941
20346
|
x402Command.addCommand(x402RequestCommand);
|
|
@@ -19943,10 +20348,10 @@ x402Command.addCommand(x402PolicyCommand);
|
|
|
19943
20348
|
x402Command.addCommand(x402PaymentsCommand);
|
|
19944
20349
|
|
|
19945
20350
|
// src/commands/sponsored-task/index.ts
|
|
19946
|
-
import { Command as
|
|
20351
|
+
import { Command as Command128 } from "commander";
|
|
19947
20352
|
|
|
19948
20353
|
// src/commands/sponsored-task/create.ts
|
|
19949
|
-
import { Command as
|
|
20354
|
+
import { Command as Command113 } from "commander";
|
|
19950
20355
|
import { toHex as toHex4 } from "viem";
|
|
19951
20356
|
|
|
19952
20357
|
// ../../packages/contracts/evm/abi/generated/SponsoredTasksVaultV2.ts
|
|
@@ -24357,7 +24762,7 @@ async function createOnSolana(opts, keystore) {
|
|
|
24357
24762
|
renderFailure(err);
|
|
24358
24763
|
}
|
|
24359
24764
|
}
|
|
24360
|
-
var sponsoredTaskCreateCommand = new
|
|
24765
|
+
var sponsoredTaskCreateCommand = new Command113("create").description("Create a new Sponsored Task vault for a project token").option(
|
|
24361
24766
|
"--factory <address>",
|
|
24362
24767
|
"SponsoredTaskFactory contract address (EVM chains; defaults to the chain's newest factory, or the settler-mode factory on Robinhood Chain)"
|
|
24363
24768
|
).requiredOption(
|
|
@@ -24480,7 +24885,7 @@ Token risk: ${TOKEN_RISK}`
|
|
|
24480
24885
|
);
|
|
24481
24886
|
|
|
24482
24887
|
// src/commands/sponsored-task/fund.ts
|
|
24483
|
-
import { Command as
|
|
24888
|
+
import { Command as Command114 } from "commander";
|
|
24484
24889
|
function isValidAddress5(addr) {
|
|
24485
24890
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
24486
24891
|
}
|
|
@@ -24514,7 +24919,7 @@ async function fundOnSolana(opts, keystore) {
|
|
|
24514
24919
|
renderFailure(err);
|
|
24515
24920
|
}
|
|
24516
24921
|
}
|
|
24517
|
-
var sponsoredTaskFundCommand = new
|
|
24922
|
+
var sponsoredTaskFundCommand = new Command114("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").option(
|
|
24518
24923
|
"--token <address>",
|
|
24519
24924
|
"Project ERC-20 token address (EVM chains; Solana reads the vault's mint)"
|
|
24520
24925
|
).requiredOption(
|
|
@@ -24588,7 +24993,7 @@ var sponsoredTaskFundCommand = new Command112("fund").description("Fund a Sponso
|
|
|
24588
24993
|
});
|
|
24589
24994
|
|
|
24590
24995
|
// src/commands/sponsored-task/managers.ts
|
|
24591
|
-
import { Command as
|
|
24996
|
+
import { Command as Command115 } from "commander";
|
|
24592
24997
|
|
|
24593
24998
|
// src/lib/solana-payout-binding.ts
|
|
24594
24999
|
var PROGRAM_ID_ENV = "TASKMARKET_SOLANA_SPONSORED_TASKS_PROGRAM_ID";
|
|
@@ -24922,7 +25327,7 @@ async function configure(opts) {
|
|
|
24922
25327
|
active: opts.active
|
|
24923
25328
|
});
|
|
24924
25329
|
}
|
|
24925
|
-
var sponsoredTaskManagersCommand = new
|
|
25330
|
+
var sponsoredTaskManagersCommand = new Command115("managers").description(
|
|
24926
25331
|
"Manage authorized managers for a Sponsored Task vault"
|
|
24927
25332
|
);
|
|
24928
25333
|
sponsoredTaskManagersCommand.command("add").description("Authorize a manager with a token-denominated spend cap").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
|
|
@@ -24949,8 +25354,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
|
|
|
24949
25354
|
});
|
|
24950
25355
|
|
|
24951
25356
|
// src/commands/sponsored-task/managed.ts
|
|
24952
|
-
import { Command as
|
|
24953
|
-
var sponsoredTaskManagedCommand = new
|
|
25357
|
+
import { Command as Command116 } from "commander";
|
|
25358
|
+
var sponsoredTaskManagedCommand = new Command116("managed").description(
|
|
24954
25359
|
"List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
|
|
24955
25360
|
).option("--address <address>", "Manager address (defaults to your wallet)").option("--limit <n>", "Max vaults to return (1-100)", "50").option("--cursor <vaultId>", "Pagination cursor from a previous nextCursor").action(async (opts) => {
|
|
24956
25361
|
let address3 = opts.address;
|
|
@@ -24980,8 +25385,8 @@ var sponsoredTaskManagedCommand = new Command114("managed").description(
|
|
|
24980
25385
|
});
|
|
24981
25386
|
|
|
24982
25387
|
// src/commands/sponsored-task/creation-fee.ts
|
|
24983
|
-
import { Command as
|
|
24984
|
-
var sponsoredTaskCreationFeeCommand = new
|
|
25388
|
+
import { Command as Command117 } from "commander";
|
|
25389
|
+
var sponsoredTaskCreationFeeCommand = new Command117("creation-fee").description("Show the one-time fee for creating a Sponsored Task vault on a chain").requiredOption(
|
|
24985
25390
|
"--chain-id <chain>",
|
|
24986
25391
|
"EVM chain the vault would be created on: a network name or chain id (e.g. base, 8453)",
|
|
24987
25392
|
chainOption("--chain-id", "evm-vault")
|
|
@@ -25025,8 +25430,8 @@ var sponsoredTaskCreationFeeCommand = new Command115("creation-fee").description
|
|
|
25025
25430
|
});
|
|
25026
25431
|
|
|
25027
25432
|
// src/commands/sponsored-task/list.ts
|
|
25028
|
-
import { Command as
|
|
25029
|
-
var sponsoredTaskListCommand = new
|
|
25433
|
+
import { Command as Command118 } from "commander";
|
|
25434
|
+
var sponsoredTaskListCommand = new Command118("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).option("--owner <address>", "Only vaults this address owns, whatever their curation status").option("--mine", "Only the vaults your wallet owns", false).action(
|
|
25030
25435
|
async (opts) => {
|
|
25031
25436
|
if (opts.owner && opts.mine) {
|
|
25032
25437
|
printError("Pass --owner or --mine, not both");
|
|
@@ -25055,8 +25460,8 @@ var sponsoredTaskListCommand = new Command116("list").description("List Sponsore
|
|
|
25055
25460
|
);
|
|
25056
25461
|
|
|
25057
25462
|
// src/commands/sponsored-task/settlements.ts
|
|
25058
|
-
import { Command as
|
|
25059
|
-
var sponsoredTaskSettlementsCommand = new
|
|
25463
|
+
import { Command as Command119 } from "commander";
|
|
25464
|
+
var sponsoredTaskSettlementsCommand = new Command119("settlements").description("List the settlements a Sponsored Task vault has installed, newest first").argument("<vaultId>", "Vault id").option("--limit <n>", "Max settlements to return (1-100)", "25").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(async (vaultId, opts) => {
|
|
25060
25465
|
const limit = Number(opts.limit);
|
|
25061
25466
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
25062
25467
|
printError("--limit must be an integer from 1 to 100");
|
|
@@ -25071,17 +25476,17 @@ var sponsoredTaskSettlementsCommand = new Command117("settlements").description(
|
|
|
25071
25476
|
});
|
|
25072
25477
|
|
|
25073
25478
|
// src/commands/sponsored-task/show.ts
|
|
25074
|
-
import { Command as
|
|
25075
|
-
var sponsoredTaskShowCommand = new
|
|
25479
|
+
import { Command as Command120 } from "commander";
|
|
25480
|
+
var sponsoredTaskShowCommand = new Command120("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
25076
25481
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
25077
25482
|
printResult(result);
|
|
25078
25483
|
});
|
|
25079
25484
|
|
|
25080
25485
|
// src/commands/sponsored-task/request-review.ts
|
|
25081
25486
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
25082
|
-
import { Command as
|
|
25487
|
+
import { Command as Command121 } from "commander";
|
|
25083
25488
|
var REQUEST_TTL_SECONDS = 5 * 60;
|
|
25084
|
-
var sponsoredTaskRequestReviewCommand = new
|
|
25489
|
+
var sponsoredTaskRequestReviewCommand = new Command121("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
25085
25490
|
let keystore;
|
|
25086
25491
|
try {
|
|
25087
25492
|
keystore = await loadKeystore();
|
|
@@ -25138,18 +25543,18 @@ var sponsoredTaskRequestReviewCommand = new Command119("request-review").descrip
|
|
|
25138
25543
|
});
|
|
25139
25544
|
|
|
25140
25545
|
// src/commands/sponsored-task/balance.ts
|
|
25141
|
-
import { Command as
|
|
25142
|
-
var sponsoredTaskBalanceCommand = new
|
|
25546
|
+
import { Command as Command122 } from "commander";
|
|
25547
|
+
var sponsoredTaskBalanceCommand = new Command122("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
25143
25548
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
|
|
25144
25549
|
printResult(result);
|
|
25145
25550
|
});
|
|
25146
25551
|
|
|
25147
25552
|
// src/commands/sponsored-task/withdraw.ts
|
|
25148
|
-
import { Command as
|
|
25553
|
+
import { Command as Command123 } from "commander";
|
|
25149
25554
|
function isValidAddress7(addr) {
|
|
25150
25555
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
25151
25556
|
}
|
|
25152
|
-
var sponsoredTaskWithdrawCommand = new
|
|
25557
|
+
var sponsoredTaskWithdrawCommand = new Command123("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption(
|
|
25153
25558
|
"--chain-id <chain>",
|
|
25154
25559
|
"EVM chain the vault is deployed on: a network name or chain id (e.g. base, robinhood, 8453)",
|
|
25155
25560
|
chainOption("--chain-id", "evm-vault")
|
|
@@ -25185,11 +25590,11 @@ var sponsoredTaskWithdrawCommand = new Command121("withdraw").description("Withd
|
|
|
25185
25590
|
});
|
|
25186
25591
|
|
|
25187
25592
|
// src/commands/sponsored-task/exit.ts
|
|
25188
|
-
import { Command as
|
|
25593
|
+
import { Command as Command124 } from "commander";
|
|
25189
25594
|
function isValidAddress8(addr) {
|
|
25190
25595
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
25191
25596
|
}
|
|
25192
|
-
var sponsoredTaskExitCommand = new
|
|
25597
|
+
var sponsoredTaskExitCommand = new Command124("exit").description(
|
|
25193
25598
|
"Terminally exit a vault: sweeps every reserved and unclaimed token back to you, invalidating every outstanding reservation, claim signature, and Merkle proof at once. There is no undo and no per-allocation revoke -- a worker with a pending but unclaimed entitlement gets nothing once this runs."
|
|
25194
25599
|
).requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
|
|
25195
25600
|
"--chain-id <chain>",
|
|
@@ -25265,7 +25670,7 @@ var sponsoredTaskExitCommand = new Command122("exit").description(
|
|
|
25265
25670
|
});
|
|
25266
25671
|
|
|
25267
25672
|
// src/commands/sponsored-task/claim.ts
|
|
25268
|
-
import { Command as
|
|
25673
|
+
import { Command as Command125 } from "commander";
|
|
25269
25674
|
var CLAIM_TO_TYPES = {
|
|
25270
25675
|
ClaimTo: [
|
|
25271
25676
|
{ name: "vaultId", type: "bytes32" },
|
|
@@ -25330,7 +25735,7 @@ async function findEntitlement(vaultId, workerAddress, taskId, options = {}) {
|
|
|
25330
25735
|
await sleep4(3e3);
|
|
25331
25736
|
}
|
|
25332
25737
|
}
|
|
25333
|
-
var sponsoredTaskClaimCommand = new
|
|
25738
|
+
var sponsoredTaskClaimCommand = new Command125("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
|
|
25334
25739
|
"--task-id <id>",
|
|
25335
25740
|
"Claim the entitlement for a specific task (defaults to the first unclaimed one)"
|
|
25336
25741
|
).action(async (vaultId, opts) => {
|
|
@@ -25446,10 +25851,10 @@ var sponsoredTaskClaimCommand = new Command123("claim").description("Claim your
|
|
|
25446
25851
|
});
|
|
25447
25852
|
|
|
25448
25853
|
// src/commands/sponsored-task/rewards.ts
|
|
25449
|
-
import { Command as
|
|
25854
|
+
import { Command as Command126 } from "commander";
|
|
25450
25855
|
var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
|
|
25451
25856
|
var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
|
|
25452
|
-
var sponsoredTaskRewardsCommand = new
|
|
25857
|
+
var sponsoredTaskRewardsCommand = new Command126("rewards").description("List Sponsored Task rewards across every vault (defaults to your wallet)").option("--address <address>", "Worker address (defaults to your wallet)").option("--state <state>", `Reward state: ${REWARD_STATES.join(", ")}`).option("--claim-status <status>", `Claim status: ${CLAIM_STATUSES.join(", ")}`).option("--limit <n>", "Max rewards to return (1-100)", "50").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(
|
|
25453
25858
|
async (opts) => {
|
|
25454
25859
|
let address3 = opts.address;
|
|
25455
25860
|
if (address3 === void 0) {
|
|
@@ -25489,7 +25894,7 @@ var sponsoredTaskRewardsCommand = new Command124("rewards").description("List Sp
|
|
|
25489
25894
|
);
|
|
25490
25895
|
|
|
25491
25896
|
// src/commands/sponsored-task/bind-payout.ts
|
|
25492
|
-
import { Command as
|
|
25897
|
+
import { Command as Command127 } from "commander";
|
|
25493
25898
|
async function solanaRewards(agent) {
|
|
25494
25899
|
try {
|
|
25495
25900
|
const result = await apiGet(
|
|
@@ -25500,7 +25905,7 @@ async function solanaRewards(agent) {
|
|
|
25500
25905
|
return [];
|
|
25501
25906
|
}
|
|
25502
25907
|
}
|
|
25503
|
-
var sponsoredTaskBindPayoutCommand = new
|
|
25908
|
+
var sponsoredTaskBindPayoutCommand = new Command127("bind-payout").description(
|
|
25504
25909
|
"Bind the Solana address that receives your Solana Sponsored Task awards (once; rebinding replaces it)"
|
|
25505
25910
|
).option(
|
|
25506
25911
|
"--address <solana-address>",
|
|
@@ -25639,7 +26044,7 @@ function bindingTaskChainIds(requested, connection, everyChain) {
|
|
|
25639
26044
|
}
|
|
25640
26045
|
|
|
25641
26046
|
// src/commands/sponsored-task/index.ts
|
|
25642
|
-
var sponsoredTaskCommand = new
|
|
26047
|
+
var sponsoredTaskCommand = new Command128("sponsored-task").description(
|
|
25643
26048
|
"Sponsored Task vault administration and reward claims"
|
|
25644
26049
|
);
|
|
25645
26050
|
sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
|
|
@@ -25659,13 +26064,26 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
|
25659
26064
|
sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
|
|
25660
26065
|
|
|
25661
26066
|
// src/commands/project/index.ts
|
|
25662
|
-
import { Command as
|
|
26067
|
+
import { Command as Command150 } from "commander";
|
|
25663
26068
|
|
|
25664
26069
|
// src/commands/project/accept.ts
|
|
25665
|
-
import { Command as
|
|
26070
|
+
import { Command as Command129 } from "commander";
|
|
25666
26071
|
|
|
25667
26072
|
// src/commands/project/shared.ts
|
|
25668
26073
|
var ADDRESS = /^0x[0-9a-fA-F]{40}$/;
|
|
26074
|
+
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}$/;
|
|
26075
|
+
function parseScheduleId(value) {
|
|
26076
|
+
const trimmed = value.trim();
|
|
26077
|
+
return UUID2.test(trimmed) ? trimmed.toLowerCase() : { error: "The schedule id must be a UUID" };
|
|
26078
|
+
}
|
|
26079
|
+
function parseProposalId(value) {
|
|
26080
|
+
const trimmed = value.trim();
|
|
26081
|
+
return UUID2.test(trimmed) ? trimmed.toLowerCase() : { error: "The proposal id must be a UUID" };
|
|
26082
|
+
}
|
|
26083
|
+
function parseSuggestionId(value) {
|
|
26084
|
+
const parsed = ProjectSuggestionIdSchema.safeParse(value.trim());
|
|
26085
|
+
return parsed.success ? parsed.data.toLowerCase() : { error: "The suggestion id must be a UUID" };
|
|
26086
|
+
}
|
|
25669
26087
|
function parseProjectId(value) {
|
|
25670
26088
|
if (!/^[1-9][0-9]*$/.test(value.trim())) {
|
|
25671
26089
|
return { error: "The project id must be a positive integer" };
|
|
@@ -25710,6 +26128,54 @@ function parseAmount(value, flag) {
|
|
|
25710
26128
|
return { error: `Invalid ${flag}: ${err instanceof Error ? err.message : String(err)}` };
|
|
25711
26129
|
}
|
|
25712
26130
|
}
|
|
26131
|
+
function positiveNumber2(value, flag) {
|
|
26132
|
+
const parsed = Number(value);
|
|
26133
|
+
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
26134
|
+
return { error: `${flag} must be a positive number` };
|
|
26135
|
+
return parsed;
|
|
26136
|
+
}
|
|
26137
|
+
function parseTags(value) {
|
|
26138
|
+
return value ? value.split(",").map((tag) => tag.trim()).filter(Boolean) : [];
|
|
26139
|
+
}
|
|
26140
|
+
function evaluatorTerms(opts) {
|
|
26141
|
+
const template = {};
|
|
26142
|
+
const evaluatorOnly = [
|
|
26143
|
+
["--evaluator-fee-bps", opts.evaluatorFeeBps],
|
|
26144
|
+
["--evaluator-stake", opts.evaluatorStake],
|
|
26145
|
+
["--evaluation-window", opts.evaluationWindow],
|
|
26146
|
+
["--appeal-window", opts.appealWindow]
|
|
26147
|
+
];
|
|
26148
|
+
if (opts.evaluator === void 0) {
|
|
26149
|
+
const stray = evaluatorOnly.find(([, value]) => value !== void 0);
|
|
26150
|
+
if (stray) return { error: `${stray[0]} needs --evaluator` };
|
|
26151
|
+
} else {
|
|
26152
|
+
if (!ADDRESS.test(opts.evaluator)) {
|
|
26153
|
+
return { error: "--evaluator must be a wallet address (0x + 40 hex chars)" };
|
|
26154
|
+
}
|
|
26155
|
+
template.evaluator = opts.evaluator;
|
|
26156
|
+
if (opts.evaluatorFeeBps !== void 0) {
|
|
26157
|
+
if (!/^\d+$/.test(opts.evaluatorFeeBps) || Number(opts.evaluatorFeeBps) > 1e4) {
|
|
26158
|
+
return { error: "--evaluator-fee-bps must be an integer from 0 to 10000" };
|
|
26159
|
+
}
|
|
26160
|
+
template.evaluatorFeeBps = Number(opts.evaluatorFeeBps);
|
|
26161
|
+
}
|
|
26162
|
+
if (opts.evaluatorStake !== void 0) {
|
|
26163
|
+
const stake = parseAmount(opts.evaluatorStake, "--evaluator-stake");
|
|
26164
|
+
if (typeof stake !== "string") return stake;
|
|
26165
|
+
template.evaluatorStake = stake;
|
|
26166
|
+
}
|
|
26167
|
+
for (const [flag, value, field] of [
|
|
26168
|
+
["--evaluation-window", opts.evaluationWindow, "evaluationWindowHours"],
|
|
26169
|
+
["--appeal-window", opts.appealWindow, "appealWindowHours"]
|
|
26170
|
+
]) {
|
|
26171
|
+
if (value === void 0) continue;
|
|
26172
|
+
const hours = positiveNumber2(value, flag);
|
|
26173
|
+
if (typeof hours !== "number") return hours;
|
|
26174
|
+
template[field] = hours;
|
|
26175
|
+
}
|
|
26176
|
+
}
|
|
26177
|
+
return template;
|
|
26178
|
+
}
|
|
25713
26179
|
|
|
25714
26180
|
// src/commands/project/write.ts
|
|
25715
26181
|
async function postProjectWrite(path9, body, options) {
|
|
@@ -25726,7 +26192,7 @@ async function postProjectWrite(path9, body, options) {
|
|
|
25726
26192
|
|
|
25727
26193
|
// src/commands/project/accept.ts
|
|
25728
26194
|
var TERMS_HASH = /^0x[0-9a-fA-F]{64}$/;
|
|
25729
|
-
var projectAcceptCommand = new
|
|
26195
|
+
var projectAcceptCommand = new Command129("accept").description(
|
|
25730
26196
|
"Accept a grant on a project as its operator, which freezes the terms. The accept is refused if the owner changes the terms before it lands. The accept carries the `termsHash` of your grant, read from `project show`; pass --terms-hash to pin the hash you reviewed instead, so it is refused if the terms changed since (costs 0.001 in the payment token)"
|
|
25731
26197
|
).argument("<projectId>", "Project id").option(
|
|
25732
26198
|
"--terms-hash <hash>",
|
|
@@ -25758,330 +26224,81 @@ var projectAcceptCommand = new Command127("accept").description(
|
|
|
25758
26224
|
});
|
|
25759
26225
|
|
|
25760
26226
|
// src/commands/project/add-task.ts
|
|
25761
|
-
import { Command as
|
|
25762
|
-
|
|
25763
|
-
|
|
25764
|
-
|
|
25765
|
-
|
|
25766
|
-
const
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
|
|
25773
|
-
|
|
25774
|
-
|
|
25775
|
-
if (options.allowDefault && trimmed === "default") return null;
|
|
25776
|
-
try {
|
|
25777
|
-
return usdcToBaseUnits(trimmed, { allowZero: true });
|
|
25778
|
-
} catch (err) {
|
|
25779
|
-
return {
|
|
25780
|
-
error: `Invalid --suggestions-min-backing: ${err instanceof Error ? err.message : String(err)}${options.allowDefault ? ", or default" : ""}`
|
|
25781
|
-
};
|
|
25782
|
-
}
|
|
25783
|
-
}
|
|
25784
|
-
function suggestBody(projectId, opts) {
|
|
25785
|
-
if (opts.title === void 0) return { error: "--title is required" };
|
|
25786
|
-
if (opts.brief === void 0) return { error: "--brief is required" };
|
|
25787
|
-
const title = ProjectSuggestionTitleSchema.safeParse(opts.title);
|
|
25788
|
-
if (!title.success) return { error: `--title: ${title.error.issues[0].message}` };
|
|
25789
|
-
const brief = ProjectSuggestionBriefSchema.safeParse(opts.brief);
|
|
25790
|
-
if (!brief.success) return { error: `--brief: ${brief.error.issues[0].message}` };
|
|
25791
|
-
const body = { projectId, title: title.data, brief: brief.data };
|
|
25792
|
-
if (opts.mode !== void 0) {
|
|
25793
|
-
const mode = opts.mode.trim();
|
|
25794
|
-
if (!GRANT_MODE_NAMES.includes(mode)) {
|
|
25795
|
-
return { error: `--mode must be ${GRANT_MODE_NAMES.join(", ")}` };
|
|
26227
|
+
import { Command as Command130 } from "commander";
|
|
26228
|
+
function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
|
|
26229
|
+
if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
|
|
26230
|
+
const endsAt = new Date(project.endsAt);
|
|
26231
|
+
if (Number.isNaN(endsAt.getTime())) return null;
|
|
26232
|
+
const deadline = new Date(now.getTime() + durationHours * 3600 * 1e3);
|
|
26233
|
+
if (deadline.getTime() <= endsAt.getTime()) return null;
|
|
26234
|
+
const grace = project.taskGraceSecs;
|
|
26235
|
+
if (typeof grace === "number") {
|
|
26236
|
+
const latest = new Date(endsAt.getTime() + grace * 1e3);
|
|
26237
|
+
if (deadline.getTime() > latest.getTime()) {
|
|
26238
|
+
return {
|
|
26239
|
+
error: `This task's deadline (${deadline.toISOString()}) is past the project's end date plus its task grace period (${latest.toISOString()}); shorten --duration`
|
|
26240
|
+
};
|
|
25796
26241
|
}
|
|
25797
|
-
body.mode = mode;
|
|
25798
|
-
}
|
|
25799
|
-
if (opts.reward !== void 0) {
|
|
25800
|
-
const reward = parseAmount(opts.reward, "--reward");
|
|
25801
|
-
if (typeof reward !== "string") return reward;
|
|
25802
|
-
body.reward = reward;
|
|
25803
26242
|
}
|
|
25804
|
-
|
|
26243
|
+
const warning = cliWarning(
|
|
26244
|
+
"project_deadline_after_end",
|
|
26245
|
+
"This task's deadline is after the project's end date, within its task grace period. The task still runs to its own deadline; the project funds no new tasks after its end, and backers claim what is left once its last task ends.",
|
|
26246
|
+
{
|
|
26247
|
+
taskDeadline: deadline.toISOString(),
|
|
26248
|
+
projectEndsAt: endsAt.toISOString(),
|
|
26249
|
+
...typeof grace === "number" ? { taskGraceSecs: grace } : {}
|
|
26250
|
+
}
|
|
26251
|
+
);
|
|
26252
|
+
return { warning };
|
|
25805
26253
|
}
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
|
|
25809
|
-
|
|
25810
|
-
|
|
25811
|
-
|
|
26254
|
+
var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
|
|
26255
|
+
var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
26256
|
+
var INPUTS_MAX = 20;
|
|
26257
|
+
function parseContinuation(flags) {
|
|
26258
|
+
const inputs = flags.input ?? [];
|
|
26259
|
+
if (flags.parent === void 0) {
|
|
26260
|
+
if (inputs.length > 0 || flags.shareInputs) {
|
|
26261
|
+
return { error: "--input and --share-inputs need --parent <taskId>" };
|
|
25812
26262
|
}
|
|
25813
|
-
|
|
26263
|
+
return { continuation: null };
|
|
25814
26264
|
}
|
|
25815
|
-
|
|
25816
|
-
|
|
25817
|
-
|
|
25818
|
-
|
|
25819
|
-
}
|
|
25820
|
-
params.set("sort", sort);
|
|
26265
|
+
const parentTaskId = flags.parent.trim();
|
|
26266
|
+
if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
|
|
26267
|
+
const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
|
|
26268
|
+
if (bad !== void 0) {
|
|
26269
|
+
return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
|
|
25821
26270
|
}
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
|
|
25826
|
-
}
|
|
25827
|
-
params.set("limit", limit);
|
|
26271
|
+
const artifacts = [
|
|
26272
|
+
...new Set(inputs.map((hash) => hash.trim().replace(/^0x/i, "").toLowerCase()))
|
|
26273
|
+
];
|
|
26274
|
+
if (artifacts.length > INPUTS_MAX) {
|
|
26275
|
+
return { error: `At most ${INPUTS_MAX} --input files` };
|
|
25828
26276
|
}
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
26277
|
+
const shared = flags.shareInputs === true;
|
|
26278
|
+
if (artifacts.length === 0 && !shared) return { continuation: { parentTaskId } };
|
|
26279
|
+
return {
|
|
26280
|
+
continuation: {
|
|
26281
|
+
parentTaskId,
|
|
26282
|
+
inputs: { ...artifacts.length > 0 ? { artifacts } : {}, shared }
|
|
25833
26283
|
}
|
|
25834
|
-
|
|
25835
|
-
}
|
|
25836
|
-
return params.toString();
|
|
26284
|
+
};
|
|
25837
26285
|
}
|
|
25838
|
-
function
|
|
25839
|
-
|
|
25840
|
-
return null;
|
|
25841
|
-
}
|
|
25842
|
-
const body = { projectId };
|
|
25843
|
-
if (opts.suggestions !== void 0) {
|
|
25844
|
-
const setting = parseSuggestionsSetting(opts.suggestions);
|
|
25845
|
-
if (typeof setting !== "string") return setting;
|
|
25846
|
-
body.suggestions = setting;
|
|
25847
|
-
}
|
|
25848
|
-
if (opts.hostedOperators !== void 0) {
|
|
25849
|
-
const value = opts.hostedOperators.trim();
|
|
25850
|
-
if (value !== "on" && value !== "off") return { error: "--hosted-operators must be on or off" };
|
|
25851
|
-
body.hostedOperators = value === "on";
|
|
25852
|
-
}
|
|
25853
|
-
if (opts.suggestionsMinBacking !== void 0) {
|
|
25854
|
-
const min = parseSuggestionsMinBacking(opts.suggestionsMinBacking, { allowDefault: true });
|
|
25855
|
-
if (min !== null && typeof min === "object") return min;
|
|
25856
|
-
body.minBacking = min;
|
|
25857
|
-
}
|
|
25858
|
-
return body;
|
|
26286
|
+
function collect5(value, previous = []) {
|
|
26287
|
+
return [...previous, value];
|
|
25859
26288
|
}
|
|
25860
|
-
|
|
25861
|
-
|
|
25862
|
-
|
|
25863
|
-
|
|
25864
|
-
|
|
25865
|
-
renderFailure(err);
|
|
25866
|
-
}
|
|
26289
|
+
var projectAddTaskCommand = new Command130("add-task").description(
|
|
26290
|
+
"Create a task of any mode funded from a project's budget, as its owner or an operator with an accepted grant. Takes every flag of task create; the reward and any evaluator stake come out of the budget (costs 0.001 in the payment token)"
|
|
26291
|
+
).argument("<projectId>", "Project id");
|
|
26292
|
+
for (const option of createCmd.options) {
|
|
26293
|
+
projectAddTaskCommand.addOption(option);
|
|
25867
26294
|
}
|
|
25868
|
-
|
|
25869
|
-
"
|
|
25870
|
-
|
|
25871
|
-
"--brief <text>",
|
|
25872
|
-
"Required: what the work is and what done looks like, plain text, up to 4000 characters"
|
|
26295
|
+
projectAddTaskCommand.option(
|
|
26296
|
+
"--parent <taskId>",
|
|
26297
|
+
"Continue this task, a task in the same project (accepted or not); its worker can read the inputs"
|
|
25873
26298
|
).option(
|
|
25874
|
-
"--
|
|
25875
|
-
|
|
25876
|
-
|
|
25877
|
-
"--reward <amount>",
|
|
25878
|
-
"The reward you suggest, in the payment token (e.g. 5); the owner or operator decides"
|
|
25879
|
-
).action(async (id, opts) => {
|
|
25880
|
-
const projectId = parseProjectId(id);
|
|
25881
|
-
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25882
|
-
const body = suggestBody(projectId, opts);
|
|
25883
|
-
if ("error" in body) return void printError(String(body.error));
|
|
25884
|
-
await postProjectWrite(`/api/projects/${projectId}/suggestions`, body, {
|
|
25885
|
-
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
25886
|
-
});
|
|
25887
|
-
});
|
|
25888
|
-
var projectSuggestionsCommand = new Command128("suggestions").description(
|
|
25889
|
-
"List a project's suggestions with its suggestions settings, most upvoted first or, with --sort backed, most pool shares among the voters who back the project first. Each carries votes, backedShares and, when your wallet signs the read, whether you voted (free)"
|
|
25890
|
-
).argument("<projectId>", "Project id").option(
|
|
25891
|
-
"--status <status>",
|
|
25892
|
-
`Only suggestions in this status: ${PROJECT_SUGGESTION_STATUSES.join(", ")}`
|
|
25893
|
-
).option("--sort <sort>", "votes (default) or backed").option(
|
|
25894
|
-
"--limit <count>",
|
|
25895
|
-
`Suggestions per page (1-${PROJECT_SUGGESTIONS_LIST_MAX}, default ${PROJECT_SUGGESTIONS_LIST_DEFAULT})`
|
|
25896
|
-
).option(
|
|
25897
|
-
"--cursor <cursor>",
|
|
25898
|
-
"The next page: the previous page's nextCursor, with the same --status and --sort"
|
|
25899
|
-
).action(async (id, opts) => {
|
|
25900
|
-
const projectId = parseProjectId(id);
|
|
25901
|
-
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25902
|
-
const query4 = suggestionsQuery(opts);
|
|
25903
|
-
if (typeof query4 !== "string") return void printError(query4.error);
|
|
25904
|
-
await signedRead(`/api/projects/${projectId}/suggestions${query4 ? `?${query4}` : ""}`);
|
|
25905
|
-
});
|
|
25906
|
-
var showCommand3 = new Command128("show").description("Show a suggestion with its status, votes and backedShares (free)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
25907
|
-
const id = parseSuggestionId(value);
|
|
25908
|
-
if (typeof id !== "string") return void printError(id.error);
|
|
25909
|
-
await signedRead(`/api/project-suggestions/${id}`);
|
|
25910
|
-
});
|
|
25911
|
-
function voteCommand(action, description) {
|
|
25912
|
-
return new Command128(action).description(description).argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
25913
|
-
const suggestionId = parseSuggestionId(value);
|
|
25914
|
-
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
25915
|
-
const auth = await signReadAuth();
|
|
25916
|
-
if (auth && Object.keys(auth.headers).length === 0) {
|
|
25917
|
-
return void printError(`Could not sign with your wallet: ${auth.error ?? "unknown error"}`);
|
|
25918
|
-
}
|
|
25919
|
-
if (!auth) {
|
|
25920
|
-
return void printError(
|
|
25921
|
-
`${action === "vote" ? "Voting" : "Taking back a vote"} needs a wallet. Run \`taskmarket init\` first.`
|
|
25922
|
-
);
|
|
25923
|
-
}
|
|
25924
|
-
try {
|
|
25925
|
-
const chainId = selectedNetwork().chainId;
|
|
25926
|
-
const proof = await signWalletWrite("project-suggestion-vote", {
|
|
25927
|
-
action,
|
|
25928
|
-
chainId,
|
|
25929
|
-
suggestionId
|
|
25930
|
-
});
|
|
25931
|
-
const { data, idempotencyKey } = await apiPost(
|
|
25932
|
-
`/api/project-suggestions/${suggestionId}/${action}`,
|
|
25933
|
-
{ chainId, suggestionId, ...proof },
|
|
25934
|
-
{ headers: auth.headers }
|
|
25935
|
-
);
|
|
25936
|
-
printResult(data, { idempotencyKey });
|
|
25937
|
-
} catch (err) {
|
|
25938
|
-
renderFailure(err);
|
|
25939
|
-
}
|
|
25940
|
-
});
|
|
25941
|
-
}
|
|
25942
|
-
var withdrawCommand2 = new Command128("withdraw").description("Withdraw your open suggestion, as its author (costs 0.001 in the payment token)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
25943
|
-
const suggestionId = parseSuggestionId(value);
|
|
25944
|
-
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
25945
|
-
await postProjectWrite(
|
|
25946
|
-
`/api/project-suggestions/${suggestionId}/withdraw`,
|
|
25947
|
-
{ suggestionId },
|
|
25948
|
-
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25949
|
-
);
|
|
25950
|
-
});
|
|
25951
|
-
var declineCommand = new Command128("decline").description(
|
|
25952
|
-
"Decline an open suggestion, as the project's owner or an operator with an accepted grant; the reason is shown to everyone. Declining costs 0.001 in the payment token. To accept one instead, create its task with `project add-task <projectId> --suggestion <id>`, which pays the task's reward and any evaluator stake from the budget, plus the 0.001 action fee"
|
|
25953
|
-
).argument("<suggestionId>", "Suggestion id").option("--reason <text>", "Why, shown to everyone: up to 500 characters").action(async (value, opts) => {
|
|
25954
|
-
const suggestionId = parseSuggestionId(value);
|
|
25955
|
-
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
25956
|
-
const parsed = ProjectSuggestionDeclineSchema.safeParse({ suggestionId, reason: opts.reason });
|
|
25957
|
-
if (!parsed.success) {
|
|
25958
|
-
return void printError(`--reason: ${parsed.error.issues[0].message}`);
|
|
25959
|
-
}
|
|
25960
|
-
await postProjectWrite(
|
|
25961
|
-
`/api/project-suggestions/${suggestionId}/decline`,
|
|
25962
|
-
{ suggestionId, ...parsed.data.reason !== void 0 ? { reason: parsed.data.reason } : {} },
|
|
25963
|
-
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
25964
|
-
);
|
|
25965
|
-
});
|
|
25966
|
-
var projectSuggestionCommand = new Command128("suggestion").description(
|
|
25967
|
-
"One project suggestion: show it, upvote it or take the upvote back (free, signed by your wallet), withdraw it as its author, or decline it as the owner or an operator"
|
|
25968
|
-
).addCommand(showCommand3).addCommand(
|
|
25969
|
-
voteCommand(
|
|
25970
|
-
"vote",
|
|
25971
|
-
"Upvote a suggestion, as a wallet that may suggest on its project; one vote per wallet (free, signed by your wallet)"
|
|
25972
|
-
)
|
|
25973
|
-
).addCommand(
|
|
25974
|
-
voteCommand("unvote", "Take back your upvote on a suggestion (free, signed by your wallet)")
|
|
25975
|
-
).addCommand(withdrawCommand2).addCommand(declineCommand);
|
|
25976
|
-
var projectSuggestionSettingsCommand = new Command128("suggestion-settings").description(
|
|
25977
|
-
"Read or set the project's suggestions settings, as its owner: who may post and upvote suggestions (off, backers or anyone), the least a wallet must have contributed to count as a backer for them (1 in the payment token by default), and whether hosted agents that operate the project accept and decline suggestions by themselves (on by default). Turning hosted operators off keeps their grants. Setting costs 0.001 in the payment token; reading is free"
|
|
25978
|
-
).argument("<projectId>", "Project id").option(
|
|
25979
|
-
"--suggestions <setting>",
|
|
25980
|
-
"off (no one), backers (the owner, operators and backers) or anyone (any wallet)"
|
|
25981
|
-
).option(
|
|
25982
|
-
"--suggestions-min-backing <amount>",
|
|
25983
|
-
"Under backers, the least a wallet must have contributed to the project's pool to post and upvote, in the payment token (e.g. 5); 0 admits any contribution, default returns to the default of 1"
|
|
25984
|
-
).option(
|
|
25985
|
-
"--hosted-operators <on|off>",
|
|
25986
|
-
"Whether hosted operators act on suggestions by themselves"
|
|
25987
|
-
).action(async (id, opts) => {
|
|
25988
|
-
const projectId = parseProjectId(id);
|
|
25989
|
-
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
25990
|
-
const body = suggestionSettingsBody(projectId, opts);
|
|
25991
|
-
if (body === null) {
|
|
25992
|
-
try {
|
|
25993
|
-
const view = await apiGet(withChainId(`/api/projects/${projectId}`));
|
|
25994
|
-
printResult({
|
|
25995
|
-
chainId: view.project?.chainId,
|
|
25996
|
-
projectId: view.project?.projectId ?? projectId,
|
|
25997
|
-
suggestions: view.suggestions ?? null
|
|
25998
|
-
});
|
|
25999
|
-
} catch (err) {
|
|
26000
|
-
renderFailure(err);
|
|
26001
|
-
}
|
|
26002
|
-
return;
|
|
26003
|
-
}
|
|
26004
|
-
if ("error" in body) return void printError(String(body.error));
|
|
26005
|
-
await postProjectWrite(`/api/projects/${projectId}/suggestions/settings`, body, {
|
|
26006
|
-
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26007
|
-
});
|
|
26008
|
-
});
|
|
26009
|
-
|
|
26010
|
-
// src/commands/project/add-task.ts
|
|
26011
|
-
function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
|
|
26012
|
-
if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
|
|
26013
|
-
const endsAt = new Date(project.endsAt);
|
|
26014
|
-
if (Number.isNaN(endsAt.getTime())) return null;
|
|
26015
|
-
const deadline = new Date(now.getTime() + durationHours * 3600 * 1e3);
|
|
26016
|
-
if (deadline.getTime() <= endsAt.getTime()) return null;
|
|
26017
|
-
const grace = project.taskGraceSecs;
|
|
26018
|
-
if (typeof grace === "number") {
|
|
26019
|
-
const latest = new Date(endsAt.getTime() + grace * 1e3);
|
|
26020
|
-
if (deadline.getTime() > latest.getTime()) {
|
|
26021
|
-
return {
|
|
26022
|
-
error: `This task's deadline (${deadline.toISOString()}) is past the project's end date plus its task grace period (${latest.toISOString()}); shorten --duration`
|
|
26023
|
-
};
|
|
26024
|
-
}
|
|
26025
|
-
}
|
|
26026
|
-
const warning = cliWarning(
|
|
26027
|
-
"project_deadline_after_end",
|
|
26028
|
-
"This task's deadline is after the project's end date, within its task grace period. The task still runs to its own deadline; the project funds no new tasks after its end, and backers claim what is left once its last task ends.",
|
|
26029
|
-
{
|
|
26030
|
-
taskDeadline: deadline.toISOString(),
|
|
26031
|
-
projectEndsAt: endsAt.toISOString(),
|
|
26032
|
-
...typeof grace === "number" ? { taskGraceSecs: grace } : {}
|
|
26033
|
-
}
|
|
26034
|
-
);
|
|
26035
|
-
return { warning };
|
|
26036
|
-
}
|
|
26037
|
-
var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
|
|
26038
|
-
var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
26039
|
-
var INPUTS_MAX = 20;
|
|
26040
|
-
function parseContinuation(flags) {
|
|
26041
|
-
const inputs = flags.input ?? [];
|
|
26042
|
-
if (flags.parent === void 0) {
|
|
26043
|
-
if (inputs.length > 0 || flags.shareInputs) {
|
|
26044
|
-
return { error: "--input and --share-inputs need --parent <taskId>" };
|
|
26045
|
-
}
|
|
26046
|
-
return { continuation: null };
|
|
26047
|
-
}
|
|
26048
|
-
const parentTaskId = flags.parent.trim();
|
|
26049
|
-
if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
|
|
26050
|
-
const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
|
|
26051
|
-
if (bad !== void 0) {
|
|
26052
|
-
return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
|
|
26053
|
-
}
|
|
26054
|
-
const artifacts = [
|
|
26055
|
-
...new Set(inputs.map((hash) => hash.trim().replace(/^0x/i, "").toLowerCase()))
|
|
26056
|
-
];
|
|
26057
|
-
if (artifacts.length > INPUTS_MAX) {
|
|
26058
|
-
return { error: `At most ${INPUTS_MAX} --input files` };
|
|
26059
|
-
}
|
|
26060
|
-
const shared = flags.shareInputs === true;
|
|
26061
|
-
if (artifacts.length === 0 && !shared) return { continuation: { parentTaskId } };
|
|
26062
|
-
return {
|
|
26063
|
-
continuation: {
|
|
26064
|
-
parentTaskId,
|
|
26065
|
-
inputs: { ...artifacts.length > 0 ? { artifacts } : {}, shared }
|
|
26066
|
-
}
|
|
26067
|
-
};
|
|
26068
|
-
}
|
|
26069
|
-
function collect5(value, previous = []) {
|
|
26070
|
-
return [...previous, value];
|
|
26071
|
-
}
|
|
26072
|
-
var projectAddTaskCommand = new Command129("add-task").description(
|
|
26073
|
-
"Create a task of any mode funded from a project's budget, as its owner or an operator with an accepted grant. Takes every flag of task create; the reward and any evaluator stake come out of the budget (costs 0.001 in the payment token)"
|
|
26074
|
-
).argument("<projectId>", "Project id");
|
|
26075
|
-
for (const option of createCmd.options) {
|
|
26076
|
-
projectAddTaskCommand.addOption(option);
|
|
26077
|
-
}
|
|
26078
|
-
projectAddTaskCommand.option(
|
|
26079
|
-
"--parent <taskId>",
|
|
26080
|
-
"Continue this task, a task in the same project (accepted or not); its worker can read the inputs"
|
|
26081
|
-
).option(
|
|
26082
|
-
"--input <sha256>",
|
|
26083
|
-
"A file of the parent's accepted submissions, by SHA-256, as an input; repeat for more (default: the winning accepted submission's files)",
|
|
26084
|
-
collect5
|
|
26299
|
+
"--input <sha256>",
|
|
26300
|
+
"A file of the parent's accepted submissions, by SHA-256, as an input; repeat for more (default: the winning accepted submission's files)",
|
|
26301
|
+
collect5
|
|
26085
26302
|
).option(
|
|
26086
26303
|
"--share-inputs",
|
|
26087
26304
|
"As the project's owner, share the input files of a parent that hides them (private, or submission visibility other than public) with this task's worker"
|
|
@@ -26121,7 +26338,7 @@ projectAddTaskCommand.action(async (id, opts) => {
|
|
|
26121
26338
|
});
|
|
26122
26339
|
|
|
26123
26340
|
// src/commands/project/automations.ts
|
|
26124
|
-
import { Command as
|
|
26341
|
+
import { Command as Command131 } from "commander";
|
|
26125
26342
|
function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
26126
26343
|
if (opts.cap === void 0) {
|
|
26127
26344
|
return { error: "--cap is required: the most the automations may draw from the budget" };
|
|
@@ -26150,7 +26367,7 @@ function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
|
26150
26367
|
}
|
|
26151
26368
|
return body;
|
|
26152
26369
|
}
|
|
26153
|
-
var projectAutomationsOnCommand = new
|
|
26370
|
+
var projectAutomationsOnCommand = new Command131("on").description(
|
|
26154
26371
|
"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)"
|
|
26155
26372
|
).argument("<projectId>", "Project id").option(
|
|
26156
26373
|
"--cap <amount>",
|
|
@@ -26178,7 +26395,7 @@ var projectAutomationsOnCommand = new Command130("on").description(
|
|
|
26178
26395
|
});
|
|
26179
26396
|
}
|
|
26180
26397
|
);
|
|
26181
|
-
var projectAutomationsOffCommand = new
|
|
26398
|
+
var projectAutomationsOffCommand = new Command131("off").description(
|
|
26182
26399
|
"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)"
|
|
26183
26400
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26184
26401
|
const projectId = parseProjectId(id);
|
|
@@ -26189,7 +26406,7 @@ var projectAutomationsOffCommand = new Command130("off").description(
|
|
|
26189
26406
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26190
26407
|
);
|
|
26191
26408
|
});
|
|
26192
|
-
var projectAutomationsStatusCommand = new
|
|
26409
|
+
var projectAutomationsStatusCommand = new Command131("status").description(
|
|
26193
26410
|
"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)"
|
|
26194
26411
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26195
26412
|
const projectId = parseProjectId(id);
|
|
@@ -26200,13 +26417,13 @@ var projectAutomationsStatusCommand = new Command130("status").description(
|
|
|
26200
26417
|
renderFailure(err);
|
|
26201
26418
|
}
|
|
26202
26419
|
});
|
|
26203
|
-
var projectAutomationsCommand = new
|
|
26420
|
+
var projectAutomationsCommand = new Command131("automations").description(
|
|
26204
26421
|
"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"
|
|
26205
26422
|
).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
|
|
26206
26423
|
|
|
26207
26424
|
// src/commands/project/claim.ts
|
|
26208
|
-
import { Command as
|
|
26209
|
-
var projectClaimCommand = new
|
|
26425
|
+
import { Command as Command132 } from "commander";
|
|
26426
|
+
var projectClaimCommand = new Command132("claim").description(
|
|
26210
26427
|
"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)"
|
|
26211
26428
|
).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
|
|
26212
26429
|
const projectId = parseProjectId(id);
|
|
@@ -26216,32 +26433,425 @@ var projectClaimCommand = new Command131("claim").description(
|
|
|
26216
26433
|
return void printError("Invalid Ethereum address for --backer");
|
|
26217
26434
|
}
|
|
26218
26435
|
await postProjectWrite(
|
|
26219
|
-
`/api/projects/${projectId}/claim`,
|
|
26220
|
-
{
|
|
26221
|
-
projectId,
|
|
26222
|
-
...backer ? { backer } : {}
|
|
26223
|
-
},
|
|
26436
|
+
`/api/projects/${projectId}/claim`,
|
|
26437
|
+
{
|
|
26438
|
+
projectId,
|
|
26439
|
+
...backer ? { backer } : {}
|
|
26440
|
+
},
|
|
26441
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26442
|
+
);
|
|
26443
|
+
});
|
|
26444
|
+
|
|
26445
|
+
// src/commands/project/close.ts
|
|
26446
|
+
import { Command as Command133 } from "commander";
|
|
26447
|
+
var projectCloseCommand = new Command133("close").description(
|
|
26448
|
+
"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)"
|
|
26449
|
+
).argument("<projectId>", "Project id").action(async (id) => {
|
|
26450
|
+
const projectId = parseProjectId(id);
|
|
26451
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26452
|
+
await postProjectWrite(
|
|
26453
|
+
`/api/projects/${projectId}/close`,
|
|
26454
|
+
{ projectId },
|
|
26455
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26456
|
+
);
|
|
26457
|
+
});
|
|
26458
|
+
|
|
26459
|
+
// src/commands/project/create.ts
|
|
26460
|
+
import { Command as Command136 } from "commander";
|
|
26461
|
+
|
|
26462
|
+
// src/commands/project/suggestions.ts
|
|
26463
|
+
import { Command as Command135 } from "commander";
|
|
26464
|
+
|
|
26465
|
+
// src/commands/project/suggestion-proposals.ts
|
|
26466
|
+
import { Command as Command134 } from "commander";
|
|
26467
|
+
var QUERY_ERRORS = {
|
|
26468
|
+
status: "--status must be pending, closed or expired",
|
|
26469
|
+
limit: "--limit must be an integer from 1 to 50",
|
|
26470
|
+
cursor: "--cursor must be the previous page's nextCursor"
|
|
26471
|
+
};
|
|
26472
|
+
function proposalsQuery(projectId, opts) {
|
|
26473
|
+
const query4 = {
|
|
26474
|
+
status: opts.status?.trim(),
|
|
26475
|
+
limit: opts.limit === void 0 ? void 0 : Number(opts.limit.trim() || Number.NaN),
|
|
26476
|
+
cursor: opts.cursor?.trim()
|
|
26477
|
+
};
|
|
26478
|
+
const parsed = SuggestionProposalsListInputSchema.safeParse({ projectId, ...query4 });
|
|
26479
|
+
if (!parsed.success) {
|
|
26480
|
+
const issue = parsed.error.issues[0];
|
|
26481
|
+
return { error: QUERY_ERRORS[String(issue.path[0])] ?? issue.message };
|
|
26482
|
+
}
|
|
26483
|
+
const params = new URLSearchParams();
|
|
26484
|
+
for (const [key, value] of Object.entries(query4)) {
|
|
26485
|
+
if (value !== void 0) params.set(key, String(value));
|
|
26486
|
+
}
|
|
26487
|
+
return params.toString();
|
|
26488
|
+
}
|
|
26489
|
+
function proposalDecisionBody(proposalId, suggestions) {
|
|
26490
|
+
const id = parseProposalId(proposalId);
|
|
26491
|
+
if (typeof id !== "string") return id;
|
|
26492
|
+
const body = { proposalId: id };
|
|
26493
|
+
if (suggestions.length > 0) {
|
|
26494
|
+
const ids = [];
|
|
26495
|
+
for (const value of suggestions) {
|
|
26496
|
+
const suggestionId = parseSuggestionId(value);
|
|
26497
|
+
if (typeof suggestionId !== "string") return { error: `--suggestion: ${suggestionId.error}` };
|
|
26498
|
+
ids.push(suggestionId);
|
|
26499
|
+
}
|
|
26500
|
+
body.suggestionIds = [...new Set(ids)];
|
|
26501
|
+
}
|
|
26502
|
+
const parsed = SuggestionProposalConfirmSchema.safeParse(body);
|
|
26503
|
+
if (!parsed.success) return { error: `--suggestion: ${parsed.error.issues[0].message}` };
|
|
26504
|
+
return body;
|
|
26505
|
+
}
|
|
26506
|
+
async function read(path9) {
|
|
26507
|
+
try {
|
|
26508
|
+
const headers = (await signReadAuth())?.headers ?? {};
|
|
26509
|
+
printResult(await apiGet(withChainId(path9), { headers }));
|
|
26510
|
+
} catch (err) {
|
|
26511
|
+
renderFailure(err);
|
|
26512
|
+
}
|
|
26513
|
+
}
|
|
26514
|
+
function collectSuggestion(value, previous) {
|
|
26515
|
+
return [...previous, value];
|
|
26516
|
+
}
|
|
26517
|
+
var projectSuggestionProposalsCommand = new Command134("proposals").description(
|
|
26518
|
+
"List a project's suggestion proposals, newest first: what each run of its suggestions schedule picked in propose mode, with the ranking it was picked by and each pick's rank, reward, mode and status. A pick the owner drops is not proposed again by that schedule. The reads are public; signed with your wallet when there is one, so a pick whose suggestion staff hid shows only to the project's owner and its author. A pending proposal waits for the owner to confirm or drop its picks, and expires at the schedule's next slot or after 72 hours (free)"
|
|
26519
|
+
).argument("<projectId>", "Project id").option(
|
|
26520
|
+
"--status <status>",
|
|
26521
|
+
`Only proposals in this status: ${SUGGESTION_PROPOSAL_STATUSES.join(", ")}`
|
|
26522
|
+
).option("--limit <count>", "Proposals per page (1-50, default 20)").option(
|
|
26523
|
+
"--cursor <cursor>",
|
|
26524
|
+
"The next page: the previous page's nextCursor, with the same --status"
|
|
26525
|
+
).action(async (id, opts) => {
|
|
26526
|
+
const projectId = parseProjectId(id);
|
|
26527
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26528
|
+
const query4 = proposalsQuery(projectId, opts);
|
|
26529
|
+
if (typeof query4 !== "string") return void printError(query4.error);
|
|
26530
|
+
await read(`/api/projects/${projectId}/suggestion-proposals${query4 ? `?${query4}` : ""}`);
|
|
26531
|
+
});
|
|
26532
|
+
var proposalShowCommand = new Command134("show").description(
|
|
26533
|
+
"Show a suggestion proposal with its picks: each suggestion, its rank and score, the reward and mode its task will carry, and its status (pending, confirmed, created with its taskId, dropped, expired or failed with the reason). Public; signed with your wallet when there is one, so a hidden pick shows only to the project's owner and its author (free)"
|
|
26534
|
+
).argument("<proposalId>", "Proposal id").action(async (value) => {
|
|
26535
|
+
const id = parseProposalId(value);
|
|
26536
|
+
if (typeof id !== "string") return void printError(id.error);
|
|
26537
|
+
await read(`/api/suggestion-proposals/${id}`);
|
|
26538
|
+
});
|
|
26539
|
+
function decisionCommand(action, description) {
|
|
26540
|
+
return new Command134(action).description(description).argument("<proposalId>", "Proposal id").option(
|
|
26541
|
+
"--suggestion <suggestionId>",
|
|
26542
|
+
`Only this pick; repeat it for each (default: every pending pick)`,
|
|
26543
|
+
collectSuggestion,
|
|
26544
|
+
[]
|
|
26545
|
+
).action(async (value, opts) => {
|
|
26546
|
+
const body = proposalDecisionBody(value, opts.suggestion);
|
|
26547
|
+
if ("error" in body) return void printError(String(body.error));
|
|
26548
|
+
await postProjectWrite(
|
|
26549
|
+
`/api/suggestion-proposals/${String(body.proposalId)}/${action}`,
|
|
26550
|
+
body,
|
|
26551
|
+
{
|
|
26552
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26553
|
+
}
|
|
26554
|
+
);
|
|
26555
|
+
});
|
|
26556
|
+
}
|
|
26557
|
+
var projectSuggestionProposalCommand = new Command134("proposal").description(
|
|
26558
|
+
"One suggestion proposal, as the project's owner: show it, confirm its picks so the platform runner creates their tasks, or drop them"
|
|
26559
|
+
).addCommand(proposalShowCommand).addCommand(
|
|
26560
|
+
decisionCommand(
|
|
26561
|
+
"confirm",
|
|
26562
|
+
"Confirm a pending proposal's picks, as the project's owner: the platform runner creates each pick's task from the budget under its grant, so it counts against the automations cap. Without --suggestion it confirms every pending pick, skipping any whose suggestion is held or hidden; picks you leave out stay pending until the proposal expires. Costs 0.001 in the payment token"
|
|
26563
|
+
)
|
|
26564
|
+
).addCommand(
|
|
26565
|
+
decisionCommand(
|
|
26566
|
+
"drop",
|
|
26567
|
+
"Drop a pending proposal's picks, as the project's owner: no task is created and the suggestions stay open. Costs 0.001 in the payment token"
|
|
26568
|
+
)
|
|
26569
|
+
);
|
|
26570
|
+
|
|
26571
|
+
// src/commands/project/suggestions.ts
|
|
26572
|
+
function parseSuggestionsSetting(value) {
|
|
26573
|
+
const trimmed = value.trim();
|
|
26574
|
+
return PROJECT_SUGGESTIONS_SETTINGS.includes(trimmed) ? trimmed : { error: `--suggestions must be ${PROJECT_SUGGESTIONS_SETTINGS.join(", ")}` };
|
|
26575
|
+
}
|
|
26576
|
+
function parseSuggestionsMinBacking(value, options = {}) {
|
|
26577
|
+
const trimmed = value.trim();
|
|
26578
|
+
if (options.allowDefault && trimmed === "default") return null;
|
|
26579
|
+
try {
|
|
26580
|
+
return usdcToBaseUnits(trimmed, { allowZero: true });
|
|
26581
|
+
} catch (err) {
|
|
26582
|
+
return {
|
|
26583
|
+
error: `Invalid --suggestions-min-backing: ${err instanceof Error ? err.message : String(err)}${options.allowDefault ? ", or default" : ""}`
|
|
26584
|
+
};
|
|
26585
|
+
}
|
|
26586
|
+
}
|
|
26587
|
+
function suggestBody(projectId, opts) {
|
|
26588
|
+
if (opts.title === void 0) return { error: "--title is required" };
|
|
26589
|
+
if (opts.brief === void 0) return { error: "--brief is required" };
|
|
26590
|
+
const title = ProjectSuggestionTitleSchema.safeParse(opts.title);
|
|
26591
|
+
if (!title.success) return { error: `--title: ${title.error.issues[0].message}` };
|
|
26592
|
+
const brief = ProjectSuggestionBriefSchema.safeParse(opts.brief);
|
|
26593
|
+
if (!brief.success) return { error: `--brief: ${brief.error.issues[0].message}` };
|
|
26594
|
+
const body = { projectId, title: title.data, brief: brief.data };
|
|
26595
|
+
if (opts.mode !== void 0) {
|
|
26596
|
+
const mode = opts.mode.trim();
|
|
26597
|
+
if (!GRANT_MODE_NAMES.includes(mode)) {
|
|
26598
|
+
return { error: `--mode must be ${GRANT_MODE_NAMES.join(", ")}` };
|
|
26599
|
+
}
|
|
26600
|
+
body.mode = mode;
|
|
26601
|
+
}
|
|
26602
|
+
if (opts.reward !== void 0) {
|
|
26603
|
+
const reward = parseAmount(opts.reward, "--reward");
|
|
26604
|
+
if (typeof reward !== "string") return reward;
|
|
26605
|
+
body.reward = reward;
|
|
26606
|
+
}
|
|
26607
|
+
return body;
|
|
26608
|
+
}
|
|
26609
|
+
function suggestionsQuery(opts) {
|
|
26610
|
+
const params = new URLSearchParams();
|
|
26611
|
+
if (opts.status !== void 0) {
|
|
26612
|
+
const status = opts.status.trim();
|
|
26613
|
+
if (!PROJECT_SUGGESTION_STATUSES.includes(status)) {
|
|
26614
|
+
return { error: `--status must be ${PROJECT_SUGGESTION_STATUSES.join(", ")}` };
|
|
26615
|
+
}
|
|
26616
|
+
params.set("status", status);
|
|
26617
|
+
}
|
|
26618
|
+
if (opts.sort !== void 0) {
|
|
26619
|
+
const sort = opts.sort.trim();
|
|
26620
|
+
if (!PROJECT_SUGGESTION_SORTS.includes(sort)) {
|
|
26621
|
+
return { error: `--sort must be ${PROJECT_SUGGESTION_SORTS.join(" or ")}` };
|
|
26622
|
+
}
|
|
26623
|
+
params.set("sort", sort);
|
|
26624
|
+
}
|
|
26625
|
+
if (opts.limit !== void 0) {
|
|
26626
|
+
const limit = opts.limit.trim();
|
|
26627
|
+
if (!/^[1-9][0-9]*$/.test(limit) || Number(limit) > PROJECT_SUGGESTIONS_LIST_MAX) {
|
|
26628
|
+
return { error: `--limit must be an integer from 1 to ${PROJECT_SUGGESTIONS_LIST_MAX}` };
|
|
26629
|
+
}
|
|
26630
|
+
params.set("limit", limit);
|
|
26631
|
+
}
|
|
26632
|
+
if (opts.cursor !== void 0) {
|
|
26633
|
+
const cursor = opts.cursor.trim();
|
|
26634
|
+
if (cursor.length === 0 || cursor.length > 512) {
|
|
26635
|
+
return { error: "--cursor must be the previous page's nextCursor" };
|
|
26636
|
+
}
|
|
26637
|
+
params.set("cursor", cursor);
|
|
26638
|
+
}
|
|
26639
|
+
return params.toString();
|
|
26640
|
+
}
|
|
26641
|
+
function suggestionSettingsBody(projectId, opts) {
|
|
26642
|
+
if (opts.suggestions === void 0 && opts.hostedOperators === void 0 && opts.suggestionsMinBacking === void 0) {
|
|
26643
|
+
return null;
|
|
26644
|
+
}
|
|
26645
|
+
const body = { projectId };
|
|
26646
|
+
if (opts.suggestions !== void 0) {
|
|
26647
|
+
const setting = parseSuggestionsSetting(opts.suggestions);
|
|
26648
|
+
if (typeof setting !== "string") return setting;
|
|
26649
|
+
body.suggestions = setting;
|
|
26650
|
+
}
|
|
26651
|
+
if (opts.hostedOperators !== void 0) {
|
|
26652
|
+
const value = opts.hostedOperators.trim();
|
|
26653
|
+
if (value !== "on" && value !== "off") return { error: "--hosted-operators must be on or off" };
|
|
26654
|
+
body.hostedOperators = value === "on";
|
|
26655
|
+
}
|
|
26656
|
+
if (opts.suggestionsMinBacking !== void 0) {
|
|
26657
|
+
const min = parseSuggestionsMinBacking(opts.suggestionsMinBacking, { allowDefault: true });
|
|
26658
|
+
if (min !== null && typeof min === "object") return min;
|
|
26659
|
+
body.minBacking = min;
|
|
26660
|
+
}
|
|
26661
|
+
return body;
|
|
26662
|
+
}
|
|
26663
|
+
async function signedRead(path9) {
|
|
26664
|
+
try {
|
|
26665
|
+
const headers = (await signReadAuth())?.headers ?? {};
|
|
26666
|
+
printResult(await apiGet(withChainId(path9), { headers }));
|
|
26667
|
+
} catch (err) {
|
|
26668
|
+
renderFailure(err);
|
|
26669
|
+
}
|
|
26670
|
+
}
|
|
26671
|
+
var projectSuggestCommand = new Command135("suggest").description(
|
|
26672
|
+
"Post a suggestion on an open project: an idea for work its budget could pay for, as a wallet the project's suggestions setting admits (backers: the owner, its operators and backers; anyone: any wallet). Posting costs 0.001 in the payment token. The owner or an operator turns it into a task with `project add-task --suggestion <id>`, and anyone it admits may upvote it for free"
|
|
26673
|
+
).argument("<projectId>", "Project id").option("--title <text>", "Required: one line, 1 to 120 characters").option(
|
|
26674
|
+
"--brief <text>",
|
|
26675
|
+
"Required: what the work is and what done looks like, plain text, up to 4000 characters"
|
|
26676
|
+
).option(
|
|
26677
|
+
"--mode <mode>",
|
|
26678
|
+
`The task mode you suggest (${GRANT_MODE_NAMES.join(", ")}); the owner or operator decides`
|
|
26679
|
+
).option(
|
|
26680
|
+
"--reward <amount>",
|
|
26681
|
+
"The reward you suggest, in the payment token (e.g. 5); the owner or operator decides"
|
|
26682
|
+
).action(async (id, opts) => {
|
|
26683
|
+
const projectId = parseProjectId(id);
|
|
26684
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26685
|
+
const body = suggestBody(projectId, opts);
|
|
26686
|
+
if ("error" in body) return void printError(String(body.error));
|
|
26687
|
+
await postProjectWrite(`/api/projects/${projectId}/suggestions`, body, {
|
|
26688
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26689
|
+
});
|
|
26690
|
+
});
|
|
26691
|
+
var projectSuggestionsCommand = new Command135("suggestions").description(
|
|
26692
|
+
"List a project's suggestions with its suggestions settings, most upvoted first or, with --sort backed, most pool shares among the voters who back the project first. Each carries votes, backedShares and, when your wallet signs the read, whether you voted (free)"
|
|
26693
|
+
).argument("<projectId>", "Project id").option(
|
|
26694
|
+
"--status <status>",
|
|
26695
|
+
`Only suggestions in this status: ${PROJECT_SUGGESTION_STATUSES.join(", ")}`
|
|
26696
|
+
).option("--sort <sort>", "votes (default) or backed").option(
|
|
26697
|
+
"--limit <count>",
|
|
26698
|
+
`Suggestions per page (1-${PROJECT_SUGGESTIONS_LIST_MAX}, default ${PROJECT_SUGGESTIONS_LIST_DEFAULT})`
|
|
26699
|
+
).option(
|
|
26700
|
+
"--cursor <cursor>",
|
|
26701
|
+
"The next page: the previous page's nextCursor, with the same --status and --sort"
|
|
26702
|
+
).action(async (id, opts) => {
|
|
26703
|
+
const projectId = parseProjectId(id);
|
|
26704
|
+
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26705
|
+
const query4 = suggestionsQuery(opts);
|
|
26706
|
+
if (typeof query4 !== "string") return void printError(query4.error);
|
|
26707
|
+
await signedRead(`/api/projects/${projectId}/suggestions${query4 ? `?${query4}` : ""}`);
|
|
26708
|
+
});
|
|
26709
|
+
var showCommand3 = new Command135("show").description("Show a suggestion with its status, votes and backedShares (free)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
26710
|
+
const id = parseSuggestionId(value);
|
|
26711
|
+
if (typeof id !== "string") return void printError(id.error);
|
|
26712
|
+
await signedRead(`/api/project-suggestions/${id}`);
|
|
26713
|
+
});
|
|
26714
|
+
async function readAuthFor(what) {
|
|
26715
|
+
const auth = await signReadAuth();
|
|
26716
|
+
if (auth && Object.keys(auth.headers).length === 0) {
|
|
26717
|
+
return { error: `Could not sign with your wallet: ${auth.error ?? "unknown error"}` };
|
|
26718
|
+
}
|
|
26719
|
+
if (!auth) return { error: `${what} needs a wallet. Run \`taskmarket init\` first.` };
|
|
26720
|
+
return { headers: auth.headers };
|
|
26721
|
+
}
|
|
26722
|
+
function voteCommand(action, description) {
|
|
26723
|
+
return new Command135(action).description(description).argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
26724
|
+
const suggestionId = parseSuggestionId(value);
|
|
26725
|
+
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
26726
|
+
const auth = await readAuthFor(action === "vote" ? "Voting" : "Taking back a vote");
|
|
26727
|
+
if ("error" in auth) return void printError(auth.error);
|
|
26728
|
+
try {
|
|
26729
|
+
const chainId = selectedNetwork().chainId;
|
|
26730
|
+
const proof = await signWalletWrite("project-suggestion-vote", {
|
|
26731
|
+
action,
|
|
26732
|
+
chainId,
|
|
26733
|
+
suggestionId
|
|
26734
|
+
});
|
|
26735
|
+
const { data, idempotencyKey } = await apiPost(
|
|
26736
|
+
`/api/project-suggestions/${suggestionId}/${action}`,
|
|
26737
|
+
{ chainId, suggestionId, ...proof },
|
|
26738
|
+
{ headers: auth.headers }
|
|
26739
|
+
);
|
|
26740
|
+
printResult(data, { idempotencyKey });
|
|
26741
|
+
} catch (err) {
|
|
26742
|
+
renderFailure(err);
|
|
26743
|
+
}
|
|
26744
|
+
});
|
|
26745
|
+
}
|
|
26746
|
+
var reportCommand = new Command135("report").description(
|
|
26747
|
+
"Report a suggestion to Taskmarket staff, as any wallet but its author (free, signed by your wallet). Staff may hide it from the project's lists; one open report per wallet per suggestion, so a repeat returns the open one"
|
|
26748
|
+
).argument("<suggestionId>", "Suggestion id").requiredOption("--reason <reason>", `Why: ${PROJECT_SUGGESTION_REPORT_REASONS.join(", ")}`).option("--note <text>", "What staff should know: up to 500 characters, read only by staff").action(async (value, opts) => {
|
|
26749
|
+
const suggestionId = parseSuggestionId(value);
|
|
26750
|
+
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
26751
|
+
const reason = ProjectSuggestionReportReasonSchema.safeParse(opts.reason.trim());
|
|
26752
|
+
if (!reason.success) {
|
|
26753
|
+
return void printError(`--reason must be ${PROJECT_SUGGESTION_REPORT_REASONS.join(", ")}`);
|
|
26754
|
+
}
|
|
26755
|
+
let note;
|
|
26756
|
+
if (opts.note !== void 0) {
|
|
26757
|
+
const parsed = ProjectSuggestionReportNoteSchema.safeParse(opts.note);
|
|
26758
|
+
if (!parsed.success) return void printError(`--note: ${parsed.error.issues[0].message}`);
|
|
26759
|
+
note = parsed.data;
|
|
26760
|
+
}
|
|
26761
|
+
const auth = await readAuthFor("Reporting a suggestion");
|
|
26762
|
+
if ("error" in auth) return void printError(auth.error);
|
|
26763
|
+
try {
|
|
26764
|
+
const chainId = selectedNetwork().chainId;
|
|
26765
|
+
const body = {
|
|
26766
|
+
chainId,
|
|
26767
|
+
suggestionId,
|
|
26768
|
+
reason: reason.data,
|
|
26769
|
+
...note !== void 0 ? { note } : {}
|
|
26770
|
+
};
|
|
26771
|
+
const proof = await signWalletWrite("project-suggestion-report", {
|
|
26772
|
+
action: "report",
|
|
26773
|
+
...body
|
|
26774
|
+
});
|
|
26775
|
+
const { data, idempotencyKey } = await apiPost(
|
|
26776
|
+
`/api/project-suggestions/${suggestionId}/report`,
|
|
26777
|
+
{ ...body, ...proof },
|
|
26778
|
+
{ headers: auth.headers }
|
|
26779
|
+
);
|
|
26780
|
+
printResult(data, { idempotencyKey });
|
|
26781
|
+
} catch (err) {
|
|
26782
|
+
renderFailure(err);
|
|
26783
|
+
}
|
|
26784
|
+
});
|
|
26785
|
+
var withdrawCommand2 = new Command135("withdraw").description("Withdraw your open suggestion, as its author (costs 0.001 in the payment token)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
|
|
26786
|
+
const suggestionId = parseSuggestionId(value);
|
|
26787
|
+
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
26788
|
+
await postProjectWrite(
|
|
26789
|
+
`/api/project-suggestions/${suggestionId}/withdraw`,
|
|
26790
|
+
{ suggestionId },
|
|
26791
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26792
|
+
);
|
|
26793
|
+
});
|
|
26794
|
+
var declineCommand = new Command135("decline").description(
|
|
26795
|
+
"Decline an open suggestion, as the project's owner or an operator with an accepted grant; the reason is shown to everyone. Declining costs 0.001 in the payment token. To accept one instead, create its task with `project add-task <projectId> --suggestion <id>`, which pays the task's reward and any evaluator stake from the budget, plus the 0.001 action fee"
|
|
26796
|
+
).argument("<suggestionId>", "Suggestion id").option("--reason <text>", "Why, shown to everyone: up to 500 characters").action(async (value, opts) => {
|
|
26797
|
+
const suggestionId = parseSuggestionId(value);
|
|
26798
|
+
if (typeof suggestionId !== "string") return void printError(suggestionId.error);
|
|
26799
|
+
const parsed = ProjectSuggestionDeclineSchema.safeParse({ suggestionId, reason: opts.reason });
|
|
26800
|
+
if (!parsed.success) {
|
|
26801
|
+
return void printError(`--reason: ${parsed.error.issues[0].message}`);
|
|
26802
|
+
}
|
|
26803
|
+
await postProjectWrite(
|
|
26804
|
+
`/api/project-suggestions/${suggestionId}/decline`,
|
|
26805
|
+
{ suggestionId, ...parsed.data.reason !== void 0 ? { reason: parsed.data.reason } : {} },
|
|
26224
26806
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26225
26807
|
);
|
|
26226
26808
|
});
|
|
26227
|
-
|
|
26228
|
-
|
|
26229
|
-
|
|
26230
|
-
|
|
26231
|
-
|
|
26232
|
-
|
|
26809
|
+
var projectSuggestionCommand = new Command135("suggestion").description(
|
|
26810
|
+
"One project suggestion: show it, upvote it or take the upvote back, report it to staff (each free, signed by your wallet), withdraw it as its author, or decline it as the owner or an operator. `proposals` and `proposal` read and act on what the project's suggestions schedule proposes"
|
|
26811
|
+
).addCommand(showCommand3).addCommand(
|
|
26812
|
+
voteCommand(
|
|
26813
|
+
"vote",
|
|
26814
|
+
"Upvote a suggestion, as a wallet that may suggest on its project; one vote per wallet (free, signed by your wallet)"
|
|
26815
|
+
)
|
|
26816
|
+
).addCommand(
|
|
26817
|
+
voteCommand("unvote", "Take back your upvote on a suggestion (free, signed by your wallet)")
|
|
26818
|
+
).addCommand(reportCommand).addCommand(withdrawCommand2).addCommand(declineCommand).addCommand(projectSuggestionProposalsCommand).addCommand(projectSuggestionProposalCommand);
|
|
26819
|
+
var projectSuggestionSettingsCommand = new Command135("suggestion-settings").description(
|
|
26820
|
+
"Read or set the project's suggestions settings, as its owner: who may post and upvote suggestions (off, backers or anyone), the least a wallet must have contributed to count as a backer for them (1 in the payment token by default), and whether hosted agents that operate the project accept and decline suggestions by themselves (on by default). Turning hosted operators off keeps their grants. Setting costs 0.001 in the payment token; reading is free"
|
|
26821
|
+
).argument("<projectId>", "Project id").option(
|
|
26822
|
+
"--suggestions <setting>",
|
|
26823
|
+
"off (no one), backers (the owner, operators and backers) or anyone (any wallet)"
|
|
26824
|
+
).option(
|
|
26825
|
+
"--suggestions-min-backing <amount>",
|
|
26826
|
+
"Under backers, the least a wallet must have contributed to the project's pool to post and upvote, in the payment token (e.g. 5); 0 admits any contribution, default returns to the default of 1"
|
|
26827
|
+
).option(
|
|
26828
|
+
"--hosted-operators <on|off>",
|
|
26829
|
+
"Whether hosted operators act on suggestions by themselves"
|
|
26830
|
+
).action(async (id, opts) => {
|
|
26233
26831
|
const projectId = parseProjectId(id);
|
|
26234
26832
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
26235
|
-
|
|
26236
|
-
|
|
26237
|
-
{
|
|
26238
|
-
|
|
26239
|
-
|
|
26833
|
+
const body = suggestionSettingsBody(projectId, opts);
|
|
26834
|
+
if (body === null) {
|
|
26835
|
+
try {
|
|
26836
|
+
const view = await apiGet(withChainId(`/api/projects/${projectId}`));
|
|
26837
|
+
printResult({
|
|
26838
|
+
chainId: view.project?.chainId,
|
|
26839
|
+
projectId: view.project?.projectId ?? projectId,
|
|
26840
|
+
suggestions: view.suggestions ?? null
|
|
26841
|
+
});
|
|
26842
|
+
} catch (err) {
|
|
26843
|
+
renderFailure(err);
|
|
26844
|
+
}
|
|
26845
|
+
return;
|
|
26846
|
+
}
|
|
26847
|
+
if ("error" in body) return void printError(String(body.error));
|
|
26848
|
+
await postProjectWrite(`/api/projects/${projectId}/suggestions/settings`, body, {
|
|
26849
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
26850
|
+
});
|
|
26240
26851
|
});
|
|
26241
26852
|
|
|
26242
26853
|
// src/commands/project/create.ts
|
|
26243
|
-
|
|
26244
|
-
var projectCreateCommand = new Command133("create").description(
|
|
26854
|
+
var projectCreateCommand = new Command136("create").description(
|
|
26245
26855
|
"Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
|
|
26246
26856
|
).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
|
|
26247
26857
|
"--ends-at <time>",
|
|
@@ -26290,9 +26900,9 @@ var projectCreateCommand = new Command133("create").description(
|
|
|
26290
26900
|
);
|
|
26291
26901
|
|
|
26292
26902
|
// src/commands/project/extend.ts
|
|
26293
|
-
import { Command as
|
|
26903
|
+
import { Command as Command137 } from "commander";
|
|
26294
26904
|
var MAX_EXTENSION_MS = 365 * 24 * 3600 * 1e3;
|
|
26295
|
-
var projectExtendCommand = new
|
|
26905
|
+
var projectExtendCommand = new Command137("extend").description(
|
|
26296
26906
|
"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"
|
|
26297
26907
|
).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) => {
|
|
26298
26908
|
const projectId = parseProjectId(id);
|
|
@@ -26310,8 +26920,8 @@ var projectExtendCommand = new Command134("extend").description(
|
|
|
26310
26920
|
});
|
|
26311
26921
|
|
|
26312
26922
|
// src/commands/project/fund.ts
|
|
26313
|
-
import { Command as
|
|
26314
|
-
var projectFundCommand = new
|
|
26923
|
+
import { Command as Command138 } from "commander";
|
|
26924
|
+
var projectFundCommand = new Command138("fund").description(
|
|
26315
26925
|
"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)"
|
|
26316
26926
|
).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
|
|
26317
26927
|
"--on-behalf-of <address>",
|
|
@@ -26333,7 +26943,7 @@ var projectFundCommand = new Command135("fund").description(
|
|
|
26333
26943
|
});
|
|
26334
26944
|
|
|
26335
26945
|
// src/commands/project/grant.ts
|
|
26336
|
-
import { Command as
|
|
26946
|
+
import { Command as Command139 } from "commander";
|
|
26337
26947
|
function grantBody(projectId, opts) {
|
|
26338
26948
|
if (!ADDRESS.test(opts.operator)) {
|
|
26339
26949
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -26356,7 +26966,7 @@ function grantBody(projectId, opts) {
|
|
|
26356
26966
|
revokeRemovesControl: opts.revokeRemovesControl
|
|
26357
26967
|
};
|
|
26358
26968
|
}
|
|
26359
|
-
var projectGrantCommand = new
|
|
26969
|
+
var projectGrantCommand = new Command139("grant").description(
|
|
26360
26970
|
"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)"
|
|
26361
26971
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
|
|
26362
26972
|
"--cap <amount>",
|
|
@@ -26382,7 +26992,7 @@ var projectGrantCommand = new Command136("grant").description(
|
|
|
26382
26992
|
});
|
|
26383
26993
|
|
|
26384
26994
|
// src/commands/project/review.ts
|
|
26385
|
-
import { Command as
|
|
26995
|
+
import { Command as Command140 } from "commander";
|
|
26386
26996
|
function reviewEvaluator(opts) {
|
|
26387
26997
|
if (opts.evaluator !== void 0 && opts.off) {
|
|
26388
26998
|
return { error: "Pass --evaluator <address> or --off, not both" };
|
|
@@ -26397,7 +27007,7 @@ function reviewEvaluator(opts) {
|
|
|
26397
27007
|
}
|
|
26398
27008
|
return opts.evaluator;
|
|
26399
27009
|
}
|
|
26400
|
-
var projectReviewCommand = new
|
|
27010
|
+
var projectReviewCommand = new Command140("review").description(
|
|
26401
27011
|
"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"
|
|
26402
27012
|
).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) => {
|
|
26403
27013
|
const projectId = parseProjectId(id);
|
|
@@ -26439,8 +27049,8 @@ async function ownerEvaluatorWarnings(evaluator) {
|
|
|
26439
27049
|
}
|
|
26440
27050
|
|
|
26441
27051
|
// src/commands/project/raise-cap.ts
|
|
26442
|
-
import { Command as
|
|
26443
|
-
var projectRaiseCapCommand = new
|
|
27052
|
+
import { Command as Command141 } from "commander";
|
|
27053
|
+
var projectRaiseCapCommand = new Command141("raise-cap").description(
|
|
26444
27054
|
"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"
|
|
26445
27055
|
).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) => {
|
|
26446
27056
|
const projectId = parseProjectId(id);
|
|
@@ -26458,8 +27068,8 @@ var projectRaiseCapCommand = new Command138("raise-cap").description(
|
|
|
26458
27068
|
});
|
|
26459
27069
|
|
|
26460
27070
|
// src/commands/project/lower-cap.ts
|
|
26461
|
-
import { Command as
|
|
26462
|
-
var projectLowerCapCommand = new
|
|
27071
|
+
import { Command as Command142 } from "commander";
|
|
27072
|
+
var projectLowerCapCommand = new Command142("lower-cap").description(
|
|
26463
27073
|
"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`"
|
|
26464
27074
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
|
|
26465
27075
|
"--cap <amount>",
|
|
@@ -26481,7 +27091,7 @@ var projectLowerCapCommand = new Command139("lower-cap").description(
|
|
|
26481
27091
|
});
|
|
26482
27092
|
|
|
26483
27093
|
// src/commands/project/limits.ts
|
|
26484
|
-
import { Command as
|
|
27094
|
+
import { Command as Command143 } from "commander";
|
|
26485
27095
|
function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
26486
27096
|
if (!ADDRESS.test(opts.operator)) {
|
|
26487
27097
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -26521,7 +27131,7 @@ function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
|
|
|
26521
27131
|
}
|
|
26522
27132
|
return body;
|
|
26523
27133
|
}
|
|
26524
|
-
var projectLimitsCommand = new
|
|
27134
|
+
var projectLimitsCommand = new Command143("limits").description(
|
|
26525
27135
|
"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"
|
|
26526
27136
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
|
|
26527
27137
|
"--expires <time>",
|
|
@@ -26543,8 +27153,8 @@ var projectLimitsCommand = new Command140("limits").description(
|
|
|
26543
27153
|
});
|
|
26544
27154
|
|
|
26545
27155
|
// src/commands/project/revoke.ts
|
|
26546
|
-
import { Command as
|
|
26547
|
-
var projectRevokeCommand = new
|
|
27156
|
+
import { Command as Command144 } from "commander";
|
|
27157
|
+
var projectRevokeCommand = new Command144("revoke").description(
|
|
26548
27158
|
"End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
|
|
26549
27159
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
|
|
26550
27160
|
const projectId = parseProjectId(id);
|
|
@@ -26563,7 +27173,7 @@ var projectRevokeCommand = new Command141("revoke").description(
|
|
|
26563
27173
|
});
|
|
26564
27174
|
|
|
26565
27175
|
// src/commands/project/schedule.ts
|
|
26566
|
-
import { Command as
|
|
27176
|
+
import { Command as Command147 } from "commander";
|
|
26567
27177
|
|
|
26568
27178
|
// src/lib/owner-list.ts
|
|
26569
27179
|
import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
|
|
@@ -26602,10 +27212,234 @@ function ownerListQuery(owner, opts, statuses) {
|
|
|
26602
27212
|
return params.toString();
|
|
26603
27213
|
}
|
|
26604
27214
|
|
|
27215
|
+
// src/commands/project/suggestion-schedule.ts
|
|
27216
|
+
import { Command as Command145 } from "commander";
|
|
27217
|
+
var SUGGESTION_ONLY_FLAGS = [
|
|
27218
|
+
["--rank", "rank"],
|
|
27219
|
+
["--min-backed-share", "minBackedShare"],
|
|
27220
|
+
["--min-votes", "minVotes"],
|
|
27221
|
+
["--min-age", "minAge"],
|
|
27222
|
+
["--max-tasks", "maxTasks"],
|
|
27223
|
+
["--max-spend", "maxSpend"],
|
|
27224
|
+
["--max-reward", "maxReward"],
|
|
27225
|
+
["--decline-after", "declineAfter"],
|
|
27226
|
+
["--default-mode", "defaultMode"],
|
|
27227
|
+
["--email-picks", "emailPicks"]
|
|
27228
|
+
];
|
|
27229
|
+
var TEMPLATE_FLAGS = [
|
|
27230
|
+
["--duration", "duration"],
|
|
27231
|
+
["--tags", "tags"],
|
|
27232
|
+
["--evaluator", "evaluator"],
|
|
27233
|
+
["--evaluator-fee-bps", "evaluatorFeeBps"],
|
|
27234
|
+
["--evaluator-stake", "evaluatorStake"],
|
|
27235
|
+
["--evaluation-window", "evaluationWindow"],
|
|
27236
|
+
["--appeal-window", "appealWindow"]
|
|
27237
|
+
];
|
|
27238
|
+
var FLAG_FOR_FIELD = {
|
|
27239
|
+
mode: "--mode",
|
|
27240
|
+
rank: "--rank",
|
|
27241
|
+
minBackedShare: "--min-backed-share",
|
|
27242
|
+
minVotes: "--min-votes",
|
|
27243
|
+
minAgeHours: "--min-age",
|
|
27244
|
+
maxTasksPerRun: "--max-tasks",
|
|
27245
|
+
maxSpendPerRun: "--max-spend",
|
|
27246
|
+
maxReward: "--max-reward",
|
|
27247
|
+
declineAfterDays: "--decline-after",
|
|
27248
|
+
defaultMode: "--default-mode",
|
|
27249
|
+
emailPicksWaiting: "--email-picks",
|
|
27250
|
+
duration: "--duration",
|
|
27251
|
+
tags: "--tags",
|
|
27252
|
+
evaluator: "--evaluator",
|
|
27253
|
+
evaluatorFeeBps: "--evaluator-fee-bps",
|
|
27254
|
+
evaluatorStake: "--evaluator-stake",
|
|
27255
|
+
evaluationWindowHours: "--evaluation-window",
|
|
27256
|
+
appealWindowHours: "--appeal-window"
|
|
27257
|
+
};
|
|
27258
|
+
function issueError(issue) {
|
|
27259
|
+
const field = [...issue.path].reverse().find((part) => typeof part === "string");
|
|
27260
|
+
const flag = field === void 0 ? void 0 : FLAG_FOR_FIELD[field];
|
|
27261
|
+
return { error: flag ? `${flag}: ${issue.message}` : issue.message };
|
|
27262
|
+
}
|
|
27263
|
+
function flagNumber(value) {
|
|
27264
|
+
const trimmed = value.trim();
|
|
27265
|
+
return trimmed === "" ? Number.NaN : Number(trimmed);
|
|
27266
|
+
}
|
|
27267
|
+
var EVALUATOR_FIELDS = [
|
|
27268
|
+
"evaluator",
|
|
27269
|
+
"evaluatorFeeBps",
|
|
27270
|
+
"evaluatorStake",
|
|
27271
|
+
"evaluationWindowHours",
|
|
27272
|
+
"appealWindowHours"
|
|
27273
|
+
];
|
|
27274
|
+
function setsTemplate(opts) {
|
|
27275
|
+
return TEMPLATE_FLAGS.some(([, key]) => opts[key] !== void 0);
|
|
27276
|
+
}
|
|
27277
|
+
function pickTemplate(opts, stored) {
|
|
27278
|
+
if (!setsTemplate(opts)) return void 0;
|
|
27279
|
+
const template = { ...stored };
|
|
27280
|
+
if (opts.duration !== void 0) template.duration = flagNumber(opts.duration);
|
|
27281
|
+
if (opts.tags !== void 0) template.tags = parseTags(opts.tags);
|
|
27282
|
+
template.tags ??= [];
|
|
27283
|
+
const storedEvaluator = typeof stored?.evaluator === "string" ? stored.evaluator : void 0;
|
|
27284
|
+
const terms = evaluatorTerms({ ...opts, evaluator: opts.evaluator ?? storedEvaluator });
|
|
27285
|
+
if ("error" in terms) return terms;
|
|
27286
|
+
if (opts.evaluator !== void 0) for (const field of EVALUATOR_FIELDS) delete template[field];
|
|
27287
|
+
return { ...template, ...terms };
|
|
27288
|
+
}
|
|
27289
|
+
function settingsFields(opts, stored) {
|
|
27290
|
+
const body = {};
|
|
27291
|
+
if (opts.mode !== void 0) body.mode = opts.mode.trim();
|
|
27292
|
+
if (opts.rank !== void 0) body.rank = opts.rank.trim();
|
|
27293
|
+
if (opts.minBackedShare !== void 0) body.minBackedShare = flagNumber(opts.minBackedShare);
|
|
27294
|
+
if (opts.minVotes !== void 0) body.minVotes = flagNumber(opts.minVotes);
|
|
27295
|
+
if (opts.minAge !== void 0) body.minAgeHours = flagNumber(opts.minAge);
|
|
27296
|
+
if (opts.maxTasks !== void 0) body.maxTasksPerRun = flagNumber(opts.maxTasks);
|
|
27297
|
+
for (const [flag, value, field] of [
|
|
27298
|
+
["--max-spend", opts.maxSpend, "maxSpendPerRun"],
|
|
27299
|
+
["--max-reward", opts.maxReward, "maxReward"]
|
|
27300
|
+
]) {
|
|
27301
|
+
if (value === void 0) continue;
|
|
27302
|
+
const amount = parseAmount(value, flag);
|
|
27303
|
+
if (typeof amount !== "string") return amount;
|
|
27304
|
+
body[field] = amount;
|
|
27305
|
+
}
|
|
27306
|
+
if (opts.declineAfter !== void 0) {
|
|
27307
|
+
const trimmed = opts.declineAfter.trim();
|
|
27308
|
+
body.declineAfterDays = trimmed === "never" ? null : flagNumber(trimmed);
|
|
27309
|
+
}
|
|
27310
|
+
if (opts.defaultMode !== void 0) body.defaultMode = opts.defaultMode.trim();
|
|
27311
|
+
if (opts.emailPicks !== void 0) body.emailPicksWaiting = opts.emailPicks;
|
|
27312
|
+
const template = pickTemplate(opts, stored);
|
|
27313
|
+
if (template !== void 0 && "error" in template) return template;
|
|
27314
|
+
if (template !== void 0) body.template = template;
|
|
27315
|
+
return body;
|
|
27316
|
+
}
|
|
27317
|
+
function suggestionScheduleConfig(opts) {
|
|
27318
|
+
for (const [flag, key] of [
|
|
27319
|
+
["--max-spend", "maxSpend"],
|
|
27320
|
+
["--max-reward", "maxReward"],
|
|
27321
|
+
["--duration", "duration"]
|
|
27322
|
+
]) {
|
|
27323
|
+
if (opts[key] === void 0) {
|
|
27324
|
+
return { error: `${flag} is required for a suggestions schedule` };
|
|
27325
|
+
}
|
|
27326
|
+
}
|
|
27327
|
+
const config = settingsFields(opts);
|
|
27328
|
+
if ("error" in config) return config;
|
|
27329
|
+
const parsed = SuggestionScheduleConfigSchema.safeParse(config);
|
|
27330
|
+
if (!parsed.success) return issueError(parsed.error.issues[0]);
|
|
27331
|
+
const spend = spendCoversOnePick(config);
|
|
27332
|
+
if (spend) return spend;
|
|
27333
|
+
return config;
|
|
27334
|
+
}
|
|
27335
|
+
function baseUnits(value) {
|
|
27336
|
+
return typeof value === "string" && /^[0-9]+$/.test(value) ? BigInt(value) : void 0;
|
|
27337
|
+
}
|
|
27338
|
+
function spendCoversOnePick(settings) {
|
|
27339
|
+
const spend = baseUnits(settings.maxSpendPerRun);
|
|
27340
|
+
const reward = baseUnits(settings.maxReward);
|
|
27341
|
+
if (spend === void 0 || reward === void 0) return null;
|
|
27342
|
+
const template = settings.template ?? {};
|
|
27343
|
+
const stake = baseUnits(template.evaluatorStake) ?? 0n;
|
|
27344
|
+
if (reward + stake <= spend) return null;
|
|
27345
|
+
return {
|
|
27346
|
+
error: stake > 0n ? "--max-reward plus --evaluator-stake must be at most --max-spend: each pick draws its reward and the stake" : "--max-reward must be at most --max-spend"
|
|
27347
|
+
};
|
|
27348
|
+
}
|
|
27349
|
+
function suggestionScheduleSettingsBody(scheduleId, opts, stored) {
|
|
27350
|
+
const id = parseScheduleId(scheduleId);
|
|
27351
|
+
if (typeof id !== "string") return id;
|
|
27352
|
+
const fields = settingsFields(opts, stored?.template);
|
|
27353
|
+
if ("error" in fields) return fields;
|
|
27354
|
+
if (Object.keys(fields).length === 0) {
|
|
27355
|
+
return { error: "Pass at least one setting to change (see --help)" };
|
|
27356
|
+
}
|
|
27357
|
+
const body = { scheduleId: id, ...fields };
|
|
27358
|
+
const parsed = SuggestionScheduleSettingsSchema.safeParse(body);
|
|
27359
|
+
if (!parsed.success) return issueError(parsed.error.issues[0]);
|
|
27360
|
+
const spend = spendCoversOnePick({
|
|
27361
|
+
maxSpendPerRun: fields.maxSpendPerRun ?? stored?.maxSpendPerRun,
|
|
27362
|
+
maxReward: fields.maxReward ?? stored?.maxReward,
|
|
27363
|
+
template: fields.template ?? stored?.template
|
|
27364
|
+
});
|
|
27365
|
+
if (spend) return spend;
|
|
27366
|
+
return body;
|
|
27367
|
+
}
|
|
27368
|
+
async function storedSettings(scheduleId) {
|
|
27369
|
+
const view = await apiGet(`/api/project-schedules/${scheduleId}`);
|
|
27370
|
+
const settings = view?.schedule?.suggestions;
|
|
27371
|
+
return settings?.template ? settings : { error: `Schedule ${scheduleId} is not a suggestions schedule` };
|
|
27372
|
+
}
|
|
27373
|
+
function addSuggestionScheduleOptions(command) {
|
|
27374
|
+
return command.option(
|
|
27375
|
+
"--rank <rank>",
|
|
27376
|
+
"Suggestions schedules: rank by backed (most pool shares among backer voters, default) or votes"
|
|
27377
|
+
).option(
|
|
27378
|
+
"--min-backed-share <fraction>",
|
|
27379
|
+
"Suggestions schedules: the least share of the pool's shares a suggestion's backer voters must hold, 0 to 1 (default 0)"
|
|
27380
|
+
).option(
|
|
27381
|
+
"--min-votes <count>",
|
|
27382
|
+
"Suggestions schedules: the least upvotes a suggestion must have (default 0)"
|
|
27383
|
+
).option(
|
|
27384
|
+
"--min-age <hours>",
|
|
27385
|
+
"Suggestions schedules: how long a suggestion must have been open, in hours (0 to 720, default 24)"
|
|
27386
|
+
).option(
|
|
27387
|
+
"--max-tasks <count>",
|
|
27388
|
+
`Suggestions schedules: most picks a run takes (1 to ${SUGGESTION_SCHEDULE_MAX_TASKS_PER_RUN}, default 1)`
|
|
27389
|
+
).option(
|
|
27390
|
+
"--max-spend <amount>",
|
|
27391
|
+
"Suggestions schedules: most one run's picks may draw together, in the payment token (e.g. 20): each pick draws its reward plus the template's evaluator stake, so it must cover --max-reward plus --evaluator-stake; required at create"
|
|
27392
|
+
).option(
|
|
27393
|
+
"--max-reward <amount>",
|
|
27394
|
+
"Suggestions schedules: a suggested reward above this is lowered to it, in the payment token; the API requires it plus the evaluator stake to be at most --max-spend; required at create"
|
|
27395
|
+
).option(
|
|
27396
|
+
"--decline-after <days|never>",
|
|
27397
|
+
"Suggestions schedules: decline an open suggestion that never reached --min-votes or --min-backed-share once it is this many days old (1 to 365, default 30), or never. Only those two thresholds count, so with both at 0 (the default) nothing is declined: set one of them when you use this"
|
|
27398
|
+
).option(
|
|
27399
|
+
"--default-mode <mode>",
|
|
27400
|
+
"Suggestions schedules: the task mode when a suggestion names none: bounty (default), claim or pitch. A suggestion whose own mode the runner's grant refuses is skipped"
|
|
27401
|
+
).option(
|
|
27402
|
+
"--email-picks",
|
|
27403
|
+
"Suggestions schedules: email the owner when a propose run has picks waiting (the default)"
|
|
27404
|
+
).option("--no-email-picks", "Suggestions schedules: do not email when picks are waiting");
|
|
27405
|
+
}
|
|
27406
|
+
var suggestionScheduleSettingsCommand = addSuggestionScheduleOptions(
|
|
27407
|
+
new Command145("suggestion-settings").description(
|
|
27408
|
+
"Change a suggestions schedule's settings, as the project's owner: any of its mode, ranking, thresholds, limits, stale-suggestion declines, default task mode, the picks-waiting email and the task template. Only the settings you pass change; a template flag changes only its own fields of the stored template, which the CLI reads first. A pending proposal is unchanged. Read the settings with `taskmarket project schedule show`. Costs 0.001 in the payment token"
|
|
27409
|
+
).argument("<scheduleId>", "Schedule id").option(
|
|
27410
|
+
"--mode <mode>",
|
|
27411
|
+
"propose (each run proposes its picks for you to confirm) or auto (each run creates the tasks)"
|
|
27412
|
+
).option("--duration <hours>", "Each task's deadline, in hours after it is created").option("--tags <tags>", "Comma-separated tags for each task").option("--evaluator <address>", "An evaluator for each task").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points (needs --evaluator)").option(
|
|
27413
|
+
"--evaluator-stake <amount>",
|
|
27414
|
+
"Stake behind the evaluator, from the budget (needs --evaluator)"
|
|
27415
|
+
).option("--evaluation-window <hours>", "Evaluation window in hours (needs --evaluator)").option("--appeal-window <hours>", "Appeal window in hours (needs --evaluator)")
|
|
27416
|
+
).action(async (value, opts) => {
|
|
27417
|
+
const id = parseScheduleId(value);
|
|
27418
|
+
if (typeof id !== "string") return void printError(id.error);
|
|
27419
|
+
let stored;
|
|
27420
|
+
if (setsTemplate(opts) || opts.maxSpend !== void 0 || opts.maxReward !== void 0) {
|
|
27421
|
+
let read4;
|
|
27422
|
+
try {
|
|
27423
|
+
read4 = await storedSettings(id);
|
|
27424
|
+
} catch (err) {
|
|
27425
|
+
return void renderFailure(err);
|
|
27426
|
+
}
|
|
27427
|
+
if ("error" in read4) return void printError(String(read4.error));
|
|
27428
|
+
stored = read4;
|
|
27429
|
+
}
|
|
27430
|
+
const body = suggestionScheduleSettingsBody(id, opts, stored);
|
|
27431
|
+
if ("error" in body) return void printError(String(body.error));
|
|
27432
|
+
await postProjectWrite(
|
|
27433
|
+
`/api/project-schedules/${String(body.scheduleId)}/suggestions-settings`,
|
|
27434
|
+
body,
|
|
27435
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27436
|
+
);
|
|
27437
|
+
});
|
|
27438
|
+
|
|
26605
27439
|
// src/commands/workflow-template.ts
|
|
26606
27440
|
import { readFile as readFile4 } from "fs/promises";
|
|
26607
|
-
import { Command as
|
|
26608
|
-
var
|
|
27441
|
+
import { Command as Command146 } from "commander";
|
|
27442
|
+
var UUID3 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
26609
27443
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
26610
27444
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
26611
27445
|
var PARAM_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
@@ -26632,7 +27466,7 @@ function templateChoice(value) {
|
|
|
26632
27466
|
if (WORKFLOW_PRESET_NAMES.includes(trimmed)) {
|
|
26633
27467
|
return { preset: trimmed };
|
|
26634
27468
|
}
|
|
26635
|
-
if (
|
|
27469
|
+
if (UUID3.test(trimmed)) return { templateId: trimmed.toLowerCase() };
|
|
26636
27470
|
if (OFFICIAL_WORKFLOW_TEMPLATE_ID.test(trimmed)) return { templateId: trimmed };
|
|
26637
27471
|
return {
|
|
26638
27472
|
error: `--template is a saved template id (UUID), an official template id (official:<slug>) or a preset: ${WORKFLOW_PRESET_NAMES.join(", ")}`
|
|
@@ -26698,7 +27532,7 @@ async function readValidTemplate(path9) {
|
|
|
26698
27532
|
}
|
|
26699
27533
|
return parsed.document;
|
|
26700
27534
|
}
|
|
26701
|
-
var createCommand3 = new
|
|
27535
|
+
var createCommand3 = new Command146("create").description(
|
|
26702
27536
|
"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"
|
|
26703
27537
|
).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
|
|
26704
27538
|
const template = await readValidTemplate(opts.file);
|
|
@@ -26709,7 +27543,7 @@ var createCommand3 = new Command142("create").description(
|
|
|
26709
27543
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26710
27544
|
);
|
|
26711
27545
|
});
|
|
26712
|
-
var updateCommand = new
|
|
27546
|
+
var updateCommand = new Command146("update").description(
|
|
26713
27547
|
"Replace a saved template with a JSON file, as the wallet that saved it. A change to its content makes a new version; workflows already made from it keep their document until their owner runs `taskmarket workflow update-template`. Costs 0.001 in the payment token"
|
|
26714
27548
|
).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
|
|
26715
27549
|
const choice = templateChoice(value);
|
|
@@ -26763,7 +27597,7 @@ function parseTemplateSearch(opts) {
|
|
|
26763
27597
|
}
|
|
26764
27598
|
return { query: query4 };
|
|
26765
27599
|
}
|
|
26766
|
-
var listCommand6 = new
|
|
27600
|
+
var listCommand6 = new Command146("list").description(
|
|
26767
27601
|
"List the official templates (official: true, ids official:<slug>), the built-in presets and a wallet's saved templates, newest first (your wallet unless --owner is given). Any wallet may make a workflow from any of them (free). With --search, --tag, --featured or --sort, search instead: one page of templates, featured first, with `hasMore`, `nextCursor` and the catalog's most used tags in `catalogTags`; each template lists its `tags` and `featured`"
|
|
26768
27602
|
).option("--owner <address>", "The wallet whose templates to list").option(
|
|
26769
27603
|
"--mine",
|
|
@@ -26848,7 +27682,7 @@ var listCommand6 = new Command142("list").description(
|
|
|
26848
27682
|
}
|
|
26849
27683
|
}
|
|
26850
27684
|
);
|
|
26851
|
-
var showCommand4 = new
|
|
27685
|
+
var showCommand4 = new Command146("show").description(
|
|
26852
27686
|
"Show a saved template, an official template (official:<slug>) or a preset (code, content, research): its version (a counter for a saved template, a content hash for an official one), the earlier versions of a saved template as `versions` (number, hash, date), whether it is `listed` in the gallery, its parameters, steps and worst case (free)"
|
|
26853
27687
|
).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
|
|
26854
27688
|
const choice = templateChoice(value);
|
|
@@ -26871,7 +27705,7 @@ function savedTemplateId(value, verb) {
|
|
|
26871
27705
|
}
|
|
26872
27706
|
return choice.templateId;
|
|
26873
27707
|
}
|
|
26874
|
-
var publishCommand = new
|
|
27708
|
+
var publishCommand = new Command146("publish").description(
|
|
26875
27709
|
"List a saved template in the public gallery, as the wallet that saved it, so others can find it with `template list --gallery` (and on the web Templates page) without being given its id; it is shown with your wallet as its author. It needs a description and at most 10 templates per wallet can be listed. Listing again changes nothing. Costs 0.001 in the payment token"
|
|
26876
27710
|
).argument("<templateId>", "Saved template id").action(async (value) => {
|
|
26877
27711
|
const id = savedTemplateId(value, "publish");
|
|
@@ -26882,7 +27716,7 @@ var publishCommand = new Command142("publish").description(
|
|
|
26882
27716
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26883
27717
|
);
|
|
26884
27718
|
});
|
|
26885
|
-
var unpublishCommand = new
|
|
27719
|
+
var unpublishCommand = new Command146("unpublish").description(
|
|
26886
27720
|
"Take a saved template out of the public gallery, as the wallet that saved it. It stays usable by anyone who has its id. Costs 0.001 in the payment token"
|
|
26887
27721
|
).argument("<templateId>", "Saved template id").action(async (value) => {
|
|
26888
27722
|
const id = savedTemplateId(value, "unpublish");
|
|
@@ -26893,7 +27727,7 @@ var unpublishCommand = new Command142("unpublish").description(
|
|
|
26893
27727
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26894
27728
|
);
|
|
26895
27729
|
});
|
|
26896
|
-
var deleteCommand2 = new
|
|
27730
|
+
var deleteCommand2 = new Command146("delete").description(
|
|
26897
27731
|
"Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
|
|
26898
27732
|
).argument("<templateId>", "Template id").action(async (value) => {
|
|
26899
27733
|
const choice = templateChoice(value);
|
|
@@ -26910,7 +27744,7 @@ var deleteCommand2 = new Command142("delete").description(
|
|
|
26910
27744
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
26911
27745
|
);
|
|
26912
27746
|
});
|
|
26913
|
-
var workflowTemplateCommand = new
|
|
27747
|
+
var workflowTemplateCommand = new Command146("template").description(
|
|
26914
27748
|
"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"
|
|
26915
27749
|
).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand4).addCommand(publishCommand).addCommand(unpublishCommand).addCommand(deleteCommand2);
|
|
26916
27750
|
async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
@@ -26930,19 +27764,41 @@ async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
|
26930
27764
|
}
|
|
26931
27765
|
|
|
26932
27766
|
// src/commands/project/schedule.ts
|
|
26933
|
-
var UUID3 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
26934
27767
|
var STATUSES = ["active", "paused", "cancelled", "completed"];
|
|
26935
|
-
function positiveNumber2(value, flag) {
|
|
26936
|
-
const parsed = Number(value);
|
|
26937
|
-
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
26938
|
-
return { error: `${flag} must be a positive number` };
|
|
26939
|
-
return parsed;
|
|
26940
|
-
}
|
|
26941
27768
|
function scheduleCreateBody(projectId, opts, workflow) {
|
|
26942
27769
|
const cadence = parseScheduleCadence(opts.cadence);
|
|
26943
27770
|
if ("error" in cadence) return { error: `--cadence: ${cadence.error}` };
|
|
27771
|
+
if (!opts.suggestions) {
|
|
27772
|
+
const stray = SUGGESTION_ONLY_FLAGS.find(([, key]) => opts[key] !== void 0);
|
|
27773
|
+
if (stray) {
|
|
27774
|
+
const flag = stray[1] === "emailPicks" && opts.emailPicks === false ? "--no-email-picks" : stray[0];
|
|
27775
|
+
return { error: `${flag} sets a suggestions schedule; pass --suggestions` };
|
|
27776
|
+
}
|
|
27777
|
+
}
|
|
26944
27778
|
let target;
|
|
26945
|
-
if (
|
|
27779
|
+
if (opts.suggestions) {
|
|
27780
|
+
if (workflow !== void 0 || opts.workflow !== void 0 || opts.workflowFile !== void 0) {
|
|
27781
|
+
return { error: "Pass one of --suggestions, --workflow or --workflow-file" };
|
|
27782
|
+
}
|
|
27783
|
+
for (const [flag, key] of [
|
|
27784
|
+
["--description", "description"],
|
|
27785
|
+
["--reward", "reward"]
|
|
27786
|
+
]) {
|
|
27787
|
+
if (opts[key] !== void 0) {
|
|
27788
|
+
return {
|
|
27789
|
+
error: `${flag} describes a task; a suggestions schedule takes each task's from its suggestion`
|
|
27790
|
+
};
|
|
27791
|
+
}
|
|
27792
|
+
}
|
|
27793
|
+
if (opts.continuePrevious) {
|
|
27794
|
+
return {
|
|
27795
|
+
error: "--continue-previous continues a task schedule; a suggestions schedule has none"
|
|
27796
|
+
};
|
|
27797
|
+
}
|
|
27798
|
+
const suggestions = suggestionScheduleConfig(opts);
|
|
27799
|
+
if ("error" in suggestions) return suggestions;
|
|
27800
|
+
target = { suggestions };
|
|
27801
|
+
} else if (workflow !== void 0) {
|
|
26946
27802
|
const taskFlag = TASK_TEMPLATE_FLAGS.find(([, key]) => opts[key] !== void 0);
|
|
26947
27803
|
if (taskFlag) {
|
|
26948
27804
|
return { error: `${taskFlag[0]} describes a task; a workflow schedule takes none` };
|
|
@@ -27009,44 +27865,11 @@ function taskTemplate(opts) {
|
|
|
27009
27865
|
reward,
|
|
27010
27866
|
duration,
|
|
27011
27867
|
mode,
|
|
27012
|
-
tags: opts.tags
|
|
27868
|
+
tags: parseTags(opts.tags)
|
|
27013
27869
|
};
|
|
27014
|
-
const
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
["--evaluation-window", opts.evaluationWindow],
|
|
27018
|
-
["--appeal-window", opts.appealWindow]
|
|
27019
|
-
];
|
|
27020
|
-
if (opts.evaluator === void 0) {
|
|
27021
|
-
const stray = evaluatorOnly.find(([, value]) => value !== void 0);
|
|
27022
|
-
if (stray) return { error: `${stray[0]} needs --evaluator` };
|
|
27023
|
-
} else {
|
|
27024
|
-
if (!ADDRESS.test(opts.evaluator)) {
|
|
27025
|
-
return { error: "--evaluator must be a wallet address (0x + 40 hex chars)" };
|
|
27026
|
-
}
|
|
27027
|
-
template.evaluator = opts.evaluator;
|
|
27028
|
-
if (opts.evaluatorFeeBps !== void 0) {
|
|
27029
|
-
if (!/^\d+$/.test(opts.evaluatorFeeBps) || Number(opts.evaluatorFeeBps) > 1e4) {
|
|
27030
|
-
return { error: "--evaluator-fee-bps must be an integer from 0 to 10000" };
|
|
27031
|
-
}
|
|
27032
|
-
template.evaluatorFeeBps = Number(opts.evaluatorFeeBps);
|
|
27033
|
-
}
|
|
27034
|
-
if (opts.evaluatorStake !== void 0) {
|
|
27035
|
-
const stake = parseAmount(opts.evaluatorStake, "--evaluator-stake");
|
|
27036
|
-
if (typeof stake !== "string") return stake;
|
|
27037
|
-
template.evaluatorStake = stake;
|
|
27038
|
-
}
|
|
27039
|
-
for (const [flag, value, field] of [
|
|
27040
|
-
["--evaluation-window", opts.evaluationWindow, "evaluationWindowHours"],
|
|
27041
|
-
["--appeal-window", opts.appealWindow, "appealWindowHours"]
|
|
27042
|
-
]) {
|
|
27043
|
-
if (value === void 0) continue;
|
|
27044
|
-
const hours = positiveNumber2(value, flag);
|
|
27045
|
-
if (typeof hours !== "number") return hours;
|
|
27046
|
-
template[field] = hours;
|
|
27047
|
-
}
|
|
27048
|
-
}
|
|
27049
|
-
return template;
|
|
27870
|
+
const terms = evaluatorTerms(opts);
|
|
27871
|
+
if ("error" in terms) return terms;
|
|
27872
|
+
return { ...template, ...terms };
|
|
27050
27873
|
}
|
|
27051
27874
|
async function resolveWorkflowTarget(projectId, opts) {
|
|
27052
27875
|
const pairs = opts.param ?? [];
|
|
@@ -27073,7 +27896,7 @@ async function resolveWorkflowTarget(projectId, opts) {
|
|
|
27073
27896
|
return { preset: value, ...params };
|
|
27074
27897
|
}
|
|
27075
27898
|
if (OFFICIAL_WORKFLOW_TEMPLATE_ID.test(value)) return { templateId: value, ...params };
|
|
27076
|
-
if (!
|
|
27899
|
+
if (!UUID2.test(value)) {
|
|
27077
27900
|
return {
|
|
27078
27901
|
error: `--workflow is a preset (${WORKFLOW_PRESET_NAMES.join(", ")}), an official template id (official:<slug>), a saved template id or a workflow id`
|
|
27079
27902
|
};
|
|
@@ -27113,44 +27936,52 @@ function scheduleSettingsBody(projectId, opts) {
|
|
|
27113
27936
|
}
|
|
27114
27937
|
return body;
|
|
27115
27938
|
}
|
|
27116
|
-
function
|
|
27117
|
-
return UUID3.test(value.trim()) ? value.trim().toLowerCase() : { error: "The schedule id must be a UUID" };
|
|
27118
|
-
}
|
|
27119
|
-
async function read(path9) {
|
|
27939
|
+
async function read2(path9) {
|
|
27120
27940
|
try {
|
|
27121
27941
|
printResult(await apiGet(path9));
|
|
27122
27942
|
} catch (err) {
|
|
27123
27943
|
renderFailure(err);
|
|
27124
27944
|
}
|
|
27125
27945
|
}
|
|
27126
|
-
var createCommand4 =
|
|
27127
|
-
|
|
27128
|
-
).
|
|
27129
|
-
"
|
|
27130
|
-
|
|
27131
|
-
)
|
|
27132
|
-
|
|
27133
|
-
|
|
27134
|
-
).
|
|
27135
|
-
|
|
27136
|
-
|
|
27137
|
-
|
|
27138
|
-
|
|
27139
|
-
|
|
27140
|
-
"--
|
|
27141
|
-
|
|
27142
|
-
|
|
27143
|
-
"--
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
-
|
|
27946
|
+
var createCommand4 = addSuggestionScheduleOptions(
|
|
27947
|
+
new Command147("create").description(
|
|
27948
|
+
"Create a schedule that opens a task from the project's budget on a cadence, starts a run of a workflow (--workflow or --workflow-file), or turns the top open suggestions into tasks (--suggestions), as the project's owner. The platform runner creates each task or run under your grant to it, and pays the action fee: grant it first (see `taskmarket project runner`). A slot is skipped while the previous task is open or the previous run is not settled, and failures in a row (3 by default) pause the schedule. A suggestions schedule proposes its picks for you to confirm (`taskmarket project suggestion proposals`) unless --mode auto; it needs --max-spend, --max-reward and --duration. Costs 0.001 in the payment token"
|
|
27949
|
+
).argument("<projectId>", "Project id").requiredOption(
|
|
27950
|
+
"--cadence <cadence>",
|
|
27951
|
+
'An ISO 8601 duration (PT30M, PT6H, P1D, P1W) or a five-field cron expression in UTC ("0 9 * * 1"); at least 30 minutes between runs, or the project minimum'
|
|
27952
|
+
).option(
|
|
27953
|
+
"--workflow <workflow>",
|
|
27954
|
+
"Run a workflow each slot instead of opening a task: a preset (" + WORKFLOW_PRESET_NAMES.join(", ") + "), an official template (official:<slug>), a saved template id, or a workflow id on this project. Not with the task flags"
|
|
27955
|
+
).option(
|
|
27956
|
+
"--param <name=value>",
|
|
27957
|
+
"A preset or template parameter value for --workflow; repeat it for each",
|
|
27958
|
+
collect6,
|
|
27959
|
+
[]
|
|
27960
|
+
).option("--workflow-file <path>", "Run this workflow document (JSON) each slot").option(
|
|
27961
|
+
"--suggestions",
|
|
27962
|
+
"Take the project's top open suggestions each slot and propose them as tasks (or create them with --mode auto), within the suggestions flags below; not with --workflow or the task's --description and --reward"
|
|
27963
|
+
).option("--description <text>", "Each task's description (task schedules)").option(
|
|
27964
|
+
"--reward <amount>",
|
|
27965
|
+
"Each task's reward in the payment token (e.g. 5), from the budget (task schedules)"
|
|
27966
|
+
).option(
|
|
27967
|
+
"--duration <hours>",
|
|
27968
|
+
"Each task's deadline, in hours after it opens (task and suggestions schedules)"
|
|
27969
|
+
).option(
|
|
27970
|
+
"--mode <mode>",
|
|
27971
|
+
"Task mode: bounty, claim or pitch (default bounty); with --suggestions, propose (default: you confirm each pick) or auto (each run creates the tasks)"
|
|
27972
|
+
).option("--tags <tags>", "Comma-separated tags").option("--evaluator <address>", "An evaluator for each task (optional)").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points (needs --evaluator)").option(
|
|
27973
|
+
"--evaluator-stake <amount>",
|
|
27974
|
+
"Stake behind the evaluator, from the budget (needs --evaluator)"
|
|
27975
|
+
).option("--evaluation-window <hours>", "Evaluation window in hours (needs --evaluator)").option("--appeal-window <hours>", "Appeal window in hours (needs --evaluator)").option(
|
|
27976
|
+
"--runs <count>",
|
|
27977
|
+
"How many runs the schedule makes (default: until cancelled or the project ends); a task schedule opens one task a run, and a suggestions schedule may create up to --max-tasks a run"
|
|
27978
|
+
).option("--continue-previous", "Each task continues the previous run's task (task schedules)").option("--start <time>", "The first slot, ISO 8601 (default: now, or the next cron time)")
|
|
27979
|
+
).action(async (id, opts) => {
|
|
27149
27980
|
const projectId = parseProjectId(id);
|
|
27150
27981
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
27151
|
-
let workflow;
|
|
27982
|
+
let workflow = null;
|
|
27152
27983
|
try {
|
|
27153
|
-
workflow = await resolveWorkflowTarget(projectId, opts);
|
|
27984
|
+
if (!opts.suggestions) workflow = await resolveWorkflowTarget(projectId, opts);
|
|
27154
27985
|
} catch (err) {
|
|
27155
27986
|
return void renderFailure(err);
|
|
27156
27987
|
}
|
|
@@ -27162,7 +27993,7 @@ var createCommand4 = new Command143("create").description(
|
|
|
27162
27993
|
});
|
|
27163
27994
|
});
|
|
27164
27995
|
var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
|
|
27165
|
-
var listCommand7 = new
|
|
27996
|
+
var listCommand7 = new Command147("list").description(
|
|
27166
27997
|
"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)"
|
|
27167
27998
|
).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(
|
|
27168
27999
|
"--status <status>",
|
|
@@ -27173,7 +28004,7 @@ var listCommand7 = new Command143("list").description(
|
|
|
27173
28004
|
if (owner) {
|
|
27174
28005
|
const query5 = ownerListQuery(owner.owner, opts, OWNER_SCHEDULE_STATUSES);
|
|
27175
28006
|
if (typeof query5 !== "string") return void printError(query5.error);
|
|
27176
|
-
return void await
|
|
28007
|
+
return void await read2(withChainId(`/api/schedules?${query5}`));
|
|
27177
28008
|
}
|
|
27178
28009
|
if (id === void 0) {
|
|
27179
28010
|
return void printError("Pass a project id, or --mine / --owner <address>");
|
|
@@ -27193,18 +28024,18 @@ var listCommand7 = new Command143("list").description(
|
|
|
27193
28024
|
if (opts.status) params.set("status", opts.status);
|
|
27194
28025
|
if (opts.limit) params.set("limit", opts.limit.trim());
|
|
27195
28026
|
const query4 = params.toString();
|
|
27196
|
-
await
|
|
28027
|
+
await read2(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
|
|
27197
28028
|
});
|
|
27198
|
-
var showCommand5 = new
|
|
27199
|
-
"Show a schedule (its target, task or
|
|
28029
|
+
var showCommand5 = new Command147("show").description(
|
|
28030
|
+
"Show a schedule (its target, task, workflow or suggestions, with workflowId, template or its suggestions settings) and its newest runs: opened, proposed, skipped with the reason, or failed, each with its task, workflowRunId, proposalId or taskIds (free)"
|
|
27200
28031
|
).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
27201
|
-
const id =
|
|
28032
|
+
const id = parseScheduleId(value);
|
|
27202
28033
|
if (typeof id !== "string") return void printError(id.error);
|
|
27203
|
-
await
|
|
28034
|
+
await read2(`/api/project-schedules/${id}`);
|
|
27204
28035
|
});
|
|
27205
28036
|
function actionCommand(action, description) {
|
|
27206
|
-
return new
|
|
27207
|
-
const id =
|
|
28037
|
+
return new Command147(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
28038
|
+
const id = parseScheduleId(value);
|
|
27208
28039
|
if (typeof id !== "string") return void printError(id.error);
|
|
27209
28040
|
await postProjectWrite(
|
|
27210
28041
|
`/api/project-schedules/${id}/${action}`,
|
|
@@ -27213,7 +28044,7 @@ function actionCommand(action, description) {
|
|
|
27213
28044
|
);
|
|
27214
28045
|
});
|
|
27215
28046
|
}
|
|
27216
|
-
var settingsCommand = new
|
|
28047
|
+
var settingsCommand = new Command147("settings").description(
|
|
27217
28048
|
"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"
|
|
27218
28049
|
).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) => {
|
|
27219
28050
|
const projectId = parseProjectId(id);
|
|
@@ -27235,8 +28066,8 @@ var settingsCommand = new Command143("settings").description(
|
|
|
27235
28066
|
maxAmount: ACTION_FEE_MAX_AMOUNT
|
|
27236
28067
|
});
|
|
27237
28068
|
});
|
|
27238
|
-
var projectScheduleCommand = new
|
|
27239
|
-
"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>`)"
|
|
28069
|
+
var projectScheduleCommand = new Command147("schedule").description(
|
|
28070
|
+
"Schedules: a task from the project's budget on a cadence, a workflow run, or tasks from the top suggestions, created by the platform runner once the project's automations are on (`taskmarket project automations on <projectId> --cap <amount>`)"
|
|
27240
28071
|
).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand5).addCommand(
|
|
27241
28072
|
actionCommand(
|
|
27242
28073
|
"pause",
|
|
@@ -27257,16 +28088,16 @@ var projectScheduleCommand = new Command143("schedule").description(
|
|
|
27257
28088
|
"stop-auto-payout",
|
|
27258
28089
|
"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)"
|
|
27259
28090
|
)
|
|
27260
|
-
).addCommand(settingsCommand);
|
|
27261
|
-
var projectRunnerCommand = new
|
|
28091
|
+
).addCommand(settingsCommand).addCommand(suggestionScheduleSettingsCommand);
|
|
28092
|
+
var projectRunnerCommand = new Command147("runner").description(
|
|
27262
28093
|
"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"
|
|
27263
28094
|
).action(async () => {
|
|
27264
|
-
await
|
|
28095
|
+
await read2(withChainId("/api/project-runner"));
|
|
27265
28096
|
});
|
|
27266
28097
|
|
|
27267
28098
|
// src/commands/project/transfer.ts
|
|
27268
|
-
import { Command as
|
|
27269
|
-
var proposeCommand = new
|
|
28099
|
+
import { Command as Command148 } from "commander";
|
|
28100
|
+
var proposeCommand = new Command148("propose").description(
|
|
27270
28101
|
"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"
|
|
27271
28102
|
).argument("<projectId>", "Project id").requiredOption("--to <address>", "The wallet that will own the project once it accepts").action(async (id, opts) => {
|
|
27272
28103
|
const projectId = parseProjectId(id);
|
|
@@ -27280,7 +28111,7 @@ var proposeCommand = new Command144("propose").description(
|
|
|
27280
28111
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27281
28112
|
);
|
|
27282
28113
|
});
|
|
27283
|
-
var acceptCommand2 = new
|
|
28114
|
+
var acceptCommand2 = new Command148("accept").description(
|
|
27284
28115
|
"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"
|
|
27285
28116
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
27286
28117
|
const projectId = parseProjectId(id);
|
|
@@ -27291,7 +28122,7 @@ var acceptCommand2 = new Command144("accept").description(
|
|
|
27291
28122
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27292
28123
|
);
|
|
27293
28124
|
});
|
|
27294
|
-
var cancelCommand = new
|
|
28125
|
+
var cancelCommand = new Command148("cancel").description(
|
|
27295
28126
|
"Withdraw the pending ownership proposal, as the project owner (costs 0.001 in the payment token)"
|
|
27296
28127
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
27297
28128
|
const projectId = parseProjectId(id);
|
|
@@ -27302,13 +28133,13 @@ var cancelCommand = new Command144("cancel").description(
|
|
|
27302
28133
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27303
28134
|
);
|
|
27304
28135
|
});
|
|
27305
|
-
var projectTransferCommand = new
|
|
28136
|
+
var projectTransferCommand = new Command148("transfer").description(
|
|
27306
28137
|
"Hand a project to another wallet in two steps: the owner proposes, the new owner accepts, and the owner can cancel before it does"
|
|
27307
28138
|
).addCommand(proposeCommand).addCommand(acceptCommand2).addCommand(cancelCommand);
|
|
27308
28139
|
|
|
27309
28140
|
// src/commands/project/show.ts
|
|
27310
|
-
import { Command as
|
|
27311
|
-
var projectShowCommand = new
|
|
28141
|
+
import { Command as Command149 } from "commander";
|
|
28142
|
+
var projectShowCommand = new Command149("show").description(
|
|
27312
28143
|
"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)"
|
|
27313
28144
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
27314
28145
|
const projectId = parseProjectId(id);
|
|
@@ -27317,7 +28148,7 @@ var projectShowCommand = new Command145("show").description(
|
|
|
27317
28148
|
printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
|
|
27318
28149
|
});
|
|
27319
28150
|
var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
|
|
27320
|
-
var projectBackersCommand = new
|
|
28151
|
+
var projectBackersCommand = new Command149("backers").description(
|
|
27321
28152
|
"List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
|
|
27322
28153
|
).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) => {
|
|
27323
28154
|
const projectId = parseProjectId(id);
|
|
@@ -27336,13 +28167,13 @@ var projectBackersCommand = new Command145("backers").description(
|
|
|
27336
28167
|
await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
|
|
27337
28168
|
);
|
|
27338
28169
|
});
|
|
27339
|
-
var projectForTaskCommand = new
|
|
28170
|
+
var projectForTaskCommand = new Command149("for-task").description("The project a task was funded from, or null when it was not (free)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
27340
28171
|
if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
|
|
27341
28172
|
return void printError("The task id must be 0x-prefixed hex");
|
|
27342
28173
|
}
|
|
27343
28174
|
printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
|
|
27344
28175
|
});
|
|
27345
|
-
var projectListCommand = new
|
|
28176
|
+
var projectListCommand = new Command149("list").description(
|
|
27346
28177
|
"List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
|
|
27347
28178
|
).option(
|
|
27348
28179
|
"--funding",
|
|
@@ -27393,7 +28224,7 @@ var projectListCommand = new Command145("list").description(
|
|
|
27393
28224
|
);
|
|
27394
28225
|
|
|
27395
28226
|
// src/commands/project/index.ts
|
|
27396
|
-
var projectCommand = new
|
|
28227
|
+
var projectCommand = new Command150("project").description(
|
|
27397
28228
|
"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"
|
|
27398
28229
|
);
|
|
27399
28230
|
projectCommand.addCommand(projectCreateCommand);
|
|
@@ -27424,7 +28255,7 @@ projectCommand.addCommand(projectForTaskCommand);
|
|
|
27424
28255
|
|
|
27425
28256
|
// src/commands/workflow.ts
|
|
27426
28257
|
import { readFile as readFile5 } from "fs/promises";
|
|
27427
|
-
import { Command as
|
|
28258
|
+
import { Command as Command151 } from "commander";
|
|
27428
28259
|
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}$/;
|
|
27429
28260
|
var FILE_MAX_BYTES2 = 256 * 1024;
|
|
27430
28261
|
function parseWorkflowText(text) {
|
|
@@ -27462,7 +28293,7 @@ function stepKey(value) {
|
|
|
27462
28293
|
}
|
|
27463
28294
|
return trimmed;
|
|
27464
28295
|
}
|
|
27465
|
-
async function
|
|
28296
|
+
async function read3(path9) {
|
|
27466
28297
|
try {
|
|
27467
28298
|
printResult(await apiGet(path9));
|
|
27468
28299
|
} catch (err) {
|
|
@@ -27488,7 +28319,7 @@ async function projectContext(projectId) {
|
|
|
27488
28319
|
runner
|
|
27489
28320
|
};
|
|
27490
28321
|
}
|
|
27491
|
-
var validateCommand = new
|
|
28322
|
+
var validateCommand = new Command151("validate").description(
|
|
27492
28323
|
"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)"
|
|
27493
28324
|
).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) => {
|
|
27494
28325
|
const parsed = await readDocument(opts.file ?? file);
|
|
@@ -27531,7 +28362,7 @@ var validateCommand = new Command147("validate").description(
|
|
|
27531
28362
|
document: result.document
|
|
27532
28363
|
});
|
|
27533
28364
|
});
|
|
27534
|
-
var createCommand5 = new
|
|
28365
|
+
var createCommand5 = new Command151("create").description(
|
|
27535
28366
|
"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"
|
|
27536
28367
|
).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
|
|
27537
28368
|
"--template <template>",
|
|
@@ -27574,7 +28405,7 @@ var createCommand5 = new Command147("create").description(
|
|
|
27574
28405
|
);
|
|
27575
28406
|
});
|
|
27576
28407
|
var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
|
|
27577
|
-
var listCommand8 = new
|
|
28408
|
+
var listCommand8 = new Command151("list").description(
|
|
27578
28409
|
"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)"
|
|
27579
28410
|
).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(
|
|
27580
28411
|
"--status <status>",
|
|
@@ -27585,7 +28416,7 @@ var listCommand8 = new Command147("list").description(
|
|
|
27585
28416
|
if (owner) {
|
|
27586
28417
|
const query5 = ownerListQuery(owner.owner, opts, OWNER_WORKFLOW_STATUSES);
|
|
27587
28418
|
if (typeof query5 !== "string") return void printError(query5.error);
|
|
27588
|
-
return void await
|
|
28419
|
+
return void await read3(withChainId(`/api/workflows?${query5}`));
|
|
27589
28420
|
}
|
|
27590
28421
|
if (id === void 0) {
|
|
27591
28422
|
return void printError("Pass a project id, or --mine / --owner <address>");
|
|
@@ -27602,9 +28433,9 @@ var listCommand8 = new Command147("list").description(
|
|
|
27602
28433
|
if (opts.limit) params.set("limit", opts.limit.trim());
|
|
27603
28434
|
if (opts.cursor) params.set("cursor", opts.cursor.trim());
|
|
27604
28435
|
const query4 = params.toString();
|
|
27605
|
-
await
|
|
28436
|
+
await read3(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
|
|
27606
28437
|
});
|
|
27607
|
-
var showCommand6 = new
|
|
28438
|
+
var showCommand6 = new Command151("show").description(
|
|
27608
28439
|
"Show a workflow, its validated document, its newest runs and, for one made from a template, `workflow.templateUpdate` (the version it has, the template's latest and `available`); when an update is available a `note` says how to apply it (free)"
|
|
27609
28440
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
27610
28441
|
const id = uuid(value, "workflow");
|
|
@@ -27617,7 +28448,7 @@ var showCommand6 = new Command147("show").description(
|
|
|
27617
28448
|
renderFailure(err);
|
|
27618
28449
|
}
|
|
27619
28450
|
});
|
|
27620
|
-
var updateTemplateCommand = new
|
|
28451
|
+
var updateTemplateCommand = new Command151("update-template").description(
|
|
27621
28452
|
"Apply the newest version of the template a workflow was made from, as the project owner: the document is made again from the template with the workflow's own parameter values and checked against the project, like a new workflow. It never happens on its own; `workflow show` says when an update is available. Runs already started keep the version they started with. Costs 0.001 in the payment token"
|
|
27622
28453
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
27623
28454
|
const id = uuid(value, "workflow");
|
|
@@ -27628,7 +28459,29 @@ var updateTemplateCommand = new Command147("update-template").description(
|
|
|
27628
28459
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27629
28460
|
);
|
|
27630
28461
|
});
|
|
27631
|
-
var
|
|
28462
|
+
var updateStepsCommand = new Command151("update-steps").description(
|
|
28463
|
+
"Replace a saved workflow's steps with a new JSON document (--file), as the project owner. The API checks it against the project as it checks a new workflow (step limit, worst case against the budget). Runs already started keep the steps they started with; the new steps apply to runs started afterwards. A workflow made from a template becomes hand-written, so update-template no longer applies to it. Get the current document with `workflow show`. Costs 0.001 in the payment token"
|
|
28464
|
+
).argument("<workflowId>", "Workflow id").option("--file <path>", "The new document, JSON").action(async (value, opts) => {
|
|
28465
|
+
const id = uuid(value, "workflow");
|
|
28466
|
+
if (typeof id !== "string") return void printError(id.error);
|
|
28467
|
+
const parsed = await readDocument(opts.file);
|
|
28468
|
+
if ("error" in parsed) return void printError(parsed.error);
|
|
28469
|
+
const result = validateWorkflowDocument(parsed.document, {
|
|
28470
|
+
stepLimit: WORKFLOW_STEP_LIMIT_MAX
|
|
28471
|
+
});
|
|
28472
|
+
if (!result.valid) {
|
|
28473
|
+
return void renderFailure(
|
|
28474
|
+
new Error(`The workflow document is invalid (${result.errors.length} errors)`),
|
|
28475
|
+
{ details: { errors: result.errors } }
|
|
28476
|
+
);
|
|
28477
|
+
}
|
|
28478
|
+
await postProjectWrite(
|
|
28479
|
+
`/api/project-workflows/${id}/update-steps`,
|
|
28480
|
+
{ workflowId: id, document: parsed.document },
|
|
28481
|
+
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28482
|
+
);
|
|
28483
|
+
});
|
|
28484
|
+
var runsCommand = new Command151("runs").description("Page through a workflow's runs, newest first (free)").argument("<workflowId>", "Workflow id").option("--limit <count>", "Runs per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (value, opts) => {
|
|
27632
28485
|
const id = uuid(value, "workflow");
|
|
27633
28486
|
if (typeof id !== "string") return void printError(id.error);
|
|
27634
28487
|
if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
|
|
@@ -27638,16 +28491,16 @@ var runsCommand = new Command147("runs").description("Page through a workflow's
|
|
|
27638
28491
|
if (opts.limit) params.set("limit", opts.limit.trim());
|
|
27639
28492
|
if (opts.cursor) params.set("cursor", opts.cursor.trim());
|
|
27640
28493
|
const query4 = params.toString();
|
|
27641
|
-
await
|
|
28494
|
+
await read3(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
|
|
27642
28495
|
});
|
|
27643
|
-
var statusCommand3 = new
|
|
28496
|
+
var statusCommand3 = new Command151("status").description(
|
|
27644
28497
|
"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)"
|
|
27645
28498
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
27646
28499
|
const id = uuid(value, "run");
|
|
27647
28500
|
if (typeof id !== "string") return void printError(id.error);
|
|
27648
|
-
await
|
|
28501
|
+
await read3(`/api/project-workflow-runs/${id}`);
|
|
27649
28502
|
});
|
|
27650
|
-
var runCommand2 = new
|
|
28503
|
+
var runCommand2 = new Command151("run").description(
|
|
27651
28504
|
"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"
|
|
27652
28505
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
27653
28506
|
const id = uuid(value, "workflow");
|
|
@@ -27659,7 +28512,7 @@ var runCommand2 = new Command147("run").description(
|
|
|
27659
28512
|
);
|
|
27660
28513
|
});
|
|
27661
28514
|
function stepCommand(action, description) {
|
|
27662
|
-
return new
|
|
28515
|
+
return new Command151(action).description(description).argument("<runId>", "Run id").requiredOption(
|
|
27663
28516
|
"--step <key>",
|
|
27664
28517
|
"The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
|
|
27665
28518
|
).action(async (value, opts) => {
|
|
@@ -27674,7 +28527,7 @@ function stepCommand(action, description) {
|
|
|
27674
28527
|
);
|
|
27675
28528
|
});
|
|
27676
28529
|
}
|
|
27677
|
-
var cancelCommand2 = new
|
|
28530
|
+
var cancelCommand2 = new Command151("cancel").description(
|
|
27678
28531
|
"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"
|
|
27679
28532
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
27680
28533
|
const id = uuid(value, "run");
|
|
@@ -27685,7 +28538,7 @@ var cancelCommand2 = new Command147("cancel").description(
|
|
|
27685
28538
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27686
28539
|
);
|
|
27687
28540
|
});
|
|
27688
|
-
var stopAutoPayoutCommand = new
|
|
28541
|
+
var stopAutoPayoutCommand = new Command151("stop-auto-payout").description(
|
|
27689
28542
|
"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"
|
|
27690
28543
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
27691
28544
|
const id = uuid(value, "run");
|
|
@@ -27696,7 +28549,7 @@ var stopAutoPayoutCommand = new Command147("stop-auto-payout").description(
|
|
|
27696
28549
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27697
28550
|
);
|
|
27698
28551
|
});
|
|
27699
|
-
var deleteCommand3 = new
|
|
28552
|
+
var deleteCommand3 = new Command151("delete").description(
|
|
27700
28553
|
"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"
|
|
27701
28554
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
27702
28555
|
const id = uuid(value, "workflow");
|
|
@@ -27718,22 +28571,22 @@ async function ownerRead(path9) {
|
|
|
27718
28571
|
renderFailure(err);
|
|
27719
28572
|
}
|
|
27720
28573
|
}
|
|
27721
|
-
var payoutListCommand = new
|
|
27722
|
-
"A run's payout proposals: what each accepted gating review recommends paying on the task it gates, with the exact accept confirming sends; visible to the project's owner and operators only (signed with your wallet); status is pending, confirmed, auto_paid (payout: auto, with mode, txHash and intentId), accepted_by_owner (the gated task was accepted by hand before the automatic payout landed; the runner paid nothing) or unavailable (free)"
|
|
28574
|
+
var payoutListCommand = new Command151("list").description(
|
|
28575
|
+
"A run's payout proposals: what each accepted gating review recommends paying on the task it gates, with the exact accept confirming sends; visible to the project's owner and operators only (signed with your wallet); status is pending, confirmed, auto_paid (payout: auto, with mode, txHash and intentId), accepted_by_owner (the gated task was accepted by hand before the automatic payout landed; the runner paid nothing) or unavailable (free). `kind` is payout, or refund when the review recommended nothing (an empty payout): the entries are rejected and the task cancelled, `refund` lists the entries. A payout: auto proposal is held until `holdUntil` for entrants to object (`objections` lists each one); `evidence` holds the check results of the recommendation"
|
|
27723
28576
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
27724
28577
|
const id = uuid(value, "run");
|
|
27725
28578
|
if (typeof id !== "string") return void printError(id.error);
|
|
27726
28579
|
await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
|
|
27727
28580
|
});
|
|
27728
|
-
var payoutShowCommand = new
|
|
27729
|
-
|
|
28581
|
+
var payoutShowCommand = new Command151("show").description(
|
|
28582
|
+
'Show a payout proposal: its status (pending, confirmed, auto_paid, accepted_by_owner or unavailable), mode, txHash and intentId once sent, the ranking and rationale, and `accept`, the winners and shares (basis points) confirming sends. A `kind: "refund"` proposal has `refund` instead: the entries rejected before the gated task is cancelled, returning its reward to the project budget. `holdUntil` is when a held automatic payout is sent, `objections` the entrants who objected (worker, reason, at) and `evidence` the per-entry checks of the recommendation, log file names and hash. Owner and operators, and an entrant of the gated task while the proposal is held (free)'
|
|
27730
28583
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
27731
28584
|
const id = uuid(value, "payout proposal");
|
|
27732
28585
|
if (typeof id !== "string") return void printError(id.error);
|
|
27733
28586
|
await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
|
|
27734
28587
|
});
|
|
27735
|
-
var payoutConfirmCommand = new
|
|
27736
|
-
|
|
28588
|
+
var payoutConfirmCommand = new Command151("confirm").description(
|
|
28589
|
+
'Confirm a pending payout proposal, as the project\'s owner: sends exactly the accept it shows (`taskmarket workflow payout show` prints the winners and shares first), paying the gated task out. Refused unless the proposal is pending (an auto_paid one was already sent by the runner). Costs the accept, paid like `task accept-submissions`. A `kind: "refund"` proposal (the review recommended nothing) is confirmed the same way, but costs one action fee and the platform runner then rejects every active entry of the gated task and cancels it, returning the reward to the project budget; its status turns confirmed, then reads Refunded in `reason` once the task is cancelled'
|
|
27737
28590
|
).argument("<proposalId>", "Payout proposal id").action(async (value) => {
|
|
27738
28591
|
const id = uuid(value, "payout proposal");
|
|
27739
28592
|
if (typeof id !== "string") return void printError(id.error);
|
|
@@ -27744,21 +28597,49 @@ var payoutConfirmCommand = new Command147("confirm").description(
|
|
|
27744
28597
|
} catch (err) {
|
|
27745
28598
|
return void renderFailure(err);
|
|
27746
28599
|
}
|
|
27747
|
-
|
|
28600
|
+
const refund = view.kind === "refund";
|
|
28601
|
+
if (view.status !== "pending" || (refund ? !view.refund : view.accept === null)) {
|
|
27748
28602
|
return void printError(
|
|
27749
|
-
view.status === "unavailable" ? `Payout proposal ${id} is unavailable (${view.reason ?? "no valid recommendation"}); accept the gated task by hand with
|
|
28603
|
+
view.status === "unavailable" ? `Payout proposal ${id} is unavailable (${view.reason ?? "no valid recommendation"}); ${refund ? "reject the entries and cancel the gated task by hand with `taskmarket task reject-all-submissions` and `taskmarket task cancel`" : "accept the gated task by hand with `taskmarket task accept-submissions`"}` : `Payout proposal ${id} is ${view.status}, not pending; there is nothing to confirm`
|
|
27750
28604
|
);
|
|
27751
28605
|
}
|
|
27752
28606
|
await postProjectWrite(
|
|
27753
28607
|
`/api/project-workflow-payouts/${id}/confirm`,
|
|
27754
28608
|
{ proposalId: id },
|
|
27755
|
-
{
|
|
28609
|
+
{
|
|
28610
|
+
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
28611
|
+
extra: refund ? { refund: view.refund } : { accept: view.accept }
|
|
28612
|
+
}
|
|
27756
28613
|
);
|
|
27757
28614
|
});
|
|
27758
|
-
var
|
|
28615
|
+
var payoutObjectCommand = new Command151("object").description(
|
|
28616
|
+
`Object to an automatic payout or refund held for objections, as an entrant of the gated task (a wallet with an active submission on it; \`payout.pending_auto\` tells you when a hold starts, with the proposal id). Once per proposal, while the hold is open (\`holdUntil\` in \`payout show\`). The proposal then waits for the owner to confirm it and the owner is told. Needs --reason (1 to ${WORKFLOW_OBJECTION_REASON_MAX} characters). Free; signed with your wallet`
|
|
28617
|
+
).argument("<proposalId>", "Payout proposal id").requiredOption("--reason <text>", "Why you object, shown to the owner").action(async (value, opts) => {
|
|
28618
|
+
const id = uuid(value, "payout proposal");
|
|
28619
|
+
if (typeof id !== "string") return void printError(id.error);
|
|
28620
|
+
const reason = opts.reason.trim();
|
|
28621
|
+
if (reason.length < 1 || reason.length > WORKFLOW_OBJECTION_REASON_MAX) {
|
|
28622
|
+
return void printError(`--reason must be 1 to ${WORKFLOW_OBJECTION_REASON_MAX} characters`);
|
|
28623
|
+
}
|
|
28624
|
+
const auth = await signReadAuth();
|
|
28625
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
28626
|
+
return void printError("Objecting needs a wallet. Run `taskmarket init` first.");
|
|
28627
|
+
}
|
|
28628
|
+
try {
|
|
28629
|
+
const { data, idempotencyKey } = await apiPost(
|
|
28630
|
+
`/api/project-workflow-payouts/${id}/object`,
|
|
28631
|
+
{ proposalId: id, reason, chainId: selectedNetwork().chainId },
|
|
28632
|
+
{ headers: auth.headers }
|
|
28633
|
+
);
|
|
28634
|
+
printResult(data, { idempotencyKey });
|
|
28635
|
+
} catch (err) {
|
|
28636
|
+
renderFailure(err);
|
|
28637
|
+
}
|
|
28638
|
+
});
|
|
28639
|
+
var payoutCommand = new Command151("payout").description(
|
|
27759
28640
|
"Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
|
|
27760
|
-
).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand);
|
|
27761
|
-
var settingsCommand2 = new
|
|
28641
|
+
).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand).addCommand(payoutObjectCommand);
|
|
28642
|
+
var settingsCommand2 = new Command151("settings").description(
|
|
27762
28643
|
`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`
|
|
27763
28644
|
).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
|
|
27764
28645
|
const projectId = parseProjectId(id);
|
|
@@ -27789,7 +28670,7 @@ var settingsCommand2 = new Command147("settings").description(
|
|
|
27789
28670
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27790
28671
|
);
|
|
27791
28672
|
});
|
|
27792
|
-
var workflowCommand = new
|
|
28673
|
+
var workflowCommand = new Command151("workflow").description(
|
|
27793
28674
|
"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"
|
|
27794
28675
|
).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand6).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
|
|
27795
28676
|
stepCommand(
|
|
@@ -27801,11 +28682,11 @@ var workflowCommand = new Command147("workflow").description(
|
|
|
27801
28682
|
"retry",
|
|
27802
28683
|
"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)"
|
|
27803
28684
|
)
|
|
27804
|
-
).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
|
|
28685
|
+
).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(updateStepsCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
|
|
27805
28686
|
|
|
27806
28687
|
// src/commands/drops.ts
|
|
27807
|
-
import { Command as
|
|
27808
|
-
var listCommand9 = new
|
|
28688
|
+
import { Command as Command152 } from "commander";
|
|
28689
|
+
var listCommand9 = new Command152("list").description("List public Task Drops, ones accepting work first").option("--limit <n>", "Maximum drops to return (1-48)", "24").option("--cursor <cursor>", "nextCursor from a previous page").option("--status <status>", "ended: only drops no longer accepting work, newest first").option("--worker <address>", "Only drops this wallet entered (a submission, pitch or bid)").option("--entered", "Only drops your wallet entered (--worker with your own address)").action(
|
|
27809
28690
|
async (opts) => {
|
|
27810
28691
|
try {
|
|
27811
28692
|
if (opts.worker && opts.entered) throw new Error("Pass --worker or --entered, not both");
|
|
@@ -27833,7 +28714,7 @@ var listCommand9 = new Command148("list").description("List public Task Drops, o
|
|
|
27833
28714
|
}
|
|
27834
28715
|
}
|
|
27835
28716
|
);
|
|
27836
|
-
var showCommand7 = new
|
|
28717
|
+
var showCommand7 = new Command152("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
|
|
27837
28718
|
try {
|
|
27838
28719
|
const input = parseInput(TaskDropGetInputSchema, { taskDropId });
|
|
27839
28720
|
const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
|
|
@@ -27845,7 +28726,7 @@ var showCommand7 = new Command148("show").description("Show a Task Drop and its
|
|
|
27845
28726
|
renderFailure(err);
|
|
27846
28727
|
}
|
|
27847
28728
|
});
|
|
27848
|
-
var subscribeCommand = new
|
|
28729
|
+
var subscribeCommand = new Command152("subscribe").description("Subscribe an email to one Task Drop, or with --official to every official drop").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to notify").option("--official", "Subscribe to all official Task Drops").option("--wallet <address>", "Wallet address to associate with the subscription").action(
|
|
27849
28730
|
async (taskDropId, opts) => {
|
|
27850
28731
|
try {
|
|
27851
28732
|
if (opts.official) {
|
|
@@ -27873,7 +28754,7 @@ var subscribeCommand = new Command148("subscribe").description("Subscribe an ema
|
|
|
27873
28754
|
}
|
|
27874
28755
|
}
|
|
27875
28756
|
);
|
|
27876
|
-
var statusCommand4 = new
|
|
28757
|
+
var statusCommand4 = new Command152("status").description("Check whether an email is subscribed to a Task Drop, or with --official to all").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to check").option("--official", "Check the all-official-drops subscription").action(async (taskDropId, opts) => {
|
|
27877
28758
|
try {
|
|
27878
28759
|
if (opts.official) {
|
|
27879
28760
|
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
@@ -27890,15 +28771,15 @@ var statusCommand4 = new Command148("status").description("Check whether an emai
|
|
|
27890
28771
|
renderFailure(err);
|
|
27891
28772
|
}
|
|
27892
28773
|
});
|
|
27893
|
-
var dropsCommand = new
|
|
28774
|
+
var dropsCommand = new Command152("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand7).addCommand(subscribeCommand).addCommand(statusCommand4);
|
|
27894
28775
|
|
|
27895
28776
|
// src/commands/hooks.ts
|
|
27896
|
-
import { Command as
|
|
28777
|
+
import { Command as Command154 } from "commander";
|
|
27897
28778
|
import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
|
|
27898
28779
|
|
|
27899
28780
|
// src/lib/listing-submissions.ts
|
|
27900
28781
|
import { readFile as readFile6 } from "fs/promises";
|
|
27901
|
-
import { Command as
|
|
28782
|
+
import { Command as Command153 } from "commander";
|
|
27902
28783
|
var NOTICE = "Submitted for staff review. The action fee is kept whether the submission is approved or rejected. Approval opens a review pull request; `listed` turns true once the entry is served.";
|
|
27903
28784
|
function prepareListingFile(kind, text) {
|
|
27904
28785
|
if (Buffer.byteLength(text, "utf8") > LISTING_SUBMISSION_MAX_BYTES) {
|
|
@@ -27955,7 +28836,7 @@ function prepareListingFile(kind, text) {
|
|
|
27955
28836
|
}
|
|
27956
28837
|
function submitCommandFor(kind) {
|
|
27957
28838
|
const what = kind === "catalog" ? "catalog entry (kind x402-endpoint)" : "hook manifest";
|
|
27958
|
-
return new
|
|
28839
|
+
return new Command153("submit").description(
|
|
27959
28840
|
`Submit a ${what} for staff review. Pays the standard action fee, kept either way; needs an ERC-8004 identity on the selected network`
|
|
27960
28841
|
).requiredOption("--file <path>", `Path to the ${what} JSON file`).action(async (opts) => {
|
|
27961
28842
|
let text;
|
|
@@ -27987,7 +28868,7 @@ function submitCommandFor(kind) {
|
|
|
27987
28868
|
});
|
|
27988
28869
|
}
|
|
27989
28870
|
function submissionsCommandFor(kind) {
|
|
27990
|
-
return new
|
|
28871
|
+
return new Command153("submissions").description(
|
|
27991
28872
|
`List the ${kind === "catalog" ? "catalog entries" : "hook listings"} you submitted and their status`
|
|
27992
28873
|
).option("--status <status>", `Only this status: ${LISTING_SUBMISSION_STATUSES.join(", ")}`).option("--limit <n>", "Maximum submissions to return (1-100)", "50").action(async (opts) => {
|
|
27993
28874
|
if (opts.status && !LISTING_SUBMISSION_STATUSES.includes(opts.status)) {
|
|
@@ -28053,7 +28934,7 @@ async function probeHookVersion(entry, chainId) {
|
|
|
28053
28934
|
return reverted ? { ...entry, hookVersion: 1 } : entry;
|
|
28054
28935
|
}
|
|
28055
28936
|
}
|
|
28056
|
-
var listCommand10 = new
|
|
28937
|
+
var listCommand10 = new Command154("list").description(
|
|
28057
28938
|
"List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
|
|
28058
28939
|
).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(
|
|
28059
28940
|
"--cursor <cursor>",
|
|
@@ -28092,7 +28973,7 @@ var listCommand10 = new Command150("list").description(
|
|
|
28092
28973
|
}
|
|
28093
28974
|
}
|
|
28094
28975
|
);
|
|
28095
|
-
var showCommand8 = new
|
|
28976
|
+
var showCommand8 = new Command154("show").description(
|
|
28096
28977
|
"Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
|
|
28097
28978
|
).argument("<address>", "Hook contract address").action(async (address3) => {
|
|
28098
28979
|
try {
|
|
@@ -28112,7 +28993,7 @@ var showCommand8 = new Command150("show").description(
|
|
|
28112
28993
|
renderFailure(err);
|
|
28113
28994
|
}
|
|
28114
28995
|
});
|
|
28115
|
-
var encodeConfigCommand = new
|
|
28996
|
+
var encodeConfigCommand = new Command154("encode-config").description(
|
|
28116
28997
|
"Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
|
|
28117
28998
|
).argument("<address>", "Hook contract address").requiredOption(
|
|
28118
28999
|
"--values <json>",
|
|
@@ -28141,7 +29022,7 @@ var encodeConfigCommand = new Command150("encode-config").description(
|
|
|
28141
29022
|
renderFailure(err);
|
|
28142
29023
|
}
|
|
28143
29024
|
});
|
|
28144
|
-
var attachmentConfigCommand = new
|
|
29025
|
+
var attachmentConfigCommand = new Command154("attachment-config").description(
|
|
28145
29026
|
"Show the protocol-default hook order and maximum hooks per task on the selected --network"
|
|
28146
29027
|
).action(async () => {
|
|
28147
29028
|
try {
|
|
@@ -28150,16 +29031,16 @@ var attachmentConfigCommand = new Command150("attachment-config").description(
|
|
|
28150
29031
|
renderFailure(err);
|
|
28151
29032
|
}
|
|
28152
29033
|
});
|
|
28153
|
-
var hooksCommand = new
|
|
29034
|
+
var hooksCommand = new Command154("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand8).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand).addCommand(submitCommandFor("hook")).addCommand(submissionsCommandFor("hook"));
|
|
28154
29035
|
|
|
28155
29036
|
// src/commands/catalog/index.ts
|
|
28156
|
-
import { Command as
|
|
28157
|
-
var catalogCommand = new
|
|
29037
|
+
import { Command as Command155 } from "commander";
|
|
29038
|
+
var catalogCommand = new Command155("catalog").description("Submit paid endpoints to the Taskmarket catalog and track your submissions").addCommand(submitCommandFor("catalog")).addCommand(submissionsCommandFor("catalog"));
|
|
28158
29039
|
|
|
28159
29040
|
// src/commands/tap.ts
|
|
28160
29041
|
import { promises as fs12 } from "fs";
|
|
28161
|
-
import { Command as
|
|
28162
|
-
var tapCommand = new
|
|
29042
|
+
import { Command as Command156 } from "commander";
|
|
29043
|
+
var tapCommand = new Command156("tap").description(
|
|
28163
29044
|
"Manage the TAP signing key used on tasks that require TAP verification"
|
|
28164
29045
|
);
|
|
28165
29046
|
tapCommand.command("import").description(
|
|
@@ -28318,7 +29199,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
|
|
|
28318
29199
|
});
|
|
28319
29200
|
|
|
28320
29201
|
// src/commands/hire.ts
|
|
28321
|
-
import { Command as
|
|
29202
|
+
import { Command as Command157 } from "commander";
|
|
28322
29203
|
var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
|
|
28323
29204
|
async function lookupListedService(worker, serviceId) {
|
|
28324
29205
|
let listing;
|
|
@@ -28350,7 +29231,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
|
|
|
28350
29231
|
}
|
|
28351
29232
|
return null;
|
|
28352
29233
|
}
|
|
28353
|
-
var hireCommand = new
|
|
29234
|
+
var hireCommand = new Command157("hire").description(
|
|
28354
29235
|
"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."
|
|
28355
29236
|
).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(
|
|
28356
29237
|
"--requires-evaluator",
|
|
@@ -28413,7 +29294,7 @@ hireCommand.action(async (worker, opts) => {
|
|
|
28413
29294
|
// src/index.ts
|
|
28414
29295
|
var require2 = createRequire(import.meta.url);
|
|
28415
29296
|
var { version } = require2("../package.json");
|
|
28416
|
-
var program = new
|
|
29297
|
+
var program = new Command158();
|
|
28417
29298
|
setLastErrorCliVersion(version);
|
|
28418
29299
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
28419
29300
|
program.option(
|