gm-skill 2.0.1219 → 2.0.1221

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.1219` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1221` — 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
 
@@ -1 +1 @@
1
- 0.1.447
1
+ 0.1.448
package/bin/plugkit.wasm CHANGED
Binary file
@@ -1 +1 @@
1
- 0ce920f00138b9524a0a1ad062dab691e4959497853644a7d06403c2b77ed480 plugkit.wasm
1
+ 9bafe43d985cebd33c63433b532a7f396599905fa1d90c9f411ea292f10fd7c1 plugkit.wasm
@@ -49,7 +49,7 @@ const SPOOL_POLL_PATTERNS = [
49
49
  /\\b(?:test|Test-Path|tp)\\s+(?:-[A-Za-z]+\\s+)?['"]?[^'"|;&]*\\.gm[\\\\/](?:exec-spool|spool)[\\\\/]/i,
50
50
  ];
51
51
 
52
- const SPOOL_POLL_REASON = 'spool polling and bash-reads of .gm/exec-spool/ are forbidden — plugkit is synchronous from your view, and the canonical way to inspect spool files is the Read tool. Use Read on .gm/exec-spool/out/<verb>-<N>.json directly. If the response file does not exist, the watcher is either dead (Read .gm/exec-spool/.status.json and check its mtime against now) or the verb is genuinely slow (Read .gm/exec-spool/.watcher.log for the dispatch trace). You are the state machine; plugkit serves the response the moment you write the request, and Read is how you observe the result.';
52
+ const SPOOL_POLL_REASON = 'spool polling and bash-reads of .gm/exec-spool/ are forbidden — plugkit is synchronous from your view, and the Read tool is the canonical way to inspect spool files. Specific replacements:\\n\\n- Instead of \`cat .gm/exec-spool/.status.json\` → use the Read tool: \`Read .gm/exec-spool/.status.json\`\\n- Instead of \`ls .gm/exec-spool/out/\` → check the specific response file you wrote, e.g. \`Read .gm/exec-spool/out/<verb>-<N>.json\`\\n- Instead of \`cat .gm/exec-spool/.watcher.log\` use the Read tool with offset for tailing\\n- Instead of \`sleep N; cat .gm/exec-spool/<...>\` → just Read the response file directly; if it doesn\\'t exist yet, the watcher is dead (Read .gm/exec-spool/.status.json fresh ts means alive) or the verb is slow (Read .gm/exec-spool/.watcher.log for the dispatch trace)\\n\\nYou are the state machine. Plugkit serves the response the moment you write the request file. If you find yourself thinking "let me just check whether the file is there yet" — use Read. If you find yourself thinking "the watcher might have died" — Read .gm/exec-spool/.status.json. Bash on .gm/exec-spool/ is wrong every single time.';
53
53
 
54
54
  function stripHeredocsAndStringLiterals(command) {
55
55
  let s = String(command);
@@ -282,11 +282,29 @@ function dispatchVerbToWasmInternal(instance, verb, body) {
282
282
  }
283
283
  }
284
284
 
285
- function tryAutoRecallForTurnEntry(instance, sess, cwd) {
285
+ const AUTO_RECALL_STOPWORDS = new Set([
286
+ 'the','a','an','and','or','but','if','then','else','for','of','to','in','on','at','by','with','from','as','is','are','was','were','be','been','being','have','has','had','do','does','did','will','would','should','could','can','may','might','must','shall',
287
+ 'look','check','see','use','make','run','get','set','put','take','give','find','show','tell','let','keep','try','add','new','old','this','that','these','those','it','its','their','there','here','about','into','over','under','also','just','some','any','all','more','less','most','past','minutes','minute','hours','hour','seconds','second','days','day',
288
+ ]);
289
+
290
+ function deriveFallbackQuery(prompt) {
286
291
  try {
287
- const prompt = readUserPromptForRecall(cwd);
288
- if (!prompt) return null;
289
- const out = dispatchVerbToWasmInternal(instance, 'auto-recall', prompt);
292
+ const tokens = String(prompt).toLowerCase().split(/[^a-z0-9_]+/).filter(Boolean);
293
+ const freq = new Map();
294
+ for (const t of tokens) {
295
+ if (t.length < 4) continue;
296
+ if (AUTO_RECALL_STOPWORDS.has(t)) continue;
297
+ freq.set(t, (freq.get(t) || 0) + 1);
298
+ }
299
+ const ranked = Array.from(freq.entries()).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
300
+ const top = ranked.slice(0, 3).map(([w]) => w);
301
+ return top.join(' ');
302
+ } catch (_) { return ''; }
303
+ }
304
+
305
+ function dispatchAutoRecall(instance, queryPrompt) {
306
+ try {
307
+ const out = dispatchVerbToWasmInternal(instance, 'auto-recall', queryPrompt);
290
308
  if (!out) return null;
291
309
  let parsed;
292
310
  try { parsed = JSON.parse(out); } catch (_) { return null; }
@@ -297,8 +315,42 @@ function tryAutoRecallForTurnEntry(instance, sess, cwd) {
297
315
  }
298
316
  if (!inner || typeof inner !== 'object') return null;
299
317
  const hits = Array.isArray(inner.results) ? inner.results : (Array.isArray(inner.hits) ? inner.hits : []);
300
- const payload = { query: inner.query || '', hits, fired_at: new Date().toISOString(), turn_entry: true };
301
- logEvent('plugkit', 'auto_recall.turn-entry', { sess, query: payload.query, count: hits.length });
318
+ return { query: inner.query || '', hits };
319
+ } catch (_) { return null; }
320
+ }
321
+
322
+ function tryAutoRecallForTurnEntry(instance, sess, cwd) {
323
+ try {
324
+ const prompt = readUserPromptForRecall(cwd);
325
+ if (!prompt) return null;
326
+ const primary = dispatchAutoRecall(instance, prompt);
327
+ const fallbackQuery = deriveFallbackQuery(prompt);
328
+ let fallback = null;
329
+ if (fallbackQuery && fallbackQuery !== (primary && primary.query)) {
330
+ fallback = dispatchAutoRecall(instance, fallbackQuery);
331
+ }
332
+ const seen = new Set();
333
+ const merged = [];
334
+ for (const src of [primary, fallback]) {
335
+ if (!src || !Array.isArray(src.hits)) continue;
336
+ for (const h of src.hits) {
337
+ const id = h && (h.id || h.hash || h.key || JSON.stringify(h));
338
+ if (id && seen.has(id)) continue;
339
+ if (id) seen.add(id);
340
+ merged.push(h);
341
+ }
342
+ }
343
+ const queries = [];
344
+ if (primary && primary.query) queries.push(primary.query);
345
+ if (fallback && fallback.query && !queries.includes(fallback.query)) queries.push(fallback.query);
346
+ const payload = {
347
+ query: (primary && primary.query) || '',
348
+ queries,
349
+ hits: merged.slice(0, 20),
350
+ fired_at: new Date().toISOString(),
351
+ turn_entry: true,
352
+ };
353
+ logEvent('plugkit', 'auto_recall.turn-entry', { sess, queries, count: merged.length });
302
354
  return payload;
303
355
  } catch (e) {
304
356
  logEvent('plugkit', 'auto_recall.error', { sess, error: String(e && e.message || e) });
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1219",
3
+ "version": "2.0.1221",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.447"
20
+ "plugkitVersion": "0.1.448"
21
21
  }
@@ -342,7 +342,7 @@ const SPOOL_POLL_PATTERNS = [
342
342
  /\\b(?:test|Test-Path|tp)\\s+(?:-[A-Za-z]+\\s+)?['"]?[^'"|;&]*\\.gm[\\\\/](?:exec-spool|spool)[\\\\/]/i,
343
343
  ];
344
344
 
345
- const SPOOL_POLL_REASON = 'spool polling and bash-reads of .gm/exec-spool/ are forbidden — plugkit is synchronous from your view, and the canonical way to inspect spool files is the Read tool. Use Read on .gm/exec-spool/out/<verb>-<N>.json directly. If the response file does not exist, the watcher is either dead (Read .gm/exec-spool/.status.json and check its mtime against now) or the verb is genuinely slow (Read .gm/exec-spool/.watcher.log for the dispatch trace). You are the state machine; plugkit serves the response the moment you write the request, and Read is how you observe the result.';
345
+ const SPOOL_POLL_REASON = 'spool polling and bash-reads of .gm/exec-spool/ are forbidden — plugkit is synchronous from your view, and the Read tool is the canonical way to inspect spool files. Specific replacements:\\n\\n- Instead of \`cat .gm/exec-spool/.status.json\` → use the Read tool: \`Read .gm/exec-spool/.status.json\`\\n- Instead of \`ls .gm/exec-spool/out/\` → check the specific response file you wrote, e.g. \`Read .gm/exec-spool/out/<verb>-<N>.json\`\\n- Instead of \`cat .gm/exec-spool/.watcher.log\` use the Read tool with offset for tailing\\n- Instead of \`sleep N; cat .gm/exec-spool/<...>\` → just Read the response file directly; if it doesn\\'t exist yet, the watcher is dead (Read .gm/exec-spool/.status.json fresh ts means alive) or the verb is slow (Read .gm/exec-spool/.watcher.log for the dispatch trace)\\n\\nYou are the state machine. Plugkit serves the response the moment you write the request file. If you find yourself thinking "let me just check whether the file is there yet" — use Read. If you find yourself thinking "the watcher might have died" — Read .gm/exec-spool/.status.json. Bash on .gm/exec-spool/ is wrong every single time.';
346
346
 
347
347
  function stripHeredocsAndStringLiterals(command) {
348
348
  let s = String(command);
@@ -267,7 +267,7 @@ const SPOOL_POLL_PATTERNS = [
267
267
  /\b(?:test|Test-Path|tp)\s+(?:-[A-Za-z]+\s+)?['"]?[^'"|;&]*\.gm[\\/](?:exec-spool|spool)[\\/]/i,
268
268
  ];
269
269
 
270
- const SPOOL_POLL_REASON = 'spool polling and bash-reads of .gm/exec-spool/ are forbidden — plugkit is synchronous from your view, and the canonical way to inspect spool files is the Read tool. Use Read on .gm/exec-spool/out/<verb>-<N>.json directly. If the response file does not exist, the watcher is either dead (Read .gm/exec-spool/.status.json and check its mtime against now) or the verb is genuinely slow (Read .gm/exec-spool/.watcher.log for the dispatch trace). Polling with sleep+cat/ls/Test-Path treats plugkit as an async worker; bare cat/ls of the spool dir treats it as a shell artifact. It is neither. You are the state machine; plugkit serves the response the moment you write the request, and Read is how you observe the result.';
270
+ const SPOOL_POLL_REASON = 'spool polling and bash-reads of .gm/exec-spool/ are forbidden — plugkit is synchronous from your view, and the Read tool is the canonical way to inspect spool files. Specific replacements:\n\n- Instead of `cat .gm/exec-spool/.status.json` → use the Read tool: `Read .gm/exec-spool/.status.json`\n- Instead of `ls .gm/exec-spool/out/` → check the specific response file you wrote, e.g. `Read .gm/exec-spool/out/<verb>-<N>.json`\n- Instead of `cat .gm/exec-spool/.watcher.log` use the Read tool with offset for tailing\n- Instead of `sleep N; cat .gm/exec-spool/<...>` → just Read the response file directly; if it doesn\'t exist yet, the watcher is dead (Read .gm/exec-spool/.status.json fresh ts means alive) or the verb is slow (Read .gm/exec-spool/.watcher.log for the dispatch trace)\n\nYou are the state machine. Plugkit serves the response the moment you write the request file. If you find yourself thinking "let me just check whether the file is there yet" use Read. If you find yourself thinking "the watcher might have died" — Read .gm/exec-spool/.status.json. Bash on .gm/exec-spool/ is wrong every single time.';
271
271
 
272
272
  function stripHeredocsAndStringLiterals(command) {
273
273
  let s = String(command);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1219",
3
+ "version": "2.0.1221",
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.1219"
42
+ "gm-plugkit": "^2.0.1221"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"