MCP, skill and tool rows in Settings say "Updated 5m ago" beside how they're reached and who gets them. updated_at now means a change to an extension's settings (an edit, or any Access save): runs, connections and MCP syncs keep their own last_checked_at / last_synced_at and no longer touch it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import type { BUN_SQLITE_COBBLE_CUSTOM_TOOLS } from "@/db/types/db";
|
|
import type { CustomToolStatus } from "@/src/dict/custom-tool-dict";
|
|
import type { CustomToolRecord } from "@/src/types";
|
|
import parseJsonColumn from "./parse-json-column";
|
|
|
|
type Params = {
|
|
row: BUN_SQLITE_COBBLE_CUSTOM_TOOLS;
|
|
};
|
|
|
|
/**
|
|
* A `custom_tools` row with its JSON columns read.
|
|
*/
|
|
export default function parseCustomToolRow({ row }: Params): CustomToolRecord {
|
|
return {
|
|
id: Number(row.id),
|
|
name: row.name || "",
|
|
description: row.description || "",
|
|
parameters: parseJsonColumn<Record<string, unknown>>({
|
|
text: row.parameters,
|
|
fallback: { type: "object", properties: {} },
|
|
}),
|
|
all_bots: row.all_bots == 1,
|
|
enabled: row.enabled != 0,
|
|
status: (row.status || "untested") as CustomToolStatus,
|
|
last_error: row.last_error || "",
|
|
last_checked_at: typeof row.last_checked_at == "number" ? row.last_checked_at : null,
|
|
updated_at: typeof row.updated_at == "number" ? row.updated_at : null,
|
|
kind: row.kind || "prompt",
|
|
config: parseJsonColumn<Record<string, unknown>>({ text: row.config, fallback: {} }),
|
|
} as CustomToolRecord;
|
|
}
|