@crewx/sdk 0.9.0-rc.162 → 0.9.0-rc.164

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,82 @@
1
+ import { BaseSqliteRepository } from './base-sqlite-repository.js';
2
+ import { RepositoryError } from './errors.js';
3
+ import type { SidebarGroupColor } from '../schema/index.js';
4
+ export declare const SIDEBAR_CLOSED_TAB_LIMIT = 20;
5
+ export type SidebarTabErrorReason = 'NOT_FOUND' | 'INVALID_INPUT' | 'NOT_INITIALIZED';
6
+ export declare class SidebarTabRepositoryError extends RepositoryError {
7
+ readonly reason: SidebarTabErrorReason;
8
+ constructor(reason: SidebarTabErrorReason, message?: string, cause?: unknown);
9
+ }
10
+ export interface SidebarGroupSnapshot {
11
+ id: string;
12
+ name: string;
13
+ color: SidebarGroupColor;
14
+ collapsed: boolean;
15
+ threadIds: string[];
16
+ }
17
+ export interface SidebarSnapshot {
18
+ revision: number;
19
+ railCollapsed: boolean;
20
+ pinned: string[];
21
+ groups: SidebarGroupSnapshot[];
22
+ ungrouped: string[];
23
+ closedCount: number;
24
+ reads: Record<string, string>;
25
+ }
26
+ export interface InitSidebarResult {
27
+ created: boolean;
28
+ snapshot: SidebarSnapshot;
29
+ }
30
+ export interface OpenSidebarTabOptions {
31
+ groupId?: string;
32
+ beforeThreadId?: string | null;
33
+ }
34
+ export interface MoveSidebarTabInput {
35
+ section: 'pinned' | 'group' | 'ungrouped';
36
+ groupId?: string;
37
+ beforeThreadId: string | null;
38
+ }
39
+ export interface CreateSidebarGroupInput {
40
+ threadId: string;
41
+ color: SidebarGroupColor;
42
+ name?: string;
43
+ }
44
+ export interface UpdateSidebarGroupPatch {
45
+ name?: string;
46
+ color?: SidebarGroupColor;
47
+ collapsed?: boolean;
48
+ }
49
+ export interface ReopenSidebarTabResult {
50
+ threadId: string | null;
51
+ snapshot: SidebarSnapshot;
52
+ }
53
+ export interface CreateSidebarGroupResult {
54
+ groupId: string;
55
+ snapshot: SidebarSnapshot;
56
+ }
57
+ export interface MarkThreadReadResult {
58
+ readThroughAt: string;
59
+ }
60
+ export declare class SidebarTabRepository extends BaseSqliteRepository {
61
+ private readonly dbPath?;
62
+ constructor(opts?: {
63
+ dbPath?: string;
64
+ dbRoot?: string;
65
+ });
66
+ resolveDbPath(): string;
67
+ private openHandle;
68
+ private write;
69
+ private command;
70
+ getSnapshot(workspaceId: string): SidebarSnapshot | null;
71
+ initIfAbsent(workspaceId: string, seedThreadIds: string[]): InitSidebarResult;
72
+ open(workspaceId: string, threadId: string, options?: OpenSidebarTabOptions): SidebarSnapshot;
73
+ close(workspaceId: string, threadId: string): SidebarSnapshot;
74
+ reopenLast(workspaceId: string): ReopenSidebarTabResult;
75
+ move(workspaceId: string, threadId: string, input: MoveSidebarTabInput): SidebarSnapshot;
76
+ createGroup(workspaceId: string, input: CreateSidebarGroupInput): CreateSidebarGroupResult;
77
+ updateGroup(workspaceId: string, groupId: string, patch: UpdateSidebarGroupPatch): SidebarSnapshot;
78
+ ungroup(workspaceId: string, groupId: string): SidebarSnapshot;
79
+ moveGroup(workspaceId: string, groupId: string, beforeGroupId: string | null): SidebarSnapshot;
80
+ setRailCollapsed(workspaceId: string, railCollapsed: boolean): SidebarSnapshot;
81
+ markRead(workspaceId: string, threadId: string, throughTaskId: string): MarkThreadReadResult;
82
+ }
@@ -1,4 +1,5 @@
1
1
  import { BaseSqliteRepository } from './base-sqlite-repository.js';
2
+ import type { DrizzleHandle } from './db.js';
2
3
  import { RepositoryError } from './errors.js';
3
4
  import { threads } from '../schema/index.js';
4
5
  import { type TaskStatus } from './task-status.js';
