Skip to content
2 changes: 2 additions & 0 deletions packages/client/src/promise/generated/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

224 changes: 222 additions & 2 deletions packages/core/schema.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "7",
"dialect": "sqlite",
"id": "44bd8ca5-689a-410e-a46a-958eb5accd97",
"prevIds": ["f1f14616-b6a1-483d-87b0-d5b7a9132580"],
"id": "23940db2-8b4e-4a5e-a404-70d785bd788c",
"prevIds": ["44bd8ca5-689a-410e-a46a-958eb5accd97"],
"ddl": [
{
"name": "account_state",
Expand Down Expand Up @@ -44,6 +44,10 @@
"name": "project",
"entityType": "tables"
},
{
"name": "schedule",
"entityType": "tables"
},
{
"name": "blob_ref",
"entityType": "tables"
Expand Down Expand Up @@ -744,6 +748,176 @@
"entityType": "columns",
"table": "project"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "id",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "session_id",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "name",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "action",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "when",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "tz",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": true,
"autoincrement": false,
"default": "'active'",
"generated": null,
"name": "status",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "next_due_at",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "ends_at",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "remaining_runs",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": true,
"autoincrement": false,
"default": "0",
"generated": null,
"name": "run_count",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "last_fired_at",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "last_message_id",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "last_outcome",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "retry_at",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "time_created",
"entityType": "columns",
"table": "schedule"
},
{
"type": "integer",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "time_updated",
"entityType": "columns",
"table": "schedule"
},
{
"type": "text",
"notNull": true,
Expand Down Expand Up @@ -1618,6 +1792,17 @@
"entityType": "fks",
"table": "project_directory"
},
{
"columns": ["session_id"],
"tableTo": "session_v2",
"columnsTo": ["id"],
"onUpdate": "NO ACTION",
"onDelete": "CASCADE",
"nameExplicit": false,
"name": "fk_schedule_session_id_session_v2_id_fk",
"entityType": "fks",
"table": "schedule"
},
{
"columns": ["session_id"],
"tableTo": "session_v2",
Expand Down Expand Up @@ -1797,6 +1982,13 @@
"table": "project",
"entityType": "pks"
},
{
"columns": ["id"],
"nameExplicit": false,
"name": "schedule_pk",
"table": "schedule",
"entityType": "pks"
},
{
"columns": ["hash"],
"nameExplicit": false,
Expand Down Expand Up @@ -1908,6 +2100,34 @@
"entityType": "indexes",
"table": "permission"
},
{
"columns": [
{
"value": "session_id",
"isExpression": false
}
],
"isUnique": false,
"where": null,
"origin": "manual",
"name": "schedule_session_idx",
"entityType": "indexes",
"table": "schedule"
},
{
"columns": [
{
"value": "next_due_at",
"isExpression": false
}
],
"isUnique": false,
"where": "\"schedule\".\"status\" = 'active' and \"schedule\".\"next_due_at\" is not null",
"origin": "manual",
"name": "schedule_due_idx",
"entityType": "indexes",
"table": "schedule"
},
{
"columns": [
{
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/config/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export function normalize(input: unknown): Result {
share: Info.fields.share,
enterprise: Info.fields.enterprise,
username: Info.fields.username,
timezone: Info.fields.timezone,
snapshots: Info.fields.snapshots,
media: Info.fields.media,
tool_output: Info.fields.tool_output,
Expand Down Expand Up @@ -494,6 +495,15 @@ function normalizeExperimental(
)
if (value !== undefined) result.media_blob = value
}
if (own(experimental, "schedules")) {
const value = decodeEncoded(
ConfigExperimental.Info.fields.schedules,
experimental.schedules,
["experimental", "schedules"],
diagnostics,
)
if (value !== undefined) result.schedules = value
}
if (own(experimental, "subagent_depth")) {
const value = decodeEncoded(
ConfigExperimental.Info.fields.subagent_depth,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/database/migration.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions packages/core/src/database/migration/20261026223005_schedule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Effect } from "effect"
import type { DatabaseMigration } from "../migration.js"

const migration: DatabaseMigration.Migration = {
id: "20261026223005_schedule",
up(tx) {
return Effect.gen(function* () {
yield* tx.run(`
CREATE TABLE \`schedule\` (
\`id\` text PRIMARY KEY,
\`session_id\` text,
\`name\` text,
\`action\` text NOT NULL,
\`when\` text NOT NULL,
\`tz\` text NOT NULL,
\`status\` text DEFAULT 'active' NOT NULL,
\`next_due_at\` integer,
\`ends_at\` integer,
\`remaining_runs\` integer,
\`run_count\` integer DEFAULT 0 NOT NULL,
\`last_fired_at\` integer,
\`last_message_id\` text,
\`last_outcome\` text,
\`retry_at\` integer,
\`time_created\` integer NOT NULL,
\`time_updated\` integer NOT NULL,
CONSTRAINT \`fk_schedule_session_id_session_v2_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session_v2\`(\`id\`) ON DELETE CASCADE
);
`)
yield* tx.run(`CREATE INDEX \`schedule_session_idx\` ON \`schedule\` (\`session_id\`);`)
yield* tx.run(
`CREATE INDEX \`schedule_due_idx\` ON \`schedule\` (\`next_due_at\`) WHERE "schedule"."status" = 'active' and "schedule"."next_due_at" is not null;`,
)
})
},
}

export default migration
26 changes: 26 additions & 0 deletions packages/core/src/database/schema.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading