@hasna/brains 0.0.8 → 0.0.9

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.
Files changed (40) hide show
  1. package/LICENSE +170 -0
  2. package/dist/cli/index.js +635 -998
  3. package/dist/db/index.d.ts.map +1 -1
  4. package/dist/index.js +142 -4294
  5. package/dist/lib/gatherers/index.d.ts +0 -3
  6. package/dist/lib/gatherers/index.d.ts.map +1 -1
  7. package/dist/lib/index.d.ts +0 -3
  8. package/dist/lib/index.d.ts.map +1 -1
  9. package/dist/lib/providers/openai.d.ts +0 -2
  10. package/dist/lib/providers/openai.d.ts.map +1 -1
  11. package/dist/lib/providers/thinker-labs.d.ts +0 -1
  12. package/dist/lib/providers/thinker-labs.d.ts.map +1 -1
  13. package/dist/mcp/index.d.ts.map +1 -1
  14. package/dist/mcp/index.js +195 -4584
  15. package/dist/server/index.d.ts +1 -1
  16. package/dist/server/index.d.ts.map +1 -1
  17. package/dist/server/index.js +9 -4638
  18. package/package.json +2 -1
  19. package/dist/lib/config.d.ts +0 -11
  20. package/dist/lib/config.d.ts.map +0 -1
  21. package/dist/lib/gatherers/assistants.d.ts +0 -3
  22. package/dist/lib/gatherers/assistants.d.ts.map +0 -1
  23. package/dist/lib/gatherers/economy.d.ts +0 -3
  24. package/dist/lib/gatherers/economy.d.ts.map +0 -1
  25. package/dist/lib/gatherers/protocol.d.ts +0 -29
  26. package/dist/lib/gatherers/protocol.d.ts.map +0 -1
  27. package/dist/lib/gatherers/recordings.d.ts +0 -3
  28. package/dist/lib/gatherers/recordings.d.ts.map +0 -1
  29. package/dist/lib/gatherers/registry.d.ts +0 -7
  30. package/dist/lib/gatherers/registry.d.ts.map +0 -1
  31. package/dist/lib/gatherers/researcher.d.ts +0 -3
  32. package/dist/lib/gatherers/researcher.d.ts.map +0 -1
  33. package/dist/lib/gatherers/styles.d.ts +0 -3
  34. package/dist/lib/gatherers/styles.d.ts.map +0 -1
  35. package/dist/lib/gatherers/tickets.d.ts +0 -3
  36. package/dist/lib/gatherers/tickets.d.ts.map +0 -1
  37. package/dist/lib/retry.d.ts +0 -7
  38. package/dist/lib/retry.d.ts.map +0 -1
  39. package/dist/lib/schemas.d.ts +0 -87
  40. package/dist/lib/schemas.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/brains",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
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",
@@ -46,6 +46,7 @@
46
46
  "cli"
47
47
  ],
48
48
  "publishConfig": {
49
+ "registry": "https://registry.npmjs.org",
49
50
  "access": "public"
50
51
  },
