@indexnetwork/cli 0.14.0-rc.63.1 → 0.16.0-rc.65.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/dist/index.js +15 -373
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { spawn } from "node:child_process";
|
|
|
19
19
|
// package.json
|
|
20
20
|
var package_default = {
|
|
21
21
|
name: "@indexnetwork/cli",
|
|
22
|
-
version: "0.
|
|
22
|
+
version: "0.16.0",
|
|
23
23
|
description: "Command-line interface for Index Network",
|
|
24
24
|
license: "MIT",
|
|
25
25
|
type: "module",
|
|
@@ -39,10 +39,10 @@ var package_default = {
|
|
|
39
39
|
"publish:all": "bun scripts/publish.ts"
|
|
40
40
|
},
|
|
41
41
|
optionalDependencies: {
|
|
42
|
-
"@indexnetwork/cli-linux-x64": "0.
|
|
43
|
-
"@indexnetwork/cli-linux-arm64": "0.
|
|
44
|
-
"@indexnetwork/cli-darwin-x64": "0.
|
|
45
|
-
"@indexnetwork/cli-darwin-arm64": "0.
|
|
42
|
+
"@indexnetwork/cli-linux-x64": "0.16.0",
|
|
43
|
+
"@indexnetwork/cli-linux-arm64": "0.16.0",
|
|
44
|
+
"@indexnetwork/cli-darwin-x64": "0.16.0",
|
|
45
|
+
"@indexnetwork/cli-darwin-arm64": "0.16.0"
|
|
46
46
|
},
|
|
47
47
|
devDependencies: {
|
|
48
48
|
"@types/bun": "1.3.14"
|
|
@@ -54,7 +54,7 @@ var KNOWN_COMMANDS = new Set(["login", "logout", "profile", "intent", "opportuni
|
|
|
54
54
|
var OPPORTUNITY_SUBCOMMANDS = new Set(["list", "show", "accept", "reject"]);
|
|
55
55
|
var NEGOTIATION_SUBCOMMANDS = new Set(["list", "show"]);
|
|
56
56
|
var NETWORK_SUBCOMMANDS = new Set(["list", "create", "show", "join", "leave", "invite", "update", "delete"]);
|
|
57
|
-
var CONVERSATION_SUBCOMMANDS = new Set(["list", "with", "show", "send", "stream", "
|
|
57
|
+
var CONVERSATION_SUBCOMMANDS = new Set(["list", "with", "show", "send", "stream", "help"]);
|
|
58
58
|
function parseArgs(args) {
|
|
59
59
|
const result = {
|
|
60
60
|
command: "help",
|
|
@@ -101,7 +101,6 @@ function parseArgs(args) {
|
|
|
101
101
|
result.list = true;
|
|
102
102
|
i++;
|
|
103
103
|
} else if (arg === "--session" || arg === "-s") {
|
|
104
|
-
result.sessionId = args[i + 1];
|
|
105
104
|
i += 2;
|
|
106
105
|
} else if (arg === "--api-url") {
|
|
107
106
|
result.apiUrl = args[i + 1];
|
|
@@ -124,12 +123,6 @@ function parseArgs(args) {
|
|
|
124
123
|
} else if (arg === "--json") {
|
|
125
124
|
result.json = true;
|
|
126
125
|
i++;
|
|
127
|
-
} else if (arg === "--name") {
|
|
128
|
-
result.name = args[i + 1];
|
|
129
|
-
i += 2;
|
|
130
|
-
} else if (arg === "--gmail") {
|
|
131
|
-
result.gmail = true;
|
|
132
|
-
i++;
|
|
133
126
|
} else if (arg === "--objective") {
|
|
134
127
|
result.objective = args[i + 1];
|
|
135
128
|
i += 2;
|
|
@@ -236,8 +229,6 @@ function parseArgs(args) {
|
|
|
236
229
|
if (positionals.length > 0 && CONVERSATION_SUBCOMMANDS.has(positionals[0])) {
|
|
237
230
|
result.subcommand = positionals[0];
|
|
238
231
|
result.positionals = positionals.slice(1);
|
|
239
|
-
} else if (positionals.length > 0) {
|
|
240
|
-
result.message = positionals.join(" ");
|
|
241
232
|
}
|
|
242
233
|
}
|
|
243
234
|
return result;
|
|
@@ -345,11 +336,6 @@ class ApiClient {
|
|
|
345
336
|
authHeaders() {
|
|
346
337
|
return { "x-api-key": this.token };
|
|
347
338
|
}
|
|
348
|
-
async listSessions() {
|
|
349
|
-
const res = await this.get("/api/chat/sessions");
|
|
350
|
-
const body = await res.json();
|
|
351
|
-
return body.sessions;
|
|
352
|
-
}
|
|
353
339
|
async revokeApiKey(keyId, targetKey = this.token) {
|
|
354
340
|
const res = await this.post("/api/auth/cli-credential/revoke", { keyId, targetKey });
|
|
355
341
|
const body = await res.json();
|
|
@@ -390,23 +376,6 @@ class ApiClient {
|
|
|
390
376
|
});
|
|
391
377
|
return await res.json();
|
|
392
378
|
}
|
|
393
|
-
async streamChat(params) {
|
|
394
|
-
const res = await fetch(`${this.baseUrl}/api/chat/stream`, {
|
|
395
|
-
method: "POST",
|
|
396
|
-
headers: {
|
|
397
|
-
"Content-Type": "application/json",
|
|
398
|
-
...this.authHeaders()
|
|
399
|
-
},
|
|
400
|
-
body: JSON.stringify({
|
|
401
|
-
message: params.message,
|
|
402
|
-
...params.sessionId ? { sessionId: params.sessionId } : {}
|
|
403
|
-
})
|
|
404
|
-
});
|
|
405
|
-
if (!res.ok) {
|
|
406
|
-
await this.handleError(res);
|
|
407
|
-
}
|
|
408
|
-
return res;
|
|
409
|
-
}
|
|
410
379
|
async listIntents(options = {}) {
|
|
411
380
|
const body = {};
|
|
412
381
|
if (options.limit !== undefined)
|
|
@@ -879,7 +848,6 @@ __export(exports_output, {
|
|
|
879
848
|
success: () => success,
|
|
880
849
|
stripAnsi: () => stripAnsi,
|
|
881
850
|
status: () => status,
|
|
882
|
-
sessionTable: () => sessionTable,
|
|
883
851
|
raw: () => raw,
|
|
884
852
|
profileCard: () => profileCard,
|
|
885
853
|
padTo: () => padTo,
|
|
@@ -1001,10 +969,7 @@ var TOOL_DESCRIPTIONS = {
|
|
|
1001
969
|
update_opportunity: "Updating opportunity status...",
|
|
1002
970
|
scrape_url: "Reading content from URL...",
|
|
1003
971
|
read_docs: "Looking up documentation...",
|
|
1004
|
-
import_gmail_contacts: "Importing Gmail contacts...",
|
|
1005
|
-
import_contacts: "Importing contacts...",
|
|
1006
972
|
list_contacts: "Listing your contacts...",
|
|
1007
|
-
add_contact: "Adding contact...",
|
|
1008
973
|
remove_contact: "Removing contact..."
|
|
1009
974
|
};
|
|
1010
975
|
function humanizeToolName(name) {
|
|
@@ -1313,28 +1278,6 @@ function contactTable(contacts) {
|
|
|
1313
1278
|
console.log(` ${c.name.padEnd(nameWidth)} ${c.email}${ghost}`);
|
|
1314
1279
|
}
|
|
1315
1280
|
}
|
|
1316
|
-
function sessionTable(sessions) {
|
|
1317
|
-
if (sessions.length === 0) {
|
|
1318
|
-
dim(" No chat sessions found.");
|
|
1319
|
-
return;
|
|
1320
|
-
}
|
|
1321
|
-
const idWidth = 36;
|
|
1322
|
-
const titleWidth = 40;
|
|
1323
|
-
const dateWidth = 20;
|
|
1324
|
-
console.log(` ${BOLD}${"ID".padEnd(idWidth)} ${"Title".padEnd(titleWidth)} ${"Created".padEnd(dateWidth)}${RESET}`);
|
|
1325
|
-
console.log(` ${GRAY}${"-".repeat(idWidth)} ${"-".repeat(titleWidth)} ${"-".repeat(dateWidth)}${RESET}`);
|
|
1326
|
-
for (const s of sessions) {
|
|
1327
|
-
const title = (s.title ?? "(untitled)").slice(0, titleWidth);
|
|
1328
|
-
const date = new Date(s.createdAt).toLocaleDateString("en-US", {
|
|
1329
|
-
year: "numeric",
|
|
1330
|
-
month: "short",
|
|
1331
|
-
day: "numeric",
|
|
1332
|
-
hour: "2-digit",
|
|
1333
|
-
minute: "2-digit"
|
|
1334
|
-
});
|
|
1335
|
-
console.log(` ${GRAY}${s.id.padEnd(idWidth)}${RESET} ${title.padEnd(titleWidth)} ${GRAY}${date}${RESET}`);
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
1281
|
function intentTable(intents) {
|
|
1339
1282
|
if (intents.length === 0) {
|
|
1340
1283
|
dim(" No signals found.");
|
|
@@ -2440,122 +2383,9 @@ async function networkInvite(client, id, email, json) {
|
|
|
2440
2383
|
}
|
|
2441
2384
|
|
|
2442
2385
|
// src/conversation.command.ts
|
|
2443
|
-
import { createInterface } from "node:readline/promises";
|
|
2444
|
-
async function renderSSEStream(response, callbacks) {
|
|
2445
|
-
const { onToken, onStatus, onToolActivity, onResponseReset } = callbacks;
|
|
2446
|
-
const result = {};
|
|
2447
|
-
if (!response.body) {
|
|
2448
|
-
result.error = "No response body";
|
|
2449
|
-
return result;
|
|
2450
|
-
}
|
|
2451
|
-
const reader = response.body.getReader();
|
|
2452
|
-
const decoder = new TextDecoder;
|
|
2453
|
-
let buffer = "";
|
|
2454
|
-
let insideToolCall = false;
|
|
2455
|
-
const toolDescriptions = new Map;
|
|
2456
|
-
try {
|
|
2457
|
-
while (true) {
|
|
2458
|
-
const { done, value } = await reader.read();
|
|
2459
|
-
if (done)
|
|
2460
|
-
break;
|
|
2461
|
-
buffer += decoder.decode(value, { stream: true });
|
|
2462
|
-
while (buffer.includes(`
|
|
2463
|
-
|
|
2464
|
-
`)) {
|
|
2465
|
-
const idx = buffer.indexOf(`
|
|
2466
|
-
|
|
2467
|
-
`);
|
|
2468
|
-
const raw2 = buffer.slice(0, idx);
|
|
2469
|
-
buffer = buffer.slice(idx + 2);
|
|
2470
|
-
for (const line of raw2.split(`
|
|
2471
|
-
`)) {
|
|
2472
|
-
if (!line.startsWith("data:"))
|
|
2473
|
-
continue;
|
|
2474
|
-
const jsonStr = line.slice("data:".length).trim();
|
|
2475
|
-
if (!jsonStr)
|
|
2476
|
-
continue;
|
|
2477
|
-
try {
|
|
2478
|
-
const event = JSON.parse(jsonStr);
|
|
2479
|
-
const type = event.type;
|
|
2480
|
-
switch (type) {
|
|
2481
|
-
case "token": {
|
|
2482
|
-
if (typeof event.content !== "string")
|
|
2483
|
-
break;
|
|
2484
|
-
if (insideToolCall)
|
|
2485
|
-
break;
|
|
2486
|
-
onToken(event.content);
|
|
2487
|
-
break;
|
|
2488
|
-
}
|
|
2489
|
-
case "status":
|
|
2490
|
-
if (onStatus && typeof event.message === "string") {
|
|
2491
|
-
onStatus(event.message);
|
|
2492
|
-
}
|
|
2493
|
-
break;
|
|
2494
|
-
case "tool_activity": {
|
|
2495
|
-
const phase = event.phase;
|
|
2496
|
-
const toolName = typeof event.toolName === "string" ? event.toolName : "";
|
|
2497
|
-
const desc = typeof event.description === "string" ? event.description : undefined;
|
|
2498
|
-
if (phase === "start") {
|
|
2499
|
-
insideToolCall = true;
|
|
2500
|
-
if (desc && toolName) {
|
|
2501
|
-
toolDescriptions.set(toolName, desc);
|
|
2502
|
-
}
|
|
2503
|
-
if (onToolActivity && desc) {
|
|
2504
|
-
onToolActivity(desc, "start");
|
|
2505
|
-
}
|
|
2506
|
-
} else if (phase === "end") {
|
|
2507
|
-
insideToolCall = false;
|
|
2508
|
-
const startDesc = toolName ? toolDescriptions.get(toolName) : undefined;
|
|
2509
|
-
if (onToolActivity) {
|
|
2510
|
-
onToolActivity(startDesc ?? desc ?? toolName, "end", event.success !== false);
|
|
2511
|
-
}
|
|
2512
|
-
if (toolName)
|
|
2513
|
-
toolDescriptions.delete(toolName);
|
|
2514
|
-
}
|
|
2515
|
-
break;
|
|
2516
|
-
}
|
|
2517
|
-
case "tool_start":
|
|
2518
|
-
insideToolCall = true;
|
|
2519
|
-
break;
|
|
2520
|
-
case "tool_end":
|
|
2521
|
-
insideToolCall = false;
|
|
2522
|
-
break;
|
|
2523
|
-
case "llm_start":
|
|
2524
|
-
insideToolCall = false;
|
|
2525
|
-
break;
|
|
2526
|
-
case "response_reset":
|
|
2527
|
-
result.response = undefined;
|
|
2528
|
-
if (onResponseReset) {
|
|
2529
|
-
onResponseReset(typeof event.reason === "string" ? event.reason : undefined);
|
|
2530
|
-
}
|
|
2531
|
-
break;
|
|
2532
|
-
case "done":
|
|
2533
|
-
result.sessionId = typeof event.sessionId === "string" ? event.sessionId : undefined;
|
|
2534
|
-
result.response = typeof event.response === "string" ? event.response : undefined;
|
|
2535
|
-
result.title = typeof event.title === "string" ? event.title : undefined;
|
|
2536
|
-
break;
|
|
2537
|
-
case "error":
|
|
2538
|
-
result.error = typeof event.message === "string" ? event.message : "Unknown stream error";
|
|
2539
|
-
break;
|
|
2540
|
-
default:
|
|
2541
|
-
break;
|
|
2542
|
-
}
|
|
2543
|
-
} catch {}
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
} finally {
|
|
2548
|
-
reader.releaseLock();
|
|
2549
|
-
}
|
|
2550
|
-
return result;
|
|
2551
|
-
}
|
|
2552
2386
|
var CONVERSATION_HELP = `
|
|
2553
2387
|
Conversation Commands:
|
|
2554
|
-
index conversation
|
|
2555
|
-
index conversation "message" One-shot message to the AI agent
|
|
2556
|
-
index conversation --session <id> Resume a specific chat session
|
|
2557
|
-
index conversation sessions List AI chat sessions
|
|
2558
|
-
index conversation list List all conversations (H2A + H2H)
|
|
2388
|
+
index conversation list List all conversations
|
|
2559
2389
|
index conversation with <user-id|key> Open or resume a DM with a user
|
|
2560
2390
|
index conversation show <id> Show messages (accepts short ID)
|
|
2561
2391
|
index conversation show <id> --limit <n> Limit number of messages
|
|
@@ -2564,21 +2394,10 @@ Conversation Commands:
|
|
|
2564
2394
|
`;
|
|
2565
2395
|
async function handleConversation(client, subcommand, positionals, options) {
|
|
2566
2396
|
if (!subcommand) {
|
|
2567
|
-
|
|
2568
|
-
error("`--json` requires an explicit conversation subcommand.", 1);
|
|
2569
|
-
return;
|
|
2570
|
-
}
|
|
2571
|
-
if (options?.message) {
|
|
2572
|
-
await chatOneShot(client, options.message, options.sessionId);
|
|
2573
|
-
} else {
|
|
2574
|
-
await chatRepl(client, options?.sessionId);
|
|
2575
|
-
}
|
|
2397
|
+
error("Agent chat is no longer available from the CLI. Use `index conversation list` " + "for your conversations, or chat in the Index app.", 1);
|
|
2576
2398
|
return;
|
|
2577
2399
|
}
|
|
2578
2400
|
switch (subcommand) {
|
|
2579
|
-
case "sessions":
|
|
2580
|
-
await chatSessionsList(client, options?.json);
|
|
2581
|
-
return;
|
|
2582
2401
|
case "list":
|
|
2583
2402
|
await conversationList(client, options?.json);
|
|
2584
2403
|
return;
|
|
@@ -2704,140 +2523,12 @@ async function conversationStream(client) {
|
|
|
2704
2523
|
reader.releaseLock();
|
|
2705
2524
|
}
|
|
2706
2525
|
}
|
|
2707
|
-
async function chatSessionsList(client, json) {
|
|
2708
|
-
const sessions = await client.listSessions();
|
|
2709
|
-
if (json) {
|
|
2710
|
-
console.log(JSON.stringify(sessions));
|
|
2711
|
-
return;
|
|
2712
|
-
}
|
|
2713
|
-
heading("Chat Sessions");
|
|
2714
|
-
sessionTable(sessions);
|
|
2715
|
-
console.log();
|
|
2716
|
-
}
|
|
2717
|
-
async function chatOneShot(client, message, sessionId) {
|
|
2718
|
-
const response = await client.streamChat({ message, sessionId });
|
|
2719
|
-
if (!response.ok) {
|
|
2720
|
-
handleStreamError(response);
|
|
2721
|
-
return;
|
|
2722
|
-
}
|
|
2723
|
-
const result = await streamToTerminal(response);
|
|
2724
|
-
if (result.error) {
|
|
2725
|
-
error(result.error, 1);
|
|
2726
|
-
return;
|
|
2727
|
-
}
|
|
2728
|
-
if (result.sessionId) {
|
|
2729
|
-
dim(`
|
|
2730
|
-
Session: ${result.sessionId}`);
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
async function chatRepl(client, sessionId) {
|
|
2734
|
-
let currentSessionId = sessionId;
|
|
2735
|
-
chatHeader();
|
|
2736
|
-
const PROMPT_STR2 = PROMPT_STR;
|
|
2737
|
-
const rl = createInterface({
|
|
2738
|
-
input: process.stdin,
|
|
2739
|
-
output: process.stderr,
|
|
2740
|
-
terminal: true
|
|
2741
|
-
});
|
|
2742
|
-
rl.setPrompt(PROMPT_STR2);
|
|
2743
|
-
rl.prompt();
|
|
2744
|
-
try {
|
|
2745
|
-
for await (const line of rl) {
|
|
2746
|
-
const input = line.trim();
|
|
2747
|
-
if (!input) {
|
|
2748
|
-
rl.prompt();
|
|
2749
|
-
continue;
|
|
2750
|
-
}
|
|
2751
|
-
if (input === "exit" || input === "quit")
|
|
2752
|
-
break;
|
|
2753
|
-
const response = await client.streamChat({
|
|
2754
|
-
message: input,
|
|
2755
|
-
sessionId: currentSessionId
|
|
2756
|
-
});
|
|
2757
|
-
if (!response.ok) {
|
|
2758
|
-
if (response.status === 401) {
|
|
2759
|
-
error("Session expired. Run `index login` to re-authenticate.", 1);
|
|
2760
|
-
return;
|
|
2761
|
-
}
|
|
2762
|
-
const body = await response.json().catch(() => ({}));
|
|
2763
|
-
error(body.error ?? `HTTP ${response.status}`);
|
|
2764
|
-
rl.prompt();
|
|
2765
|
-
continue;
|
|
2766
|
-
}
|
|
2767
|
-
const result = await streamToTerminal(response);
|
|
2768
|
-
if (result.error) {
|
|
2769
|
-
error(result.error);
|
|
2770
|
-
}
|
|
2771
|
-
if (result.sessionId) {
|
|
2772
|
-
currentSessionId = result.sessionId;
|
|
2773
|
-
}
|
|
2774
|
-
process.stderr.write(`
|
|
2775
|
-
`);
|
|
2776
|
-
rl.prompt();
|
|
2777
|
-
}
|
|
2778
|
-
} finally {
|
|
2779
|
-
rl.close();
|
|
2780
|
-
}
|
|
2781
|
-
process.stderr.write(`
|
|
2782
|
-
`);
|
|
2783
|
-
dim("Goodbye!");
|
|
2784
|
-
}
|
|
2785
|
-
async function streamToTerminal(response) {
|
|
2786
|
-
let hasTokens = false;
|
|
2787
|
-
const md = new MarkdownRenderer;
|
|
2788
|
-
let lastToolDesc = "";
|
|
2789
|
-
const result = await renderSSEStream(response, {
|
|
2790
|
-
onToken(text) {
|
|
2791
|
-
if (!hasTokens) {
|
|
2792
|
-
clearStatus();
|
|
2793
|
-
hasTokens = true;
|
|
2794
|
-
}
|
|
2795
|
-
md.write(text);
|
|
2796
|
-
lastToolDesc = "";
|
|
2797
|
-
},
|
|
2798
|
-
onStatus(msg) {
|
|
2799
|
-
if (!hasTokens) {
|
|
2800
|
-
status(msg);
|
|
2801
|
-
}
|
|
2802
|
-
},
|
|
2803
|
-
onToolActivity(description, phase) {
|
|
2804
|
-
if (phase === "start") {
|
|
2805
|
-
const friendly = humanizeToolName(description);
|
|
2806
|
-
if (friendly === lastToolDesc)
|
|
2807
|
-
return;
|
|
2808
|
-
lastToolDesc = friendly;
|
|
2809
|
-
md.finalize();
|
|
2810
|
-
hasTokens = false;
|
|
2811
|
-
toolActivity(friendly);
|
|
2812
|
-
}
|
|
2813
|
-
},
|
|
2814
|
-
onResponseReset(reason) {
|
|
2815
|
-
md.reset(reason);
|
|
2816
|
-
hasTokens = false;
|
|
2817
|
-
}
|
|
2818
|
-
});
|
|
2819
|
-
md.finalize();
|
|
2820
|
-
clearStatus();
|
|
2821
|
-
if (hasTokens) {
|
|
2822
|
-
console.log();
|
|
2823
|
-
}
|
|
2824
|
-
return result;
|
|
2825
|
-
}
|
|
2826
|
-
async function handleStreamError(response) {
|
|
2827
|
-
if (response.status === 401) {
|
|
2828
|
-
error("Session expired or invalid. Run `index login` to re-authenticate.", 1);
|
|
2829
|
-
}
|
|
2830
|
-
const body = await response.json().catch(() => ({}));
|
|
2831
|
-
error(body.error ?? `HTTP ${response.status}`, 1);
|
|
2832
|
-
}
|
|
2833
2526
|
|
|
2834
2527
|
// src/contact.command.ts
|
|
2835
2528
|
var CONTACT_HELP = `
|
|
2836
2529
|
Usage:
|
|
2837
|
-
index contact list
|
|
2838
|
-
index contact
|
|
2839
|
-
index contact remove <email> Remove a contact
|
|
2840
|
-
index contact import --gmail Import contacts from Gmail
|
|
2530
|
+
index contact list List your contacts
|
|
2531
|
+
index contact remove <email> Remove a contact
|
|
2841
2532
|
`;
|
|
2842
2533
|
async function handleContact(client, subcommand, positionals, options) {
|
|
2843
2534
|
if (!subcommand) {
|
|
@@ -2867,25 +2558,6 @@ async function handleContact(client, subcommand, positionals, options) {
|
|
|
2867
2558
|
console.log();
|
|
2868
2559
|
return;
|
|
2869
2560
|
}
|
|
2870
|
-
case "add": {
|
|
2871
|
-
const email = positionals[0];
|
|
2872
|
-
if (!email) {
|
|
2873
|
-
error("Missing email. Usage: index contact add <email>", 1);
|
|
2874
|
-
return;
|
|
2875
|
-
}
|
|
2876
|
-
const result = await client.callTool("add_contact", { email, name: options.name });
|
|
2877
|
-
if (options.json) {
|
|
2878
|
-
console.log(JSON.stringify(result));
|
|
2879
|
-
return;
|
|
2880
|
-
}
|
|
2881
|
-
if (!result.success) {
|
|
2882
|
-
error(result.error ?? "Failed to add contact", 1);
|
|
2883
|
-
return;
|
|
2884
|
-
}
|
|
2885
|
-
const data = result.data;
|
|
2886
|
-
success(data.message);
|
|
2887
|
-
return;
|
|
2888
|
-
}
|
|
2889
2561
|
case "remove": {
|
|
2890
2562
|
const email = positionals[0];
|
|
2891
2563
|
if (!email) {
|
|
@@ -2915,24 +2587,6 @@ async function handleContact(client, subcommand, positionals, options) {
|
|
|
2915
2587
|
success(`Removed ${email} from contacts.`);
|
|
2916
2588
|
return;
|
|
2917
2589
|
}
|
|
2918
|
-
case "import": {
|
|
2919
|
-
if (options.gmail) {
|
|
2920
|
-
const result = await client.callTool("import_gmail_contacts", {});
|
|
2921
|
-
if (options.json) {
|
|
2922
|
-
console.log(JSON.stringify(result));
|
|
2923
|
-
return;
|
|
2924
|
-
}
|
|
2925
|
-
if (!result.success) {
|
|
2926
|
-
error(result.error ?? "Failed to import Gmail contacts", 1);
|
|
2927
|
-
return;
|
|
2928
|
-
}
|
|
2929
|
-
const data = result.data;
|
|
2930
|
-
success(data.message);
|
|
2931
|
-
} else {
|
|
2932
|
-
error("Specify import source: --gmail", 1);
|
|
2933
|
-
}
|
|
2934
|
-
return;
|
|
2935
|
-
}
|
|
2936
2590
|
default: {
|
|
2937
2591
|
if (options.json) {
|
|
2938
2592
|
console.log(JSON.stringify({ error: `Unknown subcommand: ${subcommand}` }));
|
|
@@ -3072,8 +2726,7 @@ function renderHelp() {
|
|
|
3072
2726
|
];
|
|
3073
2727
|
const gsLW = Math.max(...gsLefts.map((s) => s.length));
|
|
3074
2728
|
const formsLefts = [
|
|
3075
|
-
|
|
3076
|
-
"index conversation --session <id>",
|
|
2729
|
+
"index conversation list",
|
|
3077
2730
|
"index sync --json",
|
|
3078
2731
|
"index profile create",
|
|
3079
2732
|
"index profile update",
|
|
@@ -3100,14 +2753,11 @@ function renderHelp() {
|
|
|
3100
2753
|
const optLefts = [
|
|
3101
2754
|
"--api-url <url>",
|
|
3102
2755
|
"--app-url <url>",
|
|
3103
|
-
"--session <id>",
|
|
3104
2756
|
"--archived",
|
|
3105
2757
|
"--status <status>",
|
|
3106
2758
|
"--limit <n>",
|
|
3107
2759
|
"--since <date>",
|
|
3108
2760
|
"--json",
|
|
3109
|
-
"--name <name>",
|
|
3110
|
-
"--gmail",
|
|
3111
2761
|
"--objective <text>",
|
|
3112
2762
|
"--linkedin <url>",
|
|
3113
2763
|
"--github <url>",
|
|
@@ -3130,8 +2780,7 @@ function renderHelp() {
|
|
|
3130
2780
|
helpRowCmd(gsLW, "index opportunity list", "see what was found for you")
|
|
3131
2781
|
]);
|
|
3132
2782
|
panel("common forms", [
|
|
3133
|
-
helpRowCmd(formsLW,
|
|
3134
|
-
helpRowCmd(formsLW, "index conversation --session <id>", "resume an agent chat session"),
|
|
2783
|
+
helpRowCmd(formsLW, "index conversation list", "list your conversations"),
|
|
3135
2784
|
helpRowCmd(formsLW, "index sync --json", "print synced context as JSON"),
|
|
3136
2785
|
"",
|
|
3137
2786
|
helpRowCmd(formsLW, "index profile create", "use social URL flags"),
|
|
@@ -3149,10 +2798,10 @@ function renderHelp() {
|
|
|
3149
2798
|
helpRowCmd(cmdLW, "negotiation", "list · show"),
|
|
3150
2799
|
"",
|
|
3151
2800
|
helpRowCmd(cmdLW, "profile", "show · sync · search · create · update"),
|
|
3152
|
-
helpRowCmd(cmdLW, "conversation", "
|
|
2801
|
+
helpRowCmd(cmdLW, "conversation", "list · with · show · send · stream"),
|
|
3153
2802
|
helpRowCmd(cmdLW, "network", "list · create · show · update · delete"),
|
|
3154
2803
|
helpRowCont(cmdLW, "join · leave · invite"),
|
|
3155
|
-
helpRowCmd(cmdLW, "contact", "list ·
|
|
2804
|
+
helpRowCmd(cmdLW, "contact", "list · remove"),
|
|
3156
2805
|
"",
|
|
3157
2806
|
helpRowCmd(cmdLW, "scrape", "extract content from a URL"),
|
|
3158
2807
|
helpRowCmd(cmdLW, "sync", "download your context locally"),
|
|
@@ -3161,14 +2810,11 @@ function renderHelp() {
|
|
|
3161
2810
|
panel("options", [
|
|
3162
2811
|
helpRowDim(optLW, "--api-url <url>", "override API server URL"),
|
|
3163
2812
|
helpRowDim(optLW, "--app-url <url>", "override app URL for login"),
|
|
3164
|
-
helpRowDim(optLW, "--session <id>", "resume a chat session"),
|
|
3165
2813
|
helpRowDim(optLW, "--archived", "include archived signals"),
|
|
3166
2814
|
helpRowDim(optLW, "--status <status>", "filter opportunities by status"),
|
|
3167
2815
|
helpRowDim(optLW, "--limit <n>", "limit number of results"),
|
|
3168
2816
|
helpRowDim(optLW, "--since <date>", "filter by ISO date or duration"),
|
|
3169
2817
|
helpRowDim(optLW, "--json", "output raw JSON"),
|
|
3170
|
-
helpRowDim(optLW, "--name <name>", "name for contact add"),
|
|
3171
|
-
helpRowDim(optLW, "--gmail", "import contacts from Gmail"),
|
|
3172
2818
|
helpRowDim(optLW, "--objective <text>", "objective for scrape command"),
|
|
3173
2819
|
helpRowDim(optLW, "--linkedin <url>", "LinkedIn URL for profile create"),
|
|
3174
2820
|
helpRowDim(optLW, "--github <url>", "GitHub URL for profile create"),
|
|
@@ -3313,16 +2959,12 @@ async function main() {
|
|
|
3313
2959
|
case "conversation":
|
|
3314
2960
|
await handleConversation(client, args.subcommand, args.positionals ?? [], {
|
|
3315
2961
|
limit: args.limit,
|
|
3316
|
-
sessionId: args.sessionId,
|
|
3317
|
-
message: args.message,
|
|
3318
2962
|
json: args.json
|
|
3319
2963
|
});
|
|
3320
2964
|
return;
|
|
3321
2965
|
case "contact":
|
|
3322
2966
|
await handleContact(client, args.subcommand, args.positionals ?? [], {
|
|
3323
|
-
json: args.json
|
|
3324
|
-
name: args.name,
|
|
3325
|
-
gmail: args.gmail
|
|
2967
|
+
json: args.json
|
|
3326
2968
|
});
|
|
3327
2969
|
return;
|
|
3328
2970
|
case "scrape":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexnetwork/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0-rc.65.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.
|
|
24
|
-
"@indexnetwork/cli-linux-arm64": "0.
|
|
25
|
-
"@indexnetwork/cli-darwin-x64": "0.
|
|
26
|
-
"@indexnetwork/cli-darwin-arm64": "0.
|
|
23
|
+
"@indexnetwork/cli-linux-x64": "0.16.0-rc.65.1",
|
|
24
|
+
"@indexnetwork/cli-linux-arm64": "0.16.0-rc.65.1",
|
|
25
|
+
"@indexnetwork/cli-darwin-x64": "0.16.0-rc.65.1",
|
|
26
|
+
"@indexnetwork/cli-darwin-arm64": "0.16.0-rc.65.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "1.3.14"
|