@@ -80,6 +81,11 @@ export declare class ThreadTitleMetadataPatchError extends RepositoryError {
80
81
  readonly reason: ThreadTitleMetadataPatchErrorReason;
81
82
  constructor(reason: ThreadTitleMetadataPatchErrorReason, message?: string);
82
83
  }
84
+ export type ThreadTransaction = Parameters<Parameters<DrizzleHandle['db']['transaction']>[0]>[0];
85
+ export declare function toggleThreadPinInTx(tx: ThreadTransaction, threadId: string, workspaceId?: string): {
86
+ pinned: boolean;
87
+ } | null;
88
+ export declare function reorderPinsInTx(tx: ThreadTransaction, threadIds: string[], workspaceId?: string): void;
83
89
  export declare class ThreadRepository extends BaseSqliteRepository {
84
90
  private readonly dbPath?;
85
91
  constructor(opts?: {
@@ -121,6 +127,10 @@ export declare class ThreadRepository extends BaseSqliteRepository {
121
127
  };
122
128
  };
123
129
  getDescendantSummaryByTaskId(threadId: string, workspaceId?: string): Record<string, TaskDescendantSummary>;
130
+ getThreadTaskStatusBatch(threadIds: string[], workspaceId?: string): {
131
+ tasksByThread: Map<string, TaskListRow[]>;
132
+ descendantSummaryByTaskId: Record<string, TaskDescendantSummary>;
133
+ };
124
134
  listDescendantsByTaskId(taskId: string, workspaceId: string, options?: TaskDescendantListOptions): TaskDescendantList | undefined;
125
135
  findInterceptedRequests(taskIds: readonly string[]): Map<string, string>;
126
136
  findTopLevelTasks(threadId: string, workspaceId?: string, limit?: number, ownAgentId?: string): TaskRow[];
@@ -22,3 +22,4 @@ export * from './common-codes.js';
22
22
  export * from './thread-history.js';
23
23
  export * from './storage-metadata.js';
24
24
  export * from './agent-send-history.js';
25
+ export * from './sidebar-tabs.js';
@@ -0,0 +1,466 @@
1
+ export declare const SIDEBAR_GROUP_COLORS: readonly ["cyan", "orange", "purple", "blue"];
2
+ export type SidebarGroupColor = (typeof SIDEBAR_GROUP_COLORS)[number];
3
+ export declare const sidebar_states: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4
+ name: "sidebar_states";
5
+ schema: undefined;
6
+ columns: {
7
+ workspace_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
8
+ name: "workspace_id";
9
+ tableName: "sidebar_states";
10
+ dataType: "string";
11
+ columnType: "SQLiteText";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: false;
16
+ isPrimaryKey: true;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: false;
19
+ enumValues: [string, ...string[]];
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}, {
24
+ length: number | undefined;
25
+ }>;
26
+ revision: import("drizzle-orm/sqlite-core").SQLiteColumn<{
27
+ name: "revision";
28
+ tableName: "sidebar_states";
29
+ dataType: "number";
30
+ columnType: "SQLiteInteger";
31
+ data: number;
32
+ driverParam: number;
33
+ notNull: true;
34
+ hasDefault: true;
35
+ isPrimaryKey: false;
36
+ isAutoincrement: false;
37
+ hasRuntimeDefault: false;
38
+ enumValues: undefined;
39
+ baseColumn: never;
40
+ identity: undefined;
41
+ generated: undefined;
42
+ }, {}, {}>;
43
+ rail_collapsed: import("drizzle-orm/sqlite-core").SQLiteColumn<{
44
+ name: "rail_collapsed";
45
+ tableName: "sidebar_states";
46
+ dataType: "number";
47
+ columnType: "SQLiteInteger";
48
+ data: number;
49
+ driverParam: number;
50
+ notNull: true;
51
+ hasDefault: true;
52
+ isPrimaryKey: false;
53
+ isAutoincrement: false;
54
+ hasRuntimeDefault: false;
55
+ enumValues: undefined;
56
+ baseColumn: never;
57
+ identity: undefined;
58
+ generated: undefined;
59
+ }, {}, {}>;
60
+ seeded_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
61
+ name: "seeded_at";
62
+ tableName: "sidebar_states";
63
+ dataType: "string";
64
+ columnType: "SQLiteText";
65
+ data: string;
66
+ driverParam: string;
67
+ notNull: true;
68
+ hasDefault: false;
69
+ isPrimaryKey: false;
70
+ isAutoincrement: false;
71
+ hasRuntimeDefault: false;
72
+ enumValues: [string, ...string[]];
73
+ baseColumn: never;
74
+ identity: undefined;
75
+ generated: undefined;
76
+ }, {}, {
77
+ length: number | undefined;
78
+ }>;
79
+ };
80
+ dialect: "sqlite";
81
+ }>;
82
+ export declare const sidebar_groups: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
83
+ name: "sidebar_groups";
84
+ schema: undefined;
85
+ columns: {
86
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
87
+ name: "id";
88
+ tableName: "sidebar_groups";
89
+ dataType: "string";
90
+ columnType: "SQLiteText";
91
+ data: string;
92
+ driverParam: string;
93
+ notNull: true;
94
+ hasDefault: false;
95
+ isPrimaryKey: true;
96
+ isAutoincrement: false;
97
+ hasRuntimeDefault: false;
98
+ enumValues: [string, ...string[]];
99
+ baseColumn: never;
100
+ identity: undefined;
101
+ generated: undefined;
102
+ }, {}, {
103
+ length: number | undefined;
104
+ }>;
105
+ workspace_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
106
+ name: "workspace_id";
107
+ tableName: "sidebar_groups";
108
+ dataType: "string";
109
+ columnType: "SQLiteText";
110
+ data: string;
111
+ driverParam: string;
112
+ notNull: true;
113
+ hasDefault: false;
114
+ isPrimaryKey: false;
115
+ isAutoincrement: false;
116
+ hasRuntimeDefault: false;
117
+ enumValues: [string, ...string[]];
118
+ baseColumn: never;
119
+ identity: undefined;
120
+ generated: undefined;
121
+ }, {}, {
122
+ length: number | undefined;
123
+ }>;
124
+ name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
125
+ name: "name";
126
+ tableName: "sidebar_groups";
127
+ dataType: "string";
128
+ columnType: "SQLiteText";
129
+ data: string;
130
+ driverParam: string;
131
+ notNull: true;
132
+ hasDefault: false;
133
+ isPrimaryKey: false;
134
+ isAutoincrement: false;
135
+ hasRuntimeDefault: false;
136
+ enumValues: [string, ...string[]];
137
+ baseColumn: never;
138
+ identity: undefined;
139
+ generated: undefined;
140
+ }, {}, {
141
+ length: number | undefined;
142
+ }>;
143
+ color: import("drizzle-orm/sqlite-core").SQLiteColumn<{
144
+ name: "color";
145
+ tableName: "sidebar_groups";
146
+ dataType: "string";
147
+ columnType: "SQLiteText";
148
+ data: string;
149
+ driverParam: string;
150
+ notNull: true;
151
+ hasDefault: false;
152
+ isPrimaryKey: false;
153
+ isAutoincrement: false;
154
+ hasRuntimeDefault: false;
155
+ enumValues: [string, ...string[]];
156
+ baseColumn: never;
157
+ identity: undefined;
158
+ generated: undefined;
159
+ }, {}, {
160
+ length: number | undefined;
161
+ }>;
162
+ collapsed: import("drizzle-orm/sqlite-core").SQLiteColumn<{
163
+ name: "collapsed";
164
+ tableName: "sidebar_groups";
165
+ dataType: "number";
166
+ columnType: "SQLiteInteger";
167
+ data: number;
168
+ driverParam: number;
169
+ notNull: true;
170
+ hasDefault: true;
171
+ isPrimaryKey: false;
172
+ isAutoincrement: false;
173
+ hasRuntimeDefault: false;
174
+ enumValues: undefined;
175
+ baseColumn: never;
176
+ identity: undefined;
177
+ generated: undefined;
178
+ }, {}, {}>;
179
+ position: import("drizzle-orm/sqlite-core").SQLiteColumn<{
180
+ name: "position";
181
+ tableName: "sidebar_groups";
182
+ dataType: "number";
183
+ columnType: "SQLiteInteger";
184
+ data: number;
185
+ driverParam: number;
186
+ notNull: true;
187
+ hasDefault: false;
188
+ isPrimaryKey: false;
189
+ isAutoincrement: false;
190
+ hasRuntimeDefault: false;
191
+ enumValues: undefined;
192
+ baseColumn: never;
193
+ identity: undefined;
194
+ generated: undefined;
195
+ }, {}, {}>;
196
+ };
197
+ dialect: "sqlite";
198
+ }>;
199
+ export declare const sidebar_tabs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
200
+ name: "sidebar_tabs";
201
+ schema: undefined;
202
+ columns: {
203
+ workspace_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
204
+ name: "workspace_id";
205
+ tableName: "sidebar_tabs";
206
+ dataType: "string";
207
+ columnType: "SQLiteText";
208
+ data: string;
209
+ driverParam: string;
210
+ notNull: true;
211
+ hasDefault: false;
212
+ isPrimaryKey: false;
213
+ isAutoincrement: false;
214
+ hasRuntimeDefault: false;
215
+ enumValues: [string, ...string[]];
216
+ baseColumn: never;
217
+ identity: undefined;
218
+ generated: undefined;
219
+ }, {}, {
220
+ length: number | undefined;
221
+ }>;
222
+ thread_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
223
+ name: "thread_id";
224
+ tableName: "sidebar_tabs";
225
+ dataType: "string";
226
+ columnType: "SQLiteText";
227
+ data: string;
228
+ driverParam: string;
229
+ notNull: true;
230
+ hasDefault: false;
231
+ isPrimaryKey: false;
232
+ isAutoincrement: false;
233
+ hasRuntimeDefault: false;
234
+ enumValues: [string, ...string[]];
235
+ baseColumn: never;
236
+ identity: undefined;
237
+ generated: undefined;
238
+ }, {}, {
239
+ length: number | undefined;
240
+ }>;
241
+ group_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
242
+ name: "group_id";
243
+ tableName: "sidebar_tabs";
244
+ dataType: "string";
245
+ columnType: "SQLiteText";
246
+ data: string;
247
+ driverParam: string;
248
+ notNull: false;
249
+ hasDefault: false;
250
+ isPrimaryKey: false;
251
+ isAutoincrement: false;
252
+ hasRuntimeDefault: false;
253
+ enumValues: [string, ...string[]];
254
+ baseColumn: never;
255
+ identity: undefined;
256
+ generated: undefined;
257
+ }, {}, {
258
+ length: number | undefined;
259
+ }>;
260
+ position: import("drizzle-orm/sqlite-core").SQLiteColumn<{
261
+ name: "position";
262
+ tableName: "sidebar_tabs";
263
+ dataType: "number";
264
+ columnType: "SQLiteInteger";
265
+ data: number;
266
+ driverParam: number;
267
+ notNull: true;
268
+ hasDefault: false;
269
+ isPrimaryKey: false;
270
+ isAutoincrement: false;
271
+ hasRuntimeDefault: false;
272
+ enumValues: undefined;
273
+ baseColumn: never;
274
+ identity: undefined;
275
+ generated: undefined;
276
+ }, {}, {}>;
277
+ };
278
+ dialect: "sqlite";
279
+ }>;
280
+ export declare const sidebar_closed_tabs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
281
+ name: "sidebar_closed_tabs";
282
+ schema: undefined;
283
+ columns: {
284
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
285
+ name: "id";
286
+ tableName: "sidebar_closed_tabs";
287
+ dataType: "number";
288
+ columnType: "SQLiteInteger";
289
+ data: number;
290
+ driverParam: number;
291
+ notNull: true;
292
+ hasDefault: true;
293
+ isPrimaryKey: true;
294
+ isAutoincrement: false;
295
+ hasRuntimeDefault: false;
296
+ enumValues: undefined;
297
+ baseColumn: never;
298
+ identity: undefined;
299
+ generated: undefined;
300
+ }, {}, {}>;
301
+ workspace_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
302
+ name: "workspace_id";
303
+ tableName: "sidebar_closed_tabs";
304
+ dataType: "string";
305
+ columnType: "SQLiteText";
306
+ data: string;
307
+ driverParam: string;
308
+ notNull: true;
309
+ hasDefault: false;
310
+ isPrimaryKey: false;
311
+ isAutoincrement: false;
312
+ hasRuntimeDefault: false;
313
+ enumValues: [string, ...string[]];
314
+ baseColumn: never;
315
+ identity: undefined;
316
+ generated: undefined;
317
+ }, {}, {
318
+ length: number | undefined;
319
+ }>;
320
+ thread_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
321
+ name: "thread_id";
322
+ tableName: "sidebar_closed_tabs";
323
+ dataType: "string";
324
+ columnType: "SQLiteText";
325
+ data: string;
326
+ driverParam: string;
327
+ notNull: true;
328
+ hasDefault: false;
329
+ isPrimaryKey: false;
330
+ isAutoincrement: false;
331
+ hasRuntimeDefault: false;
332
+ enumValues: [string, ...string[]];
333
+ baseColumn: never;
334
+ identity: undefined;
335
+ generated: undefined;
336
+ }, {}, {
337
+ length: number | undefined;
338
+ }>;
339
+ group_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
340
+ name: "group_id";
341
+ tableName: "sidebar_closed_tabs";
342
+ dataType: "string";
343
+ columnType: "SQLiteText";
344
+ data: string;
345
+ driverParam: string;
346
+ notNull: false;
347
+ hasDefault: false;
348
+ isPrimaryKey: false;
349
+ isAutoincrement: false;
350
+ hasRuntimeDefault: false;
351
+ enumValues: [string, ...string[]];
352
+ baseColumn: never;
353
+ identity: undefined;
354
+ generated: undefined;
355
+ }, {}, {
356
+ length: number | undefined;
357
+ }>;
358
+ position: import("drizzle-orm/sqlite-core").SQLiteColumn<{
359
+ name: "position";
360
+ tableName: "sidebar_closed_tabs";
361
+ dataType: "number";
362
+ columnType: "SQLiteInteger";
363
+ data: number;
364
+ driverParam: number;
365
+ notNull: true;
366
+ hasDefault: false;
367
+ isPrimaryKey: false;
368
+ isAutoincrement: false;
369
+ hasRuntimeDefault: false;
370
+ enumValues: undefined;
371
+ baseColumn: never;
372
+ identity: undefined;
373
+ generated: undefined;
374
+ }, {}, {}>;
375
+ closed_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
376
+ name: "closed_at";
377
+ tableName: "sidebar_closed_tabs";
378
+ dataType: "string";
379
+ columnType: "SQLiteText";
380
+ data: string;
381
+ driverParam: string;
382
+ notNull: true;
383
+ hasDefault: false;
384
+ isPrimaryKey: false;
385
+ isAutoincrement: false;
386
+ hasRuntimeDefault: false;
387
+ enumValues: [string, ...string[]];
388
+ baseColumn: never;
389
+ identity: undefined;
390
+ generated: undefined;
391
+ }, {}, {
392
+ length: number | undefined;
393
+ }>;
394
+ };
395
+ dialect: "sqlite";
396
+ }>;
397
+ export declare const thread_reads: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
398
+ name: "thread_reads";
399
+ schema: undefined;
400
+ columns: {
401
+ workspace_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
402
+ name: "workspace_id";
403
+ tableName: "thread_reads";
404
+ dataType: "string";
405
+ columnType: "SQLiteText";
406
+ data: string;
407
+ driverParam: string;
408
+ notNull: true;
409
+ hasDefault: false;
410
+ isPrimaryKey: false;
411
+ isAutoincrement: false;
412
+ hasRuntimeDefault: false;
413
+ enumValues: [string, ...string[]];
414
+ baseColumn: never;
415
+ identity: undefined;
416
+ generated: undefined;
417
+ }, {}, {
418
+ length: number | undefined;
419
+ }>;
420
+ thread_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
421
+ name: "thread_id";
422
+ tableName: "thread_reads";
423
+ dataType: "string";
424
+ columnType: "SQLiteText";
425
+ data: string;
426
+ driverParam: string;
427
+ notNull: true;
428
+ hasDefault: false;
429
+ isPrimaryKey: false;
430
+ isAutoincrement: false;
431
+ hasRuntimeDefault: false;
432
+ enumValues: [string, ...string[]];
433
+ baseColumn: never;
434
+ identity: undefined;
435
+ generated: undefined;
436
+ }, {}, {
437
+ length: number | undefined;
438
+ }>;
439
+ read_through_at: import("drizzle-orm/sqlite-core").SQLiteColumn<{
440
+ name: "read_through_at";
441
+ tableName: "thread_reads";
442
+ dataType: "string";
443
+ columnType: "SQLiteText";
444
+ data: string;
445
+ driverParam: string;
446
+ notNull: true;
447
+ hasDefault: false;
448
+ isPrimaryKey: false;
449
+ isAutoincrement: false;
450
+ hasRuntimeDefault: false;
451
+ enumValues: [string, ...string[]];
452
+ baseColumn: never;
453
+ identity: undefined;
454
+ generated: undefined;
455
+ }, {}, {
456
+ length: number | undefined;
457
+ }>;
458
+ };
459
+ dialect: "sqlite";
460
+ }>;
461
+ export type SidebarState = typeof sidebar_states.$inferSelect;
462
+ export type SidebarGroup = typeof sidebar_groups.$inferSelect;
463
+ export type NewSidebarGroup = typeof sidebar_groups.$inferInsert;
464
+ export type SidebarTab = typeof sidebar_tabs.$inferSelect;
465
+ export type SidebarClosedTab = typeof sidebar_closed_tabs.$inferSelect;
466
+ export type ThreadRead = typeof thread_reads.$inferSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/sdk",
3
- "version": "0.9.0-rc.162",
3
+ "version": "0.9.0-rc.164",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"