@kybernesis/brain-contracts 0.1.6 → 0.2.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.
package/dist/sleep.js CHANGED
@@ -1,62 +1,64 @@
1
1
  import { z } from 'zod';
2
2
  import { MemoryEdgeRelationSchema, MemoryEdgeMethodSchema, SleepStatusSchema } from './constants.js';
3
+ // Field names are snake_case to match the DB columns / KAD's brain object shapes.
4
+ // This is deliberate and load-bearing — see the header note in `entity.ts`.
3
5
  // Maps to sleep_runs table in sleep.db.
4
6
  export const SleepRunSchema = z.object({
5
7
  id: z.number().int(),
6
- startedAt: z.string(),
7
- completedAt: z.string().optional(),
8
+ started_at: z.string(),
9
+ completed_at: z.string().optional(),
8
10
  status: SleepStatusSchema,
9
- checkpointStep: z.string().optional(),
10
- checkpointData: z.string().optional(),
11
+ checkpoint_step: z.string().optional(),
12
+ checkpoint_data: z.string().optional(),
11
13
  metrics: z.string().optional(),
12
- errorMessage: z.string().optional(),
13
- createdAt: z.string(),
14
+ error_message: z.string().optional(),
15
+ created_at: z.string(),
14
16
  });
15
17
  // Maps to memory_edges table in sleep.db.
16
18
  export const MemoryEdgeSchema = z.object({
17
19
  id: z.number().int(),
18
- fromPath: z.string(),
19
- toPath: z.string(), // UNIQUE(fromPath, toPath)
20
+ from_path: z.string(),
21
+ to_path: z.string(), // UNIQUE(from_path, to_path)
20
22
  relation: MemoryEdgeRelationSchema,
21
23
  weight: z.number(),
22
24
  confidence: z.number(),
23
- sharedTags: z.string().optional(),
25
+ shared_tags: z.string().optional(),
24
26
  rationale: z.string().optional(),
25
27
  method: MemoryEdgeMethodSchema,
26
- createdAt: z.string(),
27
- lastVerified: z.string().optional(),
28
+ created_at: z.string(),
29
+ last_verified: z.string().optional(),
28
30
  });
29
31
  // Maps to maintenance_queue table in sleep.db.
30
32
  export const MaintenanceItemTypeSchema = z.enum(['timeline', 'entity', 'file']);
31
33
  export const MaintenanceQueueItemSchema = z.object({
32
34
  id: z.number().int(),
33
- itemType: MaintenanceItemTypeSchema,
34
- itemId: z.string(),
35
+ item_type: MaintenanceItemTypeSchema,
36
+ item_id: z.string(),
35
37
  task: z.string(),
36
38
  priority: z.number().int(),
37
- createdAt: z.string(),
38
- processedAt: z.string().optional(),
39
- errorMessage: z.string().optional(),
39
+ created_at: z.string(),
40
+ processed_at: z.string().optional(),
41
+ error_message: z.string().optional(),
40
42
  });
41
43
  // Maps to sleep_telemetry table in sleep.db.
42
44
  export const SleepTelemetrySchema = z.object({
43
45
  id: z.number().int(),
44
- runId: z.number().int().optional(),
46
+ run_id: z.number().int().optional(),
45
47
  step: z.string(),
46
- eventType: z.string(),
48
+ event_type: z.string(),
47
49
  count: z.number().int(),
48
- durationMs: z.number().int().optional(),
50
+ duration_ms: z.number().int().optional(),
49
51
  metadata: z.string().optional(),
50
- createdAt: z.string(),
52
+ created_at: z.string(),
51
53
  });
52
54
  // Maps to tier_transitions table in sleep.db (created lazily).
53
55
  export const TierTransitionSchema = z.object({
54
56
  id: z.number().int(),
55
- itemId: z.number().int(),
56
- fromTier: z.string().optional(),
57
- toTier: z.string(),
57
+ item_id: z.number().int(),
58
+ from_tier: z.string().optional(),
59
+ to_tier: z.string(),
58
60
  reason: z.string().optional(),
59
- createdAt: z.string(),
61
+ created_at: z.string(),
60
62
  });
