gm-skill 2.0.2545 → 2.0.2547
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/gm-plugkit/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2547",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform wasm, verifies SHA256, and launches agentplug-runner (the native wasm host) as the spool watcher daemon.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/gm.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2547",
|
|
4
4
|
"description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,41 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Migrates gm's default memory corpus (.gm/memories/*.md + any legacy
|
|
3
|
-
// .gm/rs-learn.db, if present) into the opt-in tencentdb_backend
|
|
4
|
-
// (memory.tencentdb_backend in gm.config.json). Discards superfluous
|
|
5
|
-
// content (git-log-derivable facts, dated audit entries, historical
|
|
6
|
-
// "we used to" framing) using the same heuristic rs-plugkit's own
|
|
7
|
-
// memorize-fire already applies at write time (orchestrator/memorize.rs's
|
|
8
|
-
// is_derivable_state), so migrated content is held to the same bar new
|
|
9
|
-
// memories already are, not a looser one.
|
|
10
|
-
//
|
|
11
|
-
// Idempotent: re-running produces zero new writes for content already
|
|
12
|
-
// migrated, since the target backend dedupes by the same
|
|
13
|
-
// namespace|text content-hash key scheme gm's memorize verb uses.
|
|
14
|
-
//
|
|
15
|
-
// Usage:
|
|
16
|
-
// node scripts/migrate-memory-to-tencentdb.mjs --project <path> [--namespace default] [--dry-run] [--archive]
|
|
17
|
-
//
|
|
18
|
-
// Requires the target project to have a live gm-plugkit spool watcher
|
|
19
|
-
// (boots one if .gm/exec-spool is missing, same as any other gm session)
|
|
20
|
-
// and memory.tencentdb_backend.enabled=true with the target namespace
|
|
21
|
-
// listed in gm.config.json -- this script drives the memorize verb, never
|
|
22
|
-
// writes .gm/tencentdb-memory files directly, so the write always goes
|
|
23
|
-
// through the same dedup/embed/index path a live agent dispatch would.
|
|
24
|
-
//
|
|
25
|
-
// This is the batch/CLI-driven migration path -- useful for migrating a
|
|
26
|
-
// whole namespace outside a live agent session, and it applies the
|
|
27
|
-
// derivable-state discard filter below (the verb-based path does not).
|
|
28
|
-
// The `tencentdb-memory-import` verb (rs-plugkit's
|
|
29
|
-
// wasm_dispatch/verbs.rs::tencentdb_memory_import) is the single-dispatch
|
|
30
|
-
// alternative for use from within an already-running agent session; both
|
|
31
|
-
// write through the same tencentdb_memory::write_cfg path and share the
|
|
32
|
-
// same --archive/archive_source opt-in archiving behavior (see below).
|
|
33
|
-
//
|
|
34
|
-
// --archive (default off, matches the verb's archive_source default) moves
|
|
35
|
-
// each successfully-migrated source .md file to
|
|
36
|
-
// .gm/memories-archive-tencentdb/<namespace>/<filename> instead of leaving
|
|
37
|
-
// it in place -- opt-in because the default stays a pure one-way copy (the
|
|
38
|
-
// old backend keeps working for any namespace not also switched over).
|
|
39
2
|
|
|
40
3
|
import { existsSync, readFileSync, readdirSync, statSync, mkdirSync, renameSync } from "node:fs";
|
|
41
4
|
import { join, dirname } from "node:path";
|
|
@@ -55,12 +18,7 @@ const MEMORIES_DIR = join(PROJECT, ".gm", "memories");
|
|
|
55
18
|
const RS_LEARN_DB = join(PROJECT, ".gm", "rs-learn.db");
|
|
56
19
|
const ARCHIVE_DIR = join(PROJECT, ".gm", "memories-archive-tencentdb", NAMESPACE);
|
|
57
20
|
|
|
58
|
-
|
|
59
|
-
// (pattern list kept in sync by hand -- both are small and rarely change;
|
|
60
|
-
// a mismatch here would only ever under- or over-reject, never corrupt
|
|
61
|
-
// data, since the actual write still goes through gm's own memorize verb
|
|
62
|
-
// which re-applies its own copy of this check).
|
|
63
|
-
function isDerivableState(text) {
|
|
21
|
+
function isDerivableStateMirroringMemorizeRs(text) {
|
|
64
22
|
const t = text.trim();
|
|
65
23
|
if (t.length > 40 && /^[0-9a-fA-F]+$/.test(t)) {
|
|
66
24
|
return "memo is a hex hash; git log is the source of truth";
|
|
@@ -87,9 +45,7 @@ function isDerivableState(text) {
|
|
|
87
45
|
return null;
|
|
88
46
|
}
|
|
89
47
|
|
|
90
|
-
|
|
91
|
-
// ---\nkey: ...\nns: ...\ncreated: <ms>\nupdated: <ms>\n---\n\n<body>\n
|
|
92
|
-
function parseMemoryFile(raw) {
|
|
48
|
+
function parseMemoryMdFrontmatterFile(raw) {
|
|
93
49
|
const m = raw.match(/^---\n([\s\S]*?)\n---\n\n([\s\S]*)$/);
|
|
94
50
|
if (!m) return null;
|
|
95
51
|
const [, frontmatter, body] = m;
|
|
@@ -134,8 +90,8 @@ function dispatchVerb(verb, body, timeoutMs = 30_000) {
|
|
|
134
90
|
if (existsSync(outPath)) {
|
|
135
91
|
try {
|
|
136
92
|
return JSON.parse(readFileSync(outPath, "utf8"));
|
|
137
|
-
} catch {
|
|
138
|
-
|
|
93
|
+
} catch (parseErrorWhileStillBeingWritten) {
|
|
94
|
+
void parseErrorWhileStillBeingWritten;
|
|
139
95
|
}
|
|
140
96
|
}
|
|
141
97
|
execFileSync("sleep", ["0.2"]);
|
|
@@ -162,13 +118,13 @@ function main() {
|
|
|
162
118
|
|
|
163
119
|
for (const path of files) {
|
|
164
120
|
const raw = readFileSync(path, "utf8");
|
|
165
|
-
const parsed =
|
|
121
|
+
const parsed = parseMemoryMdFrontmatterFile(raw);
|
|
166
122
|
if (!parsed || !parsed.text) {
|
|
167
123
|
errored++;
|
|
168
124
|
console.log(`[migrate] ERROR: ${path} does not match the expected memory_md.rs frontmatter format, skipping`);
|
|
169
125
|
continue;
|
|
170
126
|
}
|
|
171
|
-
const reason =
|
|
127
|
+
const reason = isDerivableStateMirroringMemorizeRs(parsed.text);
|
|
172
128
|
if (reason) {
|
|
173
129
|
discarded++;
|
|
174
130
|
if (discardedSamples.length < 10) {
|