trucontext 0.7.1 → 0.8.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/bin/cli.js +4 -0
- package/package.json +1 -1
- package/src/commands/curiosity.js +97 -0
package/bin/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ import { recipesListCommand, recipesGetCommand, recipesCreateCommand, recipesDel
|
|
|
19
19
|
import { relationshipTypesListCommand } from '../src/commands/relationship-types.js';
|
|
20
20
|
import { docsListCommand, docsShowCommand } from '../src/commands/docs.js';
|
|
21
21
|
import { registerRootsCommand } from '../src/commands/roots.js';
|
|
22
|
+
import { registerCuriosityCommand } from '../src/commands/curiosity.js';
|
|
22
23
|
|
|
23
24
|
program
|
|
24
25
|
.name('trucontext')
|
|
@@ -136,6 +137,9 @@ entities.command('edges <entityId>')
|
|
|
136
137
|
// Root Nodes
|
|
137
138
|
registerRootsCommand(program);
|
|
138
139
|
|
|
140
|
+
// Curiosity
|
|
141
|
+
registerCuriosityCommand(program);
|
|
142
|
+
|
|
139
143
|
// Recipes
|
|
140
144
|
const recipes = program.command('recipes').description('Manage recipes').action(function() { this.help(); });
|
|
141
145
|
recipes.command('list')
|
package/package.json
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// curiosity.js — Curiosity Engine commands
|
|
2
|
+
//
|
|
3
|
+
// Trigger curiosity analysis and view knowledge gaps for a root node.
|
|
4
|
+
// Curiosity analysis is always scoped to a root node's ego network.
|
|
5
|
+
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { controlPlane } from '../client.js';
|
|
8
|
+
import { getConfig, getActiveApp } from '../config.js';
|
|
9
|
+
|
|
10
|
+
export function registerCuriosityCommand(program) {
|
|
11
|
+
const curiosity = program
|
|
12
|
+
.command('curiosity')
|
|
13
|
+
.description('Curiosity engine — discover knowledge gaps')
|
|
14
|
+
.action(function() { this.help(); });
|
|
15
|
+
|
|
16
|
+
// List curiosity packets
|
|
17
|
+
curiosity
|
|
18
|
+
.command('list')
|
|
19
|
+
.description('List curiosity packets for a root node')
|
|
20
|
+
.option('--root <rootId>', 'Root node ID (uses active root if not specified)')
|
|
21
|
+
.option('--status <status>', 'Filter by status: PENDING, DISMISSED', 'PENDING')
|
|
22
|
+
.option('--limit <n>', 'Max packets to return', '20')
|
|
23
|
+
.action(async (opts) => {
|
|
24
|
+
const appId = getActiveApp();
|
|
25
|
+
const config = getConfig();
|
|
26
|
+
const rootId = opts.root || config.activeRoot;
|
|
27
|
+
if (!rootId) {
|
|
28
|
+
console.error(chalk.red('No root specified. Use --root <id> or set active root with: trucontext roots use <id>'));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const res = await controlPlane('GET', `/apps/${appId}/mind/curiosity?root_id=${rootId}&status=${opts.status}&limit=${opts.limit}`);
|
|
34
|
+
const packets = res.data?.packets || [];
|
|
35
|
+
|
|
36
|
+
if (packets.length === 0) {
|
|
37
|
+
console.log(chalk.dim(`No ${opts.status.toLowerCase()} curiosity packets for root: ${rootId}`));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log(chalk.bold(`Curiosity Packets (${packets.length}) — root: ${rootId}\n`));
|
|
42
|
+
for (const p of packets) {
|
|
43
|
+
const typeColor = p.curiosity_type === 'EXTERNAL' ? chalk.cyan : chalk.yellow;
|
|
44
|
+
console.log(` ${typeColor(`[${p.gap_type}]`)} ${p.question}`);
|
|
45
|
+
if (p.why_it_matters) console.log(chalk.dim(` Why: ${p.why_it_matters}`));
|
|
46
|
+
if (p.suggested_approach) console.log(chalk.dim(` Approach: ${p.suggested_approach}`));
|
|
47
|
+
console.log(chalk.dim(` Priority: ${p.priority_score?.toFixed(2) || '?'} | Status: ${p.status} | ID: ${p.packet_id}`));
|
|
48
|
+
console.log();
|
|
49
|
+
}
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error(chalk.red('Failed:'), err.response?.data?.error || err.message);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Trigger on-demand curiosity evaluation
|
|
57
|
+
curiosity
|
|
58
|
+
.command('trigger')
|
|
59
|
+
.description('Run curiosity analysis on a root node')
|
|
60
|
+
.option('--root <rootId>', 'Root node ID (uses active root if not specified)')
|
|
61
|
+
.action(async (opts) => {
|
|
62
|
+
const appId = getActiveApp();
|
|
63
|
+
const config = getConfig();
|
|
64
|
+
const rootId = opts.root || config.activeRoot;
|
|
65
|
+
if (!rootId) {
|
|
66
|
+
console.error(chalk.red('No root specified. Use --root <id> or set active root with: trucontext roots use <id>'));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
console.log(chalk.dim(`Triggering curiosity analysis for root: ${rootId}...`));
|
|
72
|
+
await controlPlane('POST', `/apps/${appId}/mind/curiosity/trigger`, {
|
|
73
|
+
root_id: rootId,
|
|
74
|
+
});
|
|
75
|
+
console.log(chalk.green(`Curiosity analysis started for root: ${rootId}`));
|
|
76
|
+
console.log(chalk.dim(`Results will appear shortly. Check with: trucontext curiosity list --root ${rootId}`));
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error(chalk.red('Failed:'), err.response?.data?.error || err.message);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Dismiss a curiosity packet
|
|
84
|
+
curiosity
|
|
85
|
+
.command('dismiss <packetId>')
|
|
86
|
+
.description('Dismiss a curiosity packet')
|
|
87
|
+
.action(async (packetId) => {
|
|
88
|
+
const appId = getActiveApp();
|
|
89
|
+
try {
|
|
90
|
+
await controlPlane('PUT', `/apps/${appId}/mind/curiosity/${packetId}/dismiss`);
|
|
91
|
+
console.log(chalk.green(`Dismissed: ${packetId}`));
|
|
92
|
+
} catch (err) {
|
|
93
|
+
console.error(chalk.red('Failed:'), err.response?.data?.error || err.message);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|