@fickydev/pigent 0.1.5 → 0.1.7

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,519 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "a63274e2-bbd7-4003-864b-df9dc906e6c1",
5
+ "prevId": "e22a939b-7de8-4f8f-97d8-f01f58bd0f25",
6
+ "tables": {
7
+ "agent_sessions": {
8
+ "name": "agent_sessions",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "agent_id": {
18
+ "name": "agent_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "channel": {
25
+ "name": "channel",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "chat_id": {
32
+ "name": "chat_id",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "thread_id": {
39
+ "name": "thread_id",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "user_id": {
46
+ "name": "user_id",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
+ "autoincrement": false
51
+ },
52
+ "pi_session_id": {
53
+ "name": "pi_session_id",
54
+ "type": "text",
55
+ "primaryKey": false,
56
+ "notNull": false,
57
+ "autoincrement": false
58
+ },
59
+ "instructions_hash": {
60
+ "name": "instructions_hash",
61
+ "type": "text",
62
+ "primaryKey": false,
63
+ "notNull": false,
64
+ "autoincrement": false
65
+ },
66
+ "model": {
67
+ "name": "model",
68
+ "type": "text",
69
+ "primaryKey": false,
70
+ "notNull": false,
71
+ "autoincrement": false
72
+ },
73
+ "thinking_level": {
74
+ "name": "thinking_level",
75
+ "type": "text",
76
+ "primaryKey": false,
77
+ "notNull": false,
78
+ "autoincrement": false
79
+ },
80
+ "created_at": {
81
+ "name": "created_at",
82
+ "type": "integer",
83
+ "primaryKey": false,
84
+ "notNull": true,
85
+ "autoincrement": false
86
+ },
87
+ "updated_at": {
88
+ "name": "updated_at",
89
+ "type": "integer",
90
+ "primaryKey": false,
91
+ "notNull": true,
92
+ "autoincrement": false
93
+ }
94
+ },
95
+ "indexes": {
96
+ "agent_sessions_key_unique": {
97
+ "name": "agent_sessions_key_unique",
98
+ "columns": [
99
+ "agent_id",
100
+ "channel",
101
+ "chat_id",
102
+ "thread_id"
103
+ ],
104
+ "isUnique": true
105
+ }
106
+ },
107
+ "foreignKeys": {},
108
+ "compositePrimaryKeys": {},
109
+ "uniqueConstraints": {},
110
+ "checkConstraints": {}
111
+ },
112
+ "agents": {
113
+ "name": "agents",
114
+ "columns": {
115
+ "id": {
116
+ "name": "id",
117
+ "type": "text",
118
+ "primaryKey": true,
119
+ "notNull": true,
120
+ "autoincrement": false
121
+ },
122
+ "name": {
123
+ "name": "name",
124
+ "type": "text",
125
+ "primaryKey": false,
126
+ "notNull": true,
127
+ "autoincrement": false
128
+ },
129
+ "profile": {
130
+ "name": "profile",
131
+ "type": "text",
132
+ "primaryKey": false,
133
+ "notNull": true,
134
+ "autoincrement": false
135
+ },
136
+ "workspace": {
137
+ "name": "workspace",
138
+ "type": "text",
139
+ "primaryKey": false,
140
+ "notNull": true,
141
+ "autoincrement": false
142
+ },
143
+ "config_json": {
144
+ "name": "config_json",
145
+ "type": "text",
146
+ "primaryKey": false,
147
+ "notNull": true,
148
+ "autoincrement": false
149
+ },
150
+ "system_prompt": {
151
+ "name": "system_prompt",
152
+ "type": "text",
153
+ "primaryKey": false,
154
+ "notNull": true,
155
+ "autoincrement": false,
156
+ "default": "''"
157
+ },
158
+ "created_at": {
159
+ "name": "created_at",
160
+ "type": "integer",
161
+ "primaryKey": false,
162
+ "notNull": true,
163
+ "autoincrement": false
164
+ },
165
+ "updated_at": {
166
+ "name": "updated_at",
167
+ "type": "integer",
168
+ "primaryKey": false,
169
+ "notNull": true,
170
+ "autoincrement": false
171
+ }
172
+ },
173
+ "indexes": {},
174
+ "foreignKeys": {},
175
+ "compositePrimaryKeys": {},
176
+ "uniqueConstraints": {},
177
+ "checkConstraints": {}
178
+ },
179
+ "heartbeats": {
180
+ "name": "heartbeats",
181
+ "columns": {
182
+ "id": {
183
+ "name": "id",
184
+ "type": "text",
185
+ "primaryKey": true,
186
+ "notNull": true,
187
+ "autoincrement": false
188
+ },
189
+ "agent_id": {
190
+ "name": "agent_id",
191
+ "type": "text",
192
+ "primaryKey": false,
193
+ "notNull": true,
194
+ "autoincrement": false
195
+ },
196
+ "session_id": {
197
+ "name": "session_id",
198
+ "type": "text",
199
+ "primaryKey": false,
200
+ "notNull": false,
201
+ "autoincrement": false
202
+ },
203
+ "status": {
204
+ "name": "status",
205
+ "type": "text",
206
+ "primaryKey": false,
207
+ "notNull": true,
208
+ "autoincrement": false
209
+ },
210
+ "prompt": {
211
+ "name": "prompt",
212
+ "type": "text",
213
+ "primaryKey": false,
214
+ "notNull": true,
215
+ "autoincrement": false
216
+ },
217
+ "result": {
218
+ "name": "result",
219
+ "type": "text",
220
+ "primaryKey": false,
221
+ "notNull": false,
222
+ "autoincrement": false
223
+ },
224
+ "error": {
225
+ "name": "error",
226
+ "type": "text",
227
+ "primaryKey": false,
228
+ "notNull": false,
229
+ "autoincrement": false
230
+ },
231
+ "started_at": {
232
+ "name": "started_at",
233
+ "type": "integer",
234
+ "primaryKey": false,
235
+ "notNull": false,
236
+ "autoincrement": false
237
+ },
238
+ "finished_at": {
239
+ "name": "finished_at",
240
+ "type": "integer",
241
+ "primaryKey": false,
242
+ "notNull": false,
243
+ "autoincrement": false
244
+ },
245
+ "created_at": {
246
+ "name": "created_at",
247
+ "type": "integer",
248
+ "primaryKey": false,
249
+ "notNull": true,
250
+ "autoincrement": false
251
+ }
252
+ },
253
+ "indexes": {},
254
+ "foreignKeys": {},
255
+ "compositePrimaryKeys": {},
256
+ "uniqueConstraints": {},
257
+ "checkConstraints": {}
258
+ },
259
+ "messages": {
260
+ "name": "messages",
261
+ "columns": {
262
+ "id": {
263
+ "name": "id",
264
+ "type": "text",
265
+ "primaryKey": true,
266
+ "notNull": true,
267
+ "autoincrement": false
268
+ },
269
+ "agent_id": {
270
+ "name": "agent_id",
271
+ "type": "text",
272
+ "primaryKey": false,
273
+ "notNull": true,
274
+ "autoincrement": false
275
+ },
276
+ "session_id": {
277
+ "name": "session_id",
278
+ "type": "text",
279
+ "primaryKey": false,
280
+ "notNull": false,
281
+ "autoincrement": false
282
+ },
283
+ "channel": {
284
+ "name": "channel",
285
+ "type": "text",
286
+ "primaryKey": false,
287
+ "notNull": true,
288
+ "autoincrement": false
289
+ },
290
+ "direction": {
291
+ "name": "direction",
292
+ "type": "text",
293
+ "primaryKey": false,
294
+ "notNull": true,
295
+ "autoincrement": false
296
+ },
297
+ "sender_id": {
298
+ "name": "sender_id",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": false,
302
+ "autoincrement": false
303
+ },
304
+ "chat_id": {
305
+ "name": "chat_id",
306
+ "type": "text",
307
+ "primaryKey": false,
308
+ "notNull": false,
309
+ "autoincrement": false
310
+ },
311
+ "thread_id": {
312
+ "name": "thread_id",
313
+ "type": "text",
314
+ "primaryKey": false,
315
+ "notNull": false,
316
+ "autoincrement": false
317
+ },
318
+ "content": {
319
+ "name": "content",
320
+ "type": "text",
321
+ "primaryKey": false,
322
+ "notNull": true,
323
+ "autoincrement": false
324
+ },
325
+ "raw_json": {
326
+ "name": "raw_json",
327
+ "type": "text",
328
+ "primaryKey": false,
329
+ "notNull": false,
330
+ "autoincrement": false
331
+ },
332
+ "created_at": {
333
+ "name": "created_at",
334
+ "type": "integer",
335
+ "primaryKey": false,
336
+ "notNull": true,
337
+ "autoincrement": false
338
+ }
339
+ },
340
+ "indexes": {},
341
+ "foreignKeys": {},
342
+ "compositePrimaryKeys": {},
343
+ "uniqueConstraints": {},
344
+ "checkConstraints": {}
345
+ },
346
+ "runtime_kv": {
347
+ "name": "runtime_kv",
348
+ "columns": {
349
+ "key": {
350
+ "name": "key",
351
+ "type": "text",
352
+ "primaryKey": true,
353
+ "notNull": true,
354
+ "autoincrement": false
355
+ },
356
+ "value": {
357
+ "name": "value",
358
+ "type": "text",
359
+ "primaryKey": false,
360
+ "notNull": true,
361
+ "autoincrement": false
362
+ },
363
+ "updated_at": {
364
+ "name": "updated_at",
365
+ "type": "integer",
366
+ "primaryKey": false,
367
+ "notNull": true,
368
+ "autoincrement": false
369
+ }
370
+ },
371
+ "indexes": {},
372
+ "foreignKeys": {},
373
+ "compositePrimaryKeys": {},
374
+ "uniqueConstraints": {},
375
+ "checkConstraints": {}
376
+ },
377
+ "telegram_chat_agents": {
378
+ "name": "telegram_chat_agents",
379
+ "columns": {
380
+ "id": {
381
+ "name": "id",
382
+ "type": "text",
383
+ "primaryKey": true,
384
+ "notNull": true,
385
+ "autoincrement": false
386
+ },
387
+ "chat_id": {
388
+ "name": "chat_id",
389
+ "type": "text",
390
+ "primaryKey": false,
391
+ "notNull": true,
392
+ "autoincrement": false
393
+ },
394
+ "agent_id": {
395
+ "name": "agent_id",
396
+ "type": "text",
397
+ "primaryKey": false,
398
+ "notNull": true,
399
+ "autoincrement": false
400
+ },
401
+ "enabled": {
402
+ "name": "enabled",
403
+ "type": "integer",
404
+ "primaryKey": false,
405
+ "notNull": true,
406
+ "autoincrement": false,
407
+ "default": true
408
+ },
409
+ "custom_instructions": {
410
+ "name": "custom_instructions",
411
+ "type": "text",
412
+ "primaryKey": false,
413
+ "notNull": true,
414
+ "autoincrement": false,
415
+ "default": "''"
416
+ },
417
+ "created_at": {
418
+ "name": "created_at",
419
+ "type": "integer",
420
+ "primaryKey": false,
421
+ "notNull": true,
422
+ "autoincrement": false
423
+ },
424
+ "updated_at": {
425
+ "name": "updated_at",
426
+ "type": "integer",
427
+ "primaryKey": false,
428
+ "notNull": true,
429
+ "autoincrement": false
430
+ }
431
+ },
432
+ "indexes": {
433
+ "telegram_chat_agents_chat_agent_unique": {
434
+ "name": "telegram_chat_agents_chat_agent_unique",
435
+ "columns": [
436
+ "chat_id",
437
+ "agent_id"
438
+ ],
439
+ "isUnique": true
440
+ }
441
+ },
442
+ "foreignKeys": {},
443
+ "compositePrimaryKeys": {},
444
+ "uniqueConstraints": {},
445
+ "checkConstraints": {}
446
+ },
447
+ "telegram_chats": {
448
+ "name": "telegram_chats",
449
+ "columns": {
450
+ "chat_id": {
451
+ "name": "chat_id",
452
+ "type": "text",
453
+ "primaryKey": true,
454
+ "notNull": true,
455
+ "autoincrement": false
456
+ },
457
+ "title": {
458
+ "name": "title",
459
+ "type": "text",
460
+ "primaryKey": false,
461
+ "notNull": false,
462
+ "autoincrement": false
463
+ },
464
+ "default_agent_id": {
465
+ "name": "default_agent_id",
466
+ "type": "text",
467
+ "primaryKey": false,
468
+ "notNull": false,
469
+ "autoincrement": false
470
+ },
471
+ "instructions": {
472
+ "name": "instructions",
473
+ "type": "text",
474
+ "primaryKey": false,
475
+ "notNull": true,
476
+ "autoincrement": false,
477
+ "default": "''"
478
+ },
479
+ "enabled": {
480
+ "name": "enabled",
481
+ "type": "integer",
482
+ "primaryKey": false,
483
+ "notNull": true,
484
+ "autoincrement": false,
485
+ "default": true
486
+ },
487
+ "created_at": {
488
+ "name": "created_at",
489
+ "type": "integer",
490
+ "primaryKey": false,
491
+ "notNull": true,
492
+ "autoincrement": false
493
+ },
494
+ "updated_at": {
495
+ "name": "updated_at",
496
+ "type": "integer",
497
+ "primaryKey": false,
498
+ "notNull": true,
499
+ "autoincrement": false
500
+ }
501
+ },
502
+ "indexes": {},
503
+ "foreignKeys": {},
504
+ "compositePrimaryKeys": {},
505
+ "uniqueConstraints": {},
506
+ "checkConstraints": {}
507
+ }
508
+ },
509
+ "views": {},
510
+ "enums": {},
511
+ "_meta": {
512
+ "schemas": {},
513
+ "tables": {},
514
+ "columns": {}
515
+ },
516
+ "internal": {
517
+ "indexes": {}
518
+ }
519
+ }
@@ -8,6 +8,13 @@
8
8
  "when": 1779047084019,
9
9
  "tag": "0000_great_daredevil",
10
10
  "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "6",
15
+ "when": 1779069686461,
16
+ "tag": "0001_session_model_overrides",
17
+ "breakpoints": true
11
18
  }
