@hasna/brains 0.0.30 → 0.0.32

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.
@@ -15,6 +15,9 @@ declare function parseListFilters(opts: ListModelsOptions): {
15
15
  status?: ModelStatus;
16
16
  limit?: number;
17
17
  };
18
+ declare function formatModelTags(tags: string | null | undefined): string;
19
+ declare function addModelTagJson(tags: string | null | undefined, tag: string): string;
20
+ declare function removeModelTagJson(tags: string | null | undefined, tag: string): string;
18
21
  export declare function registerModelsCommands(program: Command): void;
19
- export { parseListFilters, parseListLimit };
22
+ export { addModelTagJson, formatModelTags, parseListFilters, parseListLimit, removeModelTagJson };
20
23
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAS,eAAe,EAAgB,MAAM,mBAAmB,CAAC;AAKzE,KAAK,QAAQ,GAAG,OAAO,eAAe,CAAC,YAAY,CAAC;AACpD,KAAK,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AACrC,KAAK,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAUtC,UAAU,iBAAiB;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOxE;AAED,iBAAS,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAiBhH;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmQ7D;AAED,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAS,eAAe,EAAgB,MAAM,mBAAmB,CAAC;AAMzE,KAAK,QAAQ,GAAG,OAAO,eAAe,CAAC,YAAY,CAAC;AACpD,KAAK,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AACrC,KAAK,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAUtC,UAAU,iBAAiB;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOxE;AAED,iBAAS,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAiBhH;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGhE;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED,iBAAS,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiQ7D;AAED,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
package/dist/cli/index.js CHANGED
@@ -13151,6 +13151,20 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
13151
13151
  init_adapter();
13152
13152
  });
13153
13153
 
13154
+ // src/lib/gatherers/tags.ts
13155
+ function parseTagList(value) {
13156
+ if (!value?.trim())
13157
+ return [];
13158
+ try {
13159
+ const parsed = JSON.parse(value);
13160
+ if (!Array.isArray(parsed))
13161
+ return [];
13162
+ return parsed.filter((tag) => typeof tag === "string");
13163
+ } catch {
13164
+ return [];
13165
+ }
13166
+ }
13167
+
13154
13168
  // src/lib/gatherers/todos.ts
13155
13169
  var exports_todos = {};
