@indexnetwork/cli 0.30.0-rc.104.1 → 0.30.0-rc.108.1
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/index.js +49 -14
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ index docs workflows --json
|
|
|
129
129
|
index agent me --json
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
Topics are `identity-context`, `
|
|
132
|
+
Topics are `identity-context`, `intents`, `communities-networks`,
|
|
133
133
|
`opportunities`, `negotiations`, and `workflows`. An unknown topic exits nonzero.
|
|
134
134
|
|
|
135
135
|
### `index logout`
|
package/dist/index.js
CHANGED
|
@@ -95,7 +95,7 @@ function parseArgs(args) {
|
|
|
95
95
|
return { ...result, command: "version" };
|
|
96
96
|
if (["--api-url", "--app-url", "--status", "--limit", "--prompt", "-p", "--objective", "--title"].includes(arg) && (!args[i + 1] || args[i + 1].startsWith("--")))
|
|
97
97
|
throw new Error(`Missing value for ${arg}`);
|
|
98
|
-
if (["--query", "--state", "--action", "--message", "--intent-id", "--question-id", "--receipt", "--source-type", "--source-id", "--name", "--intro", "--location", "--statuses", "--answer", "--social"].includes(arg)) {
|
|
98
|
+
if (["--query", "--state", "--action", "--message", "--intent-id", "--question-id", "--receipt", "--source-type", "--source-id", "--visibility", "--exclude", "--name", "--intro", "--location", "--statuses", "--answer", "--social"].includes(arg)) {
|
|
99
99
|
const value = args[i + 1];
|
|
100
100
|
if (value === undefined || value.startsWith("--"))
|
|
101
101
|
throw new Error(`Missing value for ${arg}`);
|
|
@@ -127,6 +127,14 @@ function parseArgs(args) {
|
|
|
127
127
|
case "--source-id":
|
|
128
128
|
result.sourceId = value;
|
|
129
129
|
break;
|
|
130
|
+
case "--visibility":
|
|
131
|
+
if (value !== "networks_only" && value !== "mutuals_only")
|
|
132
|
+
throw new Error("--visibility is networks_only or mutuals_only");
|
|
133
|
+
result.visibility = value;
|
|
134
|
+
break;
|
|
135
|
+
case "--exclude":
|
|
136
|
+
result.excludeUserId = value;
|
|
137
|
+
break;
|
|
130
138
|
case "--name":
|
|
131
139
|
result.name = value;
|
|
132
140
|
break;
|
|
@@ -153,6 +161,9 @@ function parseArgs(args) {
|
|
|
153
161
|
}
|
|
154
162
|
}
|
|
155
163
|
i += 2;
|
|
164
|
+
} else if (arg === "--private") {
|
|
165
|
+
result.isPrivate = true;
|
|
166
|
+
i += 1;
|
|
156
167
|
} else if (arg === "--api-url") {
|
|
157
168
|
result.apiUrl = args[i + 1];
|
|
158
169
|
i += 2;
|
|
@@ -291,7 +302,7 @@ function parseArgs(args) {
|
|
|
291
302
|
}
|
|
292
303
|
return result;
|
|
293
304
|
}
|
|
294
|
-
var INTENT_SUBCOMMANDS = new Set(["list", "show", "create", "prepare", "archive", "pause", "resume", "update", "networks", "add-to-network", "remove-from-network"]);
|
|
305
|
+
var INTENT_SUBCOMMANDS = new Set(["list", "show", "create", "prepare", "archive", "pause", "resume", "update", "networks", "add-to-network", "remove-from-network", "exclude"]);
|
|
295
306
|
function parseIntentArgs(positionals, result) {
|
|
296
307
|
if (positionals.length === 0)
|
|
297
308
|
return;
|
|
@@ -325,6 +336,10 @@ function parseIntentArgs(positionals, result) {
|
|
|
325
336
|
result.intentId = rest[0];
|
|
326
337
|
result.targetId = rest[1];
|
|
327
338
|
break;
|
|
339
|
+
case "exclude":
|
|
340
|
+
result.intentId = rest[0];
|
|
341
|
+
result.excludeUserId = rest[1] ?? result.excludeUserId;
|
|
342
|
+
break;
|
|
328
343
|
}
|
|
329
344
|
}
|
|
330
345
|
|
|
@@ -457,11 +472,13 @@ class ApiClient {
|
|
|
457
472
|
const body = await res.json();
|
|
458
473
|
return body.intent;
|
|
459
474
|
}
|
|
460
|
-
async createIntent(description, networkIds, preparationReceipt, source = {}) {
|
|
475
|
+
async createIntent(description, networkIds, preparationReceipt, source = {}, options = {}) {
|
|
461
476
|
const res = await this.post("/api/intents", {
|
|
462
477
|
description,
|
|
463
478
|
...networkIds?.length ? { networkIds } : {},
|
|
464
479
|
...preparationReceipt ? { preparationReceipt } : {},
|
|
480
|
+
...options.visibility ? { visibility: options.visibility } : {},
|
|
481
|
+
...options.isPrivate ? { private: true } : {},
|
|
465
482
|
...source
|
|
466
483
|
});
|
|
467
484
|
return await res.json();
|
|
@@ -473,9 +490,10 @@ class ApiClient {
|
|
|
473
490
|
async updateIntentStatus(id, status) {
|
|
474
491
|
await this.patch(`/api/intents/${encodeURIComponent(id)}/status`, { status });
|
|
475
492
|
}
|
|
476
|
-
async updateIntent(intentId, description, source = {}) {
|
|
493
|
+
async updateIntent(intentId, description, source = {}, options = {}) {
|
|
477
494
|
const res = await this.patch(`/api/intents/${encodeURIComponent(intentId)}`, {
|
|
478
495
|
...description !== undefined ? { description } : {},
|
|
496
|
+
...options.isPrivate ? { private: true } : {},
|
|
479
497
|
...source
|
|
480
498
|
});
|
|
481
499
|
return await res.json();
|
|
@@ -488,8 +506,11 @@ class ApiClient {
|
|
|
488
506
|
const body = await res.json();
|
|
489
507
|
return body.networkIds;
|
|
490
508
|
}
|
|
491
|
-
async addIntentToNetwork(intentId, networkId) {
|
|
492
|
-
await this.post(`/api/intents/${encodeURIComponent(intentId)}/networks`, { networkId });
|
|
509
|
+
async addIntentToNetwork(intentId, networkId, visibility) {
|
|
510
|
+
await this.post(`/api/intents/${encodeURIComponent(intentId)}/networks`, { networkId, ...visibility ? { visibility } : {} });
|
|
511
|
+
}
|
|
512
|
+
async excludeUser(intentId, userId) {
|
|
513
|
+
await this.post(`/api/intents/${encodeURIComponent(intentId)}/exclusions`, { userId });
|
|
493
514
|
}
|
|
494
515
|
async removeIntentFromNetwork(intentId, networkId) {
|
|
495
516
|
await this.del(`/api/intents/${encodeURIComponent(intentId)}/networks/${encodeURIComponent(networkId)}`);
|
|
@@ -1180,8 +1201,8 @@ function intentCard(intent) {
|
|
|
1180
1201
|
if (intent.semanticEntropy !== undefined) {
|
|
1181
1202
|
console.log(` ${BOLD}Entropy${RESET} ${intent.semanticEntropy.toFixed(2)}`);
|
|
1182
1203
|
}
|
|
1183
|
-
if (intent.
|
|
1184
|
-
console.log(` ${BOLD}
|
|
1204
|
+
if (intent.isPrivate) {
|
|
1205
|
+
console.log(` ${BOLD}Private${RESET} ${YELLOW}Yes${RESET}`);
|
|
1185
1206
|
}
|
|
1186
1207
|
console.log();
|
|
1187
1208
|
console.log(` ${BOLD}Created${RESET} ${GRAY}${new Date(intent.createdAt).toLocaleString()}${RESET}`);
|
|
@@ -1194,7 +1215,8 @@ function intentCard(intent) {
|
|
|
1194
1215
|
console.log(` ${BOLD}Networks${RESET}`);
|
|
1195
1216
|
for (const idx of intent.networks) {
|
|
1196
1217
|
const score = idx.relevancyScore !== undefined ? ` (${idx.relevancyScore.toFixed(2)})` : "";
|
|
1197
|
-
|
|
1218
|
+
const mode = idx.visibility === "mutuals_only" ? ` ${YELLOW}[mutuals_only]${RESET}` : "";
|
|
1219
|
+
console.log(` ${CYAN}*${RESET} ${idx.title}${GRAY}${score}${RESET}${mode}`);
|
|
1198
1220
|
}
|
|
1199
1221
|
}
|
|
1200
1222
|
console.log(` ${GRAY}${"─".repeat(50)}${RESET}`);
|
|
@@ -1689,7 +1711,7 @@ Usage:
|
|
|
1689
1711
|
|
|
1690
1712
|
--source-type and --source-id are optional strings Index stores and returns
|
|
1691
1713
|
unchanged, so a client can map its own records (such as an inferred ambient
|
|
1692
|
-
intent) to the published
|
|
1714
|
+
intent) to the published intent. Pass an empty value to clear one on update.
|
|
1693
1715
|
`;
|
|
1694
1716
|
function sourceField(value) {
|
|
1695
1717
|
return value === undefined ? undefined : value || null;
|
|
@@ -1758,7 +1780,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1758
1780
|
}
|
|
1759
1781
|
if (!options.json)
|
|
1760
1782
|
info("Processing intent...");
|
|
1761
|
-
const result = await client.createIntent(options.intentContent, options.targetId ? [options.targetId] : undefined, options.receipt, source);
|
|
1783
|
+
const result = await client.createIntent(options.intentContent, options.targetId ? [options.targetId] : undefined, options.receipt, source, { visibility: options.visibility, isPrivate: options.isPrivate });
|
|
1762
1784
|
if (options.json) {
|
|
1763
1785
|
console.log(JSON.stringify(result));
|
|
1764
1786
|
return;
|
|
@@ -1772,13 +1794,13 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1772
1794
|
error("Missing intent ID. Usage: index intent update <id> [<content>] [--source-type <s>] [--source-id <s>]", 1);
|
|
1773
1795
|
return;
|
|
1774
1796
|
}
|
|
1775
|
-
if (!options.intentContent && Object.keys(source).length === 0) {
|
|
1797
|
+
if (!options.intentContent && !options.isPrivate && Object.keys(source).length === 0) {
|
|
1776
1798
|
error("Nothing to update. Usage: index intent update <id> [<content>] [--source-type <s>] [--source-id <s>]", 1);
|
|
1777
1799
|
return;
|
|
1778
1800
|
}
|
|
1779
1801
|
if (!options.json)
|
|
1780
1802
|
info("Updating intent...");
|
|
1781
|
-
const result = await client.updateIntent(options.intentId, options.intentContent, source);
|
|
1803
|
+
const result = await client.updateIntent(options.intentId, options.intentContent, source, { isPrivate: options.isPrivate });
|
|
1782
1804
|
if (options.json) {
|
|
1783
1805
|
console.log(JSON.stringify(result));
|
|
1784
1806
|
return;
|
|
@@ -1832,7 +1854,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1832
1854
|
error("Usage: index intent add-to-network <intent-id> <network-id>", 1);
|
|
1833
1855
|
return;
|
|
1834
1856
|
}
|
|
1835
|
-
await client.addIntentToNetwork(options.intentId, options.targetId);
|
|
1857
|
+
await client.addIntentToNetwork(options.intentId, options.targetId, options.visibility);
|
|
1836
1858
|
if (options.json) {
|
|
1837
1859
|
console.log(JSON.stringify({ success: true }));
|
|
1838
1860
|
return;
|
|
@@ -1840,6 +1862,19 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1840
1862
|
success("Intent added to network.");
|
|
1841
1863
|
return;
|
|
1842
1864
|
}
|
|
1865
|
+
case "exclude": {
|
|
1866
|
+
if (!options.intentId || !options.excludeUserId) {
|
|
1867
|
+
error("Usage: index intent exclude <intent-id> <user-id>", 1);
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
await client.excludeUser(options.intentId, options.excludeUserId);
|
|
1871
|
+
if (options.json) {
|
|
1872
|
+
console.log(JSON.stringify({ success: true }));
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
success("Person excluded.");
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1843
1878
|
case "remove-from-network": {
|
|
1844
1879
|
if (!options.intentId || !options.targetId) {
|
|
1845
1880
|
error("Usage: index intent remove-from-network <intent-id> <network-id>", 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexnetwork/cli",
|
|
3
|
-
"version": "0.30.0-rc.
|
|
3
|
+
"version": "0.30.0-rc.108.1",
|
|
4
4
|
"description": "Command-line interface for Index Network",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"publish:all": "bun scripts/publish.ts"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@indexnetwork/cli-linux-x64": "0.30.0-rc.
|
|
24
|
-
"@indexnetwork/cli-linux-arm64": "0.30.0-rc.
|
|
25
|
-
"@indexnetwork/cli-darwin-x64": "0.30.0-rc.
|
|
26
|
-
"@indexnetwork/cli-darwin-arm64": "0.30.0-rc.
|
|
23
|
+
"@indexnetwork/cli-linux-x64": "0.30.0-rc.108.1",
|
|
24
|
+
"@indexnetwork/cli-linux-arm64": "0.30.0-rc.108.1",
|
|
25
|
+
"@indexnetwork/cli-darwin-x64": "0.30.0-rc.108.1",
|
|
26
|
+
"@indexnetwork/cli-darwin-arm64": "0.30.0-rc.108.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "1.3.14"
|