trucontext 0.9.0 → 0.9.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/bin/cli.js +17 -0
- package/package.json +1 -1
- package/src/commands/agents.js +75 -0
- package/src/commands/settings.js +2 -2
package/bin/cli.js
CHANGED
|
@@ -24,6 +24,7 @@ import { keysListCommand, keysCreateCommand, keysRevokeCommand } from '../src/co
|
|
|
24
24
|
import { graphOverviewCommand, graphSearchCommand, graphNodeCommand, graphNeighborsCommand } from '../src/commands/graph.js';
|
|
25
25
|
import { mindPresenceCommand, mindThoughtsCommand } from '../src/commands/mind.js';
|
|
26
26
|
import { settingsShowCommand, settingsUpdateCommand } from '../src/commands/settings.js';
|
|
27
|
+
import { provisionCommand } from '../src/commands/agents.js';
|
|
27
28
|
|
|
28
29
|
program
|
|
29
30
|
.name('trucontext')
|
|
@@ -261,4 +262,20 @@ settings.command('update')
|
|
|
261
262
|
registerRootsCommand(program);
|
|
262
263
|
registerCuriosityCommand(program);
|
|
263
264
|
|
|
265
|
+
// Agent provision
|
|
266
|
+
const agents = program.command('agents').description('Agent provisioning');
|
|
267
|
+
agents.command('provision')
|
|
268
|
+
.description('Provision an agent (create or update root node, ingest content, generate memory briefing)')
|
|
269
|
+
.requiredOption('--agent-id <id>', 'Agent identifier')
|
|
270
|
+
.requiredOption('--name <name>', 'Agent display name')
|
|
271
|
+
.requiredOption('--role <role>', 'Agent role description')
|
|
272
|
+
.option('--user-root <root>', 'User root node ID')
|
|
273
|
+
.requiredOption('--soul <fileOrText>', 'Path to SOUL.md or inline text')
|
|
274
|
+
.option('--agents <fileOrText>', 'Path to AGENTS.md or inline text')
|
|
275
|
+
.option('--identity <fileOrText>', 'Path to IDENTITY.md or inline text')
|
|
276
|
+
.option('--memory <files...>', 'Path(s) to memory files')
|
|
277
|
+
.option('--recipe <recipeId>', 'Recipe hint (skip inference)')
|
|
278
|
+
.option('--dry-run', 'Preview what would happen without doing it')
|
|
279
|
+
.action(provisionCommand);
|
|
280
|
+
|
|
264
281
|
program.parse();
|
package/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// commands/agents.js — Agent Provision CLI
|
|
2
|
+
//
|
|
3
|
+
// trucontext agents provision --agent-id <id> --name <name> --role <role> \
|
|
4
|
+
// --user-root <root> --soul <file> [--agents <file>] [--identity <file>] \
|
|
5
|
+
// [--memory <file>...] [--recipe <recipeId>] [--dry-run]
|
|
6
|
+
|
|
7
|
+
import { readFileSync, existsSync } from 'fs';
|
|
8
|
+
import { dataPlane } from '../client.js';
|
|
9
|
+
import { getConfig } from '../config.js';
|
|
10
|
+
|
|
11
|
+
export async function provisionCommand(options) {
|
|
12
|
+
const config = getConfig();
|
|
13
|
+
if (!config.activeApp) {
|
|
14
|
+
console.error('No active app. Run: trucontext use <app>');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { agentId, name, role, userRoot, soul, agents, identity, memory, recipe, dryRun } = options;
|
|
19
|
+
|
|
20
|
+
// Read file contents
|
|
21
|
+
const soulText = readFileOrText(soul);
|
|
22
|
+
if (!soulText) {
|
|
23
|
+
console.error('--soul is required (file path or inline text)');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const content = {
|
|
28
|
+
soul: soulText,
|
|
29
|
+
agents: agents ? readFileOrText(agents) : undefined,
|
|
30
|
+
identity: identity ? readFileOrText(identity) : undefined,
|
|
31
|
+
memory: (memory || []).map(m => readFileOrText(m)).filter(Boolean),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const body = {
|
|
35
|
+
agent: { id: agentId, name, role },
|
|
36
|
+
user: { root_node: userRoot || config.activeRoot || 'dustin' },
|
|
37
|
+
content,
|
|
38
|
+
hints: recipe ? { recipe } : {},
|
|
39
|
+
options: { dry_run: dryRun || false },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const res = await dataPlane('POST', '/v1/agents/provision', body);
|
|
44
|
+
const data = res.data;
|
|
45
|
+
|
|
46
|
+
if (dryRun) {
|
|
47
|
+
console.log(`Dry run — would ${data.status === 'would_create' ? 'create' : 'update'}`);
|
|
48
|
+
console.log(` Agent root: ${data.agent_root}`);
|
|
49
|
+
console.log(` User root: ${data.user_root}`);
|
|
50
|
+
console.log(` Changes: ${Object.entries(data.changes || {}).filter(([,v]) => v).map(([k]) => k).join(', ') || 'none'}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log(`${data.status === 'created' ? 'Provisioned' : 'Updated'}: ${data.agent_root}`);
|
|
55
|
+
console.log(` Recipe: ${data.recipe_id}`);
|
|
56
|
+
console.log(` Recipe inference: ${data.recipe_inference}`);
|
|
57
|
+
console.log(` Content ingested: soul=${data.content_ingested?.soul}, agents=${data.content_ingested?.agents}, identity=${data.content_ingested?.identity}, memory=${data.content_ingested?.memory_files}`);
|
|
58
|
+
|
|
59
|
+
if (data.prompt_fragment) {
|
|
60
|
+
console.log(`\n--- Prompt Fragment (${data.prompt_fragment.length} chars) ---`);
|
|
61
|
+
console.log(data.prompt_fragment);
|
|
62
|
+
}
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.error('Failed:', err.message);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function readFileOrText(input) {
|
|
70
|
+
if (!input) return null;
|
|
71
|
+
if (existsSync(input)) {
|
|
72
|
+
return readFileSync(input, 'utf8');
|
|
73
|
+
}
|
|
74
|
+
return input;
|
|
75
|
+
}
|
package/src/commands/settings.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getActiveApp } from '../config.js';
|
|
|
5
5
|
export async function settingsShowCommand() {
|
|
6
6
|
try {
|
|
7
7
|
const appId = getActiveApp();
|
|
8
|
-
const res = await controlPlane('GET', `/apps/${appId}/settings`);
|
|
8
|
+
const res = await controlPlane('GET', `/apps/${appId}/intelligence/debug-settings`);
|
|
9
9
|
const settings = res.data;
|
|
10
10
|
|
|
11
11
|
console.log(chalk.bold('App Settings'));
|
|
@@ -41,7 +41,7 @@ export async function settingsUpdateCommand(options) {
|
|
|
41
41
|
process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const res = await controlPlane('PUT', `/apps/${appId}/settings`, updates);
|
|
44
|
+
const res = await controlPlane('PUT', `/apps/${appId}/intelligence/debug-settings`, updates);
|
|
45
45
|
console.log(chalk.green('Settings updated'));
|
|
46
46
|
} catch (err) {
|
|
47
47
|
console.error(chalk.red(`Failed: ${err.message}`));
|