@kaeawc/auto-mobile 0.0.44 → 0.0.46
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/README.md +3 -3
- package/README.md.backup +3 -3
- package/dist/schemas/test-plan.schema.json +129 -6
- package/dist/schemas/tool-definitions.json +3469 -1609
- package/dist/src/db/migrations/2026_07_03_000_repair_datetime_now_defaults.ts +11 -2
- package/dist/src/db/migrations/2026_07_24_000_device_locks.ts +27 -0
- package/dist/src/db/migrations/2026_07_27_000_session_tool_capabilities.ts +17 -0
- package/dist/src/index.js +688 -421
- package/dist/src/index.js.map +1 -1
- package/package.json +29 -8
- package/schemas/test-plan.schema.json +129 -6
- package/schemas/tool-definitions.json +3469 -1609
|
@@ -126,8 +126,15 @@ async function findTablesWithBrokenDefaults(db: Kysely<unknown>): Promise<string
|
|
|
126
126
|
|
|
127
127
|
const broken: string[] = [];
|
|
128
128
|
for (const { name: table } of tables.rows) {
|
|
129
|
+
// Inline the table name as a literal (sql.lit), not a bound parameter: a
|
|
130
|
+
// parameterized pragma_table_info(?) was observed to intermittently return a
|
|
131
|
+
// null dflt_value under parallel-file load (bun:sqlite quirk, see #2922's
|
|
132
|
+
// test). Here a spurious null on a genuinely-poisoned column would fail the
|
|
133
|
+
// `!== null` guard below, so the column would never be added to the broken set
|
|
134
|
+
// and its poisoned default would be silently skipped and never rebuilt (#3612).
|
|
135
|
+
// Matches 2026_07_05_000_repair_updated_at_defaults.ts.
|
|
129
136
|
const columns = await sql<ColumnInfoRow>`
|
|
130
|
-
SELECT dflt_value FROM pragma_table_info(${table})
|
|
137
|
+
SELECT dflt_value FROM pragma_table_info(${sql.lit(table)})
|
|
131
138
|
`.execute(db);
|
|
132
139
|
if (columns.rows.some(column => column.dflt_value !== null && column.dflt_value in BROKEN_DEFAULTS)) {
|
|
133
140
|
broken.push(table);
|
|
@@ -138,8 +145,10 @@ async function findTablesWithBrokenDefaults(db: Kysely<unknown>): Promise<string
|
|
|
138
145
|
|
|
139
146
|
async function rebuildAndRepair(trx: Kysely<unknown>, tables: string[]): Promise<void> {
|
|
140
147
|
for (const table of tables) {
|
|
148
|
+
// sql.lit (not a bound param) for the same bun:sqlite null-dflt_value quirk
|
|
149
|
+
// guarded in findTablesWithBrokenDefaults above (#2922 / #3612).
|
|
141
150
|
const columns = await sql<ColumnInfoRow>`
|
|
142
|
-
SELECT name, dflt_value FROM pragma_table_info(${table})
|
|
151
|
+
SELECT name, dflt_value FROM pragma_table_info(${sql.lit(table)})
|
|
143
152
|
`.execute(trx);
|
|
144
153
|
|
|
145
154
|
const brokenColumns = columns.rows.filter(
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Remember how to unlock a device, keyed by device (issue #4360).
|
|
5
|
+
*
|
|
6
|
+
* A dedicated table rather than columns on `device_sessions`: a session row only
|
|
7
|
+
* exists when device-pool autolock is enabled, and never during boot (which runs
|
|
8
|
+
* before any session), so session-scoped storage cannot deliver
|
|
9
|
+
* remember-then-reuse in the default config or at boot. `lock_credential` is
|
|
10
|
+
* stored as-is in the local `~/.auto-mobile` DB — a single-user, on-disk
|
|
11
|
+
* automation store — so a locked dev device does not have to be unlocked by hand
|
|
12
|
+
* every session.
|
|
13
|
+
*/
|
|
14
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
15
|
+
await db.schema
|
|
16
|
+
.createTable("device_locks")
|
|
17
|
+
.ifNotExists()
|
|
18
|
+
.addColumn("device_id", "text", col => col.primaryKey())
|
|
19
|
+
.addColumn("lock_type", "text", col => col.notNull())
|
|
20
|
+
.addColumn("lock_credential", "text")
|
|
21
|
+
.addColumn("updated_at", "text", col => col.notNull().defaultTo(sql`(datetime('now'))`))
|
|
22
|
+
.execute();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
26
|
+
await db.schema.dropTable("device_locks").execute();
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
|
+
await db.schema
|
|
5
|
+
.createTable("session_tool_capabilities")
|
|
6
|
+
.ifNotExists()
|
|
7
|
+
.addColumn("session_uuid", "text", col => col.notNull())
|
|
8
|
+
.addColumn("capability", "text", col => col.notNull())
|
|
9
|
+
.addColumn("enabled", "integer", col => col.notNull())
|
|
10
|
+
.addColumn("updated_at", "text", col => col.notNull().defaultTo(sql`(datetime('now'))`))
|
|
11
|
+
.addPrimaryKeyConstraint("session_tool_capabilities_pk", ["session_uuid", "capability"])
|
|
12
|
+
.execute();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
16
|
+
await db.schema.dropTable("session_tool_capabilities").ifExists().execute();
|
|
17
|
+
}
|