@catalyst-cloud/schema 0.1.9 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catalyst-cloud/schema",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "Typed Drizzle schema = single source of truth for the per-tenant Mirror DO SQLite store (CTC-13 / ADR-0002). Shared by the mirror Worker, the host-sync replica, and the browser OPFS replica.",
6
6
  "license": "MIT",
@@ -144,6 +144,13 @@ export const MIRROR_MIGRATIONS = {
144
144
  tag: "0018_brainy_clint_barton",
145
145
  breakpoints: true,
146
146
  },
147
+ {
148
+ idx: 19,
149
+ version: "6",
150
+ when: 1786809590855,
151
+ tag: "0019_mushy_sinister_six",
152
+ breakpoints: true,
153
+ },
147
154
  ],
148
155
  },
149
156
  migrations: {
@@ -183,5 +190,7 @@ export const MIRROR_MIGRATIONS = {
183
190
  "0017_clammy_doctor_octopus": "ALTER TABLE `users` ADD `email` text;",
184
191
  "0018_brainy_clint_barton":
185
192
  "CREATE TABLE `agent_activities` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`session_id` text NOT NULL,\n\t`type` text,\n\t`body` text,\n\t`signal` text,\n\t`created_at` integer,\n\t`updated_at` integer,\n\t`raw` text\n);\n--> statement-breakpoint\nCREATE INDEX `idx_agent_activities_session_created` ON `agent_activities` (`session_id`,`created_at`);--> statement-breakpoint\nCREATE TABLE `agent_sessions` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`issue_id` text,\n\t`status` text,\n\t`app_user_id` text,\n\t`creator_id` text,\n\t`created_at` integer,\n\t`updated_at` integer,\n\t`removed_at` integer,\n\t`raw` text\n);\n--> statement-breakpoint\nCREATE INDEX `idx_agent_sessions_issue` ON `agent_sessions` (`issue_id`,`updated_at`);",
193
+ "0019_mushy_sinister_six":
194
+ "ALTER TABLE `agent_sessions` ADD `archived_at` integer;--> statement-breakpoint\nALTER TABLE `agent_sessions` ADD `dismissed_at` integer;--> statement-breakpoint\nALTER TABLE `agent_sessions` ADD `dismissed_by` text;",
186
195
  },
187
196
  } as const;
package/src/mirror.ts CHANGED
@@ -230,6 +230,15 @@ export const agent_sessions = sqliteTable(
230
230
  created_at: integer("created_at"),
231
231
  updated_at: integer("updated_at"), // drives the last-write-wins upsert guard
232
232
  removed_at: integer("removed_at"),
233
+ // CTC-529 — a session can END in ways that are NOT the same as being abandoned, and a reader has
234
+ // to tell them apart. `archived_at`/`dismissed_at` are Linear's own terminal markers; a dismissed
235
+ // session was closed BY SOMEONE (`dismissed_by`), which is a different story from one that simply
236
+ // stopped emitting. Promoted out of `raw` to real columns because CTC-503's render branches on
237
+ // them — a render that has to json_extract its own state machine is one bad path from silently
238
+ // reading a dismissed session as still-running.
239
+ archived_at: integer("archived_at"),
240
+ dismissed_at: integer("dismissed_at"),
241
+ dismissed_by: text("dismissed_by"), // FK → users.id; null when Linear reported no actor
233
242
  raw: text("raw"), // full fidelity / forward-compat, like issues.raw
234
243
  },
235
244
  (t) => [index("idx_agent_sessions_issue").on(t.issue_id, t.updated_at)],