gm-skill 2.0.1164 → 2.0.1165

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/README.md CHANGED
@@ -35,7 +35,7 @@ An earlier generation fanned out fifteen per-platform downstream repos (gm-cc, g
35
35
 
36
36
  ## Version
37
37
 
38
- `2.0.1164` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1165` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
39
39
 
40
40
  ## Source of truth
41
41
 
@@ -56,6 +56,22 @@ function turnTick(sess, verb, taskBase, phase) {
56
56
  if (phase) { t.phases.add(phase); t.lastPhase = phase; }
57
57
  }
58
58
 
59
+ let __sessCache = { value: '', mtimeMs: 0, readAt: 0 };
60
+ function readCurrentSess() {
61
+ const now = Date.now();
62
+ if (now - __sessCache.readAt < 1000) return __sessCache.value;
63
+ try {
64
+ const p = path.join(process.cwd(), '.gm', 'exec-spool', '.session-current');
65
+ const st = fs.statSync(p);
66
+ if (st.mtimeMs !== __sessCache.mtimeMs) {
67
+ __sessCache.value = fs.readFileSync(p, 'utf8').trim();
68
+ __sessCache.mtimeMs = st.mtimeMs;
69
+ }
70
+ } catch (_) {}
71
+ __sessCache.readAt = now;
72
+ return __sessCache.value || process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '';
73
+ }
74
+
59
75
  function logEvent(sub, event, fields) {
60
76
  if (process.env.GM_LOG_DISABLE) return;
61
77
  try {
@@ -67,7 +83,7 @@ function logEvent(sub, event, fields) {
67
83
  sub,
68
84
  event,
69
85
  pid: process.pid,
70
- sess: process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '',
86
+ sess: readCurrentSess(),
71
87
  ...fields,
72
88
  });
73
89
  fs.appendFileSync(path.join(dir, `${sub}.jsonl`), line + '\n');
@@ -83,7 +99,7 @@ function emitOrchestratorEvents(verb, taskBase, resultStr) {
83
99
  return;
84
100
  }
85
101
  const data = parsed.data || {};
86
- const sess = process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '';
102
+ const sess = readCurrentSess();
87
103
  turnTick(sess, verb, taskBase, data.phase);
88
104
  switch (verb) {
89
105
  case 'transition':
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1164",
3
+ "version": "2.0.1165",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -320,6 +320,16 @@ function ensureBuildToolIgnores(cwd) {
320
320
  }
321
321
  }
322
322
 
323
+ function writeSessionSidecar(sessionId) {
324
+ try {
325
+ const sess = sessionId || process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '';
326
+ if (!sess) return;
327
+ const spool = path.join(process.cwd(), '.gm', 'exec-spool');
328
+ fs.mkdirSync(spool, { recursive: true });
329
+ fs.writeFileSync(path.join(spool, '.session-current'), sess);
330
+ } catch (_) {}
331
+ }
332
+
323
333
  function ensureManagedGitignore(cwd) {
324
334
  try {
325
335
  const gi = gitignorePath(cwd);
@@ -548,6 +558,7 @@ async function bootstrapPlugkit(sessionId, options) {
548
558
  try {
549
559
  emitBootstrapEvent('info', 'Bootstrap started', { forceLatest });
550
560
 
561
+ writeSessionSidecar(sessionId);
551
562
  ensureManagedGitignore(process.cwd());
552
563
  ensureBuildToolIgnores(process.cwd());
553
564
 
@@ -101,6 +101,11 @@ async function dispatchSpool(cmd, lang, body, timeoutMs, sessionId) {
101
101
  fs.mkdirSync(inDir, { recursive: true });
102
102
  fs.mkdirSync(outDir, { recursive: true });
103
103
 
104
+ const sess = sessionId || process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '';
105
+ if (sess) {
106
+ try { fs.writeFileSync(path.join(process.cwd(), '.gm', 'exec-spool', '.session-current'), sess); } catch (_) {}
107
+ }
108
+
104
109
  const code = sessionId ? `const SESSION_ID = '${sessionId}';\n${body}` : body;
105
110
  fs.writeFileSync(inFile, code, 'utf8');
106
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1164",
3
+ "version": "2.0.1165",
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",
@@ -39,7 +39,7 @@
39
39
  "gm.json"
40
40
  ],
41
41
  "dependencies": {
42
- "gm-plugkit": "^2.0.1164"
42
+ "gm-plugkit": "^2.0.1165"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"