@gdrl/kronos-lib 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,364 @@
1
+ type IngestStatus = 'queued' | 'chunking' | 'embedding' | 'processing' | 'complete' | 'failed';
2
+ type IngestPriorityBand = 'low' | 'medium' | 'high';
3
+ type IngestMemoryDisposition = 'requested' | 'skipped_by_request';
4
+ interface IngestRequest {
5
+ app_id: string;
6
+ tenant_user_id: string;
7
+ source_type: string;
8
+ priority?: IngestPriorityBand;
9
+ addToMemory?: boolean;
10
+ content: {
11
+ type: 'text';
12
+ text: string;
13
+ };
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+ interface IngestResponse {
17
+ ingest_id: string;
18
+ }
19
+ interface IngestStatusResponse {
20
+ ingest_id: string;
21
+ tenant_user_id: string;
22
+ status: IngestStatus;
23
+ memory: {
24
+ requested: boolean;
25
+ disposition: IngestMemoryDisposition;
26
+ };
27
+ progress: {
28
+ chunks_total: number;
29
+ chunks_embedded: number;
30
+ chunks_dispatched: number;
31
+ jobs_accepted: number;
32
+ };
33
+ error: {
34
+ code: string;
35
+ message: string;
36
+ } | null;
37
+ }
38
+ interface CreateMCPServerRequest {
39
+ app_id: string;
40
+ tenant_user_id: string;
41
+ /** Omit or pass [] for all-memory access. */
42
+ scope_ids?: string[] | null;
43
+ name: string;
44
+ description?: string;
45
+ options?: {
46
+ /** Expose `search_skills` and `read_skill`. Defaults to true. */
47
+ exposeSkillsTool?: boolean;
48
+ /** Expose the read-only `context_graph` tool. Defaults to false. */
49
+ exposeContextGraphTool?: boolean;
50
+ };
51
+ }
52
+ type MCPServerStatus = 'active' | 'disabled';
53
+ interface MCPServerToolCapabilities {
54
+ skills: boolean;
55
+ context_graph: boolean;
56
+ }
57
+ interface CreateMCPServerResponse {
58
+ mcp_server_id: string;
59
+ url: string;
60
+ status: MCPServerStatus;
61
+ name: string;
62
+ description: string | null;
63
+ scope_ids: string[];
64
+ tool_capabilities: MCPServerToolCapabilities;
65
+ }
66
+ interface MCPServerDetails {
67
+ mcp_server_id: string;
68
+ app_id: string;
69
+ tenant_user_id: string;
70
+ scope_ids: string[];
71
+ status: MCPServerStatus;
72
+ name: string;
73
+ description: string | null;
74
+ tool_capabilities: MCPServerToolCapabilities;
75
+ created_at: string;
76
+ updated_at: string;
77
+ }
78
+ interface ListMCPServersResponse {
79
+ servers: MCPServerDetails[];
80
+ count: number;
81
+ }
82
+ interface GetMCPServerResponse extends MCPServerDetails {
83
+ }
84
+ interface ConnectMCPServerRequest {
85
+ app_id: string;
86
+ tenant_user_id: string;
87
+ }
88
+ interface ConnectMCPServerResponse {
89
+ mcp_server_id: string;
90
+ url: string;
91
+ access_token: string;
92
+ expires_at: string;
93
+ }
94
+ interface RotateMCPServerTokenRequest {
95
+ app_id: string;
96
+ tenant_user_id: string;
97
+ }
98
+ interface RotateMCPServerTokenResponse {
99
+ token: string;
100
+ }
101
+ interface MemoryStatsResponse {
102
+ claim_count: number;
103
+ observation_count: number;
104
+ artifact_count: number;
105
+ scope_count: number;
106
+ }
107
+ interface ScratchsheetResponse {
108
+ scratchsheet: string | null;
109
+ updated_at: string | null;
110
+ }
111
+ interface ScopeSummary {
112
+ scope_id: string;
113
+ name: string;
114
+ claim_count: number;
115
+ }
116
+ interface ScopeDetail {
117
+ scope_id: string;
118
+ name: string;
119
+ claim_count: number;
120
+ mcp_server_ids: string[];
121
+ include_query: string;
122
+ exclude_query: string | null;
123
+ match_mode: 'strict' | 'broad';
124
+ allowed_source_types: string[] | null;
125
+ time_start: string | null;
126
+ time_end: string | null;
127
+ description: string | null;
128
+ created_by: string | null;
129
+ last_refreshed_at: string | null;
130
+ created_at: string;
131
+ updated_at: string;
132
+ }
133
+ interface ListScopesResponse {
134
+ scopes: ScopeDetail[];
135
+ count: number;
136
+ }
137
+ interface GetScopeResponse {
138
+ scope: ScopeDetail;
139
+ }
140
+ interface ScopeSpec {
141
+ name: string;
142
+ include_query: string;
143
+ exclude_query?: string;
144
+ match_mode?: 'strict' | 'broad';
145
+ time_range?: {
146
+ start?: string;
147
+ end?: string;
148
+ };
149
+ allowed_source_types?: string[] | 'all';
150
+ }
151
+ interface CreateScopeRequest {
152
+ app_id: string;
153
+ tenant_user_id: string;
154
+ spec: ScopeSpec;
155
+ created_by: string;
156
+ description?: string;
157
+ }
158
+ interface CreateScopeResponse {
159
+ scope_id: string;
160
+ backfill_job_id: string;
161
+ mcp_server_id?: string | null;
162
+ mcp_server_error?: string | null;
163
+ }
164
+ interface UpdateScopeResponse {
165
+ scope_id: string;
166
+ updated: boolean;
167
+ backfill_job_id?: string;
168
+ }
169
+ type TriggerType = 'cron_recurring' | 'cron_oneoff' | 'nl_webhook';
170
+ type OnTriggered = {
171
+ run: 'skill';
172
+ skill_id: string;
173
+ skill_version_id?: string | null;
174
+ } | {
175
+ run: 'freeform';
176
+ freeform: string;
177
+ };
178
+ interface TriggerRecord {
179
+ trigger_id: string;
180
+ app_id: string;
181
+ tenant_user_id: string;
182
+ trigger_type: TriggerType;
183
+ trigger_spec: Record<string, unknown>;
184
+ webhook_url: string;
185
+ /** User-facing name for the automation. */
186
+ title?: string | null;
187
+ action_description?: string | null;
188
+ skill_id?: string | null;
189
+ skill_version_id?: string | null;
190
+ status?: string | null;
191
+ last_triggered_at?: string | null;
192
+ next_run_at?: string | null;
193
+ on_triggered?: OnTriggered | null;
194
+ metadata?: Record<string, unknown> | null;
195
+ created_at?: string | null;
196
+ updated_at?: string | null;
197
+ }
198
+ interface CreateTriggerRequest {
199
+ app_id: string;
200
+ tenant_user_id: string;
201
+ webhook_url: string;
202
+ webhook_secret: string;
203
+ /** User-facing name for the automation (required for manual/NL triggers). */
204
+ title?: string | null;
205
+ action_description?: string;
206
+ skill_id?: string;
207
+ skill_version_id?: string;
208
+ trigger_description?: string;
209
+ trigger_type?: TriggerType;
210
+ trigger_spec?: Record<string, unknown>;
211
+ next_run_at?: string;
212
+ on_triggered?: OnTriggered | null;
213
+ metadata?: Record<string, unknown>;
214
+ }
215
+ interface CreateTriggerResponse {
216
+ accepted?: boolean;
217
+ trigger_id?: string;
218
+ }
219
+ interface ListTriggersResponse {
220
+ triggers: TriggerRecord[];
221
+ }
222
+ interface UpdateTriggerRequest {
223
+ app_id: string;
224
+ tenant_user_id: string;
225
+ webhook_url?: string;
226
+ title?: string | null;
227
+ trigger_type?: TriggerType;
228
+ trigger_spec?: Record<string, unknown>;
229
+ next_run_at?: string | null;
230
+ action_description?: string;
231
+ skill_id?: string | null;
232
+ skill_version_id?: string | null;
233
+ on_triggered?: OnTriggered | null;
234
+ status?: string;
235
+ metadata?: Record<string, unknown>;
236
+ }
237
+ interface UpdateTriggerResponse {
238
+ success: boolean;
239
+ trigger_id: string;
240
+ }
241
+ interface DeleteTriggerResponse {
242
+ success: boolean;
243
+ }
244
+ type SkillFileType = 'markdown-file' | 'script' | 'template';
245
+ type SkillReadMode = 'metadata' | 'instructions' | 'full' | 'tree' | 'files';
246
+ type SkillFileContentMode = 'metadata' | 'full';
247
+ interface SkillFileInput {
248
+ path: string;
249
+ type: SkillFileType;
250
+ content: string;
251
+ }
252
+ interface SkillFileRecord {
253
+ path: string;
254
+ type: SkillFileType;
255
+ checksum?: string;
256
+ size_bytes?: number;
257
+ content?: string;
258
+ }
259
+ interface SkillTreeNode {
260
+ path: string;
261
+ kind: 'directory' | 'file';
262
+ type?: SkillFileType;
263
+ checksum?: string;
264
+ size_bytes?: number;
265
+ }
266
+ interface SkillMetadataRecord {
267
+ skill_id: string;
268
+ name: string;
269
+ description: string;
270
+ metadata?: Record<string, unknown>;
271
+ created_at?: string | null;
272
+ updated_at?: string | null;
273
+ }
274
+ interface SkillSummaryRecord {
275
+ skill_id: string;
276
+ name: string;
277
+ description: string;
278
+ created_at?: string | null;
279
+ updated_at?: string | null;
280
+ }
281
+ type SkillManageParams = {
282
+ operation: 'create';
283
+ tenant_user_id: string;
284
+ name: string;
285
+ description: string;
286
+ instructions: string;
287
+ files?: SkillFileInput[];
288
+ metadata?: Record<string, unknown>;
289
+ idempotencyKey?: string;
290
+ } | {
291
+ operation: 'list';
292
+ tenant_user_id: string;
293
+ include_internal?: boolean;
294
+ } | {
295
+ operation: 'read';
296
+ tenant_user_id: string;
297
+ skill_id: string;
298
+ mode: SkillReadMode;
299
+ files?: string[];
300
+ fileContent?: SkillFileContentMode;
301
+ } | {
302
+ operation: 'update';
303
+ tenant_user_id: string;
304
+ skill_id: string;
305
+ patch: {
306
+ name?: string;
307
+ description?: string;
308
+ instructions?: string;
309
+ files?: {
310
+ upsert?: SkillFileInput[];
311
+ removePaths?: string[];
312
+ };
313
+ metadata?: Record<string, unknown> | null;
314
+ };
315
+ idempotencyKey?: string;
316
+ } | {
317
+ operation: 'delete';
318
+ tenant_user_id: string;
319
+ skill_id: string;
320
+ };
321
+ interface SkillManageResponse {
322
+ success?: boolean;
323
+ operation: 'create' | 'list' | 'read' | 'update' | 'delete';
324
+ mode?: SkillReadMode;
325
+ skill_id?: string;
326
+ skill?: SkillMetadataRecord;
327
+ skills?: SkillSummaryRecord[];
328
+ instructions?: string;
329
+ files?: SkillFileRecord[];
330
+ tree?: SkillTreeNode[];
331
+ fileContent?: SkillFileContentMode;
332
+ error?: string;
333
+ }
334
+ interface ContextGraphProcedureSummary {
335
+ title: string;
336
+ description: string;
337
+ path: string;
338
+ }
339
+ interface ContextGraphSummaryResponse {
340
+ skill_id: string | null;
341
+ procedures: ContextGraphProcedureSummary[];
342
+ }
343
+ interface ContextGraphReadResponse {
344
+ skill_id: string | null;
345
+ path: string;
346
+ content: string | null;
347
+ }
348
+ interface CreateFrontendTokenRequest {
349
+ tenantUserId: string;
350
+ ttlSeconds?: number;
351
+ ops?: string[];
352
+ }
353
+ interface CreateFrontendTokenResponse {
354
+ token: string;
355
+ expiresAt: string;
356
+ }
357
+ interface KronosClientConfig {
358
+ /** App API key for Worker authentication (Bearer token) */
359
+ apiKey: string;
360
+ /** App ID - used for API key validation and request scoping */
361
+ appId: string;
362
+ }
363
+
364
+ export type { ScopeDetail as A, CreateScopeRequest as B, CreateMCPServerResponse as C, DeleteTriggerResponse as D, TriggerType as E, CreateFrontendTokenRequest as F, GetMCPServerResponse as G, SkillFileType as H, IngestResponse as I, SkillReadMode as J, KronosClientConfig as K, ListMCPServersResponse as L, MemoryStatsResponse as M, SkillFileContentMode as N, OnTriggered as O, SkillFileInput as P, SkillFileRecord as Q, RotateMCPServerTokenResponse as R, ScratchsheetResponse as S, TriggerRecord as T, UpdateScopeResponse as U, SkillTreeNode as V, SkillMetadataRecord as W, SkillSummaryRecord as X, ContextGraphProcedureSummary as Y, IngestStatusResponse as a, ConnectMCPServerResponse as b, ListScopesResponse as c, GetScopeResponse as d, ScopeSpec as e, CreateScopeResponse as f, ListTriggersResponse as g, CreateTriggerRequest as h, CreateTriggerResponse as i, UpdateTriggerRequest as j, UpdateTriggerResponse as k, CreateFrontendTokenResponse as l, SkillManageParams as m, SkillManageResponse as n, ContextGraphSummaryResponse as o, ContextGraphReadResponse as p, IngestStatus as q, IngestMemoryDisposition as r, IngestRequest as s, CreateMCPServerRequest as t, MCPServerStatus as u, MCPServerToolCapabilities as v, MCPServerDetails as w, ConnectMCPServerRequest as x, RotateMCPServerTokenRequest as y, ScopeSummary as z };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@gdrl/kronos-lib",
3
+ "version": "0.1.0",
4
+ "description": "Lightweight TypeScript SDK for the Kronos Knowledge Graph API",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./react": {
15
+ "types": "./dist/react/index.d.ts",
16
+ "import": "./dist/react/index.mjs",
17
+ "require": "./dist/react/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsup",
26
+ "dev": "tsup --watch",
27
+ "prepublishOnly": "KRONOS_WORKER_URL=${KRONOS_WORKER_URL:-https://api.kronos.ai} KRONOS_MASTRA_URL=${KRONOS_MASTRA_URL:-https://mastra.kronos.ai} npm run build"
28
+ },
29
+ "keywords": [
30
+ "kronos",
31
+ "knowledge-graph",
32
+ "mcp",
33
+ "ingest",
34
+ "query"
35
+ ],
36
+ "author": "",
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "@types/node": "^25.0.10",
40
+ "@types/react": "^19.2.14",
41
+ "dotenv": "^17.2.3",
42
+ "react": "^19.0.0",
43
+ "tsup": "^8.3.5",
44
+ "typescript": "^5.7.2"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=18"
48
+ },
49
+ "engines": {
50
+ "node": ">=18"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ }
55
+ }