sproutkit-code 1.16.1 → 1.17.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.
Files changed (2) hide show
  1. package/dist/index.js +25 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -231,6 +231,30 @@ var require_db = __commonJS({
231
231
  } catch {
232
232
  }
233
233
  db2.exec(`
234
+ CREATE TABLE IF NOT EXISTS chat_threads (
235
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
236
+ title TEXT,
237
+ session_id TEXT,
238
+ created_at TEXT DEFAULT (datetime('now')),
239
+ updated_at TEXT DEFAULT (datetime('now'))
240
+ );
241
+ `);
242
+ try {
243
+ db2.exec("ALTER TABLE chat_messages ADD COLUMN thread_id INTEGER");
244
+ } catch {
245
+ }
246
+ {
247
+ const orphan = db2.get("SELECT COUNT(*) AS n, MIN(created_at) AS first, MAX(created_at) AS last FROM chat_messages WHERE thread_id IS NULL", []);
248
+ if (orphan && orphan.n > 0) {
249
+ db2.run("INSERT INTO chat_threads (title, created_at, updated_at) VALUES ('Earlier chat', ?, ?)", [
250
+ orphan.first ?? (/* @__PURE__ */ new Date()).toISOString(),
251
+ orphan.last ?? (/* @__PURE__ */ new Date()).toISOString()
252
+ ]);
253
+ const t = db2.get("SELECT MAX(id) AS id FROM chat_threads", []);
254
+ db2.run("UPDATE chat_messages SET thread_id = ? WHERE thread_id IS NULL", [t.id]);
255
+ }
256
+ }
257
+ db2.exec(`
234
258
  CREATE TABLE IF NOT EXISTS invoices (
235
259
  id INTEGER PRIMARY KEY AUTOINCREMENT,
236
260
  number TEXT UNIQUE NOT NULL,
@@ -100542,7 +100566,7 @@ var require_package2 = __commonJS({
100542
100566
  "package.json"(exports2, module2) {
100543
100567
  module2.exports = {
100544
100568
  name: "sproutkit-code",
100545
- version: "1.16.1",
100569
+ version: "1.17.0",
100546
100570
  description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
100547
100571
  bin: {
100548
100572
  sproutkit: "./dist/index.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutkit-code",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "description": "Sproutkit in your terminal — find leads, build sites, run outreach, all via chat.",
5
5
  "bin": {
6
6
  "sproutkit": "./dist/index.js"