gm-qwen 2.0.801 → 2.0.802
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/bootstrap.js +22 -1
- package/bin/plugkit.js +5 -1
- package/gm.json +1 -1
- package/package.json +1 -1
- package/skills/gm/SKILL.md +8 -0
package/bin/bootstrap.js
CHANGED
|
@@ -17,6 +17,27 @@ const LOCK_STALE_MS = 5 * 60 * 1000;
|
|
|
17
17
|
|
|
18
18
|
function log(msg) {
|
|
19
19
|
try { process.stderr.write(`[plugkit-bootstrap] ${msg}\n`); } catch (_) {}
|
|
20
|
+
try { obsEvent('bootstrap', 'log', { msg }); } catch (_) {}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function obsEvent(subsystem, event, fields) {
|
|
24
|
+
if (process.env.GM_LOG_DISABLE) return;
|
|
25
|
+
try {
|
|
26
|
+
const root = process.env.GM_LOG_DIR
|
|
27
|
+
|| path.join(os.homedir(), '.claude', 'gm-log');
|
|
28
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
29
|
+
const dir = path.join(root, day);
|
|
30
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
31
|
+
const line = JSON.stringify({
|
|
32
|
+
ts: new Date().toISOString(),
|
|
33
|
+
sub: subsystem,
|
|
34
|
+
event,
|
|
35
|
+
pid: process.pid,
|
|
36
|
+
sess: process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '',
|
|
37
|
+
...fields,
|
|
38
|
+
});
|
|
39
|
+
fs.appendFileSync(path.join(dir, `${subsystem}.jsonl`), line + '\n');
|
|
40
|
+
} catch (_) {}
|
|
20
41
|
}
|
|
21
42
|
|
|
22
43
|
function platformKey() {
|
|
@@ -352,7 +373,7 @@ function resolveCachedBinary(opts) {
|
|
|
352
373
|
return null;
|
|
353
374
|
}
|
|
354
375
|
|
|
355
|
-
module.exports = { bootstrap, resolveCachedBinary, resolveCachedRtk, platformKey, binaryName, rtkBinaryName, cacheRoot };
|
|
376
|
+
module.exports = { bootstrap, resolveCachedBinary, resolveCachedRtk, platformKey, binaryName, rtkBinaryName, cacheRoot, obsEvent };
|
|
356
377
|
|
|
357
378
|
if (require.main === module) {
|
|
358
379
|
bootstrap({ silent: false })
|
package/bin/plugkit.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { spawn, spawnSync } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
-
const { bootstrap, resolveCachedBinary, resolveCachedRtk } = require('./bootstrap');
|
|
6
|
+
const { bootstrap, resolveCachedBinary, resolveCachedRtk, obsEvent } = require('./bootstrap');
|
|
7
7
|
|
|
8
8
|
const dir = __dirname;
|
|
9
9
|
|
|
@@ -24,11 +24,14 @@ async function resolveBinary() {
|
|
|
24
24
|
async function main() {
|
|
25
25
|
const args = process.argv.slice(2);
|
|
26
26
|
const isHook = args[0] === 'hook';
|
|
27
|
+
const startedAt = Date.now();
|
|
28
|
+
obsEvent('plugkit_wrapper', 'invoke', { argv: args.slice(0, 4), is_hook: isHook });
|
|
27
29
|
let bin;
|
|
28
30
|
try {
|
|
29
31
|
bin = await resolveBinary();
|
|
30
32
|
} catch (err) {
|
|
31
33
|
process.stderr.write(`[plugkit] bootstrap failed: ${err.message}\n`);
|
|
34
|
+
obsEvent('plugkit_wrapper', 'bootstrap_failed', { err: err.message });
|
|
32
35
|
const legacy = legacyFallback();
|
|
33
36
|
if (legacy) { bin = legacy; }
|
|
34
37
|
else if (isHook) { process.exit(0); }
|
|
@@ -49,6 +52,7 @@ async function main() {
|
|
|
49
52
|
process.stdin.on('error', () => process.exit(1));
|
|
50
53
|
} else {
|
|
51
54
|
const result = spawnSync(bin, args, { stdio: 'inherit', windowsHide: true, env });
|
|
55
|
+
obsEvent('plugkit_wrapper', 'exit', { dur_ms: Date.now() - startedAt, code: result.status ?? -1 });
|
|
52
56
|
process.exit(result.status ?? 1);
|
|
53
57
|
}
|
|
54
58
|
}
|
package/gm.json
CHANGED
package/package.json
CHANGED
package/skills/gm/SKILL.md
CHANGED
|
@@ -93,6 +93,14 @@ Pure-prose edits to static documents with no JS/canvas/DOM behavior change are e
|
|
|
93
93
|
|
|
94
94
|
This rule fires in EXECUTE (witness on edit), EMIT (post-emit verify), and VERIFY (final gate). All three.
|
|
95
95
|
|
|
96
|
+
## OBSERVABILITY — HARD RULE
|
|
97
|
+
|
|
98
|
+
Every program is observed by default. plugkit, rs-exec, rs-plugkit, rs-learn, rs-search, and rs-codeinsight emit structured JSONL events to `~/.claude/gm-log/<YYYY-MM-DD>/<subsystem>.jsonl` for every hook fired, every exec spawn, every recall, every run_self call. The agent inspects this stream when diagnosing — `plugkit log tail`, `plugkit log grep <terms>`, `plugkit log stats`, `plugkit log path`. Asking "why did X happen" without first checking the log is forced closure.
|
|
99
|
+
|
|
100
|
+
The same discipline applies to code the agent writes. State transitions, error paths, external IO (network, disk, subprocess, queue), and timing of operations longer than a heartbeat are events the future debugger will need. Find the project's existing observability surface before inventing one (codesearch first); if a surface exists, extend it rather than starting a parallel one. If the project has none, the smallest correct shim is a single function or macro that emits one JSONL line per event to a file under `.gm/log/` (mirror what plugkit does — same shape, same fields). Never `console.log` / `println!` scatter across files; that fragments the surface and dies on the first compaction or rotation. The events are the program's own self-narration, not a debugging afterthought.
|
|
101
|
+
|
|
102
|
+
What to emit, not how often: every state transition once; every error path once at the boundary it crosses; every external IO with timing; every nontrivial decision (allow/deny, route picked, branch taken on user-derived input). Do not emit per-iteration loop bodies, per-character parser steps, or anything whose volume would obscure the load-bearing events. The signal-to-noise judgment is the agent's; the cost of getting it wrong is paid by future-you reading the file.
|
|
103
|
+
|
|
96
104
|
## NOTHING FAKE — HARD RULE
|
|
97
105
|
|
|
98
106
|
What ships runs against real services, real data, real binaries. Stubs, mocks, placeholder returns, fixture-only paths, "TODO: implement", `return null /* fake */`, hardcoded sample responses, and demo-mode fallbacks are forbidden in source the user will run. They produce green checks that survive into production and lie about what works.
|