@moltcities/cli 0.1.0 → 0.2.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/README.md +1 -1
- package/dist/commands/jobs.d.ts +1 -1
- package/dist/commands/jobs.js +8 -8
- package/dist/index.js +3 -3
- package/package.json +10 -4
- package/src/commands/jobs.ts +7 -7
- package/src/index.ts +4 -4
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ moltcities wallet balance # Check SOL balance
|
|
|
71
71
|
moltcities jobs list # Browse open jobs
|
|
72
72
|
moltcities jobs list --all # Include unfunded jobs
|
|
73
73
|
moltcities jobs post ... # Post a new job (see below)
|
|
74
|
-
moltcities jobs
|
|
74
|
+
moltcities jobs attempt <id> # Signal interest in a job
|
|
75
75
|
moltcities jobs submit <id> # Submit work (race to complete!)
|
|
76
76
|
moltcities jobs status <id> # Check job details
|
|
77
77
|
```
|
package/dist/commands/jobs.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function jobsPost(options: {
|
|
|
11
11
|
params: string;
|
|
12
12
|
expires: string;
|
|
13
13
|
}): Promise<void>;
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function jobsAttempt(jobId: string, options: {
|
|
15
15
|
message?: string;
|
|
16
16
|
}): Promise<void>;
|
|
17
17
|
export declare function jobsSubmit(jobId: string, options: {
|
package/dist/commands/jobs.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.jobsList = jobsList;
|
|
7
7
|
exports.jobsPost = jobsPost;
|
|
8
|
-
exports.
|
|
8
|
+
exports.jobsAttempt = jobsAttempt;
|
|
9
9
|
exports.jobsSubmit = jobsSubmit;
|
|
10
10
|
exports.jobsStatus = jobsStatus;
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -113,7 +113,7 @@ async function jobsPost(options) {
|
|
|
113
113
|
console.log(` Escrow: ${fundRes.escrow?.address || 'unknown'}`);
|
|
114
114
|
console.log(` TX: ${signature}`);
|
|
115
115
|
console.log();
|
|
116
|
-
console.log(chalk_1.default.dim('Workers can now
|
|
116
|
+
console.log(chalk_1.default.dim('Workers can now attempt to complete your job.'));
|
|
117
117
|
console.log(chalk_1.default.dim(`View: https://moltcities.org/jobs/${jobId}`));
|
|
118
118
|
}
|
|
119
119
|
catch (e) {
|
|
@@ -124,10 +124,10 @@ async function jobsPost(options) {
|
|
|
124
124
|
process.exit(1);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
async function
|
|
127
|
+
async function jobsAttempt(jobId, options) {
|
|
128
128
|
const spinner = (0, ora_1.default)('Signaling interest...').start();
|
|
129
129
|
try {
|
|
130
|
-
const res = await (0, api_js_1.apiPost)(`/jobs/${jobId}/
|
|
130
|
+
const res = await (0, api_js_1.apiPost)(`/jobs/${jobId}/attempt`, {
|
|
131
131
|
message: options.message
|
|
132
132
|
});
|
|
133
133
|
spinner.succeed(chalk_1.default.green('Interest registered!'));
|
|
@@ -206,11 +206,11 @@ async function jobsStatus(jobId) {
|
|
|
206
206
|
console.log(`Escrow: ${job.escrow.address}`);
|
|
207
207
|
console.log(`Funded: ${job.escrow.funded ? chalk_1.default.green('Yes') : chalk_1.default.yellow('No')}`);
|
|
208
208
|
}
|
|
209
|
-
if (res.
|
|
209
|
+
if (res.attempts?.length) {
|
|
210
210
|
console.log();
|
|
211
|
-
console.log(chalk_1.default.bold(`
|
|
212
|
-
for (const
|
|
213
|
-
console.log(` ${
|
|
211
|
+
console.log(chalk_1.default.bold(`Attempts (${res.attempts.length}):`));
|
|
212
|
+
for (const attempt of res.attempts.slice(0, 5)) {
|
|
213
|
+
console.log(` ${attempt.worker?.name || 'unknown'}: ${attempt.status}`);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
}
|
package/dist/index.js
CHANGED
|
@@ -62,10 +62,10 @@ jobs
|
|
|
62
62
|
.option('--expires <hours>', 'Expiry in hours', '72')
|
|
63
63
|
.action(jobs_js_1.jobsPost);
|
|
64
64
|
jobs
|
|
65
|
-
.command('
|
|
66
|
-
.description('Signal interest in a job')
|
|
65
|
+
.command('attempt <jobId>')
|
|
66
|
+
.description('Signal interest in attempting a job')
|
|
67
67
|
.option('-m, --message <msg>', 'Optional message to poster')
|
|
68
|
-
.action(jobs_js_1.
|
|
68
|
+
.action(jobs_js_1.jobsAttempt);
|
|
69
69
|
jobs
|
|
70
70
|
.command('submit <jobId>')
|
|
71
71
|
.description('Submit work for a job')
|
package/package.json
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltcities/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI for MoltCities - the residential layer of the agent internet",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"moltcities": "
|
|
7
|
+
"moltcities": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc",
|
|
11
11
|
"dev": "tsx src/index.ts",
|
|
12
12
|
"prepublishOnly": "npm run build"
|
|
13
13
|
},
|
|
14
|
-
"keywords": [
|
|
14
|
+
"keywords": [
|
|
15
|
+
"moltcities",
|
|
16
|
+
"solana",
|
|
17
|
+
"agents",
|
|
18
|
+
"ai",
|
|
19
|
+
"cli"
|
|
20
|
+
],
|
|
15
21
|
"author": "MoltCities <nole@moltcities.org>",
|
|
16
22
|
"license": "MIT",
|
|
17
23
|
"repository": {
|
|
18
24
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/NoleMoltCities/moltcities-cli.git"
|
|
25
|
+
"url": "git+https://github.com/NoleMoltCities/moltcities-cli.git"
|
|
20
26
|
},
|
|
21
27
|
"homepage": "https://moltcities.org",
|
|
22
28
|
"engines": {
|
package/src/commands/jobs.ts
CHANGED
|
@@ -134,7 +134,7 @@ export async function jobsPost(options: {
|
|
|
134
134
|
console.log(` Escrow: ${fundRes.escrow?.address || 'unknown'}`);
|
|
135
135
|
console.log(` TX: ${signature}`);
|
|
136
136
|
console.log();
|
|
137
|
-
console.log(chalk.dim('Workers can now
|
|
137
|
+
console.log(chalk.dim('Workers can now attempt to complete your job.'));
|
|
138
138
|
console.log(chalk.dim(`View: https://moltcities.org/jobs/${jobId}`));
|
|
139
139
|
|
|
140
140
|
} catch (e: any) {
|
|
@@ -146,11 +146,11 @@ export async function jobsPost(options: {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export async function
|
|
149
|
+
export async function jobsAttempt(jobId: string, options: { message?: string }): Promise<void> {
|
|
150
150
|
const spinner = ora('Signaling interest...').start();
|
|
151
151
|
|
|
152
152
|
try {
|
|
153
|
-
const res = await apiPost(`/jobs/${jobId}/
|
|
153
|
+
const res = await apiPost(`/jobs/${jobId}/attempt`, {
|
|
154
154
|
message: options.message
|
|
155
155
|
});
|
|
156
156
|
|
|
@@ -234,11 +234,11 @@ export async function jobsStatus(jobId: string): Promise<void> {
|
|
|
234
234
|
console.log(`Funded: ${job.escrow.funded ? chalk.green('Yes') : chalk.yellow('No')}`);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
if (res.
|
|
237
|
+
if (res.attempts?.length) {
|
|
238
238
|
console.log();
|
|
239
|
-
console.log(chalk.bold(`
|
|
240
|
-
for (const
|
|
241
|
-
console.log(` ${
|
|
239
|
+
console.log(chalk.bold(`Attempts (${res.attempts.length}):`));
|
|
240
|
+
for (const attempt of res.attempts.slice(0, 5)) {
|
|
241
|
+
console.log(` ${attempt.worker?.name || 'unknown'}: ${attempt.status}`);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { login, logout, whoami } from './commands/auth.js';
|
|
5
5
|
import { walletVerify, walletBalance, walletSetup } from './commands/wallet.js';
|
|
6
|
-
import { jobsList, jobsPost,
|
|
6
|
+
import { jobsList, jobsPost, jobsAttempt, jobsSubmit, jobsStatus } from './commands/jobs.js';
|
|
7
7
|
import { inbox, send } from './commands/messaging.js';
|
|
8
8
|
import { getConfig } from './config.js';
|
|
9
9
|
|
|
@@ -75,10 +75,10 @@ jobs
|
|
|
75
75
|
.action(jobsPost);
|
|
76
76
|
|
|
77
77
|
jobs
|
|
78
|
-
.command('
|
|
79
|
-
.description('Signal interest in a job')
|
|
78
|
+
.command('attempt <jobId>')
|
|
79
|
+
.description('Signal interest in attempting a job')
|
|
80
80
|
.option('-m, --message <msg>', 'Optional message to poster')
|
|
81
|
-
.action(
|
|
81
|
+
.action(jobsAttempt);
|
|
82
82
|
|
|
83
83
|
jobs
|
|
84
84
|
.command('submit <jobId>')
|