13156
13170
  __export(exports_todos, {
@@ -13169,7 +13183,7 @@ Description: ${task.description}` : ""}`;
13169
13183
  description: task.description ?? "",
13170
13184
  status: task.status,
13171
13185
  priority: task.priority,
13172
- tags: JSON.parse(task.tags ?? "[]"),
13186
+ tags: parseTagList(task.tags),
13173
13187
  created_at: task.created_at
13174
13188
  };
13175
13189
  return {
@@ -13208,7 +13222,7 @@ ${matched.map((t) => `- [${t.short_id ?? t.id}] ${t.title} (${t.status})`).join(
13208
13222
  };
13209
13223
  }
13210
13224
  async function gatherFromTodos(options = {}) {
13211
- const dbPath = join9(homedir8(), ".todos", "todos.db");
13225
+ const dbPath = join9(options.homeDir ?? homedir8(), ".todos", "todos.db");
13212
13226
  const db = new Database3(dbPath, { readonly: true, create: false });
13213
13227
  try {
13214
13228
  let query = "SELECT * FROM tasks WHERE 1=1";
@@ -13270,7 +13284,7 @@ Summary: ${memory.summary}` : memory.value
13270
13284
  };
13271
13285
  }
13272
13286
  function memoryToSaveExample(memory) {
13273
- const tags = JSON.parse(memory.tags ?? "[]");
13287
+ const tags = parseTagList(memory.tags);
13274
13288
  return {
13275
13289
  messages: [
13276
13290
  { role: "system", content: SYSTEM_PROMPT2 },
@@ -13301,7 +13315,7 @@ ${matched.map((m) => `- ${m.key}: ${m.value.slice(0, 120)}${m.value.length > 120
13301
13315
  };
13302
13316
  }
13303
13317
  async function gatherFromMementos(options = {}) {
13304
- const dbPath = join10(homedir9(), ".mementos", "mementos.db");
13318
+ const dbPath = join10(options.homeDir ?? homedir9(), ".mementos", "mementos.db");
13305
13319
  const db = new Database4(dbPath, { readonly: true, create: false });
13306
13320
  try {
13307
13321
  let query = "SELECT * FROM memories WHERE status = 'active'";
@@ -13372,7 +13386,7 @@ function windowToExample(window2) {
13372
13386
  return { messages };
13373
13387
  }
13374
13388
  async function gatherFromConversations(options = {}) {
13375
- const dbPath = join11(homedir10(), ".conversations", "messages.db");
13389
+ const dbPath = join11(options.homeDir ?? homedir10(), ".conversations", "messages.db");
13376
13390
  const db = new Database5(dbPath, { readonly: true, create: false });
13377
13391
  try {
13378
13392
  let query = "SELECT * FROM messages WHERE 1=1";
@@ -13433,7 +13447,7 @@ function extractText(content) {
13433
13447
  async function gatherFromSessions(options = {}) {
13434
13448
  const { limit: limit2 = 1000 } = options;
13435
13449
  const examples = [];
13436
- const claudeDir = join12(homedir11(), ".claude", "projects");
13450
+ const claudeDir = join12(options.homeDir ?? homedir11(), ".claude", "projects");
13437
13451
  if (!existsSync10(claudeDir)) {
13438
13452
  return { source: "sessions", examples: [], count: 0 };
13439
13453
  }
@@ -18129,7 +18143,6 @@ function printInfo(message) {
18129
18143
 
18130
18144
  // src/cli/commands/models.ts
18131
18145
  import { randomUUID as randomUUID5 } from "crypto";
18132
-
18133
18146
  // node_modules/openai/internal/qs/formats.mjs
18134
18147
  var default_format = "RFC3986";
18135
18148
  var formatters = {
@@ -23958,6 +23971,20 @@ function parseListFilters(opts) {
23958
23971
  const status = statusRaw;
23959
23972
  return { provider, status, limit: limit2 };
23960
23973
  }
23974
+ function formatModelTags(tags) {
23975
+ const parsed = parseTagList(tags);
23976
+ return parsed.length > 0 ? parsed.join(", ") : "(none)";
23977
+ }
23978
+ function addModelTagJson(tags, tag) {
23979
+ const existing = parseTagList(tags);
23980
+ if (!existing.includes(tag)) {
23981
+ existing.push(tag);
23982
+ }
23983
+ return JSON.stringify(existing);
23984
+ }
23985
+ function removeModelTagJson(tags, tag) {
23986
+ return JSON.stringify(parseTagList(tags).filter((existingTag) => existingTag !== tag));
23987
+ }
23961
23988
  function registerModelsCommands(program2) {
23962
23989
  const modelsCmd = program2.command("models").description("Manage tracked fine-tuned models");
23963
23990
  const ensureModelExists = async (id) => {
@@ -24018,7 +24045,7 @@ function registerModelsCommands(program2) {
24018
24045
  return;
24019
24046
  }
24020
24047
  console.log();
24021
- const tagsList = model.tags ? JSON.parse(model.tags).join(", ") : "(none)";
24048
+ const tagsList = formatModelTags(model.tags);
24022
24049
  console.log(` ID: ${model.id}`);
24023
24050
  console.log(` Name: ${model.name}`);
24024
24051
  console.log(` Display Name: ${model.displayName ?? "(none)"}`);
@@ -24065,12 +24092,10 @@ function registerModelsCommands(program2) {
24065
24092
  printError(`Model not found: ${id}`);
24066
24093
  process.exit(1);
24067
24094
  }
24068
- const existing = model.tags ? JSON.parse(model.tags) : [];
24069
- if (!existing.includes(tag)) {
24070
- existing.push(tag);
24071
- }
24072
- await db.update(fineTunedModels).set({ tags: JSON.stringify(existing), updatedAt: Date.now() }).where(eq(fineTunedModels.id, id));
24073
- printSuccess(`Tag "${tag}" added. Tags: ${existing.join(", ")}`);
24095
+ const tagsJson = addModelTagJson(model.tags, tag);
24096
+ const updated = parseTagList(tagsJson);
24097
+ await db.update(fineTunedModels).set({ tags: tagsJson, updatedAt: Date.now() }).where(eq(fineTunedModels.id, id));
24098
+ printSuccess(`Tag "${tag}" added. Tags: ${updated.join(", ")}`);
24074
24099
  } catch (err) {
24075
24100
  printError(err instanceof Error ? err.message : String(err));
24076
24101
  process.exit(1);
@@ -24084,9 +24109,9 @@ function registerModelsCommands(program2) {
24084
24109
  printError(`Model not found: ${id}`);
24085
24110
  process.exit(1);
24086
24111
  }
24087
- const existing = model.tags ? JSON.parse(model.tags) : [];
24088
- const updated = existing.filter((t) => t !== tag);
24089
- await db.update(fineTunedModels).set({ tags: JSON.stringify(updated), updatedAt: Date.now() }).where(eq(fineTunedModels.id, id));
24112
+ const tagsJson = removeModelTagJson(model.tags, tag);
24113
+ const updated = parseTagList(tagsJson);
24114
+ await db.update(fineTunedModels).set({ tags: tagsJson, updatedAt: Date.now() }).where(eq(fineTunedModels.id, id));
24090
24115
  printSuccess(`Tag "${tag}" removed. Tags: ${updated.join(", ") || "(none)"}`);
24091
24116
  } catch (err) {
24092
24117
  printError(err instanceof Error ? err.message : String(err));
@@ -1 +1 @@
1
- {"version":3,"file":"mementos.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/mementos.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAA;AAqEhF,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4C7F"}
1
+ {"version":3,"file":"mementos.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/mementos.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAA;AAsEhF,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4C7F"}
@@ -0,0 +1,2 @@
1
+ export declare function parseTagList(value: string | null | undefined): string[];
2
+ //# sourceMappingURL=tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/tags.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAUvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/todos.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAA;AAqEhF,wBAAsB,eAAe,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA+C1F"}
1
+ {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/todos.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAA;AAsEhF,wBAAsB,eAAe,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA+C1F"}
@@ -13,5 +13,6 @@ export interface GathererOptions {
13
13
  limit?: number;
14
14
  since?: Date;
15
15
  outputDir?: string;
16
+ homeDir?: string;
16
17
  }
17
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;QACrC,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;QACrC,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
package/dist/mcp/index.js CHANGED
@@ -19789,6 +19789,22 @@ class ThinkerLabsProvider {
19789
19789
  import { Database as Database3 } from "bun:sqlite";
19790
19790
  import { homedir as homedir8 } from "os";
19791
19791
  import { join as join7 } from "path";
19792
+
19793
+ // src/lib/gatherers/tags.ts
19794
+ function parseTagList(value) {
19795
+ if (!value?.trim())
19796
+ return [];
19797
+ try {
19798
+ const parsed = JSON.parse(value);
19799
+ if (!Array.isArray(parsed))
19800
+ return [];
19801
+ return parsed.filter((tag) => typeof tag === "string");
19802
+ } catch {
19803
+ return [];
19804
+ }
19805
+ }
19806
+
19807
+ // src/lib/gatherers/todos.ts
19792
19808
  var SYSTEM_PROMPT = "You are a task management assistant that helps users create, update, search, and manage tasks and projects.";
19793
19809
  function taskToCreateExample(task) {
19794
19810
  const userMsg = `Create a task: ${task.title}${task.description ? `
@@ -19800,7 +19816,7 @@ Description: ${task.description}` : ""}`;
19800
19816
  description: task.description ?? "",
19801
19817
  status: task.status,
19802
19818
  priority: task.priority,
19803
- tags: JSON.parse(task.tags ?? "[]"),
19819
+ tags: parseTagList(task.tags),
19804
19820
  created_at: task.created_at
19805
19821
  };
19806
19822
  return {
@@ -19839,7 +19855,7 @@ ${matched.map((t) => `- [${t.short_id ?? t.id}] ${t.title} (${t.status})`).join(
19839
19855
  };
19840
19856
  }
19841
19857
  async function gatherFromTodos(options = {}) {
19842
- const dbPath = join7(homedir8(), ".todos", "todos.db");
19858
+ const dbPath = join7(options.homeDir ?? homedir8(), ".todos", "todos.db");
19843
19859
  const db = new Database3(dbPath, { readonly: true, create: false });
19844
19860
  try {
19845
19861
  let query = "SELECT * FROM tasks WHERE 1=1";
@@ -19896,7 +19912,7 @@ Summary: ${memory.summary}` : memory.value
19896
19912
  };
19897
19913
  }
19898
19914
  function memoryToSaveExample(memory) {
19899
- const tags = JSON.parse(memory.tags ?? "[]");
19915
+ const tags = parseTagList(memory.tags);
19900
19916
  return {
19901
19917
  messages: [
19902
19918
  { role: "system", content: SYSTEM_PROMPT2 },
@@ -19927,7 +19943,7 @@ ${matched.map((m) => `- ${m.key}: ${m.value.slice(0, 120)}${m.value.length > 120
19927
19943
  };
19928
19944
  }
19929
19945
  async function gatherFromMementos(options = {}) {
19930
- const dbPath = join9(homedir9(), ".mementos", "mementos.db");
19946
+ const dbPath = join9(options.homeDir ?? homedir9(), ".mementos", "mementos.db");
19931
19947
  const db = new Database4(dbPath, { readonly: true, create: false });
19932
19948
  try {
19933
19949
  let query = "SELECT * FROM memories WHERE status = 'active'";
@@ -19993,7 +20009,7 @@ function windowToExample(window2) {
19993
20009
  return { messages };
19994
20010
  }
19995
20011
  async function gatherFromConversations(options = {}) {
19996
- const dbPath = join10(homedir10(), ".conversations", "messages.db");
20012
+ const dbPath = join10(options.homeDir ?? homedir10(), ".conversations", "messages.db");
19997
20013
  const db = new Database5(dbPath, { readonly: true, create: false });
19998
20014
  try {
19999
20015
  let query = "SELECT * FROM messages WHERE 1=1";
@@ -20049,7 +20065,7 @@ function extractText(content) {
20049
20065
  async function gatherFromSessions(options = {}) {
20050
20066
  const { limit: limit2 = 1000 } = options;
20051
20067
  const examples = [];
20052
- const claudeDir = join11(homedir11(), ".claude", "projects");
20068
+ const claudeDir = join11(options.homeDir ?? homedir11(), ".claude", "projects");
20053
20069
  if (!existsSync5(claudeDir)) {
20054
20070
  return { source: "sessions", examples: [], count: 0 };
20055
20071
  }
@@ -13392,6 +13392,22 @@ function getPackageVersion() {
13392
13392
  import { Database as Database3 } from "bun:sqlite";
13393
13393
  import { homedir as homedir6 } from "os";
13394
13394
  import { join as join4 } from "path";
13395
+
13396
+ // src/lib/gatherers/tags.ts
13397
+ function parseTagList(value) {
13398
+ if (!value?.trim())
13399
+ return [];
13400
+ try {
13401
+ const parsed = JSON.parse(value);
13402
+ if (!Array.isArray(parsed))
13403
+ return [];
13404
+ return parsed.filter((tag) => typeof tag === "string");
13405
+ } catch {
13406
+ return [];
13407
+ }
13408
+ }
13409
+
13410
+ // src/lib/gatherers/todos.ts
13395
13411
  var SYSTEM_PROMPT = "You are a task management assistant that helps users create, update, search, and manage tasks and projects.";
13396
13412
  function taskToCreateExample(task) {
13397
13413
  const userMsg = `Create a task: ${task.title}${task.description ? `
@@ -13403,7 +13419,7 @@ Description: ${task.description}` : ""}`;
13403
13419
  description: task.description ?? "",
13404
13420
  status: task.status,
13405
13421
  priority: task.priority,
13406
- tags: JSON.parse(task.tags ?? "[]"),
13422
+ tags: parseTagList(task.tags),
13407
13423
  created_at: task.created_at
13408
13424
  };
13409
13425
  return {
@@ -13442,7 +13458,7 @@ ${matched.map((t) => `- [${t.short_id ?? t.id}] ${t.title} (${t.status})`).join(
13442
13458
  };
13443
13459
  }
13444
13460
  async function gatherFromTodos(options = {}) {
13445
- const dbPath = join4(homedir6(), ".todos", "todos.db");
13461
+ const dbPath = join4(options.homeDir ?? homedir6(), ".todos", "todos.db");
13446
13462
  const db = new Database3(dbPath, { readonly: true, create: false });
13447
13463
  try {
13448
13464
  let query = "SELECT * FROM tasks WHERE 1=1";
@@ -13499,7 +13515,7 @@ Summary: ${memory.summary}` : memory.value
13499
13515
  };
13500
13516
  }
13501
13517
  function memoryToSaveExample(memory) {
13502
- const tags = JSON.parse(memory.tags ?? "[]");
13518
+ const tags = parseTagList(memory.tags);
13503
13519
  return {
13504
13520
  messages: [
13505
13521
  { role: "system", content: SYSTEM_PROMPT2 },
@@ -13530,7 +13546,7 @@ ${matched.map((m) => `- ${m.key}: ${m.value.slice(0, 120)}${m.value.length > 120
13530
13546
  };
13531
13547
  }
13532
13548
  async function gatherFromMementos(options = {}) {
13533
- const dbPath = join7(homedir8(), ".mementos", "mementos.db");
13549
+ const dbPath = join7(options.homeDir ?? homedir8(), ".mementos", "mementos.db");
13534
13550
  const db = new Database4(dbPath, { readonly: true, create: false });
13535
13551
  try {
13536
13552
  let query = "SELECT * FROM memories WHERE status = 'active'";
@@ -13596,7 +13612,7 @@ function windowToExample(window) {
13596
13612
  return { messages };
13597
13613
  }
13598
13614
  async function gatherFromConversations(options = {}) {
13599
- const dbPath = join9(homedir9(), ".conversations", "messages.db");
13615
+ const dbPath = join9(options.homeDir ?? homedir9(), ".conversations", "messages.db");
13600
13616
  const db = new Database5(dbPath, { readonly: true, create: false });
13601
13617
  try {
13602
13618
  let query = "SELECT * FROM messages WHERE 1=1";
@@ -13652,7 +13668,7 @@ function extractText(content) {
13652
13668
  async function gatherFromSessions(options = {}) {
13653
13669
  const { limit = 1000 } = options;
13654
13670
  const examples = [];
13655
- const claudeDir = join10(homedir10(), ".claude", "projects");
13671
+ const claudeDir = join10(options.homeDir ?? homedir10(), ".claude", "projects");
13656
13672
  if (!existsSync5(claudeDir)) {
13657
13673
  return { source: "sessions", examples: [], count: 0 };
13658
13674
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/brains",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "Fine-tuned model tracker and trainer — wraps OpenAI + Thinker Labs, gathers training data from todos/mementos/conversations/sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",