@burtson-labs/agent-core 1.6.47 → 1.6.48

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/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare const createAgentRuntime: (options?: CreateAgentRuntimeOptions) =
14
14
  export * from './tools';
15
15
  export * from './graph';
16
16
  export * from './suggestions';
17
+ export * from './lessons';
17
18
  export * from './mcp';
18
19
  export { redactSecrets, redactSecretsString, BUILTIN_SECRET_PATTERNS, type SecretPattern, type RedactionResult } from './security/secretPatterns';
19
20
  export { TelemetryExporter, resolveTelemetryConfig, TTFT_BUCKETS, DURATION_BUCKETS, type TelemetryConfig } from './telemetry/otlpExporter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,yBAA0B,SAAQ,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;IAC/F,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;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,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAExB,cAAc,eAAe,CAAC;AAE9B,cAAc,WAAW,CAAC;AAK1B,cAAc,OAAO,CAAC;AAKtB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -43,6 +43,8 @@ __exportStar(require("./tools"), exports);
43
43
  __exportStar(require("./graph"), exports);
44
44
  // Next-prompt prediction (composer "what's next?" suggestions).
45
45
  __exportStar(require("./suggestions"), exports);
46
+ // Learning memory — distill durable repo lessons from turns (host stores them).
47
+ __exportStar(require("./lessons"), exports);
46
48
  // MCP — Model Context Protocol client (Phase 1: groundwork). See
47
49
  // docs/integration-playlist/mcp-roadmap.md. Off by default — hosts
48
50
  // that don't construct an McpClientPool get zero behavior change.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,yDAAsD;AACtD,+EAAiF;AAGjF,gDAA8B;AAC9B,gDAA8B;AAC9B,uCAAkD;AAAzC,0GAAA,iBAAiB,OAAA;AAE1B,+DAIqC;AADnC,oHAAA,iBAAiB,OAAA;AAGnB,6EAG4C;AAF1C,qIAAA,2BAA2B,OAAA;AAI7B,uDAUgC;AAT9B,4GAAA,YAAY,OAAA;AAeP,MAAM,kBAAkB,GAAG,CAAC,UAAqC,EAAE,EAAgB,EAAE;IAC1F,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,QAAQ,GAAG,gBAAgB,IAAI,IAAI,oDAA2B,EAAE,CAAC;IACvE,OAAO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,0CAAwB;AACxB,uEAAuE;AACvE,8EAA8E;AAC9E,0CAAwB;AACxB,gEAAgE;AAChE,gDAA8B;AAC9B,gFAAgF;AAChF,4CAA0B;AAE1B,iEAAiE;AACjE,mEAAmE;AACnE,kEAAkE;AAClE,wCAAsB;AAEtB,wDAAwD;AACxD,mEAAmE;AACnE,4CAA4C;AAC5C,4DAMmC;AALjC,+GAAA,aAAa,OAAA;AACb,qHAAA,mBAAmB,OAAA;AACnB,yHAAA,uBAAuB,OAAA;AAKzB,iFAAiF;AACjF,iFAAiF;AACjF,yDAMkC;AALhC,iHAAA,iBAAiB,OAAA;AACjB,sHAAA,sBAAsB,OAAA;AACtB,4GAAA,YAAY,OAAA;AACZ,gHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Learning memory — the distiller half.
