@gobi-ai/cli 0.1.1 → 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/dist/commands/astra.js +38 -5
- package/package.json +2 -1
package/dist/commands/astra.js
CHANGED
|
@@ -63,15 +63,17 @@ export function registerAstraCommand(program) {
|
|
|
63
63
|
.description("Ask a brain a question. Creates a targeted session (1:1 conversation).")
|
|
64
64
|
.requiredOption("--vault-slug <vaultSlug>", "Slug of the brain/vault to ask")
|
|
65
65
|
.requiredOption("--question <question>", "The question to ask (markdown supported)")
|
|
66
|
-
.option("--mode <mode>", 'Session mode: "auto" or "manual"'
|
|
66
|
+
.option("--mode <mode>", 'Session mode: "auto" or "manual"')
|
|
67
67
|
.action(async (opts) => {
|
|
68
68
|
const spaceSlug = resolveSpaceSlug(astra);
|
|
69
|
-
const
|
|
69
|
+
const body = {
|
|
70
70
|
vaultSlug: opts.vaultSlug,
|
|
71
71
|
spaceSlug,
|
|
72
72
|
question: opts.question,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
};
|
|
74
|
+
if (opts.mode != null)
|
|
75
|
+
body.mode = opts.mode;
|
|
76
|
+
const resp = (await apiPost(`/session/targeted`, body));
|
|
75
77
|
const data = unwrapResp(resp);
|
|
76
78
|
if (isJsonMode(astra)) {
|
|
77
79
|
jsonOut(data);
|
|
@@ -419,7 +421,17 @@ export function registerAstraCommand(program) {
|
|
|
419
421
|
const lines = [];
|
|
420
422
|
for (const s of items) {
|
|
421
423
|
const title = s.title || "(no title)";
|
|
422
|
-
|
|
424
|
+
const members = s.members || [];
|
|
425
|
+
const memberCount = s.memberCount ?? 0;
|
|
426
|
+
let memberInfo = "";
|
|
427
|
+
if (members.length > 0) {
|
|
428
|
+
const names = members.map((m) => m.vaultName || m.name || "Unknown");
|
|
429
|
+
const overflow = memberCount - members.length - 1; // -1 for "me"
|
|
430
|
+
memberInfo = ` | with: ${names.join(", ")}`;
|
|
431
|
+
if (overflow > 0)
|
|
432
|
+
memberInfo += ` +${overflow} more`;
|
|
433
|
+
}
|
|
434
|
+
lines.push(`- [${s.id}] "${title}" (mode: ${s.mode}, last activity: ${s.lastMessageAt})${memberInfo}`);
|
|
423
435
|
}
|
|
424
436
|
console.log(`Sessions (${items.length} of ${total}):\n` + lines.join("\n"));
|
|
425
437
|
});
|
|
@@ -441,6 +453,27 @@ export function registerAstraCommand(program) {
|
|
|
441
453
|
` Source: ${msg.source}\n` +
|
|
442
454
|
` Created: ${msg.createdAt}`);
|
|
443
455
|
});
|
|
456
|
+
astra
|
|
457
|
+
.command("update-session <sessionId>")
|
|
458
|
+
.description('Update a session\'s mode. "auto" lets the AI respond automatically; "manual" requires human replies.')
|
|
459
|
+
.requiredOption("--mode <mode>", 'Session mode: "auto" or "manual"')
|
|
460
|
+
.action(async (sessionId, opts) => {
|
|
461
|
+
if (opts.mode !== "auto" && opts.mode !== "manual") {
|
|
462
|
+
throw new Error('Invalid mode. Must be "auto" or "manual".');
|
|
463
|
+
}
|
|
464
|
+
const resp = (await apiPatch(`/session/${sessionId}`, {
|
|
465
|
+
mode: opts.mode,
|
|
466
|
+
}));
|
|
467
|
+
const data = unwrapResp(resp);
|
|
468
|
+
if (isJsonMode(astra)) {
|
|
469
|
+
jsonOut(data);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const session = (data.session || data);
|
|
473
|
+
console.log(`Session updated!\n` +
|
|
474
|
+
` ID: ${session.id}\n` +
|
|
475
|
+
` Mode: ${session.mode}`);
|
|
476
|
+
});
|
|
444
477
|
// ── Brain Updates (list, create, edit, delete) ──
|
|
445
478
|
astra
|
|
446
479
|
.command("list-brain-updates")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobi-ai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI client for the Gobi collaborative knowledge platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"dev": "tsx src/index.ts",
|
|
38
38
|
"start": "node dist/index.js",
|
|
39
39
|
"test": "node --test dist/*.test.js",
|
|
40
|
+
"generate-skill-docs": "npm run build && npx tsx skills/gobi-cli/scripts/generate-docs.ts",
|
|
40
41
|
"prepublishOnly": "npm run build"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|