@ottocode/database 0.1.305 → 0.1.307
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/drizzle/0004_damp_ted_forrester.sql +33 -0
- package/drizzle/0005_majestic_paibok.sql +1 -0
- package/drizzle/meta/0004_snapshot.json +859 -0
- package/drizzle/meta/0005_snapshot.json +866 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +2 -2
- package/src/runtime/migrations-bundled.ts +8 -0
- package/src/schema/goal-tasks.ts +13 -0
- package/src/schema/goals.ts +12 -0
- package/src/schema/index.ts +32 -0
- package/src/schema/subagents.ts +14 -0
|
@@ -29,6 +29,20 @@
|
|
|
29
29
|
"when": 1781032538297,
|
|
30
30
|
"tag": "0003_public_ted_forrester",
|
|
31
31
|
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "6",
|
|
36
|
+
"when": 1781125100182,
|
|
37
|
+
"tag": "0004_damp_ted_forrester",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"idx": 5,
|
|
42
|
+
"version": "6",
|
|
43
|
+
"when": 1781129618096,
|
|
44
|
+
"tag": "0005_majestic_paibok",
|
|
45
|
+
"breakpoints": true
|
|
32
46
|
}
|
|
33
47
|
]
|
|
34
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/database",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.307",
|
|
4
4
|
"description": "Database and persistence layer for ottocode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typecheck": "tsc --noEmit"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ottocode/sdk": "0.1.
|
|
25
|
+
"@ottocode/sdk": "0.1.307",
|
|
26
26
|
"drizzle-orm": "0.44.7"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -8,10 +8,18 @@ import mig0002 from '../../drizzle/0002_flawless_stature.sql' with {
|
|
|
8
8
|
import mig0003 from '../../drizzle/0003_public_ted_forrester.sql' with {
|
|
9
9
|
type: 'text',
|
|
10
10
|
};
|
|
11
|
+
import mig0004 from '../../drizzle/0004_damp_ted_forrester.sql' with {
|
|
12
|
+
type: 'text',
|
|
13
|
+
};
|
|
14
|
+
import mig0005 from '../../drizzle/0005_majestic_paibok.sql' with {
|
|
15
|
+
type: 'text',
|
|
16
|
+
};
|
|
11
17
|
|
|
12
18
|
export const bundledMigrations: Array<{ name: string; content: string }> = [
|
|
13
19
|
{ name: '0000_material_swarm.sql', content: mig0000 },
|
|
14
20
|
{ name: '0001_elite_ego.sql', content: mig0001 },
|
|
15
21
|
{ name: '0002_flawless_stature.sql', content: mig0002 },
|
|
16
22
|
{ name: '0003_public_ted_forrester.sql', content: mig0003 },
|
|
23
|
+
{ name: '0004_damp_ted_forrester.sql', content: mig0004 },
|
|
24
|
+
{ name: '0005_majestic_paibok.sql', content: mig0005 },
|
|
17
25
|
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
|
|
3
|
+
export const goalTasks = sqliteTable('goal_tasks', {
|
|
4
|
+
id: text('id').primaryKey(),
|
|
5
|
+
goalId: text('goal_id').notNull(),
|
|
6
|
+
position: integer('position').notNull(),
|
|
7
|
+
content: text('content').notNull(),
|
|
8
|
+
// 'pending' | 'in_progress' | 'done_pending' | 'completed' | 'blocked' | 'cancelled'
|
|
9
|
+
status: text('status').notNull().default('pending'),
|
|
10
|
+
note: text('note'),
|
|
11
|
+
createdAt: integer('created_at', { mode: 'number' }).notNull(),
|
|
12
|
+
updatedAt: integer('updated_at', { mode: 'number' }).notNull(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
|
|
3
|
+
export const goals = sqliteTable('goals', {
|
|
4
|
+
id: text('id').primaryKey(),
|
|
5
|
+
projectPath: text('project_path').notNull(),
|
|
6
|
+
sessionId: text('session_id'),
|
|
7
|
+
title: text('title').notNull(),
|
|
8
|
+
status: text('status').notNull().default('active'), // 'active' | 'completed' | 'abandoned'
|
|
9
|
+
startedAt: integer('started_at', { mode: 'number' }),
|
|
10
|
+
createdAt: integer('created_at', { mode: 'number' }).notNull(),
|
|
11
|
+
updatedAt: integer('updated_at', { mode: 'number' }).notNull(),
|
|
12
|
+
});
|
package/src/schema/index.ts
CHANGED
|
@@ -4,12 +4,18 @@ export { messages } from './messages.ts';
|
|
|
4
4
|
export { messageParts } from './message-parts.ts';
|
|
5
5
|
export { artifacts } from './artifacts.ts';
|
|
6
6
|
export { shares } from './shares.ts';
|
|
7
|
+
export { subagents } from './subagents.ts';
|
|
8
|
+
export { goals } from './goals.ts';
|
|
9
|
+
export { goalTasks } from './goal-tasks.ts';
|
|
7
10
|
|
|
8
11
|
import { sessions } from './sessions.ts';
|
|
9
12
|
import { messages } from './messages.ts';
|
|
10
13
|
import { messageParts } from './message-parts.ts';
|
|
11
14
|
import { artifacts } from './artifacts.ts';
|
|
12
15
|
import { shares } from './shares.ts';
|
|
16
|
+
import { subagents } from './subagents.ts';
|
|
17
|
+
import { goals } from './goals.ts';
|
|
18
|
+
import { goalTasks } from './goal-tasks.ts';
|
|
13
19
|
|
|
14
20
|
export const sessionsRelations = relations(sessions, ({ many }) => ({
|
|
15
21
|
messages: many(messages),
|
|
@@ -43,3 +49,29 @@ export const sharesRelations = relations(shares, ({ one }) => ({
|
|
|
43
49
|
references: [sessions.id],
|
|
44
50
|
}),
|
|
45
51
|
}));
|
|
52
|
+
|
|
53
|
+
export const subagentsRelations = relations(subagents, ({ one }) => ({
|
|
54
|
+
parentSession: one(sessions, {
|
|
55
|
+
fields: [subagents.parentSessionId],
|
|
56
|
+
references: [sessions.id],
|
|
57
|
+
}),
|
|
58
|
+
childSession: one(sessions, {
|
|
59
|
+
fields: [subagents.childSessionId],
|
|
60
|
+
references: [sessions.id],
|
|
61
|
+
}),
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
export const goalsRelations = relations(goals, ({ one, many }) => ({
|
|
65
|
+
session: one(sessions, {
|
|
66
|
+
fields: [goals.sessionId],
|
|
67
|
+
references: [sessions.id],
|
|
68
|
+
}),
|
|
69
|
+
tasks: many(goalTasks),
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
export const goalTasksRelations = relations(goalTasks, ({ one }) => ({
|
|
73
|
+
goal: one(goals, {
|
|
74
|
+
fields: [goalTasks.goalId],
|
|
75
|
+
references: [goals.id],
|
|
76
|
+
}),
|
|
77
|
+
}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
|
|
3
|
+
export const subagents = sqliteTable('subagents', {
|
|
4
|
+
id: text('id').primaryKey(),
|
|
5
|
+
parentSessionId: text('parent_session_id').notNull(),
|
|
6
|
+
childSessionId: text('child_session_id').notNull(),
|
|
7
|
+
agent: text('agent').notNull(),
|
|
8
|
+
task: text('task').notNull(),
|
|
9
|
+
status: text('status').notNull().default('running'), // 'running' | 'completed' | 'failed' | 'cancelled'
|
|
10
|
+
summary: text('summary'),
|
|
11
|
+
reported: integer('reported', { mode: 'boolean' }).notNull().default(false),
|
|
12
|
+
createdAt: integer('created_at', { mode: 'number' }).notNull(),
|
|
13
|
+
updatedAt: integer('updated_at', { mode: 'number' }).notNull(),
|
|
14
|
+
});
|