@fickydev/pigent 0.1.14 → 0.1.15
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/AGENTS.md +1 -0
- package/CHANGELOG.md +6 -0
- package/TODO.md +1 -0
- package/package.json +1 -1
- package/src/db/client.ts +14 -0
package/AGENTS.md
CHANGED
|
@@ -26,6 +26,7 @@ Add Hono later only for webhooks, Slack, WhatsApp, admin API, health endpoints,
|
|
|
26
26
|
- Always update `CHANGELOG.md` after working.
|
|
27
27
|
- Always update `TODO.md` after working.
|
|
28
28
|
- Whenever user says `remember this`, update `AGENTS.md` accordingly.
|
|
29
|
+
- When user says `release package`, commit current changes, push, and publish a patch release.
|
|
29
30
|
- Do not add Hono until explicitly requested.
|
|
30
31
|
- Do not let channel adapters call Pi directly.
|
|
31
32
|
- Do not let Pi runtime know channel secrets.
|
package/CHANGELOG.md
CHANGED
package/TODO.md
CHANGED
|
@@ -142,6 +142,7 @@
|
|
|
142
142
|
- [x] Confirm persistent session manager approach
|
|
143
143
|
- [x] Persist Pi session file path per active Pigent session
|
|
144
144
|
- [x] Reuse Pi session files across messages
|
|
145
|
+
- [x] Self-heal missing runtime `agent_sessions` columns after partial/mismatched migration state
|
|
145
146
|
- [ ] Confirm per-agent system prompt injection
|
|
146
147
|
- [ ] Confirm per-agent skills loading
|
|
147
148
|
- [ ] Confirm per-agent extensions loading
|
package/package.json
CHANGED
package/src/db/client.ts
CHANGED
|
@@ -18,9 +18,23 @@ export const sqlite = new Database(databasePath);
|
|
|
18
18
|
export const db = drizzle(sqlite, { schema });
|
|
19
19
|
|
|
20
20
|
migrate(db, { migrationsFolder: "./drizzle/migrations" });
|
|
21
|
+
ensureRuntimeSchema();
|
|
21
22
|
|
|
22
23
|
export type DbClient = typeof db;
|
|
23
24
|
|
|
24
25
|
export function getDatabasePath(): string {
|
|
25
26
|
return databasePath;
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
function ensureRuntimeSchema(): void {
|
|
30
|
+
ensureColumn("agent_sessions", "active", "ALTER TABLE `agent_sessions` ADD `active` integer DEFAULT true NOT NULL");
|
|
31
|
+
ensureColumn("agent_sessions", "ended_at", "ALTER TABLE `agent_sessions` ADD `ended_at` integer");
|
|
32
|
+
ensureColumn("agent_sessions", "pi_session_path", "ALTER TABLE `agent_sessions` ADD `pi_session_path` text");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function ensureColumn(table: string, column: string, statement: string): void {
|
|
36
|
+
const columns = sqlite.query<{ name: string }, []>(`PRAGMA table_info(${table})`).all();
|
|
37
|
+
if (!columns.some((item) => item.name === column)) {
|
|
38
|
+
sqlite.exec(statement);
|
|
39
|
+
}
|
|
40
|
+
}
|