@plur-ai/cli 0.9.0 → 0.9.2
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.
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
outputJson,
|
|
3
|
+
outputText,
|
|
4
|
+
shouldOutputJson
|
|
5
|
+
} from "./chunk-7U4W4J3G.js";
|
|
6
|
+
import {
|
|
7
|
+
createPlur
|
|
8
|
+
} from "./chunk-O6WTH7H7.js";
|
|
9
|
+
|
|
10
|
+
// src/commands/batch-decay.ts
|
|
11
|
+
async function run(args, flags) {
|
|
12
|
+
const plur = createPlur(flags);
|
|
13
|
+
let contextScope;
|
|
14
|
+
let i = 0;
|
|
15
|
+
while (i < args.length) {
|
|
16
|
+
const arg = args[i];
|
|
17
|
+
if (arg === "--context-scope" && i + 1 < args.length) {
|
|
18
|
+
contextScope = args[++i];
|
|
19
|
+
i++;
|
|
20
|
+
} else {
|
|
21
|
+
i++;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const result = plur.batchDecay({ contextScope });
|
|
25
|
+
if (shouldOutputJson(flags)) {
|
|
26
|
+
outputJson(result);
|
|
27
|
+
} else {
|
|
28
|
+
outputText(`Batch decay complete: ${result.total} engrams processed, ${result.decayed} decayed, ${result.skipped} skipped`);
|
|
29
|
+
if (result.transitions.length > 0) {
|
|
30
|
+
outputText(`${result.transitions.length} status transition(s):`);
|
|
31
|
+
result.transitions.forEach((t) => {
|
|
32
|
+
outputText(` ${t.id}: ${t.old_status} \u2192 ${t.new_status} (strength: ${t.old_strength.toFixed(3)} \u2192 ${t.new_strength.toFixed(3)})`);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
run
|
|
39
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
exit,
|
|
3
|
+
outputJson,
|
|
4
|
+
outputText,
|
|
5
|
+
shouldOutputJson
|
|
6
|
+
} from "./chunk-7U4W4J3G.js";
|
|
7
|
+
import {
|
|
8
|
+
createPlur
|
|
9
|
+
} from "./chunk-O6WTH7H7.js";
|
|
10
|
+
|
|
11
|
+
// src/commands/similarity-search.ts
|
|
12
|
+
async function run(args, flags) {
|
|
13
|
+
const plur = createPlur(flags);
|
|
14
|
+
let query = "";
|
|
15
|
+
let limit = 10;
|
|
16
|
+
let scope;
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (i < args.length) {
|
|
19
|
+
const arg = args[i];
|
|
20
|
+
if (arg === "--limit" && i + 1 < args.length) {
|
|
21
|
+
limit = parseInt(args[++i], 10);
|
|
22
|
+
i++;
|
|
23
|
+
} else if (arg === "--scope" && i + 1 < args.length) {
|
|
24
|
+
scope = args[++i];
|
|
25
|
+
i++;
|
|
26
|
+
} else if (!query) {
|
|
27
|
+
query = arg;
|
|
28
|
+
i++;
|
|
29
|
+
} else {
|
|
30
|
+
i++;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (!query) {
|
|
34
|
+
exit(1, "Usage: plur similarity-search <query> [--limit <n>] [--scope <scope>]");
|
|
35
|
+
}
|
|
36
|
+
const results = await plur.similaritySearch(query, { limit, scope });
|
|
37
|
+
if (results.length === 0) {
|
|
38
|
+
if (shouldOutputJson(flags)) {
|
|
39
|
+
outputJson({ results: [], count: 0 });
|
|
40
|
+
} else {
|
|
41
|
+
outputText("No results found.");
|
|
42
|
+
}
|
|
43
|
+
exit(2);
|
|
44
|
+
}
|
|
45
|
+
if (shouldOutputJson(flags)) {
|
|
46
|
+
outputJson({
|
|
47
|
+
results: results.map((r) => ({
|
|
48
|
+
engram_id: r.engram.id,
|
|
49
|
+
statement: r.engram.statement,
|
|
50
|
+
scope: r.engram.scope,
|
|
51
|
+
cosine_score: r.score,
|
|
52
|
+
type: r.engram.type,
|
|
53
|
+
polarity: r.engram.polarity ?? null,
|
|
54
|
+
tags: r.engram.tags ?? []
|
|
55
|
+
})),
|
|
56
|
+
count: results.length
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
results.forEach((r, idx) => {
|
|
60
|
+
const preview = r.engram.statement.length > 80 ? r.engram.statement.slice(0, 77) + "..." : r.engram.statement;
|
|
61
|
+
outputText(`${idx + 1}. [${r.score.toFixed(4)}] ${preview}`);
|
|
62
|
+
outputText(` ID: ${r.engram.id} | Scope: ${r.engram.scope} | Type: ${r.engram.type}`);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
run
|
|
68
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function createPlur(flags2) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// src/index.ts
|
|
52
|
-
var VERSION = "0.9.
|
|
52
|
+
var VERSION = "0.9.2";
|
|
53
53
|
var argv = process.argv.slice(2);
|
|
54
54
|
if (argv.includes("--version") || argv.includes("-v")) {
|
|
55
55
|
console.log(VERSION);
|
|
@@ -75,6 +75,8 @@ Commands:
|
|
|
75
75
|
packs list List installed packs
|
|
76
76
|
packs install <source> Install engram pack
|
|
77
77
|
packs export <name> Export engrams as a pack
|
|
78
|
+
similarity-search <q> Search by cosine similarity with scores
|
|
79
|
+
batch-decay Apply ACT-R decay to all engrams
|
|
78
80
|
promote <id> Promote an engram to active
|
|
79
81
|
migrate [up|down|status] Run schema migrations
|
|
80
82
|
stores list List configured stores
|
|
@@ -114,6 +116,8 @@ var COMMANDS = {
|
|
|
114
116
|
packs: "./commands/packs.js",
|
|
115
117
|
ingest: "./commands/ingest.js",
|
|
116
118
|
promote: "./commands/promote.js",
|
|
119
|
+
"similarity-search": "./commands/similarity-search.js",
|
|
120
|
+
"batch-decay": "./commands/batch-decay.js",
|
|
117
121
|
stores: "./commands/stores.js",
|
|
118
122
|
migrate: "./commands/migrate.js",
|
|
119
123
|
init: "./commands/init.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plur-ai/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"plur": "dist/index.js"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@plur-ai/core": "0.9.
|
|
13
|
+
"@plur-ai/core": "0.9.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^25.5.0"
|