12
19
  ]
13
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fickydev/pigent",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Autonomous multi-agent daemon using Pi as core execution engine.",
@@ -1,6 +1,7 @@
1
1
  id: generic-assistant
2
2
  name: Generic Assistant
3
3
  model: null
4
+ thinkingLevel: null
4
5
  instructions: |
5
6
  You are a helpful general-purpose assistant.
6
7
  Prefer concise, useful answers. Ask clarifying questions only when needed.
@@ -0,0 +1,45 @@
1
+ import type { LoadedAgentConfig, LoadedConfig, ProfileConfig } from "../config/schemas";
2
+ import type { Repositories } from "../db/repositories";
3
+
4
+ export class AgentRegistry {
5
+ private readonly agentsById: Map<string, LoadedAgentConfig>;
6
+ private readonly profilesById: Map<string, ProfileConfig>;
7
+
8
+ constructor(
9
+ private readonly config: LoadedConfig,
10
+ private readonly repositories: Repositories,
11
+ ) {
12
+ this.agentsById = new Map(config.agents.map((agent) => [agent.id, agent]));
13
+ this.profilesById = new Map(config.profiles.map((profile) => [profile.id, profile]));
14
+ }
15
+
16
+ async syncConfiguredAgents(): Promise<void> {
17
+ for (const agent of this.listAgents()) {
18
+ await this.repositories.agents.upsertLoadedAgent(agent);
19
+ }
20
+ }
21
+
22
+ listAgents(): LoadedAgentConfig[] {
23
+ return [...this.agentsById.values()];
24
+ }
25
+
26
+ listProfiles(): ProfileConfig[] {
27
+ return [...this.profilesById.values()];
28
+ }
29
+
30
+ getAgent(id: string): LoadedAgentConfig | null {
31
+ return this.agentsById.get(id) ?? null;
32
+ }
33
+
34
+ getProfile(id: string): ProfileConfig | null {
35
+ return this.profilesById.get(id) ?? null;
36
+ }
37
+
38
+ hasAgent(id: string): boolean {
39
+ return this.agentsById.has(id);
40
+ }
41
+
42
+ defaultAgentId(): string | null {
43
+ return this.listAgents()[0]?.id ?? null;
44
+ }
45
+ }