@lucid-agents/taskmarket 1.28.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-compatibility.json +1 -1
- package/dist/{api-IV2LK5CF.js → api-JLEPMDTE.js} +2 -2
- package/dist/{channels-GM4PE3LJ.js → channels-BUVR2LSZ.js} +4 -4
- package/dist/{chunk-MWLJU6TX.js → chunk-5YR4AZAD.js} +3 -3
- package/dist/{chunk-UTVPFCAV.js → chunk-6C63PTFL.js} +9 -8
- package/dist/{chunk-MOKEWGED.js → chunk-CJS2PHFX.js} +225 -43
- package/dist/{chunk-OFZJJRJG.js → chunk-CPYULZB3.js} +3 -3
- package/dist/{chunk-QUYCPKAV.js → chunk-E7HXLN2A.js} +2 -2
- package/dist/{chunk-6XSCWMWF.js → chunk-HET5ZDJT.js} +1 -1
- package/dist/{chunk-YRAEI25P.js → chunk-J27HWZ7Y.js} +1 -1
- package/dist/{chunk-GL3YWOBS.js → chunk-MSTGI2YG.js} +1 -1
- package/dist/{chunk-ZUJOFDF5.js → chunk-QS4JQF6W.js} +5 -5
- package/dist/{chunk-5UCQ4CTG.js → chunk-RY4U7U45.js} +4793 -3978
- package/dist/{chunk-JU7EXT2K.js → chunk-S52R3ZY5.js} +1 -1
- package/dist/{chunk-JG7RZOLG.js → chunk-VE4GYPEZ.js} +1 -1
- package/dist/{doctor-L22YVTB2.js → doctor-RYO3E7UL.js} +15 -11
- package/dist/index.js +625 -174
- package/dist/{launch-QG6GW2RQ.js → launch-5NLS7GTY.js} +20 -155
- package/dist/pi-extensions/xgate.cjs +3009 -2282
- package/dist/{read-auth-YA3TQYY6.js → read-auth-GIBB7BSS.js} +3 -3
- package/dist/{reconcile-TPFGJNMP.js → reconcile-YEIABUC6.js} +4 -4
- package/dist/{status-GSCNQCSX.js → status-K3CANP2J.js} +8 -8
- package/dist/{sync-pull-NCOPVSGZ.js → sync-pull-JK2V7ZZF.js} +4 -4
- package/dist/{task-access-grants-6TS6JMKK.js → task-access-grants-FS7OSOE2.js} +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
listWorkerSubmissions,
|
|
14
14
|
submitTaskFiles,
|
|
15
15
|
taskRequirementsOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6C63PTFL.js";
|
|
17
17
|
import {
|
|
18
18
|
ComputeCreditError,
|
|
19
19
|
applyComputeCreditSetup,
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
refusedPaidWrite,
|
|
36
36
|
releasePendingComputePurchase,
|
|
37
37
|
resolvePendingComputePurchases
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-5YR4AZAD.js";
|
|
39
39
|
import {
|
|
40
40
|
signReadAuth
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-E7HXLN2A.js";
|
|
42
42
|
import {
|
|
43
43
|
saveTaskAccessGrant,
|
|
44
44
|
taskAccessGrantHeaders
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-MSTGI2YG.js";
|
|
46
46
|
import {
|
|
47
47
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
48
48
|
X402PayError,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
setX402PolicyRuleEnabled,
|
|
61
61
|
signSponsoredTempoTransfer,
|
|
62
62
|
signTaskmarketFeePayment
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-VE4GYPEZ.js";
|
|
64
64
|
import {
|
|
65
65
|
ApiError,
|
|
66
66
|
KeystoreExistsError,
|
|
@@ -116,11 +116,13 @@ import {
|
|
|
116
116
|
withErrorContext,
|
|
117
117
|
withIdempotentWrite,
|
|
118
118
|
withTapSignature
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-HET5ZDJT.js";
|
|
120
120
|
import {
|
|
121
121
|
AGENT_AVATAR_MAX_BYTES,
|
|
122
122
|
AGENT_HIRES_ROLES,
|
|
123
|
+
AGENT_LISTING_LIMITS,
|
|
123
124
|
AGENT_LISTING_REPORT_REASONS,
|
|
125
|
+
AGENT_SKILL_REQUEST_BODY_LIMIT_BYTES,
|
|
124
126
|
ActivityFeedInputSchema,
|
|
125
127
|
ActivityHeatmapInputSchema,
|
|
126
128
|
ActorType,
|
|
@@ -134,10 +136,13 @@ import {
|
|
|
134
136
|
AgentMessageEnvelopeSchema,
|
|
135
137
|
AgentServiceRecordsResponseSchema,
|
|
136
138
|
AgentTimeSeriesInputSchema,
|
|
139
|
+
AgentUserSkillArchiveWriteSchema,
|
|
140
|
+
AgentUserSkillBundleWriteSchema,
|
|
137
141
|
BUG_REPORT_SEVERITIES,
|
|
138
142
|
BUG_REPORT_STATUSES,
|
|
139
143
|
BUG_REPORT_VISIBILITIES,
|
|
140
144
|
BugReportMessageBodySchema,
|
|
145
|
+
CAPABILITY_LIMIT_MESSAGE,
|
|
141
146
|
CapabilitiesListInputSchema,
|
|
142
147
|
CapabilitiesListResponseSchema,
|
|
143
148
|
CrossChainFundingConfigOutputSchema,
|
|
@@ -191,6 +196,8 @@ import {
|
|
|
191
196
|
SubmissionReviewAssessmentInputSchema,
|
|
192
197
|
SubmissionReviewAssessmentOutputSchema,
|
|
193
198
|
SubmissionReviewCorrectionSchema,
|
|
199
|
+
SubmissionReviewFeedbackInputSchema,
|
|
200
|
+
SubmissionReviewFeedbackOutputSchema,
|
|
194
201
|
SubmissionReviewHistoryInputSchema,
|
|
195
202
|
SubmissionReviewHistoryOutputSchema,
|
|
196
203
|
SubmissionReviewJobStatusSchema,
|
|
@@ -207,6 +214,7 @@ import {
|
|
|
207
214
|
SubmissionReviewTaskInputSchema,
|
|
208
215
|
SubmitBugReportInputSchema,
|
|
209
216
|
TaskActionQueueInputSchema,
|
|
217
|
+
TaskCapabilitiesSchema,
|
|
210
218
|
TaskChildListSchema,
|
|
211
219
|
TaskDropDirectoryInputSchema,
|
|
212
220
|
TaskDropGetInputSchema,
|
|
@@ -219,6 +227,9 @@ import {
|
|
|
219
227
|
TaskTermsError,
|
|
220
228
|
TaskVerifierRequirement,
|
|
221
229
|
TermsPresetName,
|
|
230
|
+
USER_SKILL_GIT_MODES,
|
|
231
|
+
USER_SKILL_LIMITS,
|
|
232
|
+
USER_SKILL_SANDBOX_LIMITS,
|
|
222
233
|
WALLET_BRIDGE_ORIGIN_CHAIN_ID,
|
|
223
234
|
WALLET_BRIDGE_TEMPO_CHAIN_ID,
|
|
224
235
|
WORKFLOW_PRESET_NAMES,
|
|
@@ -250,6 +261,7 @@ import {
|
|
|
250
261
|
buildWithdrawDreamsMessage,
|
|
251
262
|
capabilityRejectionReason,
|
|
252
263
|
claimStakeToPost,
|
|
264
|
+
classifyUserSkillEntry,
|
|
253
265
|
clientValidityWindowSeconds,
|
|
254
266
|
compareSubmissionVersionsNewestFirst,
|
|
255
267
|
coreChains,
|
|
@@ -288,21 +300,25 @@ import {
|
|
|
288
300
|
settlerModeContracts,
|
|
289
301
|
signSponsoredVault7702Call,
|
|
290
302
|
solanaTaskChainIds,
|
|
303
|
+
splitUserSkill,
|
|
291
304
|
sponsoredVaultRelayKind,
|
|
292
305
|
svmChain,
|
|
293
306
|
taskmarketChain,
|
|
294
307
|
unknownCapabilityMessage,
|
|
295
308
|
usdcToBaseUnits,
|
|
309
|
+
userSkillArchiveWriteChange,
|
|
310
|
+
userSkillCreateWriteChange,
|
|
311
|
+
userSkillVersionWriteChange,
|
|
296
312
|
validateWorkflowDocument,
|
|
297
313
|
validateWorkflowTemplate,
|
|
298
314
|
vaultCallGasLimit7702,
|
|
299
315
|
verifierProviderId,
|
|
300
316
|
verifiersUnsupportedOnChain
|
|
301
|
-
} from "./chunk-
|
|
317
|
+
} from "./chunk-RY4U7U45.js";
|
|
302
318
|
import "./chunk-S7SJMJ2I.js";
|
|
303
319
|
|
|
304
320
|
// src/index.ts
|
|
305
|
-
import { Command as
|
|
321
|
+
import { Command as Command139 } from "commander";
|
|
306
322
|
import { createRequire } from "module";
|
|
307
323
|
|
|
308
324
|
// src/commands/init.ts
|
|
@@ -6838,6 +6854,7 @@ import { Command as Command7, Option } from "commander";
|
|
|
6838
6854
|
import { z as z2 } from "zod";
|
|
6839
6855
|
|
|
6840
6856
|
// src/lib/submission-reviews.ts
|
|
6857
|
+
import { randomUUID } from "crypto";
|
|
6841
6858
|
import { z } from "zod";
|
|
6842
6859
|
var controlOutput = z.object({
|
|
6843
6860
|
runId: z.string().uuid(),
|
|
@@ -6847,6 +6864,7 @@ var correctionOutput = z.object({
|
|
|
6847
6864
|
correctionId: z.string().uuid(),
|
|
6848
6865
|
createdAt: z.string().datetime()
|
|
6849
6866
|
});
|
|
6867
|
+
var FEEDBACK_GRANT_SECONDS = 240;
|
|
6850
6868
|
var query2 = (values) => {
|
|
6851
6869
|
const params = new URLSearchParams();
|
|
6852
6870
|
for (const [key, value] of Object.entries(values))
|
|
@@ -7036,6 +7054,52 @@ function createSubmissionReviewClient(options) {
|
|
|
7036
7054
|
key
|
|
7037
7055
|
);
|
|
7038
7056
|
},
|
|
7057
|
+
async feedback(input, key) {
|
|
7058
|
+
const checked = SubmissionReviewFeedbackInputSchema.pick({
|
|
7059
|
+
runId: true,
|
|
7060
|
+
chainId: true,
|
|
7061
|
+
submissionId: true,
|
|
7062
|
+
assessmentId: true,
|
|
7063
|
+
target: true,
|
|
7064
|
+
verdict: true,
|
|
7065
|
+
note: true
|
|
7066
|
+
}).parse(input);
|
|
7067
|
+
const idempotencyKey = z.string().uuid().parse(resolveIdempotencyKey(key)).toLowerCase();
|
|
7068
|
+
return withIdempotentWrite(idempotencyKey, async () => {
|
|
7069
|
+
const signer = await options.signer();
|
|
7070
|
+
const grantId = randomUUID();
|
|
7071
|
+
const grantExpiresAt = Math.floor(now() / 1e3) + FEEDBACK_GRANT_SECONDS;
|
|
7072
|
+
const grantSignature = await signer.signMessage(
|
|
7073
|
+
buildSubmissionReviewActionMessage({
|
|
7074
|
+
action: "feedback",
|
|
7075
|
+
payload: { runId: checked.runId },
|
|
7076
|
+
chainId: checked.chainId,
|
|
7077
|
+
requester: signer.address,
|
|
7078
|
+
idempotencyKey: grantId,
|
|
7079
|
+
expiresAt: grantExpiresAt
|
|
7080
|
+
})
|
|
7081
|
+
);
|
|
7082
|
+
const { runId, ...body } = SubmissionReviewFeedbackInputSchema.parse({
|
|
7083
|
+
...checked,
|
|
7084
|
+
requesterAddress: signer.address,
|
|
7085
|
+
idempotencyKey,
|
|
7086
|
+
grantId,
|
|
7087
|
+
grantExpiresAt,
|
|
7088
|
+
grantSignature
|
|
7089
|
+
});
|
|
7090
|
+
const result = await options.transport.post(
|
|
7091
|
+
`${runPath(runId)}/feedback`,
|
|
7092
|
+
body,
|
|
7093
|
+
idempotencyKey,
|
|
7094
|
+
await headers()
|
|
7095
|
+
);
|
|
7096
|
+
if (result.idempotencyKey !== idempotencyKey)
|
|
7097
|
+
throw new Error(
|
|
7098
|
+
"Review response has a different request key; recover the original request before retrying."
|
|
7099
|
+
);
|
|
7100
|
+
return { data: SubmissionReviewFeedbackOutputSchema.parse(result.data), idempotencyKey };
|
|
7101
|
+
});
|
|
7102
|
+
},
|
|
7039
7103
|
async *watch(input, settings = {}) {
|
|
7040
7104
|
const { intervalSeconds, timeoutSeconds } = z.object({
|
|
7041
7105
|
intervalSeconds: z.number().int().min(1).max(60).default(5),
|
|
@@ -7064,7 +7128,7 @@ function cliSubmissionReviewClient() {
|
|
|
7064
7128
|
transport: {
|
|
7065
7129
|
get: (path7, headers) => apiGet(path7, { headers }),
|
|
7066
7130
|
preview: (path7, body, headers) => apiReadPost(path7, body, { headers }),
|
|
7067
|
-
post: (path7, body, idempotencyKey) => apiPost(path7, body, { idempotencyKey })
|
|
7131
|
+
post: (path7, body, idempotencyKey, headers) => apiPost(path7, body, { idempotencyKey, headers })
|
|
7068
7132
|
}
|
|
7069
7133
|
});
|
|
7070
7134
|
}
|
|
@@ -7299,6 +7363,36 @@ function createReviewCommand() {
|
|
|
7299
7363
|
}
|
|
7300
7364
|
)
|
|
7301
7365
|
);
|
|
7366
|
+
group.addCommand(
|
|
7367
|
+
runCommand(
|
|
7368
|
+
"feedback",
|
|
7369
|
+
"Record agree or disagree on one finding or quality score; never changes findings or ranking"
|
|
7370
|
+
).argument("<assessmentId>", "Assessment ID from results or assessment output").requiredOption("--submission-id <id>", "Exact submission version ID").option("--requirement-id <id>", "Checklist requirement (a finding) to give feedback on").addOption(
|
|
7371
|
+
new Option("--dimension <dimension>", "Quality score to give feedback on").choices([
|
|
7372
|
+
"clarity",
|
|
7373
|
+
"visual_coherence",
|
|
7374
|
+
"distinctiveness",
|
|
7375
|
+
"finish"
|
|
7376
|
+
])
|
|
7377
|
+
).addOption(
|
|
7378
|
+
new Option("--verdict <verdict>", "Agree or disagree").choices(["agree", "disagree"]).makeOptionMandatory()
|
|
7379
|
+
).option("--note <text>", "Optional note, up to 280 characters").action(
|
|
7380
|
+
async (runId, assessmentId, options) => {
|
|
7381
|
+
if (Boolean(options.requirementId) === Boolean(options.dimension))
|
|
7382
|
+
throw new Error("Give exactly one of --requirement-id or --dimension.");
|
|
7383
|
+
const result = await cliSubmissionReviewClient().feedback({
|
|
7384
|
+
runId,
|
|
7385
|
+
chainId: options.chainId,
|
|
7386
|
+
submissionId: options.submissionId,
|
|
7387
|
+
assessmentId,
|
|
7388
|
+
target: options.requirementId ? { kind: "finding", requirementId: options.requirementId } : { kind: "quality", dimension: options.dimension },
|
|
7389
|
+
verdict: options.verdict,
|
|
7390
|
+
...options.note !== void 0 ? { note: options.note } : {}
|
|
7391
|
+
});
|
|
7392
|
+
printResult(result.data, { idempotencyKey: result.idempotencyKey });
|
|
7393
|
+
}
|
|
7394
|
+
)
|
|
7395
|
+
);
|
|
7302
7396
|
return group;
|
|
7303
7397
|
}
|
|
7304
7398
|
var reviewCmd = createReviewCommand();
|
|
@@ -7834,6 +7928,9 @@ var createCmd = new Command8("create").description("Create a new task (costs the
|
|
|
7834
7928
|
"--require-verified <verifiers>",
|
|
7835
7929
|
"Only workers one of these verifiers passes may work on the task (comma-separated; any one is enough): tap:identity:verified (verified agents) or tap:identity:known (known or verified agents). With --require-identity too, both must be met."
|
|
7836
7930
|
).option("--tags <tags>", "Comma-separated tags").option(
|
|
7931
|
+
"--capabilities <slugs>",
|
|
7932
|
+
"Comma-separated capability slugs the task needs, from `taskmarket capabilities` (active entries only; capped like a listing)"
|
|
7933
|
+
).option(
|
|
7837
7934
|
"--metric-description <text>",
|
|
7838
7935
|
'Benchmark metric workers are ranked on, e.g. "Test suite pass rate" (benchmark mode only, max 500 characters)'
|
|
7839
7936
|
).option(
|
|
@@ -8049,6 +8146,12 @@ async function runCreateTask(opts, extra = {}) {
|
|
|
8049
8146
|
if (longTag !== void 0) {
|
|
8050
8147
|
return void printError(`Each tag must be at most ${TAG_MAX_BYTES} bytes: "${longTag}"`);
|
|
8051
8148
|
}
|
|
8149
|
+
const capabilities = opts.capabilities ? opts.capabilities.split(",").map((slug) => slug.trim()).filter(Boolean) : [];
|
|
8150
|
+
if (capabilities.length > 0) {
|
|
8151
|
+
const parsed = TaskCapabilitiesSchema.safeParse(capabilities);
|
|
8152
|
+
if (!parsed.success)
|
|
8153
|
+
return void printError(parsed.error.issues.map((i) => i.message).join(". "));
|
|
8154
|
+
}
|
|
8052
8155
|
const body = {
|
|
8053
8156
|
...extra.projectId !== void 0 ? { projectId: extra.projectId } : {},
|
|
8054
8157
|
...extra.continuation ? extra.continuation : {},
|
|
@@ -8061,6 +8164,9 @@ async function runCreateTask(opts, extra = {}) {
|
|
|
8061
8164
|
submissionVisibility: opts.submissionVisibility,
|
|
8062
8165
|
tags
|
|
8063
8166
|
};
|
|
8167
|
+
if (capabilities.length > 0) {
|
|
8168
|
+
body.capabilities = capabilities;
|
|
8169
|
+
}
|
|
8064
8170
|
if (allowedViewers && allowedViewers.length > 0) {
|
|
8065
8171
|
body.allowedViewers = allowedViewers;
|
|
8066
8172
|
}
|
|
@@ -8360,7 +8466,10 @@ var listCmd = new Command9("list").alias("search").description("List available t
|
|
|
8360
8466
|
).option("--mode <mode>", "Filter by mode (bounty, claim, pitch, benchmark, auction)").option(
|
|
8361
8467
|
"--auction-type <type>",
|
|
8362
8468
|
"Filter auction tasks by subtype (dutch, english, reverse_dutch, reverse_english)"
|
|
8363
|
-
).option("--tags <tags>", "Comma-separated tags to filter by").option(
|
|
8469
|
+
).option("--tags <tags>", "Comma-separated tags to filter by").option(
|
|
8470
|
+
"--capabilities <slugs>",
|
|
8471
|
+
"Only tasks naming any of these capabilities (comma-separated slugs from `taskmarket capabilities`)"
|
|
8472
|
+
).option("--skill <skill>", "Filter by skill tag (comma-separated, alias for --tags)").option("--reward-min <n>", "Minimum reward in the payment token").option("--reward-max <n>", "Maximum reward in the payment token").option(
|
|
8364
8473
|
"--total-reward-min <n>",
|
|
8365
8474
|
"Minimum total reward in USD: the USDC reward plus a sponsored reward valued at its approved vault's curator-set price (unpriced sponsored rewards add nothing)"
|
|
8366
8475
|
).option(
|
|
@@ -8388,6 +8497,7 @@ var listCmd = new Command9("list").alias("search").description("List available t
|
|
|
8388
8497
|
mode: opts.mode,
|
|
8389
8498
|
auctionType: opts.auctionType,
|
|
8390
8499
|
tags: tagsValue,
|
|
8500
|
+
capabilities: opts.capabilities,
|
|
8391
8501
|
minReward: opts.rewardMin ? String(Math.round(Number(opts.rewardMin) * 1e6)) : void 0,
|
|
8392
8502
|
maxReward: opts.rewardMax ? String(Math.round(Number(opts.rewardMax) * 1e6)) : void 0,
|
|
8393
8503
|
minTotalReward: opts.totalRewardMin ? String(Math.round(Number(opts.totalRewardMin) * 1e6)) : void 0,
|
|
@@ -10357,7 +10467,7 @@ async function runAgentCommand(options) {
|
|
|
10357
10467
|
try {
|
|
10358
10468
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
10359
10469
|
const pi = assertAgentCompatibility();
|
|
10360
|
-
const { runAgent } = await import("./launch-
|
|
10470
|
+
const { runAgent } = await import("./launch-5NLS7GTY.js");
|
|
10361
10471
|
result = await runAgent({
|
|
10362
10472
|
model: options.model,
|
|
10363
10473
|
pi,
|
|
@@ -10539,7 +10649,12 @@ profileCommand.command("set").description(
|
|
|
10539
10649
|
collect3
|
|
10540
10650
|
).option("--clear-specialties", "Remove every specialty").option("--clear-capabilities", "Remove every capability").option("--avatar <file>", "Upload an avatar: a PNG, JPEG or WebP file of at most 1 MB").option("--clear-avatar", "Remove your uploaded avatar and use the generated one").action(async (opts) => {
|
|
10541
10651
|
try {
|
|
10542
|
-
if (opts.capability)
|
|
10652
|
+
if (opts.capability) {
|
|
10653
|
+
assertSelectableCapabilities(opts.capability);
|
|
10654
|
+
if (new Set(opts.capability).size > AGENT_LISTING_LIMITS.capabilitiesPerListingMax) {
|
|
10655
|
+
throw new Error(CAPABILITY_LIMIT_MESSAGE);
|
|
10656
|
+
}
|
|
10657
|
+
}
|
|
10543
10658
|
if (opts.avatar !== void 0 && opts.clearAvatar) {
|
|
10544
10659
|
throw new Error("Pass --avatar or --clear-avatar, not both");
|
|
10545
10660
|
}
|
|
@@ -10566,12 +10681,16 @@ profileCommand.command("set").description(
|
|
|
10566
10681
|
);
|
|
10567
10682
|
}
|
|
10568
10683
|
}
|
|
10684
|
+
const capabilities = opts.clearCapabilities ? [] : opts.capability ?? current.capabilities;
|
|
10685
|
+
if (capabilities.length > AGENT_LISTING_LIMITS.capabilitiesPerListingMax) {
|
|
10686
|
+
throw new Error(CAPABILITY_LIMIT_MESSAGE);
|
|
10687
|
+
}
|
|
10569
10688
|
const profile = {
|
|
10570
10689
|
displayName: opts.name ?? current.displayName ?? "",
|
|
10571
10690
|
description: opts.description ?? current.description ?? "",
|
|
10572
10691
|
roles: opts.role ?? (current.roles.length > 0 ? current.roles : ["worker"]),
|
|
10573
10692
|
specialties: opts.clearSpecialties ? [] : opts.specialty ?? current.specialties.map((specialty) => specialty.label),
|
|
10574
|
-
capabilities
|
|
10693
|
+
capabilities
|
|
10575
10694
|
};
|
|
10576
10695
|
const change = { action: "profile.set", profile };
|
|
10577
10696
|
const humanRefusal = current.kind === "human" ? humanListingChangeError(change) : null;
|
|
@@ -10782,13 +10901,13 @@ function agentManagementCommands() {
|
|
|
10782
10901
|
const status = new Command53("status").description(
|
|
10783
10902
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
10784
10903
|
).action(async () => {
|
|
10785
|
-
const { collectAgentStatus } = await import("./status-
|
|
10904
|
+
const { collectAgentStatus } = await import("./status-K3CANP2J.js");
|
|
10786
10905
|
await run(() => collectAgentStatus());
|
|
10787
10906
|
});
|
|
10788
10907
|
const doctor = new Command53("doctor").description(
|
|
10789
10908
|
"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."
|
|
10790
10909
|
).action(async () => {
|
|
10791
|
-
const { runDoctor } = await import("./doctor-
|
|
10910
|
+
const { runDoctor } = await import("./doctor-RYO3E7UL.js");
|
|
10792
10911
|
const report = await run(() => runDoctor());
|
|
10793
10912
|
if (report && !report.ok) process.exitCode = 1;
|
|
10794
10913
|
});
|
|
@@ -10799,7 +10918,7 @@ function agentManagementCommands() {
|
|
|
10799
10918
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
10800
10919
|
).action(
|
|
10801
10920
|
async (invocationId, options) => {
|
|
10802
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
10921
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-YEIABUC6.js");
|
|
10803
10922
|
const choice = { rail: options.rail, channel: options.channel };
|
|
10804
10923
|
if (invocationId !== void 0) {
|
|
10805
10924
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -10831,7 +10950,7 @@ function agentManagementCommands() {
|
|
|
10831
10950
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
10832
10951
|
);
|
|
10833
10952
|
}
|
|
10834
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
10953
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-BUVR2LSZ.js");
|
|
10835
10954
|
const { rails } = await openAgentChannels();
|
|
10836
10955
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
10837
10956
|
return {
|
|
@@ -10851,8 +10970,8 @@ function agentManagementCommands() {
|
|
|
10851
10970
|
await run(async () => {
|
|
10852
10971
|
await requireExperimental();
|
|
10853
10972
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
10854
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
10855
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
10973
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-BUVR2LSZ.js");
|
|
10974
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-YEIABUC6.js");
|
|
10856
10975
|
const opened = await openAgentChannels();
|
|
10857
10976
|
const { rail, retired } = selectChannel(opened, options);
|
|
10858
10977
|
const result = await closeChannel(
|
|
@@ -10906,7 +11025,7 @@ function agentManagementCommands() {
|
|
|
10906
11025
|
async (options) => {
|
|
10907
11026
|
await run(async () => {
|
|
10908
11027
|
await requireExperimental();
|
|
10909
|
-
const { runPull } = await import("./sync-pull-
|
|
11028
|
+
const { runPull } = await import("./sync-pull-JK2V7ZZF.js");
|
|
10910
11029
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
10911
11030
|
return runPull(options, {
|
|
10912
11031
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -10975,10 +11094,10 @@ var agentsCommand = new Command55("agents").description("Browse the worker direc
|
|
|
10975
11094
|
"--sort <order>",
|
|
10976
11095
|
"Sort order: reputation (top rated), tasks or hires (most hired: completed reserved, quote and request hires)",
|
|
10977
11096
|
"reputation"
|
|
10978
|
-
).option("--
|
|
11097
|
+
).option("--specialty <specialty>", "Filter listed workers by specialty, as a label or slug").option("--skill <tag>", "Deprecated alias of --specialty").option(
|
|
10979
11098
|
"--capability <slug>",
|
|
10980
11099
|
"Filter listed agents by capability slug (see `taskmarket capabilities`)"
|
|
10981
|
-
).option("--role <role>", "Filter listed workers by role: worker or evaluator").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").option("--min-rating <n>", `Only workers rated at least this: ${MIN_RATINGS.join(", ")}`).option(
|
|
11100
|
+
).option("--role <role>", "Filter listed workers by role: worker or evaluator").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").option("--offset <n>", "Skip this many results, to page past --limit (0 to 10000)").option("--min-rating <n>", `Only workers rated at least this: ${MIN_RATINGS.join(", ")}`).option(
|
|
10982
11101
|
"--min-tasks <n>",
|
|
10983
11102
|
`Only workers with at least this many completed tasks: ${MIN_TASKS.join(", ")}`
|
|
10984
11103
|
).option(
|
|
@@ -10999,6 +11118,9 @@ var agentsCommand = new Command55("agents").description("Browse the worker direc
|
|
|
10999
11118
|
allowListed("--min-rating", opts.minRating, MIN_RATINGS);
|
|
11000
11119
|
allowListed("--min-tasks", opts.minTasks, MIN_TASKS);
|
|
11001
11120
|
allowListed("--availability", opts.availability, AVAILABILITIES);
|
|
11121
|
+
if (opts.offset !== void 0 && (!/^\d+$/.test(opts.offset) || Number(opts.offset) > 1e4)) {
|
|
11122
|
+
throw new Error("--offset must be a whole number from 0 to 10000");
|
|
11123
|
+
}
|
|
11002
11124
|
kind = opts.kind === void 0 ? void 0 : parseInput(ActorType, opts.kind);
|
|
11003
11125
|
role = opts.role === void 0 ? void 0 : parseInput(AgentListingRoleSchema, opts.role);
|
|
11004
11126
|
if (opts.capability !== void 0 && !isCapabilitySlug(opts.capability)) {
|
|
@@ -11016,26 +11138,31 @@ var agentsCommand = new Command55("agents").description("Browse the worker direc
|
|
|
11016
11138
|
const params = new URLSearchParams();
|
|
11017
11139
|
if (verifiedBy.value) params.set("verifiedBy", verifiedBy.value);
|
|
11018
11140
|
if (opts.sort) params.set("sort", opts.sort);
|
|
11019
|
-
|
|
11020
|
-
if (
|
|
11141
|
+
const specialty = opts.specialty ?? opts.skill;
|
|
11142
|
+
if (specialty) params.set("specialty", specialty);
|
|
11021
11143
|
if (opts.capability) params.set("capability", opts.capability);
|
|
11022
11144
|
if (role) params.set("role", role);
|
|
11023
11145
|
if (opts.search) params.set("search", opts.search);
|
|
11024
11146
|
if (opts.limit) params.set("limit", opts.limit);
|
|
11147
|
+
if (opts.offset) params.set("offset", String(Number(opts.offset)));
|
|
11025
11148
|
if (opts.minRating) params.set("minRating", String(Number(opts.minRating)));
|
|
11026
11149
|
if (opts.minTasks) params.set("minTasks", String(Number(opts.minTasks)));
|
|
11027
11150
|
if (kind) params.set("actorType", kind);
|
|
11028
11151
|
const availability = opts.availability ?? DEFAULT_AVAILABILITY;
|
|
11029
11152
|
if (availability !== "any") params.set("availability", availability);
|
|
11030
|
-
const
|
|
11031
|
-
params.set("chainId", String(chainId));
|
|
11153
|
+
const chainId = selectedNetworkOrUndefined()?.chainId;
|
|
11154
|
+
if (chainId !== void 0) params.set("chainId", String(chainId));
|
|
11032
11155
|
const result = await apiGet(`/api/agents/leaderboard?${params.toString()}`);
|
|
11033
11156
|
printResult(
|
|
11034
11157
|
Array.isArray(result) ? result.map((entry) => ({
|
|
11035
11158
|
...entry,
|
|
11036
11159
|
availability: entry.availability ?? null,
|
|
11037
|
-
|
|
11038
|
-
|
|
11160
|
+
...chainId === void 0 ? {
|
|
11161
|
+
chains: Array.isArray(entry.chains) ? entry.chains.map((item) => ({
|
|
11162
|
+
...item,
|
|
11163
|
+
earningsToken: paymentTokenSymbol(Number(item.chainId))
|
|
11164
|
+
})) : []
|
|
11165
|
+
} : { earningsChainId: chainId, earningsToken: paymentTokenSymbol(chainId) }
|
|
11039
11166
|
})) : result
|
|
11040
11167
|
);
|
|
11041
11168
|
}
|
|
@@ -12155,7 +12282,10 @@ async function pollBridgeStatus(requestId) {
|
|
|
12155
12282
|
}
|
|
12156
12283
|
var walletBridgeCommand = new Command67("bridge").description(
|
|
12157
12284
|
"Move free USDC on Base to OUSD at the same address on Tempo (gasless, through Relay)"
|
|
12158
|
-
).requiredOption("--to <chain>", 'Destination chain (only "tempo")').
|
|
12285
|
+
).requiredOption("--to <chain>", 'Destination chain (only "tempo")').option(
|
|
12286
|
+
"--recipient <address>",
|
|
12287
|
+
"Deliver the OUSD to this ready Tempo mainnet swarm wallet (a hosted agent wallet) instead of your own address; a refund still goes to your wallet on Base"
|
|
12288
|
+
).argument("<amount>", "Amount of USDC in whole tokens (minimum 1, e.g. 25)").action(async (amount, opts) => {
|
|
12159
12289
|
if (opts.to !== "tempo") {
|
|
12160
12290
|
printError('Invalid --to: the only bridge destination is "tempo"');
|
|
12161
12291
|
return;
|
|
@@ -12164,6 +12294,10 @@ var walletBridgeCommand = new Command67("bridge").description(
|
|
|
12164
12294
|
printError("Invalid amount: must be a positive number with at most 6 decimals (e.g. 25)");
|
|
12165
12295
|
return;
|
|
12166
12296
|
}
|
|
12297
|
+
if (opts.recipient !== void 0 && !EthAddressSchema.safeParse(opts.recipient).success) {
|
|
12298
|
+
printError("Invalid --recipient: must be a 0x-prefixed 20-byte address");
|
|
12299
|
+
return;
|
|
12300
|
+
}
|
|
12167
12301
|
const [whole, fraction = ""] = amount.split(".");
|
|
12168
12302
|
const amountBaseUnits = (BigInt(whole) * 1000000n + BigInt(fraction.padEnd(6, "0"))).toString();
|
|
12169
12303
|
let keystore;
|
|
@@ -12174,19 +12308,21 @@ var walletBridgeCommand = new Command67("bridge").description(
|
|
|
12174
12308
|
return;
|
|
12175
12309
|
}
|
|
12176
12310
|
const from = keystore.walletAddress;
|
|
12311
|
+
const expectedRecipient = opts.recipient ?? from;
|
|
12177
12312
|
let quote;
|
|
12178
12313
|
try {
|
|
12179
12314
|
({ data: quote } = await apiPost("/api/wallet/bridge-quote", {
|
|
12180
12315
|
chainId: WALLET_BRIDGE_ORIGIN_CHAIN_ID,
|
|
12181
12316
|
from,
|
|
12182
12317
|
to: "tempo",
|
|
12183
|
-
amountBaseUnits
|
|
12318
|
+
amountBaseUnits,
|
|
12319
|
+
...opts.recipient !== void 0 ? { recipient: opts.recipient } : {}
|
|
12184
12320
|
}));
|
|
12185
12321
|
} catch (err) {
|
|
12186
12322
|
renderFailure(err);
|
|
12187
12323
|
return;
|
|
12188
12324
|
}
|
|
12189
|
-
if (!sameAddress2(quote.recipient,
|
|
12325
|
+
if (!sameAddress2(quote.recipient, expectedRecipient) || !sameAddress2(quote.refundTo, from) || !sameAddress2(quote.authorization.message.to, quote.depositAddress) || quote.amountBaseUnits !== amountBaseUnits || quote.authorization.message.value !== amountBaseUnits || quote.destinationChainId !== WALLET_BRIDGE_TEMPO_CHAIN_ID) {
|
|
12190
12326
|
printError("The bridge quote does not match this request; nothing was signed");
|
|
12191
12327
|
return;
|
|
12192
12328
|
}
|
|
@@ -12661,16 +12797,16 @@ import { Command as Command72 } from "commander";
|
|
|
12661
12797
|
// src/lib/xmtp-client.ts
|
|
12662
12798
|
import fs6 from "fs";
|
|
12663
12799
|
import path4 from "path";
|
|
12664
|
-
import { randomUUID as
|
|
12800
|
+
import { randomUUID as randomUUID3, hkdfSync as hkdfSync2 } from "crypto";
|
|
12665
12801
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
12666
12802
|
|
|
12667
12803
|
// src/lib/xmtp-envelope.ts
|
|
12668
|
-
import { randomUUID } from "crypto";
|
|
12804
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
12669
12805
|
function buildEnvelope(input) {
|
|
12670
12806
|
return AgentMessageEnvelopeSchema.parse({
|
|
12671
12807
|
schemaVersion: 1,
|
|
12672
12808
|
type: input.type,
|
|
12673
|
-
requestId: input.requestId ??
|
|
12809
|
+
requestId: input.requestId ?? randomUUID2(),
|
|
12674
12810
|
replyToRequestId: input.replyToRequestId,
|
|
12675
12811
|
senderInboxId: input.senderInboxId,
|
|
12676
12812
|
senderAddress: input.senderAddress,
|
|
@@ -13065,7 +13201,7 @@ function createFileBus(dir) {
|
|
|
13065
13201
|
}
|
|
13066
13202
|
async function createDevClient(input) {
|
|
13067
13203
|
const inboxId = input.existingInboxId ?? `dev-inbox-${input.walletAddress.slice(2, 10).toLowerCase()}`;
|
|
13068
|
-
const installationId = input.existingInstallationId ??
|
|
13204
|
+
const installationId = input.existingInstallationId ?? randomUUID3();
|
|
13069
13205
|
const dbPath = input.existingDbPath ?? defaultDbPath(input.walletAddress);
|
|
13070
13206
|
const busDir = process.env.TASKMARKET_XMTP_MEMORY_DIR?.trim();
|
|
13071
13207
|
const fileBus = busDir ? createFileBus(busDir) : void 0;
|
|
@@ -13081,7 +13217,7 @@ async function createDevClient(input) {
|
|
|
13081
13217
|
},
|
|
13082
13218
|
async sendMessage(toInboxId, body) {
|
|
13083
13219
|
const message = {
|
|
13084
|
-
id:
|
|
13220
|
+
id: randomUUID3(),
|
|
13085
13221
|
toInboxId,
|
|
13086
13222
|
body,
|
|
13087
13223
|
senderInboxId: inboxId,
|
|
@@ -13598,7 +13734,7 @@ async function createProductionClient(input, env) {
|
|
|
13598
13734
|
"non-retryable"
|
|
13599
13735
|
);
|
|
13600
13736
|
}
|
|
13601
|
-
const installationId = extractString(client, ["installationId", "installationID"]) ?? extractString(asObject(client)?.installation, ["id", "installationId"]) ?? input.existingInstallationId ??
|
|
13737
|
+
const installationId = extractString(client, ["installationId", "installationID"]) ?? extractString(asObject(client)?.installation, ["id", "installationId"]) ?? input.existingInstallationId ?? randomUUID3();
|
|
13602
13738
|
const cursor = loadXmtpCursor(xmtpCursorPath(defaultXmtpDbDir(), input.walletAddress));
|
|
13603
13739
|
const inboxIdForAddress = cachedInboxLookup(async (address2) => {
|
|
13604
13740
|
const lookup = asObject(client)?.fetchInboxIdByIdentifier;
|
|
@@ -14387,6 +14523,19 @@ function parseSince(since) {
|
|
|
14387
14523
|
if (!EVENT_ID2.test(since)) throw new Error("--since must be an event id (a whole number)");
|
|
14388
14524
|
return since;
|
|
14389
14525
|
}
|
|
14526
|
+
function parseEventId(flag, value) {
|
|
14527
|
+
if (!EVENT_ID2.test(value)) throw new Error(`${flag} must be an event id (a whole number)`);
|
|
14528
|
+
return value;
|
|
14529
|
+
}
|
|
14530
|
+
function assertOrderOptions(options) {
|
|
14531
|
+
if (options.before !== void 0 && !options.newest) {
|
|
14532
|
+
throw new Error("--before needs --newest");
|
|
14533
|
+
}
|
|
14534
|
+
if (!options.newest) return;
|
|
14535
|
+
if (options.since !== void 0) throw new Error("--newest cannot take --since; use --before");
|
|
14536
|
+
if (options.follow) throw new Error("--follow reads oldest first; it cannot take --newest");
|
|
14537
|
+
if (options.task) throw new Error("--newest reads your own events; it cannot take --task");
|
|
14538
|
+
}
|
|
14390
14539
|
function parseLimit(limit) {
|
|
14391
14540
|
if (limit === void 0) return void 0;
|
|
14392
14541
|
const value = Number(limit);
|
|
@@ -14412,8 +14561,19 @@ async function readAuthHeaders() {
|
|
|
14412
14561
|
return { wallet: auth.walletAddress, headers: auth.headers };
|
|
14413
14562
|
}
|
|
14414
14563
|
async function readHistory(options) {
|
|
14564
|
+
assertOrderOptions(options);
|
|
14415
14565
|
const since = parseSince(options.since);
|
|
14416
14566
|
const limit = parseLimit(options.limit);
|
|
14567
|
+
if (options.newest) {
|
|
14568
|
+
const before = options.before === void 0 ? void 0 : parseEventId("--before", options.before);
|
|
14569
|
+
const { headers: headers2 } = await readAuthHeaders();
|
|
14570
|
+
printResult(
|
|
14571
|
+
await apiGet(`/api/market-events${query3({ order: "newest", before, limit })}`, {
|
|
14572
|
+
headers: headers2
|
|
14573
|
+
})
|
|
14574
|
+
);
|
|
14575
|
+
return;
|
|
14576
|
+
}
|
|
14417
14577
|
const headers = options.task ? (await signReadAuth())?.headers ?? {} : (await readAuthHeaders()).headers;
|
|
14418
14578
|
const path7 = options.task ? `/api/market-events/tasks/${encodeURIComponent(options.task)}${query3({ since, limit })}` : `/api/market-events${query3({ since, limit })}`;
|
|
14419
14579
|
printResult(await apiGet(path7, { headers }));
|
|
@@ -14524,10 +14684,43 @@ async function untilInterrupted(follow) {
|
|
|
14524
14684
|
process.off("SIGTERM", stop);
|
|
14525
14685
|
}
|
|
14526
14686
|
}
|
|
14687
|
+
var LAST_SEEN_PATH = "/api/market-events/last-seen";
|
|
14688
|
+
async function readOrMarkSeen(options) {
|
|
14689
|
+
const mark = options.mark === void 0 || options.mark === "latest" ? options.mark : parseEventId("--mark", options.mark);
|
|
14690
|
+
const { headers } = await readAuthHeaders();
|
|
14691
|
+
if (mark === void 0) {
|
|
14692
|
+
printResult(await apiGet(LAST_SEEN_PATH, { headers }));
|
|
14693
|
+
return;
|
|
14694
|
+
}
|
|
14695
|
+
let eventId = mark;
|
|
14696
|
+
if (mark === "latest") {
|
|
14697
|
+
const newest = await apiGet(`/api/market-events${query3({ order: "newest", limit: 1 })}`, {
|
|
14698
|
+
headers
|
|
14699
|
+
});
|
|
14700
|
+
eventId = newest.events[0]?.id;
|
|
14701
|
+
}
|
|
14702
|
+
if (eventId === void 0) {
|
|
14703
|
+
printResult(await apiGet(LAST_SEEN_PATH, { headers }));
|
|
14704
|
+
return;
|
|
14705
|
+
}
|
|
14706
|
+
const { data, idempotencyKey } = await apiPut(
|
|
14707
|
+
LAST_SEEN_PATH,
|
|
14708
|
+
{ eventId },
|
|
14709
|
+
{ headers }
|
|
14710
|
+
);
|
|
14711
|
+
printResult(data, { idempotencyKey });
|
|
14712
|
+
}
|
|
14713
|
+
function createSeenCommand() {
|
|
14714
|
+
return new Command73("seen").description(
|
|
14715
|
+
"Show the newest event you have seen and how many are unread (the web Inbox's Activity count); --mark moves it forward"
|
|
14716
|
+
).option("--mark <id>", "Mark events up to this event id as seen, or `latest` for all of them").action(async (options) => {
|
|
14717
|
+
await readOrMarkSeen(options);
|
|
14718
|
+
});
|
|
14719
|
+
}
|
|
14527
14720
|
function createEventsCommand() {
|
|
14528
14721
|
return new Command73("events").description(
|
|
14529
|
-
"Read your market events, oldest first, or one task's timeline; --follow waits for new ones and resumes after a restart"
|
|
14530
|
-
).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("--task <taskId>", "One task's timeline instead of your own events").option(
|
|
14722
|
+
"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"
|
|
14723
|
+
).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("--task <taskId>", "One task's timeline instead of your own events").option("--newest", "Read your own events newest first, as the web Activity tab does").option("--before <id>", "With --newest, only events before this event id (the next page)").option(
|
|
14531
14724
|
"--follow",
|
|
14532
14725
|
"Keep reading: print each new event with your pending actions on its task, from a cursor stored under ~/.taskmarket"
|
|
14533
14726
|
).action(async (options) => {
|
|
@@ -14536,10 +14729,11 @@ function createEventsCommand() {
|
|
|
14536
14729
|
return;
|
|
14537
14730
|
}
|
|
14538
14731
|
if (options.task) throw new Error("--follow reads your own events; it cannot take --task");
|
|
14732
|
+
assertOrderOptions(options);
|
|
14539
14733
|
const since = parseSince(options.since);
|
|
14540
14734
|
const limit = parseLimit(options.limit);
|
|
14541
14735
|
await untilInterrupted((signal) => followMarketEvents({ since, limit, signal }));
|
|
14542
|
-
});
|
|
14736
|
+
}).addCommand(createSeenCommand());
|
|
14543
14737
|
}
|
|
14544
14738
|
var eventsCommand = createEventsCommand();
|
|
14545
14739
|
|
|
@@ -15857,12 +16051,222 @@ bookmarkCommand.addCommand(removeCommand);
|
|
|
15857
16051
|
bookmarkCommand.addCommand(listCommand4);
|
|
15858
16052
|
bookmarkCommand.addCommand(collectionCommand);
|
|
15859
16053
|
|
|
16054
|
+
// src/commands/skills/index.ts
|
|
16055
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
16056
|
+
import { Command as Command97 } from "commander";
|
|
16057
|
+
|
|
16058
|
+
// src/lib/skill-directory.ts
|
|
16059
|
+
import { lstat, readdir, readFile as readFile3 } from "fs/promises";
|
|
16060
|
+
import { join, relative, sep } from "path";
|
|
16061
|
+
var MAX_ENTRIES = USER_SKILL_LIMITS.files + USER_SKILL_SANDBOX_LIMITS.files + 300;
|
|
16062
|
+
async function walk(root) {
|
|
16063
|
+
const entries = [];
|
|
16064
|
+
const visit = async (dir) => {
|
|
16065
|
+
const names = (await readdir(dir)).sort();
|
|
16066
|
+
for (const name of names) {
|
|
16067
|
+
const full = join(dir, name);
|
|
16068
|
+
const path7 = relative(root, full).split(sep).join("/");
|
|
16069
|
+
const info = await lstat(full);
|
|
16070
|
+
if (info.isDirectory()) {
|
|
16071
|
+
await visit(full);
|
|
16072
|
+
continue;
|
|
16073
|
+
}
|
|
16074
|
+
if (entries.length >= MAX_ENTRIES)
|
|
16075
|
+
throw new Error(`The skill directory has more than ${MAX_ENTRIES} files`);
|
|
16076
|
+
const mode = info.isSymbolicLink() ? USER_SKILL_GIT_MODES.symlink : !info.isFile() ? "other" : info.mode & 73 ? USER_SKILL_GIT_MODES.executable : USER_SKILL_GIT_MODES.file;
|
|
16077
|
+
entries.push({ path: path7, mode, full });
|
|
16078
|
+
}
|
|
16079
|
+
};
|
|
16080
|
+
await visit(root);
|
|
16081
|
+
return entries;
|
|
16082
|
+
}
|
|
16083
|
+
async function readSkillDirectory(root, options = {}) {
|
|
16084
|
+
const info = await lstat(root).catch(() => null);
|
|
16085
|
+
if (!info?.isDirectory()) throw new Error(`${root} is not a directory`);
|
|
16086
|
+
const files = [];
|
|
16087
|
+
const sandboxFiles = [];
|
|
16088
|
+
const excluded = [];
|
|
16089
|
+
for (const entry2 of await walk(root)) {
|
|
16090
|
+
const kind = classifyUserSkillEntry({ path: entry2.path, mode: entry2.mode });
|
|
16091
|
+
if (kind.kind === "excluded") {
|
|
16092
|
+
excluded.push({ path: entry2.path, reason: kind.reason });
|
|
16093
|
+
continue;
|
|
16094
|
+
}
|
|
16095
|
+
const bytes = await readFile3(entry2.full);
|
|
16096
|
+
if (kind.kind === "readable") {
|
|
16097
|
+
files.push({ path: entry2.path, content: bytes.toString("utf8") });
|
|
16098
|
+
} else if (kind.encoding === "base64") {
|
|
16099
|
+
sandboxFiles.push({
|
|
16100
|
+
path: entry2.path,
|
|
16101
|
+
encoding: "base64",
|
|
16102
|
+
content: bytes.toString("base64"),
|
|
16103
|
+
size: bytes.length,
|
|
16104
|
+
executable: kind.executable
|
|
16105
|
+
});
|
|
16106
|
+
} else {
|
|
16107
|
+
sandboxFiles.push({
|
|
16108
|
+
path: entry2.path,
|
|
16109
|
+
encoding: "utf8",
|
|
16110
|
+
content: bytes.toString("utf8"),
|
|
16111
|
+
executable: kind.executable
|
|
16112
|
+
});
|
|
16113
|
+
}
|
|
16114
|
+
}
|
|
16115
|
+
const entry = files.find((file) => file.path === "SKILL.md");
|
|
16116
|
+
if (!entry) throw new Error(`${root} has no SKILL.md at its root`);
|
|
16117
|
+
const meta = splitUserSkill(entry.content);
|
|
16118
|
+
return {
|
|
16119
|
+
bundle: {
|
|
16120
|
+
name: options.name ?? meta.name,
|
|
16121
|
+
description: options.description ?? meta.description,
|
|
16122
|
+
files,
|
|
16123
|
+
...sandboxFiles.length ? { sandboxFiles } : {}
|
|
16124
|
+
},
|
|
16125
|
+
excluded
|
|
16126
|
+
};
|
|
16127
|
+
}
|
|
16128
|
+
|
|
16129
|
+
// src/commands/skills/index.ts
|
|
16130
|
+
function excludedError(excluded) {
|
|
16131
|
+
const list2 = excluded.map((file) => `${file.path} (${file.reason})`).join("; ");
|
|
16132
|
+
return new Error(
|
|
16133
|
+
`These files are not allowed in a skill and would be left out: ${list2}. Remove them, or pass --skip-excluded to save the skill without them`
|
|
16134
|
+
);
|
|
16135
|
+
}
|
|
16136
|
+
var SkillRequestTooLargeError = class extends Error {
|
|
16137
|
+
constructor(bytes, limitBytes) {
|
|
16138
|
+
super(
|
|
16139
|
+
`The skill request is ${bytes} bytes once serialized, over the API's limit of ${limitBytes} bytes (1 MiB). Shrink the skill directory: remove or trim large references, scripts or assets (binary assets grow by a third as base64)`
|
|
16140
|
+
);
|
|
16141
|
+
this.bytes = bytes;
|
|
16142
|
+
this.limitBytes = limitBytes;
|
|
16143
|
+
}
|
|
16144
|
+
code = "skill_request_too_large";
|
|
16145
|
+
};
|
|
16146
|
+
function fail(error) {
|
|
16147
|
+
if (error instanceof SkillRequestTooLargeError)
|
|
16148
|
+
return renderFailure(error, {
|
|
16149
|
+
details: { code: error.code, bytes: error.bytes, limitBytes: error.limitBytes }
|
|
16150
|
+
});
|
|
16151
|
+
return renderFailure(error);
|
|
16152
|
+
}
|
|
16153
|
+
function assertBodySize(body) {
|
|
16154
|
+
const PROOF_ALLOWANCE = 512;
|
|
16155
|
+
const bytes = Buffer.byteLength(JSON.stringify(body), "utf8") + PROOF_ALLOWANCE;
|
|
16156
|
+
if (bytes > AGENT_SKILL_REQUEST_BODY_LIMIT_BYTES)
|
|
16157
|
+
throw new SkillRequestTooLargeError(bytes, AGENT_SKILL_REQUEST_BODY_LIMIT_BYTES);
|
|
16158
|
+
}
|
|
16159
|
+
async function bundleWrite(action, dir, skillId, opts) {
|
|
16160
|
+
const { bundle, excluded } = await readSkillDirectory(dir, {
|
|
16161
|
+
name: opts.name,
|
|
16162
|
+
description: opts.description
|
|
16163
|
+
});
|
|
16164
|
+
if (excluded.length && !opts.skipExcluded) throw excludedError(excluded);
|
|
16165
|
+
const keystore = await loadKeystore();
|
|
16166
|
+
const unsigned = {
|
|
16167
|
+
walletAddress: keystore.walletAddress,
|
|
16168
|
+
agentId: opts.agent,
|
|
16169
|
+
skillId,
|
|
16170
|
+
requestKey: opts.requestKey ?? randomUUID4(),
|
|
16171
|
+
bundle,
|
|
16172
|
+
note: opts.note ?? ""
|
|
16173
|
+
};
|
|
16174
|
+
const parsed = parseInput(AgentUserSkillBundleWriteSchema, unsigned);
|
|
16175
|
+
assertBodySize(parsed);
|
|
16176
|
+
const change = action === "create" ? userSkillCreateWriteChange(parsed) : userSkillVersionWriteChange(parsed);
|
|
16177
|
+
const proof = await signWalletWrite("user-skill", change);
|
|
16178
|
+
return { body: { ...parsed, ...proof }, excluded };
|
|
16179
|
+
}
|
|
16180
|
+
function summary(body, excluded) {
|
|
16181
|
+
return {
|
|
16182
|
+
files: body.bundle.files.map((file) => file.path).sort(),
|
|
16183
|
+
sandboxFiles: (body.bundle.sandboxFiles ?? []).map((file) => ({
|
|
16184
|
+
path: file.path,
|
|
16185
|
+
executable: file.executable ?? false
|
|
16186
|
+
})),
|
|
16187
|
+
excluded
|
|
16188
|
+
};
|
|
16189
|
+
}
|
|
16190
|
+
var bundleOptions = (command) => command.requiredOption("--agent <agentId>", "The hosted agent writing the skill (its agent ID)").option("--name <name>", "Skill name (default: SKILL.md's frontmatter name)").option("--description <text>", "Skill description (default: SKILL.md's frontmatter)").option("--note <text>", "A note for this version, up to 500 characters").option(
|
|
16191
|
+
"--skip-excluded",
|
|
16192
|
+
"Save without the files that are not allowed (listed in the output) instead of refusing"
|
|
16193
|
+
).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice");
|
|
16194
|
+
var SIZE_NOTE = "The whole request, files included (binary assets as base64), must fit in 1 MiB; a larger one is refused before signing";
|
|
16195
|
+
var createCommand2 = bundleOptions(
|
|
16196
|
+
new Command97("create").description(
|
|
16197
|
+
`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}`
|
|
16198
|
+
).argument("<dir>", "The skill directory, with SKILL.md at its root").option("--skill-id <uuid>", "The new skill ID (default: a new random ID)")
|
|
16199
|
+
).action(async (dir, opts) => {
|
|
16200
|
+
try {
|
|
16201
|
+
const { body, excluded } = await bundleWrite("create", dir, opts.skillId ?? randomUUID4(), opts);
|
|
16202
|
+
const { data, idempotencyKey } = await apiPost("/api/agents/skills", body, {
|
|
16203
|
+
idempotencyKey: body.requestKey
|
|
16204
|
+
});
|
|
16205
|
+
printResult(
|
|
16206
|
+
{ ...data, ...summary(body, excluded) },
|
|
16207
|
+
{ idempotencyKey }
|
|
16208
|
+
);
|
|
16209
|
+
} catch (error) {
|
|
16210
|
+
return fail(error);
|
|
16211
|
+
}
|
|
16212
|
+
});
|
|
16213
|
+
var versionCommand = bundleOptions(
|
|
16214
|
+
new Command97("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")
|
|
16215
|
+
).action(async (skillId, dir, opts) => {
|
|
16216
|
+
try {
|
|
16217
|
+
const { body, excluded } = await bundleWrite("version", dir, skillId, opts);
|
|
16218
|
+
const { data, idempotencyKey } = await apiPost(
|
|
16219
|
+
`/api/agents/skills/${encodeURIComponent(body.skillId)}/versions`,
|
|
16220
|
+
body,
|
|
16221
|
+
{ idempotencyKey: body.requestKey }
|
|
16222
|
+
);
|
|
16223
|
+
printResult(
|
|
16224
|
+
{ ...data, ...summary(body, excluded) },
|
|
16225
|
+
{ idempotencyKey }
|
|
16226
|
+
);
|
|
16227
|
+
} catch (error) {
|
|
16228
|
+
return fail(error);
|
|
16229
|
+
}
|
|
16230
|
+
});
|
|
16231
|
+
var archiveCommand = new Command97("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(
|
|
16232
|
+
"--remove-assignments",
|
|
16233
|
+
"Also remove the skill from this agent's assignments; archiving is refused while other agents have it assigned"
|
|
16234
|
+
).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice").action(
|
|
16235
|
+
async (skillId, opts) => {
|
|
16236
|
+
try {
|
|
16237
|
+
const keystore = await loadKeystore();
|
|
16238
|
+
const parsed = parseInput(AgentUserSkillArchiveWriteSchema, {
|
|
16239
|
+
walletAddress: keystore.walletAddress,
|
|
16240
|
+
agentId: opts.agent,
|
|
16241
|
+
skillId,
|
|
16242
|
+
requestKey: opts.requestKey ?? randomUUID4(),
|
|
16243
|
+
removeAssignments: Boolean(opts.removeAssignments)
|
|
16244
|
+
});
|
|
16245
|
+
const proof = await signWalletWrite("user-skill", userSkillArchiveWriteChange(parsed));
|
|
16246
|
+
const { data, idempotencyKey } = await apiPost(
|
|
16247
|
+
`/api/agents/skills/${encodeURIComponent(parsed.skillId)}/archive`,
|
|
16248
|
+
{ ...parsed, ...proof },
|
|
16249
|
+
{ idempotencyKey: parsed.requestKey }
|
|
16250
|
+
);
|
|
16251
|
+
printResult(data, { idempotencyKey });
|
|
16252
|
+
} catch (error) {
|
|
16253
|
+
return renderFailure(error);
|
|
16254
|
+
}
|
|
16255
|
+
}
|
|
16256
|
+
);
|
|
16257
|
+
var skillsCommand = new Command97("skills").description(
|
|
16258
|
+
"Skills in your owner's library that you, a hosted agent, author: create, version and archive"
|
|
16259
|
+
);
|
|
16260
|
+
skillsCommand.addCommand(createCommand2);
|
|
16261
|
+
skillsCommand.addCommand(versionCommand);
|
|
16262
|
+
skillsCommand.addCommand(archiveCommand);
|
|
16263
|
+
|
|
15860
16264
|
// src/commands/requester/index.ts
|
|
15861
|
-
import { Command as
|
|
16265
|
+
import { Command as Command99 } from "commander";
|
|
15862
16266
|
|
|
15863
16267
|
// src/commands/requester/stats.ts
|
|
15864
|
-
import { Command as
|
|
15865
|
-
var requesterStatsCmd = new
|
|
16268
|
+
import { Command as Command98 } from "commander";
|
|
16269
|
+
var requesterStatsCmd = new Command98("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address2) => {
|
|
15866
16270
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address2)) {
|
|
15867
16271
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
15868
16272
|
return;
|
|
@@ -15876,23 +16280,23 @@ var requesterStatsCmd = new Command97("stats").description("Get requester reputa
|
|
|
15876
16280
|
});
|
|
15877
16281
|
|
|
15878
16282
|
// src/commands/requester/index.ts
|
|
15879
|
-
var requesterCmd = new
|
|
16283
|
+
var requesterCmd = new Command99("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
15880
16284
|
|
|
15881
16285
|
// src/commands/capabilities.ts
|
|
15882
|
-
import { Command as
|
|
16286
|
+
import { Command as Command100 } from "commander";
|
|
15883
16287
|
async function fetchCapabilities(category) {
|
|
15884
16288
|
const input = parseInput(CapabilitiesListInputSchema, { category });
|
|
15885
16289
|
const query4 = input.category ? `?category=${encodeURIComponent(input.category)}` : "";
|
|
15886
16290
|
return CapabilitiesListResponseSchema.parse(await apiGet(`/api/capabilities${query4}`));
|
|
15887
16291
|
}
|
|
15888
|
-
var listCommand5 = new
|
|
16292
|
+
var listCommand5 = new Command100("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) => {
|
|
15889
16293
|
try {
|
|
15890
16294
|
printResult(await fetchCapabilities(opts.category));
|
|
15891
16295
|
} catch (err) {
|
|
15892
16296
|
renderFailure(err);
|
|
15893
16297
|
}
|
|
15894
16298
|
});
|
|
15895
|
-
var showCommand2 = new
|
|
16299
|
+
var showCommand2 = new Command100("show").description("Show one capability by slug").argument("<slug>", "Capability slug, for example web-search").action(async (slug) => {
|
|
15896
16300
|
try {
|
|
15897
16301
|
const { capabilities } = await fetchCapabilities();
|
|
15898
16302
|
const entry = capabilities.find((item) => item.slug === slug);
|
|
@@ -15902,13 +16306,13 @@ var showCommand2 = new Command99("show").description("Show one capability by slu
|
|
|
15902
16306
|
renderFailure(err);
|
|
15903
16307
|
}
|
|
15904
16308
|
});
|
|
15905
|
-
var capabilitiesCommand = new
|
|
16309
|
+
var capabilitiesCommand = new Command100("capabilities").description("Read the listing capability registry").addCommand(listCommand5).addCommand(showCommand2);
|
|
15906
16310
|
|
|
15907
16311
|
// src/commands/x402/index.ts
|
|
15908
|
-
import { Command as
|
|
16312
|
+
import { Command as Command104 } from "commander";
|
|
15909
16313
|
|
|
15910
16314
|
// src/commands/x402/payments.ts
|
|
15911
|
-
import { Command as
|
|
16315
|
+
import { Command as Command101, Option as Option5 } from "commander";
|
|
15912
16316
|
import { createInterface as createInterface5 } from "readline";
|
|
15913
16317
|
var PAYMENT_STATES = [
|
|
15914
16318
|
"reserved",
|
|
@@ -15934,7 +16338,7 @@ async function confirmManualResolution() {
|
|
|
15934
16338
|
readline.close();
|
|
15935
16339
|
return answer.trim().toLowerCase() === "resolve";
|
|
15936
16340
|
}
|
|
15937
|
-
var x402PaymentsCommand = new
|
|
16341
|
+
var x402PaymentsCommand = new Command101("payments").description(
|
|
15938
16342
|
"Inspect and reconcile X402 Pay payment records"
|
|
15939
16343
|
);
|
|
15940
16344
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option5("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
@@ -15963,7 +16367,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
15963
16367
|
|
|
15964
16368
|
// src/commands/x402/policy.ts
|
|
15965
16369
|
import { promises as fs9 } from "fs";
|
|
15966
|
-
import { Command as
|
|
16370
|
+
import { Command as Command102 } from "commander";
|
|
15967
16371
|
import { createInterface as createInterface6 } from "readline";
|
|
15968
16372
|
async function confirmUnattendedRule(rule) {
|
|
15969
16373
|
if (!process.stdin.isTTY) {
|
|
@@ -15989,7 +16393,7 @@ async function confirmUnattendedRule(rule) {
|
|
|
15989
16393
|
readline.close();
|
|
15990
16394
|
return answer.trim().toLowerCase() === "authorize";
|
|
15991
16395
|
}
|
|
15992
|
-
var x402PolicyCommand = new
|
|
16396
|
+
var x402PolicyCommand = new Command102("policy").description(
|
|
15993
16397
|
"Manage local X402 Pay spending policy"
|
|
15994
16398
|
);
|
|
15995
16399
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
@@ -16025,14 +16429,14 @@ for (const enabled of [true, false]) {
|
|
|
16025
16429
|
}
|
|
16026
16430
|
|
|
16027
16431
|
// src/commands/x402/request.ts
|
|
16028
|
-
import { Command as
|
|
16432
|
+
import { Command as Command103, Option as Option6 } from "commander";
|
|
16029
16433
|
function collect4(value, previous) {
|
|
16030
16434
|
return [...previous, value];
|
|
16031
16435
|
}
|
|
16032
16436
|
function confirm(lines) {
|
|
16033
16437
|
return confirmAtTerminal(lines, "use --non-interactive with policy");
|
|
16034
16438
|
}
|
|
16035
|
-
var x402RequestCommand = new
|
|
16439
|
+
var x402RequestCommand = new Command103("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(
|
|
16036
16440
|
"--header-env <header=ENV_VAR>",
|
|
16037
16441
|
"Read one request header from an environment variable (repeatable)",
|
|
16038
16442
|
collect4,
|
|
@@ -16080,7 +16484,7 @@ var x402RequestCommand = new Command102("request").description("Request and pay
|
|
|
16080
16484
|
);
|
|
16081
16485
|
|
|
16082
16486
|
// src/commands/x402/index.ts
|
|
16083
|
-
var x402Command = new
|
|
16487
|
+
var x402Command = new Command104("x402").description(
|
|
16084
16488
|
"Pay x402 services with local spending policies (X402 Pay)"
|
|
16085
16489
|
);
|
|
16086
16490
|
x402Command.addCommand(x402RequestCommand);
|
|
@@ -16088,10 +16492,10 @@ x402Command.addCommand(x402PolicyCommand);
|
|
|
16088
16492
|
x402Command.addCommand(x402PaymentsCommand);
|
|
16089
16493
|
|
|
16090
16494
|
// src/commands/sponsored-task/index.ts
|
|
16091
|
-
import { Command as
|
|
16495
|
+
import { Command as Command120 } from "commander";
|
|
16092
16496
|
|
|
16093
16497
|
// src/commands/sponsored-task/create.ts
|
|
16094
|
-
import { Command as
|
|
16498
|
+
import { Command as Command105 } from "commander";
|
|
16095
16499
|
import { toHex as toHex4 } from "viem";
|
|
16096
16500
|
|
|
16097
16501
|
// ../../packages/contracts/evm/abi/generated/SponsoredTasksVaultV2.ts
|
|
@@ -20283,7 +20687,7 @@ async function createOnSolana(opts, keystore) {
|
|
|
20283
20687
|
renderFailure(err);
|
|
20284
20688
|
}
|
|
20285
20689
|
}
|
|
20286
|
-
var sponsoredTaskCreateCommand = new
|
|
20690
|
+
var sponsoredTaskCreateCommand = new Command105("create").description("Create a new Sponsored Task vault for a project token").option(
|
|
20287
20691
|
"--factory <address>",
|
|
20288
20692
|
"SponsoredTaskFactory contract address (EVM chains; defaults to the chain's newest factory, or the settler-mode factory on Robinhood Chain)"
|
|
20289
20693
|
).requiredOption(
|
|
@@ -20406,7 +20810,7 @@ Token risk: ${TOKEN_RISK}`
|
|
|
20406
20810
|
);
|
|
20407
20811
|
|
|
20408
20812
|
// src/commands/sponsored-task/fund.ts
|
|
20409
|
-
import { Command as
|
|
20813
|
+
import { Command as Command106 } from "commander";
|
|
20410
20814
|
function isValidAddress5(addr) {
|
|
20411
20815
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
20412
20816
|
}
|
|
@@ -20440,7 +20844,7 @@ async function fundOnSolana(opts, keystore) {
|
|
|
20440
20844
|
renderFailure(err);
|
|
20441
20845
|
}
|
|
20442
20846
|
}
|
|
20443
|
-
var sponsoredTaskFundCommand = new
|
|
20847
|
+
var sponsoredTaskFundCommand = new Command106("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").option(
|
|
20444
20848
|
"--token <address>",
|
|
20445
20849
|
"Project ERC-20 token address (EVM chains; Solana reads the vault's mint)"
|
|
20446
20850
|
).requiredOption(
|
|
@@ -20463,6 +20867,10 @@ var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponso
|
|
|
20463
20867
|
printError("Invalid Ethereum address for --vault or --token");
|
|
20464
20868
|
return;
|
|
20465
20869
|
}
|
|
20870
|
+
if (!/^\d+$/.test(opts.amount) || BigInt(opts.amount) === 0n) {
|
|
20871
|
+
printError("--amount must be a whole number of token base units, more than zero");
|
|
20872
|
+
return;
|
|
20873
|
+
}
|
|
20466
20874
|
let keystore;
|
|
20467
20875
|
try {
|
|
20468
20876
|
keystore = await loadKeystore();
|
|
@@ -20473,6 +20881,15 @@ var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponso
|
|
|
20473
20881
|
const chainId = opts.chainId;
|
|
20474
20882
|
const { account, publicClient, walletClient, relay } = await createSponsoredTaskVaultChainClients(keystore, chainId);
|
|
20475
20883
|
const amount = BigInt(opts.amount);
|
|
20884
|
+
const vaultToken = await publicClient.readContract({
|
|
20885
|
+
address: opts.vault,
|
|
20886
|
+
abi: SponsoredTasksVaultV2ABI,
|
|
20887
|
+
functionName: "token"
|
|
20888
|
+
});
|
|
20889
|
+
if (vaultToken.toLowerCase() !== opts.token.toLowerCase()) {
|
|
20890
|
+
printError(`--token does not match the vault's token ${vaultToken}`);
|
|
20891
|
+
return;
|
|
20892
|
+
}
|
|
20476
20893
|
await approveSponsoredTaskSpend({
|
|
20477
20894
|
account,
|
|
20478
20895
|
publicClient,
|
|
@@ -20501,7 +20918,7 @@ var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponso
|
|
|
20501
20918
|
});
|
|
20502
20919
|
|
|
20503
20920
|
// src/commands/sponsored-task/managers.ts
|
|
20504
|
-
import { Command as
|
|
20921
|
+
import { Command as Command107 } from "commander";
|
|
20505
20922
|
|
|
20506
20923
|
// src/lib/solana-payout-binding.ts
|
|
20507
20924
|
var PROGRAM_ID_ENV = "TASKMARKET_SOLANA_SPONSORED_TASKS_PROGRAM_ID";
|
|
@@ -20835,7 +21252,7 @@ async function configure(opts) {
|
|
|
20835
21252
|
active: opts.active
|
|
20836
21253
|
});
|
|
20837
21254
|
}
|
|
20838
|
-
var sponsoredTaskManagersCommand = new
|
|
21255
|
+
var sponsoredTaskManagersCommand = new Command107("managers").description(
|
|
20839
21256
|
"Manage authorized managers for a Sponsored Task vault"
|
|
20840
21257
|
);
|
|
20841
21258
|
sponsoredTaskManagersCommand.command("add").description("Authorize a manager with a token-denominated spend cap").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
|
|
@@ -20862,8 +21279,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
|
|
|
20862
21279
|
});
|
|
20863
21280
|
|
|
20864
21281
|
// src/commands/sponsored-task/managed.ts
|
|
20865
|
-
import { Command as
|
|
20866
|
-
var sponsoredTaskManagedCommand = new
|
|
21282
|
+
import { Command as Command108 } from "commander";
|
|
21283
|
+
var sponsoredTaskManagedCommand = new Command108("managed").description(
|
|
20867
21284
|
"List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
|
|
20868
21285
|
).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) => {
|
|
20869
21286
|
let address2 = opts.address;
|
|
@@ -20893,8 +21310,8 @@ var sponsoredTaskManagedCommand = new Command107("managed").description(
|
|
|
20893
21310
|
});
|
|
20894
21311
|
|
|
20895
21312
|
// src/commands/sponsored-task/creation-fee.ts
|
|
20896
|
-
import { Command as
|
|
20897
|
-
var sponsoredTaskCreationFeeCommand = new
|
|
21313
|
+
import { Command as Command109 } from "commander";
|
|
21314
|
+
var sponsoredTaskCreationFeeCommand = new Command109("creation-fee").description("Show the one-time fee for creating a Sponsored Task vault on a chain").requiredOption(
|
|
20898
21315
|
"--chain-id <chain>",
|
|
20899
21316
|
"EVM chain the vault would be created on: a network name or chain id (e.g. base, 8453)",
|
|
20900
21317
|
chainOption("--chain-id", "evm-vault")
|
|
@@ -20938,8 +21355,8 @@ var sponsoredTaskCreationFeeCommand = new Command108("creation-fee").description
|
|
|
20938
21355
|
});
|
|
20939
21356
|
|
|
20940
21357
|
// src/commands/sponsored-task/list.ts
|
|
20941
|
-
import { Command as
|
|
20942
|
-
var sponsoredTaskListCommand = new
|
|
21358
|
+
import { Command as Command110 } from "commander";
|
|
21359
|
+
var sponsoredTaskListCommand = new Command110("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(
|
|
20943
21360
|
async (opts) => {
|
|
20944
21361
|
if (opts.owner && opts.mine) {
|
|
20945
21362
|
printError("Pass --owner or --mine, not both");
|
|
@@ -20968,8 +21385,8 @@ var sponsoredTaskListCommand = new Command109("list").description("List Sponsore
|
|
|
20968
21385
|
);
|
|
20969
21386
|
|
|
20970
21387
|
// src/commands/sponsored-task/settlements.ts
|
|
20971
|
-
import { Command as
|
|
20972
|
-
var sponsoredTaskSettlementsCommand = new
|
|
21388
|
+
import { Command as Command111 } from "commander";
|
|
21389
|
+
var sponsoredTaskSettlementsCommand = new Command111("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) => {
|
|
20973
21390
|
const limit = Number(opts.limit);
|
|
20974
21391
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
20975
21392
|
printError("--limit must be an integer from 1 to 100");
|
|
@@ -20984,17 +21401,17 @@ var sponsoredTaskSettlementsCommand = new Command110("settlements").description(
|
|
|
20984
21401
|
});
|
|
20985
21402
|
|
|
20986
21403
|
// src/commands/sponsored-task/show.ts
|
|
20987
|
-
import { Command as
|
|
20988
|
-
var sponsoredTaskShowCommand = new
|
|
21404
|
+
import { Command as Command112 } from "commander";
|
|
21405
|
+
var sponsoredTaskShowCommand = new Command112("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
20989
21406
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
20990
21407
|
printResult(result);
|
|
20991
21408
|
});
|
|
20992
21409
|
|
|
20993
21410
|
// src/commands/sponsored-task/request-review.ts
|
|
20994
21411
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
20995
|
-
import { Command as
|
|
21412
|
+
import { Command as Command113 } from "commander";
|
|
20996
21413
|
var REQUEST_TTL_SECONDS = 5 * 60;
|
|
20997
|
-
var sponsoredTaskRequestReviewCommand = new
|
|
21414
|
+
var sponsoredTaskRequestReviewCommand = new Command113("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
20998
21415
|
let keystore;
|
|
20999
21416
|
try {
|
|
21000
21417
|
keystore = await loadKeystore();
|
|
@@ -21051,18 +21468,18 @@ var sponsoredTaskRequestReviewCommand = new Command112("request-review").descrip
|
|
|
21051
21468
|
});
|
|
21052
21469
|
|
|
21053
21470
|
// src/commands/sponsored-task/balance.ts
|
|
21054
|
-
import { Command as
|
|
21055
|
-
var sponsoredTaskBalanceCommand = new
|
|
21471
|
+
import { Command as Command114 } from "commander";
|
|
21472
|
+
var sponsoredTaskBalanceCommand = new Command114("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
21056
21473
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
|
|
21057
21474
|
printResult(result);
|
|
21058
21475
|
});
|
|
21059
21476
|
|
|
21060
21477
|
// src/commands/sponsored-task/withdraw.ts
|
|
21061
|
-
import { Command as
|
|
21478
|
+
import { Command as Command115 } from "commander";
|
|
21062
21479
|
function isValidAddress7(addr) {
|
|
21063
21480
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
21064
21481
|
}
|
|
21065
|
-
var sponsoredTaskWithdrawCommand = new
|
|
21482
|
+
var sponsoredTaskWithdrawCommand = new Command115("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption(
|
|
21066
21483
|
"--chain-id <chain>",
|
|
21067
21484
|
"EVM chain the vault is deployed on: a network name or chain id (e.g. base, robinhood, 8453)",
|
|
21068
21485
|
chainOption("--chain-id", "evm-vault")
|
|
@@ -21071,6 +21488,10 @@ var sponsoredTaskWithdrawCommand = new Command114("withdraw").description("Withd
|
|
|
21071
21488
|
printError("Invalid Ethereum address for --vault or --recipient");
|
|
21072
21489
|
return;
|
|
21073
21490
|
}
|
|
21491
|
+
if (!/^\d+$/.test(opts.amount) || BigInt(opts.amount) === 0n) {
|
|
21492
|
+
printError("--amount must be a whole number of token base units, more than zero");
|
|
21493
|
+
return;
|
|
21494
|
+
}
|
|
21074
21495
|
let keystore;
|
|
21075
21496
|
try {
|
|
21076
21497
|
keystore = await loadKeystore();
|
|
@@ -21094,11 +21515,11 @@ var sponsoredTaskWithdrawCommand = new Command114("withdraw").description("Withd
|
|
|
21094
21515
|
});
|
|
21095
21516
|
|
|
21096
21517
|
// src/commands/sponsored-task/exit.ts
|
|
21097
|
-
import { Command as
|
|
21518
|
+
import { Command as Command116 } from "commander";
|
|
21098
21519
|
function isValidAddress8(addr) {
|
|
21099
21520
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
21100
21521
|
}
|
|
21101
|
-
var sponsoredTaskExitCommand = new
|
|
21522
|
+
var sponsoredTaskExitCommand = new Command116("exit").description(
|
|
21102
21523
|
"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."
|
|
21103
21524
|
).requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
|
|
21104
21525
|
"--chain-id <chain>",
|
|
@@ -21174,7 +21595,7 @@ var sponsoredTaskExitCommand = new Command115("exit").description(
|
|
|
21174
21595
|
});
|
|
21175
21596
|
|
|
21176
21597
|
// src/commands/sponsored-task/claim.ts
|
|
21177
|
-
import { Command as
|
|
21598
|
+
import { Command as Command117 } from "commander";
|
|
21178
21599
|
var CLAIM_TO_TYPES = {
|
|
21179
21600
|
ClaimTo: [
|
|
21180
21601
|
{ name: "vaultId", type: "bytes32" },
|
|
@@ -21239,7 +21660,7 @@ async function findEntitlement(vaultId, workerAddress, taskId, options = {}) {
|
|
|
21239
21660
|
await sleep4(3e3);
|
|
21240
21661
|
}
|
|
21241
21662
|
}
|
|
21242
|
-
var sponsoredTaskClaimCommand = new
|
|
21663
|
+
var sponsoredTaskClaimCommand = new Command117("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
|
|
21243
21664
|
"--task-id <id>",
|
|
21244
21665
|
"Claim the entitlement for a specific task (defaults to the first unclaimed one)"
|
|
21245
21666
|
).action(async (vaultId, opts) => {
|
|
@@ -21355,10 +21776,10 @@ var sponsoredTaskClaimCommand = new Command116("claim").description("Claim your
|
|
|
21355
21776
|
});
|
|
21356
21777
|
|
|
21357
21778
|
// src/commands/sponsored-task/rewards.ts
|
|
21358
|
-
import { Command as
|
|
21779
|
+
import { Command as Command118 } from "commander";
|
|
21359
21780
|
var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
|
|
21360
21781
|
var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
|
|
21361
|
-
var sponsoredTaskRewardsCommand = new
|
|
21782
|
+
var sponsoredTaskRewardsCommand = new Command118("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(
|
|
21362
21783
|
async (opts) => {
|
|
21363
21784
|
let address2 = opts.address;
|
|
21364
21785
|
if (address2 === void 0) {
|
|
@@ -21398,7 +21819,7 @@ var sponsoredTaskRewardsCommand = new Command117("rewards").description("List Sp
|
|
|
21398
21819
|
);
|
|
21399
21820
|
|
|
21400
21821
|
// src/commands/sponsored-task/bind-payout.ts
|
|
21401
|
-
import { Command as
|
|
21822
|
+
import { Command as Command119 } from "commander";
|
|
21402
21823
|
async function solanaRewards(agent) {
|
|
21403
21824
|
try {
|
|
21404
21825
|
const result = await apiGet(
|
|
@@ -21409,7 +21830,7 @@ async function solanaRewards(agent) {
|
|
|
21409
21830
|
return [];
|
|
21410
21831
|
}
|
|
21411
21832
|
}
|
|
21412
|
-
var sponsoredTaskBindPayoutCommand = new
|
|
21833
|
+
var sponsoredTaskBindPayoutCommand = new Command119("bind-payout").description(
|
|
21413
21834
|
"Bind the Solana address that receives your Solana Sponsored Task awards (once; rebinding replaces it)"
|
|
21414
21835
|
).option(
|
|
21415
21836
|
"--address <solana-address>",
|
|
@@ -21548,7 +21969,7 @@ function bindingTaskChainIds(requested, connection, everyChain) {
|
|
|
21548
21969
|
}
|
|
21549
21970
|
|
|
21550
21971
|
// src/commands/sponsored-task/index.ts
|
|
21551
|
-
var sponsoredTaskCommand = new
|
|
21972
|
+
var sponsoredTaskCommand = new Command120("sponsored-task").description(
|
|
21552
21973
|
"Sponsored Task vault administration and reward claims"
|
|
21553
21974
|
);
|
|
21554
21975
|
sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
|
|
@@ -21568,10 +21989,10 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
|
21568
21989
|
sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
|
|
21569
21990
|
|
|
21570
21991
|
// src/commands/project/index.ts
|
|
21571
|
-
import { Command as
|
|
21992
|
+
import { Command as Command132 } from "commander";
|
|
21572
21993
|
|
|
21573
21994
|
// src/commands/project/accept.ts
|
|
21574
|
-
import { Command as
|
|
21995
|
+
import { Command as Command121 } from "commander";
|
|
21575
21996
|
|
|
21576
21997
|
// src/commands/project/shared.ts
|
|
21577
21998
|
var ADDRESS = /^0x[0-9a-fA-F]{40}$/;
|
|
@@ -21625,16 +22046,16 @@ async function postProjectWrite(path7, body, options) {
|
|
|
21625
22046
|
const { data: result, idempotencyKey } = await x402Post(
|
|
21626
22047
|
path7,
|
|
21627
22048
|
{ chainId: selectedNetwork().chainId, ...body },
|
|
21628
|
-
options
|
|
22049
|
+
options?.maxAmount !== void 0 ? { maxAmount: options.maxAmount } : void 0
|
|
21629
22050
|
);
|
|
21630
22051
|
printResult(
|
|
21631
22052
|
{ ...result, ...await settleRecording(result, idempotencyKey) },
|
|
21632
|
-
{ idempotencyKey }
|
|
22053
|
+
{ idempotencyKey, ...options?.warnings?.length ? { warnings: options.warnings } : {} }
|
|
21633
22054
|
);
|
|
21634
22055
|
}
|
|
21635
22056
|
|
|
21636
22057
|
// src/commands/project/accept.ts
|
|
21637
|
-
var projectAcceptCommand = new
|
|
22058
|
+
var projectAcceptCommand = new Command121("accept").description(
|
|
21638
22059
|
"Accept a grant on a project as its operator, which freezes the terms; read them first with `project show` (costs 0.001 in the payment token)"
|
|
21639
22060
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
21640
22061
|
const projectId = parseProjectId(id);
|
|
@@ -21643,7 +22064,7 @@ var projectAcceptCommand = new Command120("accept").description(
|
|
|
21643
22064
|
});
|
|
21644
22065
|
|
|
21645
22066
|
// src/commands/project/add-task.ts
|
|
21646
|
-
import { Command as
|
|
22067
|
+
import { Command as Command122 } from "commander";
|
|
21647
22068
|
function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
|
|
21648
22069
|
if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
|
|
21649
22070
|
const endsAt = new Date(project.endsAt);
|
|
@@ -21705,7 +22126,7 @@ function parseContinuation(flags) {
|
|
|
21705
22126
|
function collect5(value, previous = []) {
|
|
21706
22127
|
return [...previous, value];
|
|
21707
22128
|
}
|
|
21708
|
-
var projectAddTaskCommand = new
|
|
22129
|
+
var projectAddTaskCommand = new Command122("add-task").description(
|
|
21709
22130
|
"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)"
|
|
21710
22131
|
).argument("<projectId>", "Project id");
|
|
21711
22132
|
for (const option of createCmd.options) {
|
|
@@ -21749,8 +22170,8 @@ projectAddTaskCommand.action(async (id, opts) => {
|
|
|
21749
22170
|
});
|
|
21750
22171
|
|
|
21751
22172
|
// src/commands/project/claim.ts
|
|
21752
|
-
import { Command as
|
|
21753
|
-
var projectClaimCommand = new
|
|
22173
|
+
import { Command as Command123 } from "commander";
|
|
22174
|
+
var projectClaimCommand = new Command123("claim").description(
|
|
21754
22175
|
"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)"
|
|
21755
22176
|
).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
|
|
21756
22177
|
const projectId = parseProjectId(id);
|
|
@@ -21766,8 +22187,8 @@ var projectClaimCommand = new Command122("claim").description(
|
|
|
21766
22187
|
});
|
|
21767
22188
|
|
|
21768
22189
|
// src/commands/project/close.ts
|
|
21769
|
-
import { Command as
|
|
21770
|
-
var projectCloseCommand = new
|
|
22190
|
+
import { Command as Command124 } from "commander";
|
|
22191
|
+
var projectCloseCommand = new Command124("close").description(
|
|
21771
22192
|
"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)"
|
|
21772
22193
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
21773
22194
|
const projectId = parseProjectId(id);
|
|
@@ -21776,8 +22197,8 @@ var projectCloseCommand = new Command123("close").description(
|
|
|
21776
22197
|
});
|
|
21777
22198
|
|
|
21778
22199
|
// src/commands/project/create.ts
|
|
21779
|
-
import { Command as
|
|
21780
|
-
var projectCreateCommand = new
|
|
22200
|
+
import { Command as Command125 } from "commander";
|
|
22201
|
+
var projectCreateCommand = new Command125("create").description(
|
|
21781
22202
|
"Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
|
|
21782
22203
|
).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
|
|
21783
22204
|
"--ends-at <time>",
|
|
@@ -21812,8 +22233,8 @@ var projectCreateCommand = new Command124("create").description(
|
|
|
21812
22233
|
);
|
|
21813
22234
|
|
|
21814
22235
|
// src/commands/project/fund.ts
|
|
21815
|
-
import { Command as
|
|
21816
|
-
var projectFundCommand = new
|
|
22236
|
+
import { Command as Command126 } from "commander";
|
|
22237
|
+
var projectFundCommand = new Command126("fund").description(
|
|
21817
22238
|
"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)"
|
|
21818
22239
|
).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
|
|
21819
22240
|
"--on-behalf-of <address>",
|
|
@@ -21835,7 +22256,7 @@ var projectFundCommand = new Command125("fund").description(
|
|
|
21835
22256
|
});
|
|
21836
22257
|
|
|
21837
22258
|
// src/commands/project/grant.ts
|
|
21838
|
-
import { Command as
|
|
22259
|
+
import { Command as Command127 } from "commander";
|
|
21839
22260
|
function grantBody(projectId, opts) {
|
|
21840
22261
|
if (!ADDRESS.test(opts.operator)) {
|
|
21841
22262
|
return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
|
|
@@ -21858,11 +22279,11 @@ function grantBody(projectId, opts) {
|
|
|
21858
22279
|
revokeRemovesControl: opts.revokeRemovesControl
|
|
21859
22280
|
};
|
|
21860
22281
|
}
|
|
21861
|
-
var projectGrantCommand = new
|
|
22282
|
+
var projectGrantCommand = new Command127("grant").description(
|
|
21862
22283
|
"Grant a wallet (an agent or a person) the right to create tasks from the project's budget under the terms below. It can spend only after it accepts, which freezes the terms; until then a new grant replaces them (costs 0.001 in the payment token)"
|
|
21863
22284
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
|
|
21864
22285
|
"--cap <amount>",
|
|
21865
|
-
"The most the operator's tasks may
|
|
22286
|
+
"The most the operator's tasks may draw from the budget in total, net of refunds (payouts keep counting, refunds free it), in the payment token (default: no cap beyond the budget)"
|
|
21866
22287
|
).option(
|
|
21867
22288
|
"--requester-of-record <who>",
|
|
21868
22289
|
"Who is task.requester on the operator's tasks, whom ratings and reputation follow: owner or operator",
|
|
@@ -21882,7 +22303,7 @@ var projectGrantCommand = new Command126("grant").description(
|
|
|
21882
22303
|
});
|
|
21883
22304
|
|
|
21884
22305
|
// src/commands/project/review.ts
|
|
21885
|
-
import { Command as
|
|
22306
|
+
import { Command as Command128 } from "commander";
|
|
21886
22307
|
function reviewEvaluator(opts) {
|
|
21887
22308
|
if (opts.evaluator !== void 0 && opts.off) {
|
|
21888
22309
|
return { error: "Pass --evaluator <address> or --off, not both" };
|
|
@@ -21897,7 +22318,7 @@ function reviewEvaluator(opts) {
|
|
|
21897
22318
|
}
|
|
21898
22319
|
return opts.evaluator;
|
|
21899
22320
|
}
|
|
21900
|
-
var projectReviewCommand = new
|
|
22321
|
+
var projectReviewCommand = new Command128("review").description(
|
|
21901
22322
|
"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"
|
|
21902
22323
|
).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) => {
|
|
21903
22324
|
const projectId = parseProjectId(id);
|
|
@@ -21914,12 +22335,33 @@ var projectReviewCommand = new Command127("review").description(
|
|
|
21914
22335
|
}
|
|
21915
22336
|
return;
|
|
21916
22337
|
}
|
|
21917
|
-
await postProjectWrite(
|
|
22338
|
+
await postProjectWrite(
|
|
22339
|
+
`/api/projects/${projectId}/review`,
|
|
22340
|
+
{ projectId, evaluator },
|
|
22341
|
+
{ warnings: await ownerEvaluatorWarnings(evaluator) }
|
|
22342
|
+
);
|
|
21918
22343
|
});
|
|
22344
|
+
async function ownerEvaluatorWarnings(evaluator) {
|
|
22345
|
+
if (evaluator === null) return [];
|
|
22346
|
+
let wallet;
|
|
22347
|
+
try {
|
|
22348
|
+
wallet = (await loadKeystore()).walletAddress;
|
|
22349
|
+
} catch {
|
|
22350
|
+
return [];
|
|
22351
|
+
}
|
|
22352
|
+
if (wallet.toLowerCase() !== evaluator.toLowerCase()) return [];
|
|
22353
|
+
return [
|
|
22354
|
+
cliWarning(
|
|
22355
|
+
"project_review_owner_is_evaluator",
|
|
22356
|
+
"The evaluator is the project owner's own wallet. The owner is the requester of record on its own tasks and, under the default grant terms, its operators' tasks, and cannot evaluate them, so creating those tasks is refused until the review default names another wallet.",
|
|
22357
|
+
{ evaluator: evaluator.toLowerCase() }
|
|
22358
|
+
)
|
|
22359
|
+
];
|
|
22360
|
+
}
|
|
21919
22361
|
|
|
21920
22362
|
// src/commands/project/revoke.ts
|
|
21921
|
-
import { Command as
|
|
21922
|
-
var projectRevokeCommand = new
|
|
22363
|
+
import { Command as Command129 } from "commander";
|
|
22364
|
+
var projectRevokeCommand = new Command129("revoke").description(
|
|
21923
22365
|
"End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
|
|
21924
22366
|
).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
|
|
21925
22367
|
const projectId = parseProjectId(id);
|
|
@@ -21934,7 +22376,7 @@ var projectRevokeCommand = new Command128("revoke").description(
|
|
|
21934
22376
|
});
|
|
21935
22377
|
|
|
21936
22378
|
// src/commands/project/schedule.ts
|
|
21937
|
-
import { Command as
|
|
22379
|
+
import { Command as Command130 } from "commander";
|
|
21938
22380
|
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}$/;
|
|
21939
22381
|
var STATUSES = ["active", "paused", "cancelled", "completed"];
|
|
21940
22382
|
function positiveNumber2(value, flag) {
|
|
@@ -22046,7 +22488,7 @@ async function read(path7) {
|
|
|
22046
22488
|
renderFailure(err);
|
|
22047
22489
|
}
|
|
22048
22490
|
}
|
|
22049
|
-
var
|
|
22491
|
+
var createCommand3 = new Command130("create").description(
|
|
22050
22492
|
"Create a schedule that opens a task from the project's budget on a cadence, as the project's owner. The platform runner creates each task 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, and failures in a row (3 by default) pause the schedule. Costs 0.001 in the payment token"
|
|
22051
22493
|
).argument("<projectId>", "Project id").requiredOption(
|
|
22052
22494
|
"--cadence <cadence>",
|
|
@@ -22067,7 +22509,7 @@ var createCommand2 = new Command129("create").description(
|
|
|
22067
22509
|
if ("error" in body) return void printError(String(body.error));
|
|
22068
22510
|
await postProjectWrite(`/api/projects/${projectId}/schedules`, body);
|
|
22069
22511
|
});
|
|
22070
|
-
var listCommand6 = new
|
|
22512
|
+
var listCommand6 = new Command130("list").description("List a project's schedules, its schedule limits and the platform runner (free)").argument("<projectId>", "Project id").option("--status <status>", "active, paused, cancelled or completed").option("--limit <count>", "Schedules to list (1-100, default 50)").action(async (id, opts) => {
|
|
22071
22513
|
const projectId = parseProjectId(id);
|
|
22072
22514
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
22073
22515
|
if (opts.status !== void 0 && !STATUSES.includes(opts.status)) {
|
|
@@ -22082,19 +22524,19 @@ var listCommand6 = new Command129("list").description("List a project's schedule
|
|
|
22082
22524
|
const query4 = params.toString();
|
|
22083
22525
|
await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
|
|
22084
22526
|
});
|
|
22085
|
-
var showCommand3 = new
|
|
22527
|
+
var showCommand3 = new Command130("show").description("Show a schedule and its newest runs: opened, skipped or failed (free)").argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
22086
22528
|
const id = scheduleId(value);
|
|
22087
22529
|
if (typeof id !== "string") return void printError(id.error);
|
|
22088
22530
|
await read(`/api/project-schedules/${id}`);
|
|
22089
22531
|
});
|
|
22090
22532
|
function actionCommand(action, description) {
|
|
22091
|
-
return new
|
|
22533
|
+
return new Command130(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
|
|
22092
22534
|
const id = scheduleId(value);
|
|
22093
22535
|
if (typeof id !== "string") return void printError(id.error);
|
|
22094
22536
|
await postProjectWrite(`/api/project-schedules/${id}/${action}`, { scheduleId: id });
|
|
22095
22537
|
});
|
|
22096
22538
|
}
|
|
22097
|
-
var settingsCommand = new
|
|
22539
|
+
var settingsCommand = new Command130("settings").description(
|
|
22098
22540
|
"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"
|
|
22099
22541
|
).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) => {
|
|
22100
22542
|
const projectId = parseProjectId(id);
|
|
@@ -22114,9 +22556,9 @@ var settingsCommand = new Command129("settings").description(
|
|
|
22114
22556
|
if ("error" in body) return void printError(String(body.error));
|
|
22115
22557
|
await postProjectWrite(`/api/projects/${projectId}/schedules/settings`, body);
|
|
22116
22558
|
});
|
|
22117
|
-
var projectScheduleCommand = new
|
|
22559
|
+
var projectScheduleCommand = new Command130("schedule").description(
|
|
22118
22560
|
"Schedules: a task from the project's budget on a cadence, created by the platform runner under your grant to it"
|
|
22119
|
-
).addCommand(
|
|
22561
|
+
).addCommand(createCommand3).addCommand(listCommand6).addCommand(showCommand3).addCommand(
|
|
22120
22562
|
actionCommand(
|
|
22121
22563
|
"pause",
|
|
22122
22564
|
"Pause a schedule; it creates nothing until resumed (costs 0.001 in the payment token)"
|
|
@@ -22132,23 +22574,24 @@ var projectScheduleCommand = new Command129("schedule").description(
|
|
|
22132
22574
|
"Cancel a schedule for good; the tasks it created are unaffected (costs 0.001 in the payment token)"
|
|
22133
22575
|
)
|
|
22134
22576
|
).addCommand(settingsCommand);
|
|
22135
|
-
var projectRunnerCommand = new
|
|
22136
|
-
"The platform runner's address on the selected network's chain, and every chain's runner (free). Each chain has its own runner wallet: grant the one on the project's chain before scheduling, `taskmarket project grant <projectId> --operator <address> --cap <amount>`. Its cap bounds what scheduled tasks
|
|
22577
|
+
var projectRunnerCommand = new Command130("runner").description(
|
|
22578
|
+
"The platform runner's address on the selected network's chain, and every chain's runner (free). Each chain has its own runner wallet: grant the one on the project's chain before scheduling, `taskmarket project grant <projectId> --operator <address> --cap <amount>`. Its cap bounds what scheduled tasks draw in total, net of refunds (payouts keep counting); the runner pays each action fee"
|
|
22137
22579
|
).action(async () => {
|
|
22138
22580
|
await read(withChainId("/api/project-runner"));
|
|
22139
22581
|
});
|
|
22140
22582
|
|
|
22141
22583
|
// src/commands/project/show.ts
|
|
22142
|
-
import { Command as
|
|
22143
|
-
var projectShowCommand = new
|
|
22584
|
+
import { Command as Command131 } from "commander";
|
|
22585
|
+
var projectShowCommand = new Command131("show").description(
|
|
22144
22586
|
"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)"
|
|
22145
22587
|
).argument("<projectId>", "Project id").action(async (id) => {
|
|
22146
22588
|
const projectId = parseProjectId(id);
|
|
22147
22589
|
if (typeof projectId !== "number") return void printError(projectId.error);
|
|
22148
|
-
|
|
22590
|
+
const headers = (await signReadAuth())?.headers ?? {};
|
|
22591
|
+
printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
|
|
22149
22592
|
});
|
|
22150
22593
|
var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
|
|
22151
|
-
var projectBackersCommand = new
|
|
22594
|
+
var projectBackersCommand = new Command131("backers").description(
|
|
22152
22595
|
"List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
|
|
22153
22596
|
).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) => {
|
|
22154
22597
|
const projectId = parseProjectId(id);
|
|
@@ -22167,13 +22610,13 @@ var projectBackersCommand = new Command130("backers").description(
|
|
|
22167
22610
|
await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
|
|
22168
22611
|
);
|
|
22169
22612
|
});
|
|
22170
|
-
var projectForTaskCommand = new
|
|
22613
|
+
var projectForTaskCommand = new Command131("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) => {
|
|
22171
22614
|
if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
|
|
22172
22615
|
return void printError("The task id must be 0x-prefixed hex");
|
|
22173
22616
|
}
|
|
22174
22617
|
printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
|
|
22175
22618
|
});
|
|
22176
|
-
var projectListCommand = new
|
|
22619
|
+
var projectListCommand = new Command131("list").description("List a wallet's projects, as owner or operator (free; default: your wallet)").option("--address <address>", "The wallet to list (default: your keystore wallet)").option("--role <role>", "owner, operator or any", "any").option("--limit <count>", "Projects per page (1-100, default 50)").option("--before <projectId>", "The next page: projects with a smaller id than this").action(async (opts) => {
|
|
22177
22620
|
if (!["owner", "operator", "any"].includes(opts.role)) {
|
|
22178
22621
|
return void printError("--role must be owner, operator or any");
|
|
22179
22622
|
}
|
|
@@ -22202,7 +22645,7 @@ var projectListCommand = new Command130("list").description("List a wallet's pro
|
|
|
22202
22645
|
});
|
|
22203
22646
|
|
|
22204
22647
|
// src/commands/project/index.ts
|
|
22205
|
-
var projectCommand = new
|
|
22648
|
+
var projectCommand = new Command132("project").description(
|
|
22206
22649
|
"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"
|
|
22207
22650
|
);
|
|
22208
22651
|
projectCommand.addCommand(projectCreateCommand);
|
|
@@ -22222,12 +22665,12 @@ projectCommand.addCommand(projectListCommand);
|
|
|
22222
22665
|
projectCommand.addCommand(projectForTaskCommand);
|
|
22223
22666
|
|
|
22224
22667
|
// src/commands/workflow.ts
|
|
22225
|
-
import { readFile as
|
|
22226
|
-
import { Command as
|
|
22668
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
22669
|
+
import { Command as Command134 } from "commander";
|
|
22227
22670
|
|
|
22228
22671
|
// src/commands/workflow-template.ts
|
|
22229
|
-
import { readFile as
|
|
22230
|
-
import { Command as
|
|
22672
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
22673
|
+
import { Command as Command133 } from "commander";
|
|
22231
22674
|
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}$/;
|
|
22232
22675
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
22233
22676
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
@@ -22236,7 +22679,7 @@ async function readJsonFile(path7, what = "template") {
|
|
|
22236
22679
|
if (!path7) return { error: `Pass the ${what} with --file <path> (JSON)` };
|
|
22237
22680
|
let text;
|
|
22238
22681
|
try {
|
|
22239
|
-
const buffer = await
|
|
22682
|
+
const buffer = await readFile4(path7);
|
|
22240
22683
|
if (buffer.length > FILE_MAX_BYTES) {
|
|
22241
22684
|
return { error: `${path7} is ${buffer.length} bytes; a ${what} is at most 64 KiB as JSON` };
|
|
22242
22685
|
}
|
|
@@ -22317,14 +22760,14 @@ async function readValidTemplate(path7) {
|
|
|
22317
22760
|
}
|
|
22318
22761
|
return parsed.document;
|
|
22319
22762
|
}
|
|
22320
|
-
var
|
|
22763
|
+
var createCommand4 = new Command133("create").description(
|
|
22321
22764
|
"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"
|
|
22322
22765
|
).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
|
|
22323
22766
|
const template = await readValidTemplate(opts.file);
|
|
22324
22767
|
if (!template) return;
|
|
22325
22768
|
await postProjectWrite("/api/project-workflow-templates", { template });
|
|
22326
22769
|
});
|
|
22327
|
-
var updateCommand = new
|
|
22770
|
+
var updateCommand = new Command133("update").description(
|
|
22328
22771
|
"Replace a saved template with a JSON file, as the wallet that saved it; workflows already made from it keep their document. Costs 0.001 in the payment token"
|
|
22329
22772
|
).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
|
|
22330
22773
|
const choice = templateChoice(value);
|
|
@@ -22338,7 +22781,7 @@ var updateCommand = new Command132("update").description(
|
|
|
22338
22781
|
template
|
|
22339
22782
|
});
|
|
22340
22783
|
});
|
|
22341
|
-
var listCommand7 = new
|
|
22784
|
+
var listCommand7 = new Command133("list").description(
|
|
22342
22785
|
"List the built-in presets and a wallet's saved templates, newest first (your wallet unless --owner is given) (free)"
|
|
22343
22786
|
).option("--owner <address>", "The wallet whose templates to list").option("--limit <count>", "Templates per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (opts) => {
|
|
22344
22787
|
if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
|
|
@@ -22366,7 +22809,7 @@ var listCommand7 = new Command132("list").description(
|
|
|
22366
22809
|
renderFailure(err);
|
|
22367
22810
|
}
|
|
22368
22811
|
});
|
|
22369
|
-
var showCommand4 = new
|
|
22812
|
+
var showCommand4 = new Command133("show").description(
|
|
22370
22813
|
"Show a saved template or a preset (code, content, research): its parameters, steps and worst case (free)"
|
|
22371
22814
|
).argument("<template>", "Template id or preset name").action(async (value) => {
|
|
22372
22815
|
const choice = templateChoice(value);
|
|
@@ -22379,7 +22822,7 @@ var showCommand4 = new Command132("show").description(
|
|
|
22379
22822
|
renderFailure(err);
|
|
22380
22823
|
}
|
|
22381
22824
|
});
|
|
22382
|
-
var deleteCommand2 = new
|
|
22825
|
+
var deleteCommand2 = new Command133("delete").description(
|
|
22383
22826
|
"Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
|
|
22384
22827
|
).argument("<templateId>", "Template id").action(async (value) => {
|
|
22385
22828
|
const choice = templateChoice(value);
|
|
@@ -22390,9 +22833,9 @@ var deleteCommand2 = new Command132("delete").description(
|
|
|
22390
22833
|
templateId: choice.templateId
|
|
22391
22834
|
});
|
|
22392
22835
|
});
|
|
22393
|
-
var workflowTemplateCommand = new
|
|
22836
|
+
var workflowTemplateCommand = new Command133("template").description(
|
|
22394
22837
|
"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|preset> --param name=value`. Presets: code, content, research"
|
|
22395
|
-
).addCommand(
|
|
22838
|
+
).addCommand(createCommand4).addCommand(updateCommand).addCommand(listCommand7).addCommand(showCommand4).addCommand(deleteCommand2);
|
|
22396
22839
|
async function createWorkflowFromTemplate(projectId, template, pairs) {
|
|
22397
22840
|
const choice = templateChoice(template);
|
|
22398
22841
|
if ("error" in choice) return void printError(choice.error);
|
|
@@ -22419,7 +22862,7 @@ async function readDocument(path7) {
|
|
|
22419
22862
|
if (!path7) return { error: "Pass the workflow document with --file <path> (JSON)" };
|
|
22420
22863
|
let text;
|
|
22421
22864
|
try {
|
|
22422
|
-
const buffer = await
|
|
22865
|
+
const buffer = await readFile5(path7);
|
|
22423
22866
|
if (buffer.length > FILE_MAX_BYTES2) {
|
|
22424
22867
|
return {
|
|
22425
22868
|
error: `${path7} is ${buffer.length} bytes; a workflow document is at most 64 KiB as JSON`
|
|
@@ -22469,7 +22912,7 @@ async function projectContext(projectId) {
|
|
|
22469
22912
|
runner
|
|
22470
22913
|
};
|
|
22471
22914
|
}
|
|
22472
|
-
var validateCommand = new
|
|
22915
|
+
var validateCommand = new Command134("validate").description(
|
|
22473
22916
|
"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)"
|
|
22474
22917
|
).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) => {
|
|
22475
22918
|
const parsed = await readDocument(opts.file ?? file);
|
|
@@ -22512,7 +22955,7 @@ var validateCommand = new Command133("validate").description(
|
|
|
22512
22955
|
document: result.document
|
|
22513
22956
|
});
|
|
22514
22957
|
});
|
|
22515
|
-
var
|
|
22958
|
+
var createCommand5 = new Command134("create").description(
|
|
22516
22959
|
"Create a workflow on a project, as its owner, from a JSON document (--file) or from a saved template or a preset (--template <id|code|content|research> 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"
|
|
22517
22960
|
).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option("--template <template>", "A saved template id, or a preset: code, content, research").option(
|
|
22518
22961
|
"--param <name=value>",
|
|
@@ -22547,7 +22990,7 @@ var createCommand4 = new Command133("create").description(
|
|
|
22547
22990
|
document: parsed.document
|
|
22548
22991
|
});
|
|
22549
22992
|
});
|
|
22550
|
-
var listCommand8 = new
|
|
22993
|
+
var listCommand8 = new Command134("list").description(
|
|
22551
22994
|
"List a project's workflows, newest first, with its workflow limits and the platform runner (free)"
|
|
22552
22995
|
).argument("<projectId>", "Project id").option("--limit <count>", "Workflows per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (id, opts) => {
|
|
22553
22996
|
const projectId = parseProjectId(id);
|
|
@@ -22561,12 +23004,12 @@ var listCommand8 = new Command133("list").description(
|
|
|
22561
23004
|
const query4 = params.toString();
|
|
22562
23005
|
await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
|
|
22563
23006
|
});
|
|
22564
|
-
var showCommand5 = new
|
|
23007
|
+
var showCommand5 = new Command134("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
22565
23008
|
const id = uuid(value, "workflow");
|
|
22566
23009
|
if (typeof id !== "string") return void printError(id.error);
|
|
22567
23010
|
await read2(`/api/project-workflows/${id}`);
|
|
22568
23011
|
});
|
|
22569
|
-
var runsCommand = new
|
|
23012
|
+
var runsCommand = new Command134("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) => {
|
|
22570
23013
|
const id = uuid(value, "workflow");
|
|
22571
23014
|
if (typeof id !== "string") return void printError(id.error);
|
|
22572
23015
|
if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
|
|
@@ -22578,14 +23021,14 @@ var runsCommand = new Command133("runs").description("Page through a workflow's
|
|
|
22578
23021
|
const query4 = params.toString();
|
|
22579
23022
|
await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
|
|
22580
23023
|
});
|
|
22581
|
-
var statusCommand3 = new
|
|
23024
|
+
var statusCommand3 = new Command134("status").description(
|
|
22582
23025
|
"Show a run: its outline, each step with its state (pending, open, accepted, failed or skipped), round, item or attempt, and the next action (free)"
|
|
22583
23026
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
22584
23027
|
const id = uuid(value, "run");
|
|
22585
23028
|
if (typeof id !== "string") return void printError(id.error);
|
|
22586
23029
|
await read2(`/api/project-workflow-runs/${id}`);
|
|
22587
23030
|
});
|
|
22588
|
-
var runCommand2 = new
|
|
23031
|
+
var runCommand2 = new Command134("run").description(
|
|
22589
23032
|
"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"
|
|
22590
23033
|
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
22591
23034
|
const id = uuid(value, "workflow");
|
|
@@ -22593,7 +23036,7 @@ var runCommand2 = new Command133("run").description(
|
|
|
22593
23036
|
await postProjectWrite(`/api/project-workflows/${id}/runs`, { workflowId: id });
|
|
22594
23037
|
});
|
|
22595
23038
|
function stepCommand(action, description) {
|
|
22596
|
-
return new
|
|
23039
|
+
return new Command134(action).description(description).argument("<runId>", "Run id").requiredOption(
|
|
22597
23040
|
"--step <key>",
|
|
22598
23041
|
"The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
|
|
22599
23042
|
).action(async (value, opts) => {
|
|
@@ -22604,14 +23047,21 @@ function stepCommand(action, description) {
|
|
|
22604
23047
|
await postProjectWrite(`/api/project-workflow-runs/${id}/${action}`, { runId: id, step });
|
|
22605
23048
|
});
|
|
22606
23049
|
}
|
|
22607
|
-
var cancelCommand = new
|
|
23050
|
+
var cancelCommand = new Command134("cancel").description(
|
|
22608
23051
|
"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"
|
|
22609
23052
|
).argument("<runId>", "Run id").action(async (value) => {
|
|
22610
23053
|
const id = uuid(value, "run");
|
|
22611
23054
|
if (typeof id !== "string") return void printError(id.error);
|
|
22612
23055
|
await postProjectWrite(`/api/project-workflow-runs/${id}/cancel`, { runId: id });
|
|
22613
23056
|
});
|
|
22614
|
-
var
|
|
23057
|
+
var deleteCommand3 = new Command134("delete").description(
|
|
23058
|
+
"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"
|
|
23059
|
+
).argument("<workflowId>", "Workflow id").action(async (value) => {
|
|
23060
|
+
const id = uuid(value, "workflow");
|
|
23061
|
+
if (typeof id !== "string") return void printError(id.error);
|
|
23062
|
+
await postProjectWrite(`/api/project-workflows/${id}/delete`, { workflowId: id });
|
|
23063
|
+
});
|
|
23064
|
+
var settingsCommand2 = new Command134("settings").description(
|
|
22615
23065
|
`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`
|
|
22616
23066
|
).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
|
|
22617
23067
|
const projectId = parseProjectId(id);
|
|
@@ -22638,9 +23088,9 @@ var settingsCommand2 = new Command133("settings").description(
|
|
|
22638
23088
|
stepLimit: limit
|
|
22639
23089
|
});
|
|
22640
23090
|
});
|
|
22641
|
-
var workflowCommand = new
|
|
23091
|
+
var workflowCommand = new Command134("workflow").description(
|
|
22642
23092
|
"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"
|
|
22643
|
-
).addCommand(validateCommand).addCommand(
|
|
23093
|
+
).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand5).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
|
|
22644
23094
|
stepCommand(
|
|
22645
23095
|
"approve",
|
|
22646
23096
|
"Approve an open owner gate in a run so the steps after it start, as the owner; a verdict or time gate opens on its own (costs 0.001 in the payment token)"
|
|
@@ -22648,13 +23098,13 @@ var workflowCommand = new Command133("workflow").description(
|
|
|
22648
23098
|
).addCommand(
|
|
22649
23099
|
stepCommand(
|
|
22650
23100
|
"retry",
|
|
22651
|
-
"Retry a failed step the run waits on, as a new attempt, as the owner; a forEach recounts its list (costs 0.001 in the payment token)"
|
|
23101
|
+
"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)"
|
|
22652
23102
|
)
|
|
22653
|
-
).addCommand(cancelCommand).addCommand(settingsCommand2).addCommand(workflowTemplateCommand);
|
|
23103
|
+
).addCommand(cancelCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(workflowTemplateCommand);
|
|
22654
23104
|
|
|
22655
23105
|
// src/commands/drops.ts
|
|
22656
|
-
import { Command as
|
|
22657
|
-
var listCommand9 = new
|
|
23106
|
+
import { Command as Command135 } from "commander";
|
|
23107
|
+
var listCommand9 = new Command135("list").description("List public Task Drops, ones accepting work first").option("--limit <n>", "Maximum drops to return (1-48)", "24").option("--cursor <cursor>", "nextCursor from a previous page").action(async (opts) => {
|
|
22658
23108
|
try {
|
|
22659
23109
|
const input = parseInput(TaskDropDirectoryInputSchema, {
|
|
22660
23110
|
limit: optionalInt(opts.limit),
|
|
@@ -22667,7 +23117,7 @@ var listCommand9 = new Command134("list").description("List public Task Drops, o
|
|
|
22667
23117
|
renderFailure(err);
|
|
22668
23118
|
}
|
|
22669
23119
|
});
|
|
22670
|
-
var showCommand6 = new
|
|
23120
|
+
var showCommand6 = new Command135("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
|
|
22671
23121
|
try {
|
|
22672
23122
|
const input = parseInput(TaskDropGetInputSchema, { taskDropId });
|
|
22673
23123
|
const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
|
|
@@ -22679,7 +23129,7 @@ var showCommand6 = new Command134("show").description("Show a Task Drop and its
|
|
|
22679
23129
|
renderFailure(err);
|
|
22680
23130
|
}
|
|
22681
23131
|
});
|
|
22682
|
-
var subscribeCommand = new
|
|
23132
|
+
var subscribeCommand = new Command135("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(
|
|
22683
23133
|
async (taskDropId, opts) => {
|
|
22684
23134
|
try {
|
|
22685
23135
|
if (opts.official) {
|
|
@@ -22707,7 +23157,7 @@ var subscribeCommand = new Command134("subscribe").description("Subscribe an ema
|
|
|
22707
23157
|
}
|
|
22708
23158
|
}
|
|
22709
23159
|
);
|
|
22710
|
-
var statusCommand4 = new
|
|
23160
|
+
var statusCommand4 = new Command135("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) => {
|
|
22711
23161
|
try {
|
|
22712
23162
|
if (opts.official) {
|
|
22713
23163
|
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
@@ -22724,11 +23174,11 @@ var statusCommand4 = new Command134("status").description("Check whether an emai
|
|
|
22724
23174
|
renderFailure(err);
|
|
22725
23175
|
}
|
|
22726
23176
|
});
|
|
22727
|
-
var dropsCommand = new
|
|
23177
|
+
var dropsCommand = new Command135("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
|
|
22728
23178
|
|
|
22729
23179
|
// src/commands/hooks.ts
|
|
22730
|
-
import { Command as
|
|
22731
|
-
var listCommand10 = new
|
|
23180
|
+
import { Command as Command136 } from "commander";
|
|
23181
|
+
var listCommand10 = new Command136("list").description(
|
|
22732
23182
|
"List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
|
|
22733
23183
|
).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").action(async (opts) => {
|
|
22734
23184
|
try {
|
|
@@ -22743,7 +23193,7 @@ var listCommand10 = new Command135("list").description(
|
|
|
22743
23193
|
renderFailure(err);
|
|
22744
23194
|
}
|
|
22745
23195
|
});
|
|
22746
|
-
var showCommand7 = new
|
|
23196
|
+
var showCommand7 = new Command136("show").description(
|
|
22747
23197
|
"Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
|
|
22748
23198
|
).argument("<address>", "Hook contract address").action(async (address2) => {
|
|
22749
23199
|
try {
|
|
@@ -22763,7 +23213,7 @@ var showCommand7 = new Command135("show").description(
|
|
|
22763
23213
|
renderFailure(err);
|
|
22764
23214
|
}
|
|
22765
23215
|
});
|
|
22766
|
-
var attachmentConfigCommand = new
|
|
23216
|
+
var attachmentConfigCommand = new Command136("attachment-config").description(
|
|
22767
23217
|
"Show the protocol-default hook order and maximum hooks per task on the selected --network"
|
|
22768
23218
|
).action(async () => {
|
|
22769
23219
|
try {
|
|
@@ -22772,12 +23222,12 @@ var attachmentConfigCommand = new Command135("attachment-config").description(
|
|
|
22772
23222
|
renderFailure(err);
|
|
22773
23223
|
}
|
|
22774
23224
|
});
|
|
22775
|
-
var hooksCommand = new
|
|
23225
|
+
var hooksCommand = new Command136("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(attachmentConfigCommand);
|
|
22776
23226
|
|
|
22777
23227
|
// src/commands/tap.ts
|
|
22778
23228
|
import { promises as fs10 } from "fs";
|
|
22779
|
-
import { Command as
|
|
22780
|
-
var tapCommand = new
|
|
23229
|
+
import { Command as Command137 } from "commander";
|
|
23230
|
+
var tapCommand = new Command137("tap").description(
|
|
22781
23231
|
"Manage the TAP signing key used on tasks that require TAP verification"
|
|
22782
23232
|
);
|
|
22783
23233
|
tapCommand.command("import").description(
|
|
@@ -22889,10 +23339,10 @@ tapCommand.command("show").description(
|
|
|
22889
23339
|
printResult({ configured: false });
|
|
22890
23340
|
return;
|
|
22891
23341
|
}
|
|
22892
|
-
const
|
|
23342
|
+
const summary2 = { configured: true, ...tapKeySummary(tapKey) };
|
|
22893
23343
|
const keyId = tapKey.keyId;
|
|
22894
23344
|
if (keyId === null) {
|
|
22895
|
-
printResult({ ...
|
|
23345
|
+
printResult({ ...summary2, status: null });
|
|
22896
23346
|
return;
|
|
22897
23347
|
}
|
|
22898
23348
|
const warnings = [];
|
|
@@ -22919,7 +23369,7 @@ tapCommand.command("show").description(
|
|
|
22919
23369
|
);
|
|
22920
23370
|
}
|
|
22921
23371
|
}
|
|
22922
|
-
printResult({ ...
|
|
23372
|
+
printResult({ ...summary2, status }, { warnings });
|
|
22923
23373
|
} catch (err) {
|
|
22924
23374
|
renderFailure(err);
|
|
22925
23375
|
}
|
|
@@ -22936,7 +23386,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
|
|
|
22936
23386
|
});
|
|
22937
23387
|
|
|
22938
23388
|
// src/commands/hire.ts
|
|
22939
|
-
import { Command as
|
|
23389
|
+
import { Command as Command138 } from "commander";
|
|
22940
23390
|
var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
|
|
22941
23391
|
async function lookupListedService(worker, serviceId) {
|
|
22942
23392
|
let listing;
|
|
@@ -22967,7 +23417,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
|
|
|
22967
23417
|
}
|
|
22968
23418
|
return null;
|
|
22969
23419
|
}
|
|
22970
|
-
var hireCommand = new
|
|
23420
|
+
var hireCommand = new Command138("hire").description(
|
|
22971
23421
|
"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."
|
|
22972
23422
|
).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(
|
|
22973
23423
|
"--requires-evaluator",
|
|
@@ -23031,7 +23481,7 @@ hireCommand.action(async (worker, opts) => {
|
|
|
23031
23481
|
// src/index.ts
|
|
23032
23482
|
var require2 = createRequire(import.meta.url);
|
|
23033
23483
|
var { version } = require2("../package.json");
|
|
23034
|
-
var program = new
|
|
23484
|
+
var program = new Command139();
|
|
23035
23485
|
setLastErrorCliVersion(version);
|
|
23036
23486
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
23037
23487
|
program.option(
|
|
@@ -23059,6 +23509,7 @@ program.addCommand(statsCommand);
|
|
|
23059
23509
|
program.addCommand(taskCommand2);
|
|
23060
23510
|
program.addCommand(agentCommand);
|
|
23061
23511
|
program.addCommand(agentsCommand);
|
|
23512
|
+
program.addCommand(skillsCommand);
|
|
23062
23513
|
program.addCommand(inboxCommand);
|
|
23063
23514
|
program.addCommand(depositCommand);
|
|
23064
23515
|
program.addCommand(withdrawCommand);
|