@gobi-ai/cli 0.1.2 → 0.2.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 -0
- package/dist/commands/astra.js +32 -9
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ gobi astra ask-brain --vault-slug my-vault --question "What is RAG?"
|
|
|
98
98
|
| `gobi astra list-sessions` | List your sessions |
|
|
99
99
|
| `gobi astra get-session <id>` | Get a session and its messages |
|
|
100
100
|
| `gobi astra reply-session <id> --content <c>` | Send a message in a session |
|
|
101
|
+
| `gobi astra update-session <id> --mode <mode>` | Set session mode (auto/manual) |
|
|
101
102
|
|
|
102
103
|
### Brain updates
|
|
103
104
|
|
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);
|
|
@@ -402,13 +404,13 @@ export function registerAstraCommand(program) {
|
|
|
402
404
|
limit,
|
|
403
405
|
offset,
|
|
404
406
|
}));
|
|
405
|
-
const
|
|
406
|
-
const
|
|
407
|
-
const total =
|
|
407
|
+
const items = (resp.data || []);
|
|
408
|
+
const pagination = (resp.pagination || {});
|
|
409
|
+
const total = pagination.total ?? items.length;
|
|
408
410
|
if (isJsonMode(astra)) {
|
|
409
411
|
jsonOut({
|
|
410
|
-
|
|
411
|
-
pagination:
|
|
412
|
+
items,
|
|
413
|
+
pagination: resp.pagination || {},
|
|
412
414
|
});
|
|
413
415
|
return;
|
|
414
416
|
}
|
|
@@ -451,6 +453,27 @@ export function registerAstraCommand(program) {
|
|
|
451
453
|
` Source: ${msg.source}\n` +
|
|
452
454
|
` Created: ${msg.createdAt}`);
|
|
453
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
|
+
});
|
|
454
477
|
// ── Brain Updates (list, create, edit, delete) ──
|
|
455
478
|
astra
|
|
456
479
|
.command("list-brain-updates")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobi-ai/cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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": {
|