51
52
  "repository": {
@@ -1,11 +0,0 @@
1
- export declare const CONFIG_KEYS: readonly ["OPENAI_API_KEY", "THINKER_LABS_API_KEY", "THINKER_LABS_BASE_URL"];
2
- export type ConfigKey = (typeof CONFIG_KEYS)[number];
3
- export declare function getConfigValue(key: ConfigKey): string | undefined;
4
- export declare function setConfigValue(key: ConfigKey, value: string): void;
5
- export declare function listConfig(): Array<{
6
- key: ConfigKey;
7
- value: string;
8
- source: "env" | "file" | "unset";
9
- }>;
10
- export declare function deleteConfigValue(key: ConfigKey): void;
11
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,8EAA+E,CAAC;AACxG,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAkBrD,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAIjE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIlE;AAED,wBAAgB,UAAU,IAAI,KAAK,CAAC;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,CAOvG;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAItD"}
@@ -1,3 +0,0 @@
1
- import type { GatherResult, GathererOptions } from "./types.js";
2
- export declare function gatherFromAssistants(options?: GathererOptions): Promise<GatherResult>;
3
- //# sourceMappingURL=assistants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assistants.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/assistants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAIjF,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAwC/F"}
@@ -1,3 +0,0 @@
1
- import type { GatherResult, GathererOptions } from "./types.js";
2
- export declare function gatherFromEconomy(options?: GathererOptions): Promise<GatherResult>;
3
- //# sourceMappingURL=economy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"economy.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/economy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAIjF,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiD5F"}
@@ -1,29 +0,0 @@
1
- import type { GathererOptions, GatherResult } from "./types.js";
2
- /**
3
- * A function that gathers training examples from a data source.
4
- * Implemented by each open-* repo and exported from their SDK.
5
- *
6
- * @example
7
- * // In open-styles:
8
- * export const gatherTrainingData: GatherTrainingDataFn = async (options) => { ... }
9
- *
10
- * // In open-brains gatherer registry:
11
- * import { gatherTrainingData } from "@hasnaxyz/styles";
12
- * registerGatherer("styles", gatherTrainingData);
13
- */
14
- export type GatherTrainingDataFn = (options?: GathererOptions) => Promise<GatherResult>;
15
- /**
16
- * A named, registered training data provider.
17
- * Used by the gatherer registry to map source names to gatherer functions.
18
- */
19
- export interface TrainingDataProvider {
20
- /** Source name used in `brains data gather --source <name>` */
21
- name: string;
22
- /** The gather function — imported from the repo's SDK */
23
- gather: GatherTrainingDataFn;
24
- /** Human-readable description shown in `brains data gather --list` */
25
- description: string;
26
- /** Optional: package name of the SDK this gatherer comes from */
27
- package?: string;
28
- }
29
- //# sourceMappingURL=protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/protocol.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAExF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,MAAM,EAAE,oBAAoB,CAAC;IAC7B,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -1,3 +0,0 @@
1
- import type { GatherResult, GathererOptions } from "./types.js";
2
- export declare function gatherFromRecordings(options?: GathererOptions): Promise<GatherResult>;
3
- //# sourceMappingURL=recordings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recordings.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/recordings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAIjF,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA8C/F"}
@@ -1,7 +0,0 @@
1
- import type { GatherTrainingDataFn, TrainingDataProvider } from "./protocol.js";
2
- export declare function registerGatherer(provider: TrainingDataProvider): void;
3
- export declare function getRegisteredSources(): string[];
4
- export declare function getGatherer(name: string): GatherTrainingDataFn | undefined;
5
- export declare function getProvider(name: string): TrainingDataProvider | undefined;
6
- export declare function getAllProviders(): TrainingDataProvider[];
7
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAchF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAErE;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE1E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE1E;AAED,wBAAgB,eAAe,IAAI,oBAAoB,EAAE,CAExD"}
@@ -1,3 +0,0 @@
1
- import type { GatherResult, GathererOptions } from "./types.js";
2
- export declare function gatherFromResearcher(options?: GathererOptions): Promise<GatherResult>;
3
- //# sourceMappingURL=researcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"researcher.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/researcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAIjF,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAgD/F"}
@@ -1,3 +0,0 @@
1
- import type { GatherResult, GathererOptions } from "./types.js";
2
- export declare function gatherFromStyles(options?: GathererOptions): Promise<GatherResult>;
3
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/styles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAIjF,wBAAsB,gBAAgB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA2D3F"}
@@ -1,3 +0,0 @@
1
- import type { GatherResult, GathererOptions } from "./types.js";
2
- export declare function gatherFromTickets(options?: GathererOptions): Promise<GatherResult>;
3
- //# sourceMappingURL=tickets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tickets.d.ts","sourceRoot":"","sources":["../../../src/lib/gatherers/tickets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAIjF,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAkC5F"}
@@ -1,7 +0,0 @@
1
- export interface RetryOptions {
2
- maxAttempts?: number;
3
- baseDelayMs?: number;
4
- onRetry?: (attempt: number, delayMs: number, error: Error) => void;
5
- }
6
- export declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
7
- //# sourceMappingURL=retry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/lib/retry.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACpE;AA0BD,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
@@ -1,87 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ProviderSchema: z.ZodEnum<["openai", "thinker-labs"]>;
3
- export declare const FinetuneStartSchema: z.ZodObject<{
4
- provider: z.ZodEnum<["openai", "thinker-labs"]>;
5
- baseModel: z.ZodString;
6
- dataset: z.ZodOptional<z.ZodString>;
7
- name: z.ZodString;
8
- }, "strip", z.ZodTypeAny, {
9
- baseModel: string;
10
- name: string;
11
- provider: "openai" | "thinker-labs";
12
- dataset?: string | undefined;
13
- }, {
14
- baseModel: string;
15
- name: string;
16
- provider: "openai" | "thinker-labs";
17
- dataset?: string | undefined;
18
- }>;
19
- export declare const GatherOptionsSchema: z.ZodObject<{
20
- source: z.ZodDefault<z.ZodEnum<["todos", "mementos", "conversations", "sessions", "all"]>>;
21
- output: z.ZodOptional<z.ZodString>;
22
- limit: z.ZodDefault<z.ZodNumber>;
23
- }, "strip", z.ZodTypeAny, {
24
- source: "todos" | "mementos" | "conversations" | "sessions" | "all";
25
- limit: number;
26
- output?: string | undefined;
27
- }, {
28
- source?: "todos" | "mementos" | "conversations" | "sessions" | "all" | undefined;
29
- limit?: number | undefined;
30
- output?: string | undefined;
31
- }>;
32
- export declare const ModelUpdateSchema: z.ZodObject<{
33
- displayName: z.ZodOptional<z.ZodString>;
34
- description: z.ZodOptional<z.ZodString>;
35
- collection: z.ZodOptional<z.ZodString>;
36
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
37
- }, "strip", z.ZodTypeAny, {
38
- displayName?: string | undefined;
39
- description?: string | undefined;
40
- collection?: string | undefined;
41
- tags?: string[] | undefined;
42
- }, {
43
- displayName?: string | undefined;
44
- description?: string | undefined;
45
- collection?: string | undefined;
46
- tags?: string[] | undefined;
47
- }>;
48
- export declare const McpGatherSchema: z.ZodObject<{
49
- sources: z.ZodArray<z.ZodEnum<["todos", "mementos", "conversations", "sessions"]>, "many">;
50
- limit: z.ZodOptional<z.ZodNumber>;
51
- output_dir: z.ZodOptional<z.ZodString>;
52
- }, "strip", z.ZodTypeAny, {
53
- sources: ("todos" | "mementos" | "conversations" | "sessions")[];
54
- limit?: number | undefined;
55
- output_dir?: string | undefined;
56
- }, {
57
- sources: ("todos" | "mementos" | "conversations" | "sessions")[];
58
- limit?: number | undefined;
59
- output_dir?: string | undefined;
60
- }>;
61
- export declare const McpFinetuneStartSchema: z.ZodObject<{
62
- provider: z.ZodEnum<["openai", "thinker-labs"]>;
63
- base_model: z.ZodString;
64
- dataset_path: z.ZodOptional<z.ZodString>;
65
- name: z.ZodOptional<z.ZodString>;
66
- }, "strip", z.ZodTypeAny, {
67
- base_model: string;
68
- provider: "openai" | "thinker-labs";
69
- name?: string | undefined;
70
- dataset_path?: string | undefined;
71
- }, {
72
- base_model: string;
73
- provider: "openai" | "thinker-labs";
74
- name?: string | undefined;
75
- dataset_path?: string | undefined;
76
- }>;
77
- export declare const McpFinetuneStatusSchema: z.ZodObject<{
78
- job_id: z.ZodString;
79
- provider: z.ZodEnum<["openai", "thinker-labs"]>;
80
- }, "strip", z.ZodTypeAny, {
81
- provider: "openai" | "thinker-labs";
82
- job_id: string;
83
- }, {
84
- provider: "openai" | "thinker-labs";
85
- job_id: string;
86
- }>;
87
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/lib/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,uCAEzB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAKjC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC"}