@aitherium/shell-cli 1.1.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/auth.d.ts +68 -0
- package/dist/auth.js +288 -0
- package/dist/client.d.ts +116 -0
- package/dist/client.js +528 -0
- package/dist/command-registry.d.ts +71 -0
- package/dist/command-registry.js +223 -0
- package/dist/commands.d.ts +14 -0
- package/dist/commands.js +6785 -0
- package/dist/completions.d.ts +27 -0
- package/dist/completions.js +351 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.js +48 -0
- package/dist/gargbot.d.ts +11 -0
- package/dist/gargbot.js +230 -0
- package/dist/jobs.d.ts +65 -0
- package/dist/jobs.js +386 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +389 -0
- package/dist/notebooks.d.ts +19 -0
- package/dist/notebooks.js +685 -0
- package/dist/products.d.ts +12 -0
- package/dist/products.js +159 -0
- package/dist/renderer.d.ts +104 -0
- package/dist/renderer.js +1812 -0
- package/dist/repl.d.ts +16 -0
- package/dist/repl.js +1190 -0
- package/dist/session-store.d.ts +35 -0
- package/dist/session-store.js +153 -0
- package/dist/tunnel.d.ts +13 -0
- package/dist/tunnel.js +169 -0
- package/package.json +36 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab completion for commands, @agent mentions, and !shell shortcuts.
|
|
3
|
+
*/
|
|
4
|
+
import type { GenesisClient } from './client.js';
|
|
5
|
+
/**
|
|
6
|
+
* Refresh the completion command list from the registry.
|
|
7
|
+
* Called after loadDynamicCommands() merges new commands.
|
|
8
|
+
*/
|
|
9
|
+
export declare function refreshCommandCompletions(): void;
|
|
10
|
+
export declare const STRATEGY_DIRECTIVES: {
|
|
11
|
+
trigger: string;
|
|
12
|
+
hint: string;
|
|
13
|
+
}[];
|
|
14
|
+
export declare function loadAgentNames(client: GenesisClient): Promise<string[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve an @mention to a canonical agent name using the directory.
|
|
17
|
+
* Returns { resolved: canonicalName } on success, { unknown: rawName } on failure.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveAgentMention(mention: string): {
|
|
20
|
+
resolved?: string;
|
|
21
|
+
unknown?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Get all known agent names + aliases for completions. */
|
|
24
|
+
export declare function getAgentCompletionNames(): string[];
|
|
25
|
+
export declare const SUBCOMMAND_DEFS: Record<string, [string, string][]>;
|
|
26
|
+
export declare const SUBCOMMANDS: Record<string, string[]>;
|
|
27
|
+
export declare function completer(agents: string[]): (line: string) => [string[], string];
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab completion for commands, @agent mentions, and !shell shortcuts.
|
|
3
|
+
*/
|
|
4
|
+
import { getCommandNames } from './commands.js';
|
|
5
|
+
import { getCommandRegistry } from './command-registry.js';
|
|
6
|
+
// Build initial list from static commands; refreshed after dynamic loading
|
|
7
|
+
let COMMAND_NAMES = [...getCommandNames().map(n => `/${n}`), '/jobs'];
|
|
8
|
+
/**
|
|
9
|
+
* Refresh the completion command list from the registry.
|
|
10
|
+
* Called after loadDynamicCommands() merges new commands.
|
|
11
|
+
*/
|
|
12
|
+
export function refreshCommandCompletions() {
|
|
13
|
+
const registry = getCommandRegistry();
|
|
14
|
+
const allNames = registry.allNames();
|
|
15
|
+
const mcpTools = registry.getMcpTools().map(t => t.name);
|
|
16
|
+
COMMAND_NAMES = [
|
|
17
|
+
...new Set([
|
|
18
|
+
...allNames.map(n => `/${n}`),
|
|
19
|
+
...mcpTools.map(n => `/${n}`),
|
|
20
|
+
'/jobs',
|
|
21
|
+
]),
|
|
22
|
+
].sort();
|
|
23
|
+
}
|
|
24
|
+
// Common shell commands for ! completion
|
|
25
|
+
const SHELL_HINTS = [
|
|
26
|
+
'!docker ps', '!docker compose', '!docker logs',
|
|
27
|
+
'!git status', '!git log --oneline -10', '!git diff',
|
|
28
|
+
'!pwsh', '!ls', '!cat', '!curl',
|
|
29
|
+
'!Get-AitherStatus', '!Get-AitherContainer',
|
|
30
|
+
];
|
|
31
|
+
// Fallback agent names when Genesis is unreachable
|
|
32
|
+
const DEFAULT_AGENTS = [
|
|
33
|
+
'aither', 'personal', 'demiurge', 'athena', 'atlas', 'hydra',
|
|
34
|
+
'apollo', 'prometheus', 'scribe', 'viviane', 'hera',
|
|
35
|
+
'isolde', 'prospero', 'ignis', 'terra', 'vera',
|
|
36
|
+
];
|
|
37
|
+
// Strategy directives — passed through to Genesis StrategyResolver, not agent routes
|
|
38
|
+
export const STRATEGY_DIRECTIVES = [
|
|
39
|
+
{ trigger: 'code', hint: 'Force code context — codegraph + architecture + tools' },
|
|
40
|
+
{ trigger: 'research', hint: 'Deep web research + synthesis pipeline' },
|
|
41
|
+
{ trigger: 'internal', hint: 'Full AitherOS internal context (platform only)' },
|
|
42
|
+
{ trigger: 'quick', hint: 'Fast response, no deliberation (effort 1–3)' },
|
|
43
|
+
{ trigger: 'think', hint: 'Deep reasoning with extended deliberation' },
|
|
44
|
+
{ trigger: 'reason', hint: 'Full reasoning model + structured analysis' },
|
|
45
|
+
{ trigger: 'agentic', hint: 'Force agentic ReAct loop with tools' },
|
|
46
|
+
{ trigger: 'debug', hint: 'PRISM-powered debugging — 6 expert personas' },
|
|
47
|
+
{ trigger: 'troubleshoot', hint: 'Systematic service troubleshooting' },
|
|
48
|
+
{ trigger: 'investigate', hint: 'Deep exploratory investigation — long tool chains' },
|
|
49
|
+
{ trigger: 'council', hint: '6-specialist council review before responding' },
|
|
50
|
+
{ trigger: 'deliberate', hint: 'Parallel thought streams + convergence' },
|
|
51
|
+
{ trigger: 'swarm', hint: 'Full 11-agent swarm coding (Forge mode)' },
|
|
52
|
+
{ trigger: 'compete', hint: 'Multiple strategies in parallel — best judged' },
|
|
53
|
+
{ trigger: 'personal', hint: 'Personal assistant mode' },
|
|
54
|
+
{ trigger: 'chat', hint: 'Companion mode — fast, natural conversation (persists)' },
|
|
55
|
+
{ trigger: 'companion', hint: 'Companion mode — fast, natural conversation (persists)' },
|
|
56
|
+
{ trigger: 'talk', hint: 'Companion mode — fast, natural conversation (persists)' },
|
|
57
|
+
];
|
|
58
|
+
let cachedAgents = [];
|
|
59
|
+
/** Maps lowercase alias → canonical agent name (built from directory). */
|
|
60
|
+
let agentAliasMap = {};
|
|
61
|
+
// Common short-name aliases that map to canonical agent IDs.
|
|
62
|
+
// These mirror AGENT_MENTION_MAP in intent_classifier.py.
|
|
63
|
+
const BUILTIN_ALIASES = {
|
|
64
|
+
demi: 'demiurge',
|
|
65
|
+
forge: 'demiurge',
|
|
66
|
+
swarm: 'demiurge',
|
|
67
|
+
assistant: 'personal',
|
|
68
|
+
};
|
|
69
|
+
export async function loadAgentNames(client) {
|
|
70
|
+
if (cachedAgents.length)
|
|
71
|
+
return cachedAgents;
|
|
72
|
+
try {
|
|
73
|
+
const result = await client.getAgents();
|
|
74
|
+
const agents = (result?.agents || []).map((a) => {
|
|
75
|
+
// Genesis uses a.id, ADK uses a.name/a.identity — accept all
|
|
76
|
+
const id = (a.id || a.identity || a.name || '').toLowerCase();
|
|
77
|
+
const name = (a.name || a.id || a.identity || '').toLowerCase();
|
|
78
|
+
return { id, name };
|
|
79
|
+
}).filter((a) => a.id);
|
|
80
|
+
if (agents.length) {
|
|
81
|
+
cachedAgents = agents.map((a) => a.id);
|
|
82
|
+
// Build alias map: both id and display name point to canonical id
|
|
83
|
+
agentAliasMap = {};
|
|
84
|
+
for (const a of agents) {
|
|
85
|
+
agentAliasMap[a.id] = a.id;
|
|
86
|
+
if (a.name && a.name !== a.id) {
|
|
87
|
+
agentAliasMap[a.name] = a.id;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Add built-in short aliases
|
|
91
|
+
for (const [alias, canonical] of Object.entries(BUILTIN_ALIASES)) {
|
|
92
|
+
if (!agentAliasMap[alias]) {
|
|
93
|
+
agentAliasMap[alias] = canonical;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
cachedAgents = DEFAULT_AGENTS;
|
|
99
|
+
agentAliasMap = Object.fromEntries(DEFAULT_AGENTS.map(a => [a, a]));
|
|
100
|
+
for (const [alias, canonical] of Object.entries(BUILTIN_ALIASES)) {
|
|
101
|
+
agentAliasMap[alias] = canonical;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
cachedAgents = DEFAULT_AGENTS;
|
|
107
|
+
agentAliasMap = Object.fromEntries(DEFAULT_AGENTS.map(a => [a, a]));
|
|
108
|
+
for (const [alias, canonical] of Object.entries(BUILTIN_ALIASES)) {
|
|
109
|
+
agentAliasMap[alias] = canonical;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return cachedAgents;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Resolve an @mention to a canonical agent name using the directory.
|
|
116
|
+
* Returns { resolved: canonicalName } on success, { unknown: rawName } on failure.
|
|
117
|
+
*/
|
|
118
|
+
export function resolveAgentMention(mention) {
|
|
119
|
+
const key = mention.toLowerCase();
|
|
120
|
+
const canonical = agentAliasMap[key];
|
|
121
|
+
if (canonical)
|
|
122
|
+
return { resolved: canonical };
|
|
123
|
+
// Fuzzy: check if it's a prefix of exactly one agent
|
|
124
|
+
const prefixMatches = cachedAgents.filter(a => a.toLowerCase().startsWith(key));
|
|
125
|
+
if (prefixMatches.length === 1)
|
|
126
|
+
return { resolved: prefixMatches[0].toLowerCase() };
|
|
127
|
+
return { unknown: mention };
|
|
128
|
+
}
|
|
129
|
+
/** Get all known agent names + aliases for completions. */
|
|
130
|
+
export function getAgentCompletionNames() {
|
|
131
|
+
return [...new Set([...cachedAgents, ...Object.keys(agentAliasMap)])];
|
|
132
|
+
}
|
|
133
|
+
// Subcommand completions for commands that have them
|
|
134
|
+
// Each entry: [name, argHint] — argHint is '' for no-arg subcommands
|
|
135
|
+
export const SUBCOMMAND_DEFS = {
|
|
136
|
+
'/onboard': [
|
|
137
|
+
['auto', '<path> [name] — Auto-detect code vs knowledge'],
|
|
138
|
+
['code', '<path> [name] — Index a local codebase'],
|
|
139
|
+
['knowledge', '<path> [name] — Ingest a knowledge directory'],
|
|
140
|
+
['repo', '<git-url> [name] — Import a remote repository into workspace'],
|
|
141
|
+
],
|
|
142
|
+
'/obsidian': [
|
|
143
|
+
['setup', '[vault-path] — Install plugin into an Obsidian vault'],
|
|
144
|
+
['status', '— Check plugin install status across vaults'],
|
|
145
|
+
],
|
|
146
|
+
'/scope': [
|
|
147
|
+
['graph', '[path] — Fetch dependency graph'],
|
|
148
|
+
['dead', '[path] — Find dead/unreachable code'],
|
|
149
|
+
['metrics', '[path] — Codebase metrics summary'],
|
|
150
|
+
['health', '— Check CodeGraph service health'],
|
|
151
|
+
['reindex', '[path] — Force re-index codebase'],
|
|
152
|
+
],
|
|
153
|
+
'/nb': [
|
|
154
|
+
['list', ''],
|
|
155
|
+
['plan', '<prompt>'],
|
|
156
|
+
['open', '<id>'],
|
|
157
|
+
['run', '<id>'],
|
|
158
|
+
['create', '<name>'],
|
|
159
|
+
['info', '<id>'],
|
|
160
|
+
['export', '<id> [path]'],
|
|
161
|
+
['templates', ''],
|
|
162
|
+
['sessions', ''],
|
|
163
|
+
],
|
|
164
|
+
'/notebook': [
|
|
165
|
+
['list', ''],
|
|
166
|
+
['plan', '<prompt>'],
|
|
167
|
+
['open', '<id>'],
|
|
168
|
+
['run', '<id>'],
|
|
169
|
+
['create', '<name>'],
|
|
170
|
+
['info', '<id>'],
|
|
171
|
+
['export', '<id> [path]'],
|
|
172
|
+
['templates', ''],
|
|
173
|
+
['sessions', ''],
|
|
174
|
+
],
|
|
175
|
+
'/jobs': [
|
|
176
|
+
['cancel', '<id>'],
|
|
177
|
+
],
|
|
178
|
+
'/safety': [
|
|
179
|
+
['status', ''],
|
|
180
|
+
['levels', ''],
|
|
181
|
+
['set', '<professional|casual|unrestricted|explicit> [--context <ctx>] [--scope <scope>]'],
|
|
182
|
+
['resolve', '[--scope <scope>] [--context <ctx>] [--user <id>] [--tenant <slug>] [--agent <id>]'],
|
|
183
|
+
['age-status', ''],
|
|
184
|
+
['verify-age', '<YYYY-MM-DD>'],
|
|
185
|
+
['platform', ''],
|
|
186
|
+
['tenant', '[slug]'],
|
|
187
|
+
['agent', '<agent_id>'],
|
|
188
|
+
],
|
|
189
|
+
'/calendar': [
|
|
190
|
+
['list', '— Show upcoming events'],
|
|
191
|
+
['create', '"<title>" --start <ISO> [--end <ISO>]'],
|
|
192
|
+
['delete', '<id>'],
|
|
193
|
+
['sync', '— Trigger CalDAV sync'],
|
|
194
|
+
],
|
|
195
|
+
'/cal': [
|
|
196
|
+
['list', ''],
|
|
197
|
+
['create', '"<title>" --start <ISO>'],
|
|
198
|
+
['delete', '<id>'],
|
|
199
|
+
['sync', ''],
|
|
200
|
+
],
|
|
201
|
+
'/mail': [
|
|
202
|
+
['inbox', '— Show inbox'],
|
|
203
|
+
['send', '"<subject>" --body "<text>" [--priority high]'],
|
|
204
|
+
['threads', '— List email threads'],
|
|
205
|
+
['read', '<thread_id>'],
|
|
206
|
+
],
|
|
207
|
+
'/email': [
|
|
208
|
+
['inbox', ''],
|
|
209
|
+
['send', '"<subject>" --body "<text>"'],
|
|
210
|
+
['threads', ''],
|
|
211
|
+
['read', '<thread_id>'],
|
|
212
|
+
],
|
|
213
|
+
'/will': [
|
|
214
|
+
['active', '— Show current will policy'],
|
|
215
|
+
['list', '— Available wills'],
|
|
216
|
+
['activate', '<id>'],
|
|
217
|
+
['policy', '— Full policy detail'],
|
|
218
|
+
],
|
|
219
|
+
'/escalate': [
|
|
220
|
+
['list', '— Pending proposals'],
|
|
221
|
+
['config', '— Show escalation config'],
|
|
222
|
+
['approve', '<id>'],
|
|
223
|
+
['deny', '<id> [reason]'],
|
|
224
|
+
['set', '<key> <value>'],
|
|
225
|
+
],
|
|
226
|
+
'/research': [
|
|
227
|
+
['"<topic>"', '[--depth quick|deep] [--report]'],
|
|
228
|
+
],
|
|
229
|
+
'/publish': [
|
|
230
|
+
['blog', '"<topic>" — Generate blog post'],
|
|
231
|
+
['social', '"<message>" — Craft social post'],
|
|
232
|
+
['status', '— Content deck status'],
|
|
233
|
+
],
|
|
234
|
+
'/routines': [
|
|
235
|
+
['list', '— Show all routines'],
|
|
236
|
+
['run', '<id>'],
|
|
237
|
+
['create', '<json>'],
|
|
238
|
+
['enable', '<id>'],
|
|
239
|
+
['disable', '<id>'],
|
|
240
|
+
['edit', '<id> <json>'],
|
|
241
|
+
['history', '— Recent execution history'],
|
|
242
|
+
['pause', '— Pause all routines'],
|
|
243
|
+
['resume', '— Resume routines'],
|
|
244
|
+
['status', '— Scheduler status'],
|
|
245
|
+
],
|
|
246
|
+
'/expedition': [
|
|
247
|
+
['list', '— Active expeditions'],
|
|
248
|
+
['create', '<name>'],
|
|
249
|
+
['status', '<id>'],
|
|
250
|
+
['gate', '<id> approve|reject'],
|
|
251
|
+
['run', '"<goal>" — Full autonomous orchestration'],
|
|
252
|
+
['stream', '<id> — SSE event stream'],
|
|
253
|
+
['cancel', '<id>'],
|
|
254
|
+
],
|
|
255
|
+
'/products': [
|
|
256
|
+
['list', '— Running product instances'],
|
|
257
|
+
['catalog', '— Available products'],
|
|
258
|
+
['deploy', '<type> — Deploy a product instance'],
|
|
259
|
+
['status', '<id> — Instance status'],
|
|
260
|
+
['destroy', '<id> — Remove an instance'],
|
|
261
|
+
['failover', '<id> — Activate cloud failover'],
|
|
262
|
+
],
|
|
263
|
+
'/prod': [
|
|
264
|
+
['list', ''],
|
|
265
|
+
['catalog', ''],
|
|
266
|
+
['deploy', '<type>'],
|
|
267
|
+
['status', '<id>'],
|
|
268
|
+
['destroy', '<id>'],
|
|
269
|
+
['failover', '<id>'],
|
|
270
|
+
],
|
|
271
|
+
'/tool-scope': [
|
|
272
|
+
['show', '— Current tool access config'],
|
|
273
|
+
['allow', '<tool> — Allow a tool'],
|
|
274
|
+
['deny', '<tool> — Deny a tool'],
|
|
275
|
+
],
|
|
276
|
+
'/compose': [
|
|
277
|
+
['interactive', '— Launch agent composer wizard'],
|
|
278
|
+
],
|
|
279
|
+
'/monitor': [
|
|
280
|
+
['all', '— All agent metrics'],
|
|
281
|
+
],
|
|
282
|
+
'/docker': [
|
|
283
|
+
['up', '[service] — Start containers'],
|
|
284
|
+
['down', '[service] — Stop containers'],
|
|
285
|
+
['status', '— Container status'],
|
|
286
|
+
['build', '[service] — Build images'],
|
|
287
|
+
['restart', '[service] — Restart containers'],
|
|
288
|
+
['logs', '<service> — View logs'],
|
|
289
|
+
['ps', '— List running containers'],
|
|
290
|
+
],
|
|
291
|
+
'/dc': [
|
|
292
|
+
['up', '[service]'],
|
|
293
|
+
['down', '[service]'],
|
|
294
|
+
['status', ''],
|
|
295
|
+
['build', '[service]'],
|
|
296
|
+
['restart', '[service]'],
|
|
297
|
+
['logs', '<service>'],
|
|
298
|
+
['ps', ''],
|
|
299
|
+
],
|
|
300
|
+
};
|
|
301
|
+
// Flat list for tab completion
|
|
302
|
+
export const SUBCOMMANDS = Object.fromEntries(Object.entries(SUBCOMMAND_DEFS).map(([cmd, defs]) => [cmd, defs.map(([name]) => name)]));
|
|
303
|
+
export function completer(agents) {
|
|
304
|
+
return (line) => {
|
|
305
|
+
// Slash commands
|
|
306
|
+
if (line.startsWith('/')) {
|
|
307
|
+
// Subcommand completion: "/nb li" → "/nb list"
|
|
308
|
+
const spaceIdx = line.indexOf(' ');
|
|
309
|
+
if (spaceIdx > 0) {
|
|
310
|
+
const cmd = line.slice(0, spaceIdx);
|
|
311
|
+
const partial = line.slice(spaceIdx + 1);
|
|
312
|
+
const subs = SUBCOMMANDS[cmd];
|
|
313
|
+
if (subs) {
|
|
314
|
+
const hits = subs
|
|
315
|
+
.filter(s => s.startsWith(partial))
|
|
316
|
+
.map(s => `${cmd} ${s}`);
|
|
317
|
+
return [hits.length ? hits : subs.map(s => `${cmd} ${s}`), line];
|
|
318
|
+
}
|
|
319
|
+
return [[], line];
|
|
320
|
+
}
|
|
321
|
+
const hits = COMMAND_NAMES.filter(c => c.startsWith(line));
|
|
322
|
+
return [hits.length ? hits : COMMAND_NAMES, line];
|
|
323
|
+
}
|
|
324
|
+
// @agent mentions and @strategy directives
|
|
325
|
+
if (line.startsWith('@')) {
|
|
326
|
+
const partial = line.slice(1).toLowerCase();
|
|
327
|
+
// Strategy directives first, then agents
|
|
328
|
+
const directiveHits = STRATEGY_DIRECTIVES
|
|
329
|
+
.filter(d => d.trigger.startsWith(partial))
|
|
330
|
+
.map(d => `@${d.trigger} `);
|
|
331
|
+
const agentHits = agents
|
|
332
|
+
.filter(a => a.toLowerCase().startsWith(partial))
|
|
333
|
+
.map(a => `@${a} `);
|
|
334
|
+
const allHits = [...directiveHits, ...agentHits];
|
|
335
|
+
if (allHits.length)
|
|
336
|
+
return [allHits, line];
|
|
337
|
+
// No matches — show everything
|
|
338
|
+
const allOptions = [
|
|
339
|
+
...STRATEGY_DIRECTIVES.map(d => `@${d.trigger} `),
|
|
340
|
+
...agents.map(a => `@${a} `),
|
|
341
|
+
];
|
|
342
|
+
return [allOptions, line];
|
|
343
|
+
}
|
|
344
|
+
// !shell escape hints
|
|
345
|
+
if (line.startsWith('!')) {
|
|
346
|
+
const hits = SHELL_HINTS.filter(h => h.startsWith(line));
|
|
347
|
+
return [hits.length ? hits : SHELL_HINTS, line];
|
|
348
|
+
}
|
|
349
|
+
return [[], line];
|
|
350
|
+
};
|
|
351
|
+
}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AuthUser } from './auth.js';
|
|
2
|
+
export type BackendType = 'genesis' | 'adk' | 'unknown';
|
|
3
|
+
export interface ShellConfig {
|
|
4
|
+
genesisUrl: string;
|
|
5
|
+
defaultAgent: string;
|
|
6
|
+
sessionId: string;
|
|
7
|
+
historyFile: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
identityUrl: string;
|
|
10
|
+
authToken: string | null;
|
|
11
|
+
authUser: AuthUser | null;
|
|
12
|
+
/** Detected backend type — set after first health probe. */
|
|
13
|
+
backendType: BackendType;
|
|
14
|
+
/** Backend display name (e.g. agent name from ADK, "Genesis" for full stack). */
|
|
15
|
+
backendName: string;
|
|
16
|
+
/** CLI-level overrides (--will, --effort, --safety, --private, --image). */
|
|
17
|
+
effort?: number;
|
|
18
|
+
safetyLevel?: string;
|
|
19
|
+
privateMode?: boolean;
|
|
20
|
+
/** Base64 data URL image attachments from --image flag. */
|
|
21
|
+
imageAttachments?: string[];
|
|
22
|
+
}
|
|
23
|
+
export declare function loadConfig(): ShellConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { getActiveToken, getActiveUser, ensureRootProfile } from './auth.js';
|
|
6
|
+
export function loadConfig() {
|
|
7
|
+
const home = homedir();
|
|
8
|
+
const configDir = join(home, '.aither');
|
|
9
|
+
const configFile = join(configDir, 'shell.yaml');
|
|
10
|
+
let fileConfig = {};
|
|
11
|
+
if (existsSync(configFile)) {
|
|
12
|
+
try {
|
|
13
|
+
const content = readFileSync(configFile, 'utf-8');
|
|
14
|
+
for (const line of content.split('\n')) {
|
|
15
|
+
const match = line.match(/^(\w+):\s*(.+)$/);
|
|
16
|
+
if (match)
|
|
17
|
+
fileConfig[match[1]] = match[2].trim().replace(/^["']|["']$/g, '');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch { /* ignore bad config */ }
|
|
21
|
+
}
|
|
22
|
+
// Load auth from shared ~/.aither/auth.json
|
|
23
|
+
// If no session exists, auto-provision root (like Linux console login)
|
|
24
|
+
let authToken = getActiveToken();
|
|
25
|
+
if (!authToken) {
|
|
26
|
+
ensureRootProfile();
|
|
27
|
+
authToken = getActiveToken();
|
|
28
|
+
}
|
|
29
|
+
const authUser = getActiveUser();
|
|
30
|
+
// AITHER_API_URL is the canonical env var; AITHER_GENESIS_URL is legacy alias
|
|
31
|
+
const apiUrl = process.env.AITHER_API_URL
|
|
32
|
+
|| process.env.AITHER_GENESIS_URL
|
|
33
|
+
|| fileConfig.api_url
|
|
34
|
+
|| fileConfig.genesis_url
|
|
35
|
+
|| 'http://127.0.0.1:8001';
|
|
36
|
+
return {
|
|
37
|
+
genesisUrl: apiUrl,
|
|
38
|
+
defaultAgent: process.env.AITHER_AGENT || fileConfig.default_agent || 'aither',
|
|
39
|
+
sessionId: randomUUID(),
|
|
40
|
+
historyFile: join(configDir, 'shell_history'),
|
|
41
|
+
model: process.env.AITHER_MODEL || fileConfig.model || undefined,
|
|
42
|
+
identityUrl: process.env.AITHER_IDENTITY_URL || fileConfig.identity_url || 'http://127.0.0.1:8115',
|
|
43
|
+
authToken,
|
|
44
|
+
authUser,
|
|
45
|
+
backendType: 'unknown',
|
|
46
|
+
backendName: '',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GargBot CLI commands — chat, ingest, search, status, and Obsidian sync.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* aither gargbot chat "What projects did we do in Texas?"
|
|
6
|
+
* aither gargbot ingest ./resumes/john_doe.pdf
|
|
7
|
+
* aither gargbot search "bridge engineers with PE"
|
|
8
|
+
* aither gargbot status
|
|
9
|
+
* aither gargbot sync-obsidian /path/to/vault
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleGargbotCommand(args: string[]): Promise<void>;
|