3
+ *
4
+ * After a turn, the host may make ONE cheap model call asking: did anything
5
+ * DURABLE and REPO-GENERAL happen here worth remembering for future tasks?
6
+ * ("this project uses pnpm, not npm"; "tests for src/api live in test/api";
7
+ * "the build fails unless you run codegen first"). Most turns yield nothing —
8
+ * the point is to accrue a SMALL set of high-signal, reusable facts about a
9
+ * specific repo, not a diary. Those facts are stored (see host-kit's lesson
10
+ * store) and injected on future turns so the agent gets better at THIS repo
11
+ * over time.
12
+ *
13
+ * This module is the shared, host-agnostic core: build the (small) prompt,
14
+ * parse the reply into a lesson or nothing. Pure + fully unit-testable, same
15
+ * split as the planner and next-prompt suggestions. The host owns the model
16
+ * call, the persistence, and the opt-in gate (off by default — it's an extra
17
+ * call per turn, and a store the model writes to deserves a deliberate opt-in).
18
+ */
19
+ export interface LessonTurn {
20
+ /** The user's prompt for the turn. */
21
+ prompt: string;
22
+ /** The assistant's final response. */
23
+ assistantResponse: string;
24
+ /** Tool names used this turn, in order (optional but sharpens distillation). */
25
+ toolsUsed?: string[];
26
+ /** Whether the turn succeeded, if the host knows (a failure often teaches
27
+ * the most durable lesson — "X doesn't work here, do Y"). */
28
+ outcome?: 'ok' | 'error';
29
+ }
30
+ /** The sentinel a well-behaved model returns when nothing is worth storing. */
31
+ export declare const NO_LESSON = "NONE";
32
+ export declare function buildLessonPrompt(turn: LessonTurn): string;
33
+ /**
34
+ * Parse the distiller reply into a lesson, or null when nothing was learned.
35
+ * Never throws. Filters NONE, empties, over-long/paragraph replies, and the
36
+ * "here's a lesson:" preamble the model sometimes adds.
37
+ */
38
+ export declare function parseLesson(text: string): string | null;
39
+ /** Normalize a lesson for dedup comparison (lowercase, collapse whitespace,
40
+ * drop trailing punctuation). Two lessons that normalize equal are dupes. */
41
+ export declare function normalizeLesson(lesson: string): string;
42
+ //# sourceMappingURL=lessons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lessons.d.ts","sourceRoot":"","sources":["../src/lessons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;kEAC8D;IAC9D,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;CAC1B;AAED,+EAA+E;AAC/E,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAwB1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAevD;AAED;8EAC8E;AAC9E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Learning memory — the distiller half.
4
+ *
5
+ * After a turn, the host may make ONE cheap model call asking: did anything
6
+ * DURABLE and REPO-GENERAL happen here worth remembering for future tasks?
7
+ * ("this project uses pnpm, not npm"; "tests for src/api live in test/api";
8
+ * "the build fails unless you run codegen first"). Most turns yield nothing —
9
+ * the point is to accrue a SMALL set of high-signal, reusable facts about a
10
+ * specific repo, not a diary. Those facts are stored (see host-kit's lesson
11
+ * store) and injected on future turns so the agent gets better at THIS repo
12
+ * over time.
13
+ *
14
+ * This module is the shared, host-agnostic core: build the (small) prompt,
15
+ * parse the reply into a lesson or nothing. Pure + fully unit-testable, same
16
+ * split as the planner and next-prompt suggestions. The host owns the model
17
+ * call, the persistence, and the opt-in gate (off by default — it's an extra
18
+ * call per turn, and a store the model writes to deserves a deliberate opt-in).
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.NO_LESSON = void 0;
22
+ exports.buildLessonPrompt = buildLessonPrompt;
23
+ exports.parseLesson = parseLesson;
24
+ exports.normalizeLesson = normalizeLesson;
25
+ /** The sentinel a well-behaved model returns when nothing is worth storing. */
26
+ exports.NO_LESSON = 'NONE';
27
+ function buildLessonPrompt(turn) {
28
+ const tools = turn.toolsUsed?.length ? `\nTools used: ${turn.toolsUsed.join(', ')}` : '';
29
+ const outcome = turn.outcome ? `\nOutcome: ${turn.outcome}` : '';
30
+ const clip = (s, n) => (s.length > n ? s.slice(0, n) + '…' : s);
31
+ return [
32
+ 'You maintain a small memory of DURABLE facts about THIS specific repository, to help future coding tasks.',
33
+ 'Look at the turn below and decide: did it reveal a fact that is (a) specific to this repo, (b) still true next week, and (c) genuinely useful for a future task?',
34
+ '',
35
+ 'Good lessons (store these):',
36
+ '- "This project uses pnpm; npm install breaks the workspace."',
37
+ '- "Tests for src/api/* live in test/api/* and must be updated alongside."',
38
+ '- "The build needs `pnpm codegen` run before `pnpm build`."',
39
+ '',
40
+ 'NOT lessons (never store these):',
41
+ '- Anything about this ONE task ("added a clamp function") — that\'s history, not a durable fact.',
42
+ '- Generic programming advice true of any repo.',
43
+ '- Anything you are not confident is actually true of this repo.',
44
+ '',
45
+ `Reply with ONE short sentence (the lesson, max ~140 chars) OR exactly "${exports.NO_LESSON}" if nothing durable was learned. Most turns are "${exports.NO_LESSON}". No preamble, no quotes, no markdown.`,
46
+ '',
47
+ '--- turn ---',
48
+ `User: ${clip(turn.prompt, 500)}`,
49
+ `Assistant: ${clip(turn.assistantResponse, 800)}${tools}${outcome}`,
50
+ ].join('\n');
51
+ }
52
+ /**
53
+ * Parse the distiller reply into a lesson, or null when nothing was learned.
54
+ * Never throws. Filters NONE, empties, over-long/paragraph replies, and the
55
+ * "here's a lesson:" preamble the model sometimes adds.
56
+ */
57
+ function parseLesson(text) {
58
+ let s = (text ?? '').trim();
59
+ if (!s)
60
+ return null;
61
+ // Strip a leading "lesson:" / "fact:" label if present.
62
+ s = s.replace(/^\s*(lesson|fact|answer)\s*:\s*/i, '').trim();
63
+ // Strip surrounding quotes/backticks/markdown bullet.
64
+ s = s.replace(/^[-*]\s+/, '').replace(/^["'`]+|["'`]+$/g, '').trim();
65
+ if (!s)
66
+ return null;
67
+ // Explicit "nothing to learn" in any casing/punctuation.
68
+ if (/^none[.!]?$/i.test(s))
69
+ return null;
70
+ // A model that ignored instructions and wrote a paragraph isn't a lesson.
71
+ if (s.length > 200)
72
+ return null;
73
+ // Refuse suspiciously generic non-facts.
74
+ if (/^(no|n\/a|nothing|not applicable|no lesson)\b/i.test(s))
75
+ return null;
76
+ return s;
77
+ }
78
+ /** Normalize a lesson for dedup comparison (lowercase, collapse whitespace,
79
+ * drop trailing punctuation). Two lessons that normalize equal are dupes. */
80
+ function normalizeLesson(lesson) {
81
+ return lesson.toLowerCase().replace(/\s+/g, ' ').replace(/[.!]+$/g, '').trim();
82
+ }
83
+ //# sourceMappingURL=lessons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lessons.js","sourceRoot":"","sources":["../src/lessons.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAiBH,8CAwBC;AAOD,kCAeC;AAID,0CAEC;AAvDD,+EAA+E;AAClE,QAAA,SAAS,GAAG,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C,CAAC,OAAO,CAAC,kCAAkC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,sDAAsD;IACtD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrE,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,yDAAyD;IACzD,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,0EAA0E;IAC1E,IAAI,CAAC,CAAC,MAAM,GAAG,GAAG;QAAE,OAAO,IAAI,CAAC;IAChC,yCAAyC;IACzC,IAAI,gDAAgD,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1E,OAAO,CAAC,CAAC;AACX,CAAC;AAED;8EAC8E;AAC9E,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burtson-labs/agent-core",
3
- "version": "1.6.47",
3
+ "version": "1.6.48",
4
4
  "author": {
5
5
  "name": "Burtson Labs",
6
6
  "email": "team@burtson.ai",