61
63
  // Maps to chunk_meta table in vectors.db.
62
64
  export const VectorChunkMetaSchema = z.object({
@@ -64,6 +66,6 @@ export const VectorChunkMetaSchema = z.object({
64
66
  ts: z.string(),
65
67
  source: z.string().optional(),
66
68
  content: z.string(),
67
- originId: z.string().optional(),
69
+ origin_id: z.string().optional(),
68
70
  });
69
71
  //# sourceMappingURL=sleep.js.map
package/dist/sleep.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../src/sleep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,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MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAGH,0CAA0C;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACvB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
@@ -3,134 +3,134 @@ export declare const TimelineEventSchema: z.ZodObject<{
3
3
  id: z.ZodNumber;
4
4
  type: z.ZodEnum<["conversation", "idea", "file", "transcript", "note", "intake"]>;
5
5
  timestamp: z.ZodString;
6
- endTimestamp: z.ZodOptional<z.ZodString>;
6
+ end_timestamp: z.ZodOptional<z.ZodString>;
7
7
  title: z.ZodString;
8
8
  summary: z.ZodOptional<z.ZodString>;
9
- sourcePath: z.ZodString;
9
+ source_path: z.ZodString;
10
10
  entities: z.ZodArray<z.ZodString, "many">;
11
11
  topics: z.ZodArray<z.ZodString, "many">;
12
12
  priority: z.ZodNumber;
13
- decayScore: z.ZodNumber;
13
+ decay_score: z.ZodNumber;
14
14
  tier: z.ZodEnum<["hot", "warm", "archive"]>;
15
15
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
- lastEnriched: z.ZodOptional<z.ZodString>;
17
- accessCount: z.ZodNumber;
18
- isPinned: z.ZodBoolean;
19
- lastAccessed: z.ZodOptional<z.ZodString>;
20
- projectId: z.ZodOptional<z.ZodString>;
16
+ last_enriched: z.ZodOptional<z.ZodString>;
17
+ access_count: z.ZodNumber;
18
+ is_pinned: z.ZodBoolean;
19
+ last_accessed: z.ZodOptional<z.ZodString>;
20
+ project_id: z.ZodOptional<z.ZodString>;
21
21
  classification: z.ZodOptional<z.ZodString>;
22
- connectionId: z.ZodOptional<z.ZodString>;
23
- sourceDid: z.ZodOptional<z.ZodString>;
22
+ connection_id: z.ZodOptional<z.ZodString>;
23
+ source_did: z.ZodOptional<z.ZodString>;
24
24
  }, "strip", z.ZodTypeAny, {
25
25
  id: number;
26
26
  type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
27
+ priority: number;
28
+ decay_score: number;
29
+ tier: "hot" | "warm" | "archive";
30
+ access_count: number;
31
+ is_pinned: boolean;
32
+ source_path: string;
27
33
  timestamp: string;
28
- title: string;
29
- sourcePath: string;
30
34
  entities: string[];
35
+ title: string;
31
36
  topics: string[];
32
- priority: number;
33
- decayScore: number;
34
- tier: "hot" | "warm" | "archive";
35
- accessCount: number;
36
- isPinned: boolean;
37
- endTimestamp?: string | undefined;
38
- summary?: string | undefined;
37
+ last_accessed?: string | undefined;
38
+ project_id?: string | undefined;
39
39
  tags?: string[] | undefined;
40
- lastEnriched?: string | undefined;
41
- lastAccessed?: string | undefined;
42
- projectId?: string | undefined;
43
40
  classification?: string | undefined;
44
- connectionId?: string | undefined;
45
- sourceDid?: string | undefined;
41
+ connection_id?: string | undefined;
42
+ source_did?: string | undefined;
43
+ end_timestamp?: string | undefined;
44
+ summary?: string | undefined;
45
+ last_enriched?: string | undefined;
46
46
  }, {
47
47
  id: number;
48
48
  type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
49
+ priority: number;
50
+ decay_score: number;
51
+ tier: "hot" | "warm" | "archive";
52
+ access_count: number;
53
+ is_pinned: boolean;
54
+ source_path: string;
49
55
  timestamp: string;
50
- title: string;
51
- sourcePath: string;
52
56
  entities: string[];
57
+ title: string;
53
58
  topics: string[];
54
- priority: number;
55
- decayScore: number;
56
- tier: "hot" | "warm" | "archive";
57
- accessCount: number;
58
- isPinned: boolean;
59
- endTimestamp?: string | undefined;
60
- summary?: string | undefined;
59
+ last_accessed?: string | undefined;
60
+ project_id?: string | undefined;
61
61
  tags?: string[] | undefined;
62
- lastEnriched?: string | undefined;
63
- lastAccessed?: string | undefined;
64
- projectId?: string | undefined;
65
62
  classification?: string | undefined;
66
- connectionId?: string | undefined;
67
- sourceDid?: string | undefined;
63
+ connection_id?: string | undefined;
64
+ source_did?: string | undefined;
65
+ end_timestamp?: string | undefined;
66
+ summary?: string | undefined;
67
+ last_enriched?: string | undefined;
68
68
  }>;
69
69
  export type TimelineEvent = z.infer<typeof TimelineEventSchema>;
70
70
  export declare const TimelineEventInputSchema: z.ZodObject<Omit<{
71
71
  id: z.ZodNumber;
72
72
  type: z.ZodEnum<["conversation", "idea", "file", "transcript", "note", "intake"]>;
73
73
  timestamp: z.ZodString;
74
- endTimestamp: z.ZodOptional<z.ZodString>;
74
+ end_timestamp: z.ZodOptional<z.ZodString>;
75
75
  title: z.ZodString;
76
76
  summary: z.ZodOptional<z.ZodString>;
77
- sourcePath: z.ZodString;
77
+ source_path: z.ZodString;
78
78
  entities: z.ZodArray<z.ZodString, "many">;
79
79
  topics: z.ZodArray<z.ZodString, "many">;
80
80
  priority: z.ZodNumber;
81
- decayScore: z.ZodNumber;
81
+ decay_score: z.ZodNumber;
82
82
  tier: z.ZodEnum<["hot", "warm", "archive"]>;
83
83
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
84
- lastEnriched: z.ZodOptional<z.ZodString>;
85
- accessCount: z.ZodNumber;
86
- isPinned: z.ZodBoolean;
87
- lastAccessed: z.ZodOptional<z.ZodString>;
88
- projectId: z.ZodOptional<z.ZodString>;
84
+ last_enriched: z.ZodOptional<z.ZodString>;
85
+ access_count: z.ZodNumber;
86
+ is_pinned: z.ZodBoolean;
87
+ last_accessed: z.ZodOptional<z.ZodString>;
88
+ project_id: z.ZodOptional<z.ZodString>;
89
89
  classification: z.ZodOptional<z.ZodString>;
90
- connectionId: z.ZodOptional<z.ZodString>;
91
- sourceDid: z.ZodOptional<z.ZodString>;
90
+ connection_id: z.ZodOptional<z.ZodString>;
91
+ source_did: z.ZodOptional<z.ZodString>;
92
92
  }, "id">, "strip", z.ZodTypeAny, {
93
93
  type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
94
+ priority: number;
95
+ decay_score: number;
96
+ tier: "hot" | "warm" | "archive";
97
+ access_count: number;
98
+ is_pinned: boolean;
99
+ source_path: string;
94
100
  timestamp: string;
95
- title: string;
96
- sourcePath: string;
97
101
  entities: string[];
102
+ title: string;
98
103
  topics: string[];
99
- priority: number;
100
- decayScore: number;
101
- tier: "hot" | "warm" | "archive";
102
- accessCount: number;
103
- isPinned: boolean;
104
- endTimestamp?: string | undefined;
105
- summary?: string | undefined;
104
+ last_accessed?: string | undefined;
105
+ project_id?: string | undefined;
106
106
  tags?: string[] | undefined;
107
- lastEnriched?: string | undefined;
108
- lastAccessed?: string | undefined;
109
- projectId?: string | undefined;
110
107
  classification?: string | undefined;
111
- connectionId?: string | undefined;
112
- sourceDid?: string | undefined;
108
+ connection_id?: string | undefined;
109
+ source_did?: string | undefined;
110
+ end_timestamp?: string | undefined;
111
+ summary?: string | undefined;
112
+ last_enriched?: string | undefined;
113
113
  }, {
114
114
  type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
115
+ priority: number;
116
+ decay_score: number;
117
+ tier: "hot" | "warm" | "archive";
118
+ access_count: number;
119
+ is_pinned: boolean;
120
+ source_path: string;
115
121
  timestamp: string;
116
- title: string;
117
- sourcePath: string;
118
122
  entities: string[];
123
+ title: string;
119
124
  topics: string[];
120
- priority: number;
121
- decayScore: number;
122
- tier: "hot" | "warm" | "archive";
123
- accessCount: number;
124
- isPinned: boolean;
125
- endTimestamp?: string | undefined;
126
- summary?: string | undefined;
125
+ last_accessed?: string | undefined;
126
+ project_id?: string | undefined;
127
127
  tags?: string[] | undefined;
128
- lastEnriched?: string | undefined;
129
- lastAccessed?: string | undefined;
130
- projectId?: string | undefined;
131
128
  classification?: string | undefined;
132
- connectionId?: string | undefined;
133
- sourceDid?: string | undefined;
129
+ connection_id?: string | undefined;
130
+ source_did?: string | undefined;
131
+ end_timestamp?: string | undefined;
132
+ summary?: string | undefined;
133
+ last_enriched?: string | undefined;
134
134
  }>;
135
135
  export type TimelineEventInput = z.infer<typeof TimelineEventInputSchema>;
136
136
  //# sourceMappingURL=timeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuB9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyC,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuB9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyC,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/dist/timeline.js CHANGED
@@ -1,29 +1,31 @@
1
1
  import { z } from 'zod';
2
2
  import { EventTypeSchema, TierSchema } from './constants.js';
3
+ // Field names are snake_case to match KAD's canonical brain object interfaces.
4
+ // This is deliberate and load-bearing — see the header note in `entity.ts`.
3
5
  // Maps to timeline_events table in timeline.db.
4
6
  export const TimelineEventSchema = z.object({
5
7
  id: z.number().int(),
6
8
  type: EventTypeSchema,
7
9
  timestamp: z.string(),
8
- endTimestamp: z.string().optional(),
10
+ end_timestamp: z.string().optional(),
9
11
  title: z.string(),
10
12
  summary: z.string().optional(),
11
- sourcePath: z.string(), // UNIQUE
13
+ source_path: z.string(), // UNIQUE
12
14
  entities: z.array(z.string()),
13
15
  topics: z.array(z.string()),
14
16
  priority: z.number(),
15
- decayScore: z.number(),
17
+ decay_score: z.number(),
16
18
  tier: TierSchema,
17
19
  tags: z.array(z.string()).optional(),
18
- lastEnriched: z.string().optional(),
19
- accessCount: z.number().int(),
20
- isPinned: z.boolean(),
21
- lastAccessed: z.string().optional(),
20
+ last_enriched: z.string().optional(),
21
+ access_count: z.number().int(),
22
+ is_pinned: z.boolean(),
23
+ last_accessed: z.string().optional(),
22
24
  // 4 flat scope columns (no nested scopes object — matches KAD wire shape)
23
- projectId: z.string().optional(),
25
+ project_id: z.string().optional(),
24
26
  classification: z.string().optional(),
25
- connectionId: z.string().optional(),
26
- sourceDid: z.string().optional(),
27
+ connection_id: z.string().optional(),
28
+ source_did: z.string().optional(),
27
29
  });
28
30
  // Input shape for addToTimeline — id is assigned by the DB.
29
31
  export const TimelineEventInputSchema = TimelineEventSchema.omit({ id: true });
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,gDAA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AAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,0EAA0E;IAC1E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAIH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/brain-contracts",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "description": "Zod schemas, provider interfaces, and shared types for the Kybernesis brain library",
5
5
  "license": "MIT",
6
6
  "author": "David Cruwys (AppyDave)",