@indexnetwork/cli 0.9.2 → 0.9.4
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/index.js +16 -16
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -353,10 +353,10 @@ class ApiClient {
|
|
|
353
353
|
async leaveNetwork(id) {
|
|
354
354
|
await this.post(`/api/indexes/${id}/leave`, {});
|
|
355
355
|
}
|
|
356
|
-
async searchUsers(query,
|
|
356
|
+
async searchUsers(query, networkId) {
|
|
357
357
|
const params = new URLSearchParams({ q: query });
|
|
358
|
-
if (
|
|
359
|
-
params.set("indexId",
|
|
358
|
+
if (networkId)
|
|
359
|
+
params.set("indexId", networkId);
|
|
360
360
|
const res = await this.get(`/api/indexes/search-users?${params.toString()}`);
|
|
361
361
|
const body = await res.json();
|
|
362
362
|
return body.users;
|
|
@@ -1598,7 +1598,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1598
1598
|
}
|
|
1599
1599
|
const result = await client.callTool("create_intent_index", {
|
|
1600
1600
|
intentId: options.intentId,
|
|
1601
|
-
|
|
1601
|
+
networkId: options.targetId
|
|
1602
1602
|
});
|
|
1603
1603
|
if (options.json) {
|
|
1604
1604
|
console.log(JSON.stringify(result));
|
|
@@ -1618,7 +1618,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
const result = await client.callTool("delete_intent_index", {
|
|
1620
1620
|
intentId: options.intentId,
|
|
1621
|
-
|
|
1621
|
+
networkId: options.targetId
|
|
1622
1622
|
});
|
|
1623
1623
|
if (options.json) {
|
|
1624
1624
|
console.log(JSON.stringify(result));
|
|
@@ -1654,7 +1654,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1654
1654
|
} else {
|
|
1655
1655
|
for (const idx of data.indexes) {
|
|
1656
1656
|
const score = idx.relevancyScore !== undefined ? ` (${idx.relevancyScore.toFixed(2)})` : "";
|
|
1657
|
-
console.log(` ${idx.title} ${DIM}${idx.
|
|
1657
|
+
console.log(` ${idx.title} ${DIM}${idx.networkId.slice(0, 8)}${score}${RESET}`);
|
|
1658
1658
|
}
|
|
1659
1659
|
}
|
|
1660
1660
|
console.log();
|
|
@@ -1819,8 +1819,8 @@ async function discoverIntroduction(client, userA, userB, hint, json) {
|
|
|
1819
1819
|
}
|
|
1820
1820
|
const indexesA = membershipsA.data?.memberships ?? membershipsA.data?.indexes ?? [];
|
|
1821
1821
|
const indexesB = membershipsB.data?.memberships ?? membershipsB.data?.indexes ?? [];
|
|
1822
|
-
const idsA = new Set(indexesA.map((m) => m.
|
|
1823
|
-
const shared = indexesB.filter((m) => idsA.has(m.
|
|
1822
|
+
const idsA = new Set(indexesA.map((m) => m.networkId));
|
|
1823
|
+
const shared = indexesB.filter((m) => idsA.has(m.networkId));
|
|
1824
1824
|
if (shared.length === 0) {
|
|
1825
1825
|
const err = "No shared indexes found between these users. They must be members of at least one common network.";
|
|
1826
1826
|
if (json) {
|
|
@@ -1830,13 +1830,13 @@ async function discoverIntroduction(client, userA, userB, hint, json) {
|
|
|
1830
1830
|
error(err, 1);
|
|
1831
1831
|
return;
|
|
1832
1832
|
}
|
|
1833
|
-
const
|
|
1834
|
-
dim(` Found shared network: ${
|
|
1833
|
+
const sharedNetworkId = shared[0].networkId;
|
|
1834
|
+
dim(` Found shared network: ${sharedNetworkId}`);
|
|
1835
1835
|
const [profileA, profileB, intentsA, intentsB] = await Promise.all([
|
|
1836
1836
|
client.callTool("read_user_profiles", { userId: userA }),
|
|
1837
1837
|
client.callTool("read_user_profiles", { userId: userB }),
|
|
1838
|
-
client.callTool("read_intents", { userId: userA,
|
|
1839
|
-
client.callTool("read_intents", { userId: userB,
|
|
1838
|
+
client.callTool("read_intents", { userId: userA, networkId: sharedNetworkId }),
|
|
1839
|
+
client.callTool("read_intents", { userId: userB, networkId: sharedNetworkId })
|
|
1840
1840
|
]);
|
|
1841
1841
|
const extractProfile = (result2) => {
|
|
1842
1842
|
if (!result2.success || !result2.data)
|
|
@@ -1854,8 +1854,8 @@ async function discoverIntroduction(client, userA, userB, hint, json) {
|
|
|
1854
1854
|
return d.intents?.map((i) => ({ intentId: i.intentId ?? i.id ?? "", payload: i.payload, summary: i.summary }));
|
|
1855
1855
|
};
|
|
1856
1856
|
const entities = [
|
|
1857
|
-
{ userId: userA, profile: extractProfile(profileA), intents: extractIntents(intentsA),
|
|
1858
|
-
{ userId: userB, profile: extractProfile(profileB), intents: extractIntents(intentsB),
|
|
1857
|
+
{ userId: userA, profile: extractProfile(profileA), intents: extractIntents(intentsA), networkId: sharedNetworkId },
|
|
1858
|
+
{ userId: userB, profile: extractProfile(profileB), intents: extractIntents(intentsB), networkId: sharedNetworkId }
|
|
1859
1859
|
];
|
|
1860
1860
|
dim(" Profiles and intents gathered. Creating introduction...");
|
|
1861
1861
|
const result = await client.callTool("create_opportunities", {
|
|
@@ -2007,7 +2007,7 @@ async function networkUpdate(client, id, options, json) {
|
|
|
2007
2007
|
error("Provide at least --title or --prompt. Usage: index network update <id> [--title <t>] [--prompt <p>]", 1);
|
|
2008
2008
|
return;
|
|
2009
2009
|
}
|
|
2010
|
-
const result = await client.callTool("update_index", {
|
|
2010
|
+
const result = await client.callTool("update_index", { networkId: id, settings });
|
|
2011
2011
|
if (json) {
|
|
2012
2012
|
console.log(JSON.stringify(result));
|
|
2013
2013
|
return;
|
|
@@ -2023,7 +2023,7 @@ async function networkDelete(client, id, json) {
|
|
|
2023
2023
|
error("Usage: index network delete <id>", 1);
|
|
2024
2024
|
return;
|
|
2025
2025
|
}
|
|
2026
|
-
const result = await client.callTool("delete_index", {
|
|
2026
|
+
const result = await client.callTool("delete_index", { networkId: id });
|
|
2027
2027
|
if (json) {
|
|
2028
2028
|
console.log(JSON.stringify(result));
|
|
2029
2029
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexnetwork/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
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.9.
|
|
24
|
-
"@indexnetwork/cli-linux-arm64": "0.9.
|
|
25
|
-
"@indexnetwork/cli-darwin-x64": "0.9.
|
|
26
|
-
"@indexnetwork/cli-darwin-arm64": "0.9.
|
|
23
|
+
"@indexnetwork/cli-linux-x64": "0.9.4",
|
|
24
|
+
"@indexnetwork/cli-linux-arm64": "0.9.4",
|
|
25
|
+
"@indexnetwork/cli-darwin-x64": "0.9.4",
|
|
26
|
+
"@indexnetwork/cli-darwin-arm64": "0.9.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "latest"
|