agentsmesh 0.32.0 → 0.34.0

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.
@@ -172,11 +172,6 @@ interface GuardrailWarning {
172
172
  readonly message: string;
173
173
  }
174
174
 
175
- /**
176
- * Capture rejection errors thrown by {@link addLessonInto}. Kept in their own
177
- * module so `add.ts` stays focused on the mutation logic; re-exported from
178
- * `add.js` so every existing importer keeps its `from './add.js'` path.
179
- */
180
175
  declare class UnknownTopicError extends Error {
181
176
  readonly topic: string;
182
177
  readonly code = "UNKNOWN_TOPIC";
@@ -387,15 +382,20 @@ declare function importLegacyLessons(projectRoot: string, options: ImportLegacyO
387
382
  * cross-process mutex without any third-party dependency.
388
383
  *
389
384
  * Stale recovery: the holder writes its PID and start timestamp into the lock
390
- * dir. On contention we peek at the PID; if the process is gone or the lock is
391
- * older than `staleMs`, we evict it and retry.
385
+ * dir. On contention we peek at the PID: a dead same-host holder is evicted at
386
+ * once. A live holder (or one on another host, whose PID we cannot probe) is
387
+ * evicted only past `staleMs` — an hours-long bound that catches a hung
388
+ * process or a recycled PID, never a slow but healthy run.
392
389
  */
393
390
  interface LockOptions {
394
391
  /** Maximum retry attempts before throwing LockAcquisitionError. */
395
392
  retries?: number;
396
393
  /** Delay between retries in ms. */
397
394
  retryDelayMs?: number;
398
- /** Lock age beyond which an existing lock is treated as stale and evicted. */
395
+ /**
396
+ * Secondary age bound (default 6h): a lock older than this is evicted even
397
+ * when its holder PID is still alive or cannot be probed (other host).
398
+ */
399
399
  staleMs?: number;
400
400
  /** Human-readable lock name surfaced in LockAcquisitionError, e.g. "lessons lock". */
401
401
  label?: string;
@@ -469,7 +469,7 @@ declare function toRelPath(projectRoot: string, absolute: string): string;
469
469
  * survives generate → import → generate round-trip; only the wording inside each
470
470
  * block is tightened for maximum agent compliance.
471
471
  */
472
- declare const LESSONS_PROCEDURAL_RULE = "## Lessons (BLOCKING)\n\nGraph `.agentsmesh/lessons/lessons.json` is canonical; never hand-edit it. Manual: `lessons` skill.\n\n**Recall:** before every file edit or state-changing command, MUST run `agentsmesh lessons query --file <path> --cmd <command>` and obey matches; at task start, ALSO run `agentsmesh lessons query --keyword \"<task terms>\" --always` for conceptual + universal rules no path/command names. Pure-read commands and recall itself are exempt.\n\n**Capture:** after any failure, user correction, regression, wrong assumption, useful surprise, repeated friction, or non-obvious fix, MUST self-critique and run `agentsmesh lessons add \"<imperative rule>\" --topic <id> --trigger-file <glob> --evidence <sha|lesson-id>`.\n\n**Before final:** report `Lesson: captured <id>` or `Lesson: none`. No recall/capture gate = task incomplete. No shell: use `lessons_query` / `lessons_add`.";
472
+ declare const LESSONS_PROCEDURAL_RULE = "## Lessons (BLOCKING)\n\nGraph `.agentsmesh/lessons/lessons.json` is canonical; never hand-edit it. Manual: `lessons` skill.\n\n**Recall:** before every file edit or state-changing command, MUST run `agentsmesh lessons query --file <path> --cmd <command> --session auto` and obey matches; at task start, ALSO run `agentsmesh lessons query --keyword \"<task terms>\" --always --session auto` for conceptual + universal rules no path/command names. Pure-read commands and recall itself are exempt.\n\n**Capture:** after any failure, user correction, regression, wrong assumption, useful surprise, repeated friction, or non-obvious fix, MUST self-critique and run `agentsmesh lessons add \"<imperative rule>\" --topic <id> --trigger-file <glob> --evidence <sha|lesson-id>`.\n\n**Before final:** report `Lesson: captured <id>` or `Lesson: none`. No recall/capture gate = task incomplete. No shell: use `lessons_query` / `lessons_add`.";
473
473
 
474
474
  interface ScaffoldLessonsResult {
475
475
  readonly created: string[];
package/dist/lessons.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as RankedLesson, j as LessonsQuery, A as AddLessonInput, a as AddLessonOptions, b as AddLessonResult } from './init-CrZhoNTj.js';
2
- export { c as AddLessonTriggers, D as DEFAULT_RECALL_LIMIT, X as DEFAULT_RECALL_MAX_TOKENS, I as ImportLegacyOptions, d as ImportLegacyReport, Y as LESSONS_LOCK_FILENAME, L as LESSONS_PROCEDURAL_RULE, e as Lesson, f as LessonStatus, g as LessonsGraph, Z as LessonsGraphExistsError, h as LessonsGraphSchema, i as LessonsPaths, M as MatchedLesson, k as MergeLessonsOptions, l as MergeLessonsResult, m as MutateOptions, R as RankOptions, n as RankReason, S as ScaffoldLessonsResult, p as StripMarkersOptions, q as StripMarkersReport, T as Topic, r as Trigger, s as TriggerKind, U as UnknownTopicError, V as ValidationFinding, t as ValidationLevel, u as ValidationReport, v as acquireLessonsLock, w as addLesson, x as graphFilePath, y as importLegacyLessons, _ as lessonsLockPath, z as lessonsPaths, B as loadLessonsGraph, C as mergeLessons, E as mutateLessonsGraph, F as parseGraph, G as queryLessons, H as rankLessons, J as scaffoldLessons, K as serializeGraph, N as stripLegacyMarkers, O as stripMarkersInGraph, P as toRelPath, Q as tryLoadLessonsGraph, W as validateLessonsGraph } from './init-CrZhoNTj.js';
1
+ import { o as RankedLesson, j as LessonsQuery, A as AddLessonInput, a as AddLessonOptions, b as AddLessonResult } from './init-ChDbKSJ0.js';
2
+ export { c as AddLessonTriggers, D as DEFAULT_RECALL_LIMIT, X as DEFAULT_RECALL_MAX_TOKENS, I as ImportLegacyOptions, d as ImportLegacyReport, Y as LESSONS_LOCK_FILENAME, L as LESSONS_PROCEDURAL_RULE, e as Lesson, f as LessonStatus, g as LessonsGraph, Z as LessonsGraphExistsError, h as LessonsGraphSchema, i as LessonsPaths, M as MatchedLesson, k as MergeLessonsOptions, l as MergeLessonsResult, m as MutateOptions, R as RankOptions, n as RankReason, S as ScaffoldLessonsResult, p as StripMarkersOptions, q as StripMarkersReport, T as Topic, r as Trigger, s as TriggerKind, U as UnknownTopicError, V as ValidationFinding, t as ValidationLevel, u as ValidationReport, v as acquireLessonsLock, w as addLesson, x as graphFilePath, y as importLegacyLessons, _ as lessonsLockPath, z as lessonsPaths, B as loadLessonsGraph, C as mergeLessons, E as mutateLessonsGraph, F as parseGraph, G as queryLessons, H as rankLessons, J as scaffoldLessons, K as serializeGraph, N as stripLegacyMarkers, O as stripMarkersInGraph, P as toRelPath, Q as tryLoadLessonsGraph, W as validateLessonsGraph } from './init-ChDbKSJ0.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
@@ -34,6 +34,14 @@ interface RecallOptions {
34
34
  readonly sessionId?: string;
35
35
  /** Force dedup off even when a session correlator is present. */
36
36
  readonly noDedup?: boolean;
37
+ /**
38
+ * Expire suppressions this long after delivery. Set by callers that have NO
39
+ * context-reset signal (the MCP server never sees the client compact), so a
40
+ * lesson dropped from a summarized context cannot stay hidden forever. The
41
+ * hook path leaves this unset on purpose: it resets on SessionStart
42
+ * compact/clear, which is the exact signal a wall-clock TTL only approximates.
43
+ */
44
+ readonly ttlMs?: number;
37
45
  }
38
46
  interface RecallResult {
39
47
  /** Relevance-ranked, capped lessons (compact metadata lives on each entry). */