@kybernesis/brain-contracts 0.1.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.
@@ -0,0 +1,136 @@
1
+ import { z } from 'zod';
2
+ export declare const TimelineEventSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
4
+ type: z.ZodEnum<["conversation", "idea", "file", "transcript", "note", "intake"]>;
5
+ timestamp: z.ZodString;
6
+ endTimestamp: z.ZodOptional<z.ZodString>;
7
+ title: z.ZodString;
8
+ summary: z.ZodOptional<z.ZodString>;
9
+ sourcePath: z.ZodString;
10
+ entities: z.ZodArray<z.ZodString, "many">;
11
+ topics: z.ZodArray<z.ZodString, "many">;
12
+ priority: z.ZodNumber;
13
+ decayScore: z.ZodNumber;
14
+ tier: z.ZodEnum<["hot", "warm", "archive"]>;
15
+ tags: 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>;
21
+ classification: z.ZodOptional<z.ZodString>;
22
+ connectionId: z.ZodOptional<z.ZodString>;
23
+ sourceDid: z.ZodOptional<z.ZodString>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
26
+ id: number;
27
+ priority: number;
28
+ decayScore: number;
29
+ tier: "hot" | "warm" | "archive";
30
+ accessCount: number;
31
+ isPinned: boolean;
32
+ sourcePath: string;
33
+ timestamp: string;
34
+ entities: string[];
35
+ tags: string[];
36
+ title: string;
37
+ topics: string[];
38
+ lastAccessed?: string | undefined;
39
+ projectId?: string | undefined;
40
+ classification?: string | undefined;
41
+ connectionId?: string | undefined;
42
+ sourceDid?: string | undefined;
43
+ endTimestamp?: string | undefined;
44
+ summary?: string | undefined;
45
+ lastEnriched?: string | undefined;
46
+ }, {
47
+ type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
48
+ id: number;
49
+ priority: number;
50
+ decayScore: number;
51
+ tier: "hot" | "warm" | "archive";
52
+ accessCount: number;
53
+ isPinned: boolean;
54
+ sourcePath: string;
55
+ timestamp: string;
56
+ entities: string[];
57
+ tags: string[];
58
+ title: string;
59
+ topics: string[];
60
+ lastAccessed?: string | undefined;
61
+ projectId?: string | undefined;
62
+ classification?: string | undefined;
63
+ connectionId?: string | undefined;
64
+ sourceDid?: string | undefined;
65
+ endTimestamp?: string | undefined;
66
+ summary?: string | undefined;
67
+ lastEnriched?: string | undefined;
68
+ }>;
69
+ export type TimelineEvent = z.infer<typeof TimelineEventSchema>;
70
+ export declare const TimelineEventInputSchema: z.ZodObject<Omit<{
71
+ id: z.ZodNumber;
72
+ type: z.ZodEnum<["conversation", "idea", "file", "transcript", "note", "intake"]>;
73
+ timestamp: z.ZodString;
74
+ endTimestamp: z.ZodOptional<z.ZodString>;
75
+ title: z.ZodString;
76
+ summary: z.ZodOptional<z.ZodString>;
77
+ sourcePath: z.ZodString;
78
+ entities: z.ZodArray<z.ZodString, "many">;
79
+ topics: z.ZodArray<z.ZodString, "many">;
80
+ priority: z.ZodNumber;
81
+ decayScore: z.ZodNumber;
82
+ tier: z.ZodEnum<["hot", "warm", "archive"]>;
83
+ tags: 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>;
89
+ classification: z.ZodOptional<z.ZodString>;
90
+ connectionId: z.ZodOptional<z.ZodString>;
91
+ sourceDid: z.ZodOptional<z.ZodString>;
92
+ }, "id">, "strip", z.ZodTypeAny, {
93
+ type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
94
+ priority: number;
95
+ decayScore: number;
96
+ tier: "hot" | "warm" | "archive";
97
+ accessCount: number;
98
+ isPinned: boolean;
99
+ sourcePath: string;
100
+ timestamp: string;
101
+ entities: string[];
102
+ tags: string[];
103
+ title: string;
104
+ topics: string[];
105
+ lastAccessed?: string | undefined;
106
+ projectId?: string | undefined;
107
+ classification?: string | undefined;
108
+ connectionId?: string | undefined;
109
+ sourceDid?: string | undefined;
110
+ endTimestamp?: string | undefined;
111
+ summary?: string | undefined;
112
+ lastEnriched?: string | undefined;
113
+ }, {
114
+ type: "conversation" | "idea" | "file" | "transcript" | "note" | "intake";
115
+ priority: number;
116
+ decayScore: number;
117
+ tier: "hot" | "warm" | "archive";
118
+ accessCount: number;
119
+ isPinned: boolean;
120
+ sourcePath: string;
121
+ timestamp: string;
122
+ entities: string[];
123
+ tags: string[];
124
+ title: string;
125
+ topics: string[];
126
+ lastAccessed?: string | undefined;
127
+ projectId?: string | undefined;
128
+ classification?: string | undefined;
129
+ connectionId?: string | undefined;
130
+ sourceDid?: string | undefined;
131
+ endTimestamp?: string | undefined;
132
+ summary?: string | undefined;
133
+ lastEnriched?: string | undefined;
134
+ }>;
135
+ export type TimelineEventInput = z.infer<typeof TimelineEventInputSchema>;
136
+ //# sourceMappingURL=timeline.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { EventTypeSchema, TierSchema } from './constants.js';
3
+ // Maps to timeline_events table in timeline.db.
4
+ export const TimelineEventSchema = z.object({
5
+ id: z.number().int(),
6
+ type: EventTypeSchema,
7
+ timestamp: z.string(),
8
+ endTimestamp: z.string().optional(),
9
+ title: z.string(),
10
+ summary: z.string().optional(),
11
+ sourcePath: z.string(), // UNIQUE
12
+ entities: z.array(z.string()),
13
+ topics: z.array(z.string()),
14
+ priority: z.number(),
15
+ decayScore: z.number(),
16
+ tier: TierSchema,
17
+ tags: z.array(z.string()),
18
+ lastEnriched: z.string().optional(),
19
+ accessCount: z.number().int(),
20
+ isPinned: z.boolean(),
21
+ lastAccessed: z.string().optional(),
22
+ // 4 flat scope columns (no nested scopes object — matches KAD wire shape)
23
+ projectId: z.string().optional(),
24
+ classification: z.string().optional(),
25
+ connectionId: z.string().optional(),
26
+ sourceDid: z.string().optional(),
27
+ });
28
+ // Input shape for addToTimeline — id is assigned by the DB.
29
+ export const TimelineEventInputSchema = TimelineEventSchema.omit({ id: true });
30
+ //# sourceMappingURL=timeline.js.map
@@ -0,0 +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,gDAAgD;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACpB,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAI,SAAS;IACnC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,0EAA0E;IAC1E,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAIH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@kybernesis/brain-contracts",
3
+ "version": "0.1.0",
4
+ "description": "Zod schemas, provider interfaces, and shared types for the Kybernesis brain library",
5
+ "license": "MIT",
6
+ "author": "David Cruwys (AppyDave)",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/KybernesisAI/cortex.git",
10
+ "directory": "packages/brain-contracts"
11
+ },
12
+ "homepage": "https://github.com/KybernesisAI/cortex/tree/main/packages/brain-contracts#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/KybernesisAI/cortex/issues"
15
+ },
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./tenant": {
25
+ "types": "./dist/tenant.d.ts",
26
+ "default": "./dist/tenant.js"
27
+ },
28
+ "./constants": {
29
+ "types": "./dist/constants.d.ts",
30
+ "default": "./dist/constants.js"
31
+ },
32
+ "./timeline": {
33
+ "types": "./dist/timeline.d.ts",
34
+ "default": "./dist/timeline.js"
35
+ },
36
+ "./entity": {
37
+ "types": "./dist/entity.d.ts",
38
+ "default": "./dist/entity.js"
39
+ },
40
+ "./fact": {
41
+ "types": "./dist/fact.d.ts",
42
+ "default": "./dist/fact.js"
43
+ },
44
+ "./sleep": {
45
+ "types": "./dist/sleep.d.ts",
46
+ "default": "./dist/sleep.js"
47
+ },
48
+ "./logger": {
49
+ "types": "./dist/logger.d.ts",
50
+ "default": "./dist/logger.js"
51
+ }
52
+ },
53
+ "files": [
54
+ "dist",
55
+ "README.md"
56
+ ],
57
+ "dependencies": {
58
+ "zod": "^3.23.0"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "scripts": {
64
+ "build": "tsc -b",
65
+ "clean": "tsc -b --clean",
66
+ "typecheck": "tsc -b"
67
+ }
68
+ }