moltlaunch 2.0.0 → 2.0.2
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/README.md +2 -2
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/.claude/commands/deploy.md +0 -33
- package/.claude/hooks/regenerate-docs.sh +0 -12
- package/.claude/settings.json +0 -15
- package/.env.example +0 -2
- package/.github/workflows/deploy.yml +0 -37
- package/ROADMAP.md +0 -29
- package/contracts/MandateEscrowV4.sol +0 -281
- package/contracts/mocks/MockFlaunchBuyback.sol +0 -24
- package/hardhat.config.cjs +0 -29
- package/scripts/check-deploy-cost.ts +0 -15
- package/scripts/deploy-escrow-v4.ts +0 -81
- package/scripts/deploy-escrow.cjs +0 -22
- package/scripts/generate-docs.ts +0 -309
- package/shared/manifest.json +0 -87
- package/site/.vscode/extensions.json +0 -4
- package/site/.vscode/launch.json +0 -11
- package/site/README.md +0 -43
- package/site/astro.config.mjs +0 -21
- package/site/functions/agent/[[path]].ts +0 -9
- package/site/functions/task/[[path]].ts +0 -9
- package/site/index.html.bak +0 -1755
- package/site/package-lock.json +0 -6165
- package/site/package.json +0 -17
- package/site/public/_redirects +0 -1
- package/site/public/art/hero.webp +0 -0
- package/site/public/favicon.ico +0 -0
- package/site/public/favicon.svg +0 -4
- package/site/public/logo.png +0 -0
- package/site/public/skill.md +0 -276
- package/site/src/components/AgentGridCard.astro +0 -97
- package/site/src/components/AgentRow.astro +0 -75
- package/site/src/components/Footer.astro +0 -71
- package/site/src/components/GigCard.astro +0 -36
- package/site/src/components/Navbar.astro +0 -93
- package/site/src/components/ReviewCard.astro +0 -29
- package/site/src/components/SkillPill.astro +0 -19
- package/site/src/components/StatusBadge.astro +0 -27
- package/site/src/components/TaskEntry.astro +0 -98
- package/site/src/layouts/Layout.astro +0 -268
- package/site/src/lib/api.ts +0 -342
- package/site/src/pages/404.astro +0 -33
- package/site/src/pages/admin.astro +0 -445
- package/site/src/pages/agent/[...id].astro +0 -678
- package/site/src/pages/agents/index.astro +0 -235
- package/site/src/pages/dashboard.astro +0 -244
- package/site/src/pages/docs.astro +0 -191
- package/site/src/pages/how.astro +0 -156
- package/site/src/pages/index.astro +0 -226
- package/site/src/pages/leaderboard.astro +0 -155
- package/site/src/pages/task/[...id].astro +0 -1467
- package/site/src/styles/global.css +0 -159
- package/site/tailwind.config.mjs +0 -94
- package/site/tsconfig.json +0 -5
- package/site/wrangler.toml +0 -5
- package/src/commands/accept.ts +0 -135
- package/src/commands/agents.ts +0 -190
- package/src/commands/approve.ts +0 -127
- package/src/commands/claim.ts +0 -130
- package/src/commands/decline.ts +0 -55
- package/src/commands/dispute.ts +0 -92
- package/src/commands/earnings.ts +0 -86
- package/src/commands/feedback.ts +0 -147
- package/src/commands/gig.ts +0 -141
- package/src/commands/hire.ts +0 -96
- package/src/commands/inbox.ts +0 -135
- package/src/commands/message.ts +0 -97
- package/src/commands/profile.ts +0 -62
- package/src/commands/quote.ts +0 -80
- package/src/commands/refund.ts +0 -82
- package/src/commands/register.ts +0 -250
- package/src/commands/resolve.ts +0 -104
- package/src/commands/reviews.ts +0 -78
- package/src/commands/revise.ts +0 -65
- package/src/commands/submit.ts +0 -123
- package/src/commands/tasks.ts +0 -224
- package/src/commands/view.ts +0 -122
- package/src/commands/wallet.ts +0 -42
- package/src/index.ts +0 -285
- package/src/lib/agent0.ts +0 -158
- package/src/lib/auth.ts +0 -25
- package/src/lib/constants.ts +0 -55
- package/src/lib/escrow.ts +0 -374
- package/src/lib/files.ts +0 -87
- package/src/lib/flaunch.ts +0 -277
- package/src/lib/mandate.ts +0 -623
- package/src/lib/tasks.ts +0 -466
- package/src/lib/types.ts +0 -112
- package/src/lib/wallet.ts +0 -119
- package/src/lib/x402.ts +0 -86
- package/test/MandateEscrowV4.test.cjs +0 -568
- package/tsconfig.json +0 -19
- package/tsup.config.ts +0 -15
- package/worker/package-lock.json +0 -1812
- package/worker/package.json +0 -18
- package/worker/src/agents.ts +0 -755
- package/worker/src/auth.ts +0 -126
- package/worker/src/files.ts +0 -40
- package/worker/src/index.ts +0 -963
- package/worker/src/profiles.ts +0 -85
- package/worker/src/ratelimit.ts +0 -45
- package/worker/src/tasks.ts +0 -498
- package/worker/src/types.ts +0 -95
- package/worker/tsconfig.json +0 -15
- package/worker/wrangler.toml +0 -19
package/src/commands/tasks.ts
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
// mltl tasks - View tasks you've created as a client
|
|
2
|
-
|
|
3
|
-
import { formatEther } from "viem";
|
|
4
|
-
import { loadOrCreateWallet } from "../lib/wallet.js";
|
|
5
|
-
import { getClientTasks, Task } from "../lib/tasks.js";
|
|
6
|
-
|
|
7
|
-
interface TasksOptions {
|
|
8
|
-
json?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function formatTimestamp(ts: number): string {
|
|
12
|
-
const date = new Date(ts);
|
|
13
|
-
return date.toLocaleString();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function formatStatus(status: Task["status"]): string {
|
|
17
|
-
const icons: Record<Task["status"], string> = {
|
|
18
|
-
requested: "📤 Awaiting Quote",
|
|
19
|
-
quoted: "💬 Quote Received",
|
|
20
|
-
accepted: "🔨 In Progress",
|
|
21
|
-
submitted: "📥 Review Needed",
|
|
22
|
-
revision: "🔄 Revision Requested",
|
|
23
|
-
completed: "✅ Completed",
|
|
24
|
-
declined: "❌ Declined",
|
|
25
|
-
expired: "⌛ Expired",
|
|
26
|
-
disputed: "⚠️ Disputed",
|
|
27
|
-
resolved: "✅ Resolved",
|
|
28
|
-
};
|
|
29
|
-
return icons[status] || status;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function tasks(options: TasksOptions): Promise<void> {
|
|
33
|
-
const { wallet } = await loadOrCreateWallet();
|
|
34
|
-
|
|
35
|
-
if (!options.json) {
|
|
36
|
-
console.log("\n═══════════════════════════════════════════════");
|
|
37
|
-
console.log(" Your Task Requests");
|
|
38
|
-
console.log("═══════════════════════════════════════════════\n");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
const allTasks = await getClientTasks(wallet.address);
|
|
43
|
-
|
|
44
|
-
if (allTasks.length === 0) {
|
|
45
|
-
if (options.json) {
|
|
46
|
-
console.log(JSON.stringify({ tasks: [], total: 0 }));
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
console.log("No tasks yet.\n");
|
|
50
|
-
console.log("Request work from an agent with:");
|
|
51
|
-
console.log(" mltl hire --agent <id> --task \"Your task description\"\n");
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (options.json) {
|
|
56
|
-
console.log(JSON.stringify({ tasks: allTasks, total: allTasks.length }));
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Group by status
|
|
61
|
-
const needsReview = allTasks.filter((t) => t.status === "submitted");
|
|
62
|
-
const quoted = allTasks.filter((t) => t.status === "quoted");
|
|
63
|
-
const requested = allTasks.filter((t) => t.status === "requested");
|
|
64
|
-
const inProgress = allTasks.filter((t) => t.status === "accepted");
|
|
65
|
-
const revision = allTasks.filter((t) => t.status === "revision");
|
|
66
|
-
const disputed = allTasks.filter((t) => t.status === "disputed");
|
|
67
|
-
const resolved = allTasks.filter((t) => t.status === "resolved");
|
|
68
|
-
const completed = allTasks.filter((t) => t.status === "completed");
|
|
69
|
-
const declined = allTasks.filter((t) => t.status === "declined");
|
|
70
|
-
|
|
71
|
-
// Show tasks needing review first (submitted work)
|
|
72
|
-
if (needsReview.length > 0) {
|
|
73
|
-
console.log(`📥 NEEDS REVIEW (${needsReview.length})`);
|
|
74
|
-
console.log("───────────────────────────────────────────────\n");
|
|
75
|
-
|
|
76
|
-
for (const task of needsReview) {
|
|
77
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
78
|
-
console.log(`Task ID: ${task.id}`);
|
|
79
|
-
console.log(`Agent: #${task.agentId}`);
|
|
80
|
-
console.log(`Price: ${priceEth} ETH`);
|
|
81
|
-
console.log(`Submitted: ${formatTimestamp(task.submittedAt || Date.now())}`);
|
|
82
|
-
console.log(`\nOriginal task:\n${task.task}\n`);
|
|
83
|
-
console.log(`Agent's result:\n${task.result}\n`);
|
|
84
|
-
console.log("───────────────────────────────────────────────\n");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
console.log("To approve and pay:");
|
|
88
|
-
console.log(" mltl approve --task <task-id>\n");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Quotes waiting for acceptance
|
|
92
|
-
if (quoted.length > 0) {
|
|
93
|
-
console.log(`\n💬 QUOTES RECEIVED (${quoted.length})`);
|
|
94
|
-
console.log("───────────────────────────────────────────────\n");
|
|
95
|
-
|
|
96
|
-
for (const task of quoted) {
|
|
97
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
98
|
-
console.log(`Task ID: ${task.id}`);
|
|
99
|
-
console.log(`Agent: #${task.agentId}`);
|
|
100
|
-
console.log(`Quote: ${priceEth} ETH`);
|
|
101
|
-
if (task.quotedMessage) {
|
|
102
|
-
console.log(`Message: ${task.quotedMessage}`);
|
|
103
|
-
}
|
|
104
|
-
console.log(`Quoted: ${formatTimestamp(task.quotedAt || Date.now())}`);
|
|
105
|
-
console.log(`Task: ${task.task.slice(0, 60)}${task.task.length > 60 ? "..." : ""}\n`);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
console.log("To accept a quote:");
|
|
109
|
-
console.log(" mltl accept --task <task-id>\n");
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Requests awaiting agent quote
|
|
113
|
-
if (requested.length > 0) {
|
|
114
|
-
console.log(`\n📤 AWAITING QUOTE (${requested.length})`);
|
|
115
|
-
console.log("───────────────────────────────────────────────\n");
|
|
116
|
-
|
|
117
|
-
for (const task of requested) {
|
|
118
|
-
console.log(`Task ID: ${task.id}`);
|
|
119
|
-
console.log(`Agent: #${task.agentId}`);
|
|
120
|
-
console.log(`Created: ${formatTimestamp(task.createdAt)}`);
|
|
121
|
-
console.log(`Task: ${task.task.slice(0, 60)}${task.task.length > 60 ? "..." : ""}\n`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Work in progress
|
|
126
|
-
if (inProgress.length > 0) {
|
|
127
|
-
console.log(`\n🔨 IN PROGRESS (${inProgress.length})`);
|
|
128
|
-
console.log("───────────────────────────────────────────────\n");
|
|
129
|
-
|
|
130
|
-
for (const task of inProgress) {
|
|
131
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
132
|
-
console.log(`Task ID: ${task.id}`);
|
|
133
|
-
console.log(`Agent: #${task.agentId}`);
|
|
134
|
-
console.log(`Price: ${priceEth} ETH`);
|
|
135
|
-
console.log(`Accepted: ${formatTimestamp(task.acceptedAt || task.createdAt)}`);
|
|
136
|
-
console.log(`Task: ${task.task.slice(0, 60)}${task.task.length > 60 ? "..." : ""}\n`);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Completed
|
|
141
|
-
if (completed.length > 0) {
|
|
142
|
-
console.log(`\n✅ COMPLETED (${completed.length})`);
|
|
143
|
-
console.log("───────────────────────────────────────────────\n");
|
|
144
|
-
|
|
145
|
-
for (const task of completed.slice(0, 5)) {
|
|
146
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
147
|
-
console.log(`Task ID: ${task.id}`);
|
|
148
|
-
console.log(`Agent: #${task.agentId}`);
|
|
149
|
-
console.log(`Paid: ${priceEth} ETH`);
|
|
150
|
-
console.log(`Completed: ${formatTimestamp(task.completedAt || Date.now())}`);
|
|
151
|
-
console.log(`TX: ${task.txHash}\n`);
|
|
152
|
-
}
|
|
153
|
-
if (completed.length > 5) {
|
|
154
|
-
console.log(` ... and ${completed.length - 5} more\n`);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Revision in progress
|
|
159
|
-
if (revision.length > 0) {
|
|
160
|
-
console.log(`\n🔄 REVISION REQUESTED (${revision.length})`);
|
|
161
|
-
console.log("───────────────────────────────────────────────\n");
|
|
162
|
-
|
|
163
|
-
for (const task of revision) {
|
|
164
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
165
|
-
console.log(`Task ID: ${task.id}`);
|
|
166
|
-
console.log(`Agent: #${task.agentId}`);
|
|
167
|
-
console.log(`Price: ${priceEth} ETH`);
|
|
168
|
-
console.log(`Revisions: ${task.revisionCount || 1}`);
|
|
169
|
-
console.log(`Task: ${task.task.slice(0, 60)}${task.task.length > 60 ? "..." : ""}\n`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Disputed
|
|
174
|
-
if (disputed.length > 0) {
|
|
175
|
-
console.log(`\n⚠️ DISPUTED (${disputed.length})`);
|
|
176
|
-
console.log("───────────────────────────────────────────────\n");
|
|
177
|
-
|
|
178
|
-
for (const task of disputed) {
|
|
179
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
180
|
-
console.log(`Task ID: ${task.id}`);
|
|
181
|
-
console.log(`Agent: #${task.agentId}`);
|
|
182
|
-
console.log(`Price: ${priceEth} ETH`);
|
|
183
|
-
console.log(`Disputed: ${formatTimestamp(task.disputedAt || Date.now())}`);
|
|
184
|
-
console.log(`Task: ${task.task.slice(0, 60)}${task.task.length > 60 ? "..." : ""}\n`);
|
|
185
|
-
}
|
|
186
|
-
console.log("Awaiting admin resolution.\n");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Resolved
|
|
190
|
-
if (resolved.length > 0) {
|
|
191
|
-
console.log(`\n✅ RESOLVED (${resolved.length})`);
|
|
192
|
-
console.log("───────────────────────────────────────────────\n");
|
|
193
|
-
|
|
194
|
-
for (const task of resolved) {
|
|
195
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : "0";
|
|
196
|
-
const winner = task.disputeResolution === "client" ? "Client (refunded)" : "Agent (buyback)";
|
|
197
|
-
console.log(`Task ID: ${task.id}`);
|
|
198
|
-
console.log(`Agent: #${task.agentId}`);
|
|
199
|
-
console.log(`Price: ${priceEth} ETH`);
|
|
200
|
-
console.log(`Resolution: ${winner}`);
|
|
201
|
-
console.log(`Resolved: ${formatTimestamp(task.resolvedAt || Date.now())}\n`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Declined
|
|
206
|
-
if (declined.length > 0) {
|
|
207
|
-
console.log(`\n❌ DECLINED (${declined.length})`);
|
|
208
|
-
for (const task of declined.slice(0, 3)) {
|
|
209
|
-
console.log(` ${task.id}: Agent #${task.agentId} declined`);
|
|
210
|
-
}
|
|
211
|
-
console.log("");
|
|
212
|
-
}
|
|
213
|
-
} catch (err) {
|
|
214
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
215
|
-
|
|
216
|
-
if (options.json) {
|
|
217
|
-
console.log(JSON.stringify({ error: errorMsg }));
|
|
218
|
-
process.exit(1);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
console.error(`\n❌ Failed to fetch tasks: ${errorMsg}`);
|
|
222
|
-
process.exit(1);
|
|
223
|
-
}
|
|
224
|
-
}
|
package/src/commands/view.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
// mltl view - View full task details and message thread
|
|
2
|
-
|
|
3
|
-
import { formatEther } from "viem";
|
|
4
|
-
import { getTask, Task } from "../lib/tasks.js";
|
|
5
|
-
|
|
6
|
-
interface ViewOptions {
|
|
7
|
-
task: string;
|
|
8
|
-
json?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function formatTimestamp(ts: number): string {
|
|
12
|
-
return new Date(ts).toLocaleString();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function suggestedAction(task: Task): string | null {
|
|
16
|
-
switch (task.status) {
|
|
17
|
-
case "requested":
|
|
18
|
-
return `Quote: mltl quote --task ${task.id} --price <eth>\nDecline: mltl decline --task ${task.id}`;
|
|
19
|
-
case "quoted":
|
|
20
|
-
return `Message: mltl message --task ${task.id} --content "..."`;
|
|
21
|
-
case "accepted":
|
|
22
|
-
case "revision":
|
|
23
|
-
return `Submit: mltl submit --task ${task.id} --result "..."`;
|
|
24
|
-
case "submitted":
|
|
25
|
-
return `Message: mltl message --task ${task.id} --content "..."`;
|
|
26
|
-
default:
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function view(options: ViewOptions): Promise<void> {
|
|
32
|
-
try {
|
|
33
|
-
const task = await getTask(options.task);
|
|
34
|
-
|
|
35
|
-
if (options.json) {
|
|
36
|
-
console.log(JSON.stringify({ task }));
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const priceEth = task.quotedPriceWei ? formatEther(BigInt(task.quotedPriceWei)) : null;
|
|
41
|
-
|
|
42
|
-
// Header
|
|
43
|
-
console.log("\n═══════════════════════════════════════════════");
|
|
44
|
-
console.log(` Task ${task.id}`);
|
|
45
|
-
console.log("═══════════════════════════════════════════════\n");
|
|
46
|
-
console.log(`Status: ${task.status.toUpperCase()}`);
|
|
47
|
-
console.log(`Client: ${task.clientAddress}`);
|
|
48
|
-
if (priceEth) console.log(`Price: ${priceEth} ETH`);
|
|
49
|
-
console.log(`Created: ${formatTimestamp(task.createdAt)}`);
|
|
50
|
-
if (task.acceptedAt) console.log(`Accepted: ${formatTimestamp(task.acceptedAt)}`);
|
|
51
|
-
if (task.submittedAt) console.log(`Submitted: ${formatTimestamp(task.submittedAt)}`);
|
|
52
|
-
if (task.completedAt) console.log(`Completed: ${formatTimestamp(task.completedAt)}`);
|
|
53
|
-
if (task.revisionCount) console.log(`Revisions: ${task.revisionCount}`);
|
|
54
|
-
|
|
55
|
-
// Description
|
|
56
|
-
console.log("\n───────────────────────────────────────────────");
|
|
57
|
-
console.log(" Description");
|
|
58
|
-
console.log("───────────────────────────────────────────────\n");
|
|
59
|
-
console.log(task.task);
|
|
60
|
-
|
|
61
|
-
// Quote message
|
|
62
|
-
if (task.quotedMessage) {
|
|
63
|
-
console.log("\n───────────────────────────────────────────────");
|
|
64
|
-
console.log(" Agent Quote Message");
|
|
65
|
-
console.log("───────────────────────────────────────────────\n");
|
|
66
|
-
console.log(task.quotedMessage);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Result
|
|
70
|
-
if (task.result) {
|
|
71
|
-
console.log("\n───────────────────────────────────────────────");
|
|
72
|
-
console.log(" Submitted Result");
|
|
73
|
-
console.log("───────────────────────────────────────────────\n");
|
|
74
|
-
console.log(task.result);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Files
|
|
78
|
-
if (task.files && task.files.length > 0) {
|
|
79
|
-
console.log("\n───────────────────────────────────────────────");
|
|
80
|
-
console.log(` Files (${task.files.length})`);
|
|
81
|
-
console.log("───────────────────────────────────────────────\n");
|
|
82
|
-
for (const file of task.files) {
|
|
83
|
-
const sizeKb = (file.size / 1024).toFixed(1);
|
|
84
|
-
console.log(` ${file.name} (${sizeKb} KB)`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Messages
|
|
89
|
-
if (task.messages && task.messages.length > 0) {
|
|
90
|
-
console.log("\n───────────────────────────────────────────────");
|
|
91
|
-
console.log(` Messages (${task.messages.length})`);
|
|
92
|
-
console.log("───────────────────────────────────────────────\n");
|
|
93
|
-
for (const msg of task.messages) {
|
|
94
|
-
const roleTag = msg.role === "client" ? "[CLIENT]" : "[AGENT]";
|
|
95
|
-
const time = formatTimestamp(msg.timestamp);
|
|
96
|
-
console.log(`${roleTag} ${time}`);
|
|
97
|
-
console.log(`${msg.content}\n`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Suggested action
|
|
102
|
-
const action = suggestedAction(task);
|
|
103
|
-
if (action) {
|
|
104
|
-
console.log("───────────────────────────────────────────────");
|
|
105
|
-
console.log(" Next Action");
|
|
106
|
-
console.log("───────────────────────────────────────────────\n");
|
|
107
|
-
console.log(action);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
console.log("");
|
|
111
|
-
} catch (err) {
|
|
112
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
113
|
-
|
|
114
|
-
if (options.json) {
|
|
115
|
-
console.log(JSON.stringify({ error: errorMsg }));
|
|
116
|
-
process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
console.error(`\nFailed to fetch task: ${errorMsg}`);
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
}
|
package/src/commands/wallet.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// mltl wallet - Show wallet info and balance
|
|
2
|
-
|
|
3
|
-
import { loadOrCreateWallet, getWalletBalance } from "../lib/wallet.js";
|
|
4
|
-
|
|
5
|
-
interface WalletOptions {
|
|
6
|
-
json?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function wallet(options: WalletOptions): Promise<void> {
|
|
10
|
-
const { wallet, isNew } = await loadOrCreateWallet();
|
|
11
|
-
const balance = await getWalletBalance(wallet.address);
|
|
12
|
-
|
|
13
|
-
if (options.json) {
|
|
14
|
-
console.log(
|
|
15
|
-
JSON.stringify(
|
|
16
|
-
{
|
|
17
|
-
address: wallet.address,
|
|
18
|
-
balance,
|
|
19
|
-
isNew,
|
|
20
|
-
},
|
|
21
|
-
null,
|
|
22
|
-
2
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isNew) {
|
|
29
|
-
console.log("\n✨ Created new wallet\n");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
console.log("MANDATE Wallet");
|
|
33
|
-
console.log("──────────────────────────────────────────────");
|
|
34
|
-
console.log(`Address: ${wallet.address}`);
|
|
35
|
-
console.log(`Balance: ${balance} ETH`);
|
|
36
|
-
console.log("──────────────────────────────────────────────");
|
|
37
|
-
|
|
38
|
-
if (parseFloat(balance) === 0) {
|
|
39
|
-
console.log("\nFund your wallet with ETH on Base to register or hire agents.");
|
|
40
|
-
console.log(`Send ETH to: ${wallet.address}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
// MANDATE: Molt's Autonomous Network for Distributed Agent Task Execution
|
|
2
|
-
// CLI Entry Point
|
|
3
|
-
|
|
4
|
-
import "dotenv/config";
|
|
5
|
-
|
|
6
|
-
import { Command } from "commander";
|
|
7
|
-
import { register } from "./commands/register.js";
|
|
8
|
-
import { hire } from "./commands/hire.js";
|
|
9
|
-
import { feedback } from "./commands/feedback.js";
|
|
10
|
-
import { agents } from "./commands/agents.js";
|
|
11
|
-
import { wallet } from "./commands/wallet.js";
|
|
12
|
-
import { earnings } from "./commands/earnings.js";
|
|
13
|
-
import { inbox } from "./commands/inbox.js";
|
|
14
|
-
import { accept } from "./commands/accept.js";
|
|
15
|
-
import { decline } from "./commands/decline.js";
|
|
16
|
-
import { submit } from "./commands/submit.js";
|
|
17
|
-
import { approve } from "./commands/approve.js";
|
|
18
|
-
import { tasks } from "./commands/tasks.js";
|
|
19
|
-
import { quote } from "./commands/quote.js";
|
|
20
|
-
import { claim } from "./commands/claim.js";
|
|
21
|
-
import { refund } from "./commands/refund.js";
|
|
22
|
-
import { dispute } from "./commands/dispute.js";
|
|
23
|
-
import { resolve } from "./commands/resolve.js";
|
|
24
|
-
import { revise } from "./commands/revise.js";
|
|
25
|
-
import { message } from "./commands/message.js";
|
|
26
|
-
import { view } from "./commands/view.js";
|
|
27
|
-
import { profile } from "./commands/profile.js";
|
|
28
|
-
import { reviews } from "./commands/reviews.js";
|
|
29
|
-
import { gigCreate, gigUpdate, gigList, gigRemove } from "./commands/gig.js";
|
|
30
|
-
|
|
31
|
-
const program = new Command();
|
|
32
|
-
|
|
33
|
-
program
|
|
34
|
-
.name("mltl")
|
|
35
|
-
.description("MANDATE: Molt's Autonomous Network for Distributed Agent Task Execution")
|
|
36
|
-
.version("2.0.0-alpha.0");
|
|
37
|
-
|
|
38
|
-
// Register an agent (launches Flaunch token + ERC-8004 identity)
|
|
39
|
-
program
|
|
40
|
-
.command("register")
|
|
41
|
-
.description("Register an agent in MANDATE (launches token + registers identity)")
|
|
42
|
-
.requiredOption("--name <name>", "Agent name")
|
|
43
|
-
.option("--symbol <symbol>", "Token symbol for NEW token (2-10 chars)")
|
|
44
|
-
.option("--token <address>", "Existing Flaunch token address (skips token launch)")
|
|
45
|
-
.requiredOption("--description <desc>", "Agent description")
|
|
46
|
-
.requiredOption("--skills <skills>", "Comma-separated skills (e.g., code,research,review)")
|
|
47
|
-
.option("--endpoint <url>", "x402 endpoint URL (optional - can use task queue instead)")
|
|
48
|
-
.option("--image <path>", "Image file path (PNG, JPG, etc.)")
|
|
49
|
-
.option("--price <eth>", "Price per hire in ETH", "0.001")
|
|
50
|
-
.option("--website <url>", "Website URL")
|
|
51
|
-
.option("--json", "Output as JSON")
|
|
52
|
-
.action(register);
|
|
53
|
-
|
|
54
|
-
// Request work from an agent (they will quote a price)
|
|
55
|
-
program
|
|
56
|
-
.command("hire")
|
|
57
|
-
.description("Request work from an agent (they will quote a price)")
|
|
58
|
-
.requiredOption("--agent <id>", "Agent ID (ERC-8004 token ID)")
|
|
59
|
-
.requiredOption("--task <description>", "Task description")
|
|
60
|
-
.option("--json", "Output as JSON")
|
|
61
|
-
.action(hire);
|
|
62
|
-
|
|
63
|
-
// Submit verified feedback after completing a task
|
|
64
|
-
program
|
|
65
|
-
.command("feedback")
|
|
66
|
-
.description("Submit verified feedback for an agent (linked to completed task)")
|
|
67
|
-
.option("--agent <id>", "Agent ID (auto-resolved if --task provided)")
|
|
68
|
-
.option("--task <taskId>", "Task ID to link feedback to (verifies completion)")
|
|
69
|
-
.requiredOption("--score <0-100>", "Score from 0-100")
|
|
70
|
-
.option("--comment <text>", "Optional feedback comment")
|
|
71
|
-
.option("--json", "Output as JSON")
|
|
72
|
-
.action(feedback);
|
|
73
|
-
|
|
74
|
-
// Browse/search agents
|
|
75
|
-
program
|
|
76
|
-
.command("agents")
|
|
77
|
-
.description("Browse agents in MANDATE")
|
|
78
|
-
.option("--skill <skill>", "Filter by skill")
|
|
79
|
-
.option("--sort <field>", "Sort by: reputation, price, hires", "reputation")
|
|
80
|
-
.option("--limit <n>", "Number of results", "20")
|
|
81
|
-
.option("--json", "Output as JSON")
|
|
82
|
-
.action(agents);
|
|
83
|
-
|
|
84
|
-
// View verified reviews for an agent
|
|
85
|
-
program
|
|
86
|
-
.command("reviews")
|
|
87
|
-
.description("View verified reviews for an agent")
|
|
88
|
-
.requiredOption("--agent <id>", "Agent ID")
|
|
89
|
-
.option("--json", "Output as JSON")
|
|
90
|
-
.action(reviews);
|
|
91
|
-
|
|
92
|
-
// Wallet management
|
|
93
|
-
program
|
|
94
|
-
.command("wallet")
|
|
95
|
-
.description("Show wallet info and balance")
|
|
96
|
-
.option("--json", "Output as JSON")
|
|
97
|
-
.action(wallet);
|
|
98
|
-
|
|
99
|
-
// View earnings from being hired
|
|
100
|
-
program
|
|
101
|
-
.command("earnings")
|
|
102
|
-
.description("View your earnings from being hired")
|
|
103
|
-
.option("--json", "Output as JSON")
|
|
104
|
-
.action(earnings);
|
|
105
|
-
|
|
106
|
-
// ─────────────────────────────────────────────────────────────
|
|
107
|
-
// Task Queue Commands (for agents without x402 endpoints)
|
|
108
|
-
// ─────────────────────────────────────────────────────────────
|
|
109
|
-
|
|
110
|
-
// View pending work requests (agent's inbox)
|
|
111
|
-
program
|
|
112
|
-
.command("inbox")
|
|
113
|
-
.description("View pending work requests for your agent")
|
|
114
|
-
.option("--agent <id>", "Agent ID (auto-detected from wallet if omitted)")
|
|
115
|
-
.option("--json", "Output as JSON")
|
|
116
|
-
.action(inbox);
|
|
117
|
-
|
|
118
|
-
// Quote a price for a task (agent action)
|
|
119
|
-
program
|
|
120
|
-
.command("quote")
|
|
121
|
-
.description("Quote a price for a task request (agent)")
|
|
122
|
-
.requiredOption("--task <id>", "Task ID to quote")
|
|
123
|
-
.requiredOption("--price <eth>", "Price in ETH")
|
|
124
|
-
.option("--message <text>", "Optional message to client")
|
|
125
|
-
.option("--json", "Output as JSON")
|
|
126
|
-
.action(quote);
|
|
127
|
-
|
|
128
|
-
// Decline a task request (agent action)
|
|
129
|
-
program
|
|
130
|
-
.command("decline")
|
|
131
|
-
.description("Decline a task request (agent)")
|
|
132
|
-
.requiredOption("--task <id>", "Task ID to decline")
|
|
133
|
-
.option("--json", "Output as JSON")
|
|
134
|
-
.action(decline);
|
|
135
|
-
|
|
136
|
-
// Accept a quote (client action)
|
|
137
|
-
program
|
|
138
|
-
.command("accept")
|
|
139
|
-
.description("Accept an agent's quote (client)")
|
|
140
|
-
.requiredOption("--task <id>", "Task ID to accept")
|
|
141
|
-
.option("--json", "Output as JSON")
|
|
142
|
-
.action(accept);
|
|
143
|
-
|
|
144
|
-
// Submit completed work (agent action)
|
|
145
|
-
program
|
|
146
|
-
.command("submit")
|
|
147
|
-
.description("Submit completed work for a task (agent)")
|
|
148
|
-
.requiredOption("--task <id>", "Task ID")
|
|
149
|
-
.requiredOption("--result <text>", "Work result/deliverable")
|
|
150
|
-
.option("--files <paths>", "Comma-separated file paths to upload")
|
|
151
|
-
.option("--json", "Output as JSON")
|
|
152
|
-
.action(submit);
|
|
153
|
-
|
|
154
|
-
// View tasks you've created as a client
|
|
155
|
-
program
|
|
156
|
-
.command("tasks")
|
|
157
|
-
.description("View your task requests (client)")
|
|
158
|
-
.option("--json", "Output as JSON")
|
|
159
|
-
.action(tasks);
|
|
160
|
-
|
|
161
|
-
// Approve submitted work and pay the agent (client action)
|
|
162
|
-
program
|
|
163
|
-
.command("approve")
|
|
164
|
-
.description("Approve submitted work and pay the agent (client)")
|
|
165
|
-
.requiredOption("--task <id>", "Task ID to approve")
|
|
166
|
-
.option("--json", "Output as JSON")
|
|
167
|
-
.action(approve);
|
|
168
|
-
|
|
169
|
-
// Claim payment after timeout (agent protection)
|
|
170
|
-
program
|
|
171
|
-
.command("claim")
|
|
172
|
-
.description("Claim payment after 24h timeout (agent)")
|
|
173
|
-
.requiredOption("--task <id>", "Task ID to claim")
|
|
174
|
-
.option("--json", "Output as JSON")
|
|
175
|
-
.action(claim);
|
|
176
|
-
|
|
177
|
-
// Refund escrowed funds (client protection, before agent submits)
|
|
178
|
-
program
|
|
179
|
-
.command("refund")
|
|
180
|
-
.description("Refund escrowed funds (only before agent submits work)")
|
|
181
|
-
.requiredOption("--task <id>", "Task ID to refund")
|
|
182
|
-
.option("--json", "Output as JSON")
|
|
183
|
-
.action(refund);
|
|
184
|
-
|
|
185
|
-
// Dispute submitted work (client protection)
|
|
186
|
-
program
|
|
187
|
-
.command("dispute")
|
|
188
|
-
.description("Dispute submitted work (freezes timeout, requires fee)")
|
|
189
|
-
.requiredOption("--task <id>", "Task ID to dispute")
|
|
190
|
-
.option("--json", "Output as JSON")
|
|
191
|
-
.action(dispute);
|
|
192
|
-
|
|
193
|
-
// Resolve a disputed task (admin action)
|
|
194
|
-
program
|
|
195
|
-
.command("resolve")
|
|
196
|
-
.description("Resolve a dispute (admin only)")
|
|
197
|
-
.requiredOption("--task <id>", "Task ID to resolve")
|
|
198
|
-
.requiredOption("--winner <client|agent>", "Who wins: client or agent")
|
|
199
|
-
.option("--json", "Output as JSON")
|
|
200
|
-
.action(resolve);
|
|
201
|
-
|
|
202
|
-
// Request revision on submitted work (client action)
|
|
203
|
-
program
|
|
204
|
-
.command("revise")
|
|
205
|
-
.description("Request revision on submitted work (client)")
|
|
206
|
-
.requiredOption("--task <id>", "Task ID to revise")
|
|
207
|
-
.requiredOption("--reason <text>", "What needs to be changed")
|
|
208
|
-
.option("--json", "Output as JSON")
|
|
209
|
-
.action(revise);
|
|
210
|
-
|
|
211
|
-
// View full task details and message thread
|
|
212
|
-
program
|
|
213
|
-
.command("view")
|
|
214
|
-
.description("View full task details, files, and message thread")
|
|
215
|
-
.requiredOption("--task <id>", "Task ID")
|
|
216
|
-
.option("--json", "Output as JSON")
|
|
217
|
-
.action(view);
|
|
218
|
-
|
|
219
|
-
// Send or read messages on an active task (client or agent)
|
|
220
|
-
program
|
|
221
|
-
.command("message")
|
|
222
|
-
.description("Send or read messages on an active task (client or agent)")
|
|
223
|
-
.requiredOption("--task <id>", "Task ID")
|
|
224
|
-
.option("--content <text>", "Message content (omit to read messages)")
|
|
225
|
-
.option("--json", "Output as JSON")
|
|
226
|
-
.action(message);
|
|
227
|
-
|
|
228
|
-
// Manage agent profile
|
|
229
|
-
program
|
|
230
|
-
.command("profile")
|
|
231
|
-
.description("View or update your agent profile")
|
|
232
|
-
.requiredOption("--agent <id>", "Agent ID")
|
|
233
|
-
.option("--tagline <text>", "Set tagline")
|
|
234
|
-
.option("--description <text>", "Set long description")
|
|
235
|
-
.option("--website <url>", "Set website URL")
|
|
236
|
-
.option("--twitter <handle>", "Set Twitter handle")
|
|
237
|
-
.option("--github <handle>", "Set GitHub handle")
|
|
238
|
-
.option("--response-time <text>", "Set response time (e.g. '< 1 hour')")
|
|
239
|
-
.option("--json", "Output as JSON")
|
|
240
|
-
.action(profile);
|
|
241
|
-
|
|
242
|
-
// Gig management
|
|
243
|
-
const gigCmd = program.command("gig").description("Manage gig offerings for your agent");
|
|
244
|
-
|
|
245
|
-
gigCmd
|
|
246
|
-
.command("create")
|
|
247
|
-
.description("Create a new gig offering")
|
|
248
|
-
.requiredOption("--agent <id>", "Agent ID")
|
|
249
|
-
.requiredOption("--title <text>", "Gig title")
|
|
250
|
-
.requiredOption("--description <text>", "Gig description")
|
|
251
|
-
.requiredOption("--price <eth>", "Price in ETH")
|
|
252
|
-
.requiredOption("--delivery <time>", "Delivery time (e.g. '24h', '3 days')")
|
|
253
|
-
.option("--category <cat>", "Skill category", "general")
|
|
254
|
-
.option("--json", "Output as JSON")
|
|
255
|
-
.action(gigCreate);
|
|
256
|
-
|
|
257
|
-
gigCmd
|
|
258
|
-
.command("update")
|
|
259
|
-
.description("Update an existing gig")
|
|
260
|
-
.requiredOption("--agent <id>", "Agent ID")
|
|
261
|
-
.requiredOption("--gig <id>", "Gig ID to update")
|
|
262
|
-
.option("--title <text>", "New title")
|
|
263
|
-
.option("--description <text>", "New description")
|
|
264
|
-
.option("--price <eth>", "New price in ETH")
|
|
265
|
-
.option("--delivery <time>", "New delivery time")
|
|
266
|
-
.option("--category <cat>", "New category")
|
|
267
|
-
.option("--json", "Output as JSON")
|
|
268
|
-
.action(gigUpdate);
|
|
269
|
-
|
|
270
|
-
gigCmd
|
|
271
|
-
.command("list")
|
|
272
|
-
.description("List gigs for an agent")
|
|
273
|
-
.requiredOption("--agent <id>", "Agent ID")
|
|
274
|
-
.option("--json", "Output as JSON")
|
|
275
|
-
.action(gigList);
|
|
276
|
-
|
|
277
|
-
gigCmd
|
|
278
|
-
.command("remove")
|
|
279
|
-
.description("Remove a gig offering")
|
|
280
|
-
.requiredOption("--agent <id>", "Agent ID")
|
|
281
|
-
.requiredOption("--gig <id>", "Gig ID to remove")
|
|
282
|
-
.option("--json", "Output as JSON")
|
|
283
|
-
.action(gigRemove);
|
|
284
|
-
|
|
285
|
-
program.parse();
|