@wirecat/cli-core 0.426.0 → 0.427.0
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/CHANGELOG.md +31 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
- package/dist/cli/messenger/store-maintenance-command.js +9 -47
- package/dist/cli/messenger/store-tables-command.d.ts +5 -0
- package/dist/cli/messenger/store-tables-command.js +59 -0
- package/dist/cli/store-info.d.ts +12 -0
- package/dist/cli/store-info.js +72 -0
- package/dist/entities/index.d.ts +54 -5
- package/dist/entities/index.js +3 -1
- package/dist/entities/store-maintenance.d.ts +48 -4
- package/dist/entities/store-maintenance.js +16 -3
- package/dist/entities/store-table.d.ts +8 -0
- package/dist/entities/store-table.js +9 -0
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/store/compatibility.d.ts +28 -0
- package/dist/store/compatibility.js +41 -0
- package/dist/store/exports.d.ts +1 -0
- package/dist/store/exports.js +1 -0
- package/dist/store/sqlite/store-tables.d.ts +43 -0
- package/dist/store/sqlite/store-tables.js +111 -0
- package/dist/store/store.d.ts +1 -0
- package/dist/store/store.js +1 -0
- package/package.json +3 -3
- package/parity.json +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,37 @@ shape of this file.
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 0.427.0 — 25.10.2026
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Every CLI on cli-core gets `skill status` and `skill show --for claude|agents`** from cli-base 0.56.0. `skill
|
|
15
|
+
status` says, for each agent, whether its installed SKILL.md matches this version; `skill show --for` prints the copy
|
|
16
|
+
installed there, so a host can show what `skill install` would change.
|
|
17
|
+
- **`store info` for every WireCat tool, and whether this tool can read the store.** `storeInfo(env)` returns the answer for a tool that builds its own program (drive, memo); `storeInfoCommand()` is the `info` command and `sharedStoreCommand()` a `store` group holding it, for a tool on `createProgram` with no `store` of its own (zm). `schema` gains `reason` (`missing`, `older`, `current`, `newer` — this tool may still write it — or `too_new`) and `upgrade`: `{ version, min_compatible }` the file will be at after this tool's next run, or `null`, so a caller can name every other tool whose `speaks` is below that minimum before it updates. `writable` keeps saying whether this tool can open the file. The answer has `clients`, each tool that opened the store with its `version`, cli-core `core`, `speaks` and `seen_at`. A missing store answers with this tool's `schema` too, and a file that does not open with `schema.speaks`.
|
|
18
|
+
- **`store tables list` lists every table of the archive, and `store info` describes the file itself.** WireCat
|
|
19
|
+
Desktop's Storage page showed totals but not which tables the archive holds, its migrations or the last backup, and
|
|
20
|
+
the app may not open the file. `store tables list [query...]` answers each table's `name`, `kind` (`data`,
|
|
21
|
+
`search_index`, `search_index_part`, `internal`) and `rows`, read-only; a search index's rows stay `null`, since
|
|
22
|
+
counting them scans the whole index. `--full` adds `bytes`, the pages a table and its indexes hold, which reads the
|
|
23
|
+
whole file: under a second when it is in memory, ten seconds to two minutes when not, on a 3 GB store. Under Bun,
|
|
24
|
+
whose SQLite has no `dbstat`, `--full` says so. `store info` gains `journal_mode`, `pages` (`size`, `count`, and
|
|
25
|
+
`free`, the pages a `VACUUM` would give back), `migrations` (every applied version with its `min_compatible` and
|
|
26
|
+
`applied_at`) and `backup`, the time, file and check from the `backups/last.json` marker a backup job leaves beside
|
|
27
|
+
the store (`null` without one). The resource word `tables` comes from cli-base
|
|
28
|
+
([WireCatLabs/cli-base#334](https://github.com/WireCatLabs/cli-base/pull/334)).
|
|
29
|
+
|
|
30
|
+
### Changed — may break callers
|
|
31
|
+
|
|
32
|
+
- **cli-core needs `@wirecat/cli-base` 0.56.** The peer range moves from `>=0.53.0 <0.54.0` to `>=0.56.0 <0.57.0`. A
|
|
33
|
+
CLI that pins cli-base moves its pin with this release. cli-base 0.54 and 0.55 change the release lock and the
|
|
34
|
+
changelog guard, which a CLI adopts through community's standards sync, and 0.56 adds the `missing-run-log` lint
|
|
35
|
+
rule: a CLI without `runs` fails `cli-dev lint` until it registers `runsCommand(app)`.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **`store info` opens the store read-only.** It no longer sets the journal mode, and a store too new for this tool answers with its schema and empty `rows` instead of failing to count tables it may have renamed.
|
|
40
|
+
|
|
10
41
|
## 0.426.0 — 25.10.2026
|
|
11
42
|
|
|
12
43
|
### Added
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -109,5 +109,6 @@ export { AGENTS, type Agent, agentFor, screenFor } from "./setup-screen.js";
|
|
|
109
109
|
export { accountCommand, addMeetingBatchCommand, addMeetingPreparationCommand, addMeetingProjectCandidatesCommand, addMeetingSeriesInventoryCommand, attachmentsCommand, botAdminsCommand, botCommand, botMcpCommand, botMembersCommand, botMessagesCommand, callsCommand, chatsCommand, commandsCommand, completeCommand, configCommand, contactsCommand, conversationsCommand, deleteCommand, doctorCommand, editCommand, floodCommand, forwardCommand, generatedApiCommand, guideCommand, imagesCommand, inboxCommand, markReadCommand, mcpCommand, mentionsCommand, messagesCommand, metadataCommand, modelCatalogueCommand, modelsCommand, pinCommand, pollsCommand, reactionsCommand, recipientsCommand, repliesCommand, reviewCommand, runsCommand, scheduleCommand, searchCommand, searchesCommand, sendCommand, sendsCommand, serveCommand, serverCommand, skillCommand, starCommands, statsCommand, stickersCommand, storeCommand, tagsCommand, tasksCommand, tasksStatsCommand, topicsCommand, unpinCommand, upgradeCommand, watchCommand, } from "./shared-command-exports.js";
|
|
110
110
|
export { assertSharedContracts, customizeSharedCommand, hasSharedContract, overrideSharedContract, type SharedContractOverride, sharedContractOverrides, sharedContracts, } from "./shared-contracts.js";
|
|
111
111
|
export { runnable, withSafety } from "./steps.js";
|
|
112
|
+
export { type StoreInfo, sharedStoreCommand, storeInfo, storeInfoCommand } from "./store-info.js";
|
|
112
113
|
export { changeStoreSetting, isStoreSetting, STORE_SETTINGS, storeSettings } from "./store-settings.js";
|
|
113
114
|
export { restartServers, type UpgradeContext } from "./upgrade-command.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -100,5 +100,6 @@ export { AGENTS, agentFor, screenFor } from "./setup-screen.js";
|
|
|
100
100
|
export { accountCommand, addMeetingBatchCommand, addMeetingPreparationCommand, addMeetingProjectCandidatesCommand, addMeetingSeriesInventoryCommand, attachmentsCommand, botAdminsCommand, botCommand, botMcpCommand, botMembersCommand, botMessagesCommand, callsCommand, chatsCommand, commandsCommand, completeCommand, configCommand, contactsCommand, conversationsCommand, deleteCommand, doctorCommand, editCommand, floodCommand, forwardCommand, generatedApiCommand, guideCommand, imagesCommand, inboxCommand, markReadCommand, mcpCommand, mentionsCommand, messagesCommand, metadataCommand, modelCatalogueCommand, modelsCommand, pinCommand, pollsCommand, reactionsCommand, recipientsCommand, repliesCommand, reviewCommand, runsCommand, scheduleCommand, searchCommand, searchesCommand, sendCommand, sendsCommand, serveCommand, serverCommand, skillCommand, starCommands, statsCommand, stickersCommand, storeCommand, tagsCommand, tasksCommand, tasksStatsCommand, topicsCommand, unpinCommand, upgradeCommand, watchCommand, } from "./shared-command-exports.js";
|
|
101
101
|
export { assertSharedContracts, customizeSharedCommand, hasSharedContract, overrideSharedContract, sharedContractOverrides, sharedContracts, } from "./shared-contracts.js";
|
|
102
102
|
export { runnable, withSafety } from "./steps.js";
|
|
103
|
+
export { sharedStoreCommand, storeInfo, storeInfoCommand } from "./store-info.js";
|
|
103
104
|
export { changeStoreSetting, isStoreSetting, STORE_SETTINGS, storeSettings } from "./store-settings.js";
|
|
104
105
|
export { restartServers } from "./upgrade-command.js";
|
|
@@ -3,9 +3,9 @@ import type { CacheDatabase } from "../../store/driver.js";
|
|
|
3
3
|
import type { Messenger } from "./context.js";
|
|
4
4
|
/** `doctor`'s short summary of the store. Must answer for a broken file, so an error is a field. */
|
|
5
5
|
export declare const storeSummary: (env: NodeJS.ProcessEnv) => Promise<{
|
|
6
|
-
error?: undefined;
|
|
7
6
|
path: string;
|
|
8
7
|
exists: boolean;
|
|
8
|
+
error?: undefined;
|
|
9
9
|
} | {
|
|
10
10
|
path: string;
|
|
11
11
|
exists: boolean;
|
|
@@ -7,31 +7,27 @@ import { holdersOf } from "../../background/processes.js";
|
|
|
7
7
|
import { RULES_VERSION } from "../../conversations/link.js";
|
|
8
8
|
import { syncsOneChat } from "../../ports/traits.js";
|
|
9
9
|
import { isSealed, sealFile, unsealFile } from "../../sealed.js";
|
|
10
|
-
import {
|
|
10
|
+
import { fileSchemaOf, SPEAKS, writableBy } from "../../store/compatibility.js";
|
|
11
|
+
import { migrate } from "../../store/migrations.js";
|
|
11
12
|
import { openCache } from "../../store/open.js";
|
|
12
13
|
import { storePath } from "../../store/path.js";
|
|
13
14
|
import { deleteCopy, repairStore } from "../../store/repair.js";
|
|
14
|
-
import { drainNoteIndex, fillSearchIndex, fillStems, involvementStoreOver, noteIndexState,
|
|
15
|
+
import { drainNoteIndex, fillSearchIndex, fillStems, involvementStoreOver, noteIndexState, openStore, orphanPointers, pendingNormalization, resetAttachmentWords, resetNoteIndex, resetSearchIndex, resetStems, searchIndexState, stemmerCache, stemsState, } from "../../store/store.js";
|
|
15
16
|
import { environmentOf, outputFor } from "../context.js";
|
|
16
17
|
import { destroysNothing, LOCAL_READ, LOCAL_WRITE } from "../effects.js";
|
|
17
18
|
import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
18
19
|
import { lineOf, nextStep } from "../steps.js";
|
|
20
|
+
import { storeInfoCommand } from "../store-info.js";
|
|
19
21
|
import { answerOf } from "./ask.js";
|
|
20
22
|
import { ENCRYPT_OPTION, passwordOf } from "./password.js";
|
|
21
23
|
import { servingProfiles } from "./serve-command.js";
|
|
22
|
-
|
|
24
|
+
import { storeTablesCommand } from "./store-tables-command.js";
|
|
23
25
|
const SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
24
26
|
/** Contentless: it has no table to be compared with, only its own structure to check. */
|
|
25
27
|
const WORD_INDEX = "message_words";
|
|
26
|
-
/** An empty file is normal: `openStore` creates it before the first migration runs. */
|
|
27
28
|
const schemaOf = (database) => {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
? database.prepare("SELECT version, min_compatible FROM schema_migrations ORDER BY version DESC LIMIT 1").get()
|
|
31
|
-
: undefined;
|
|
32
|
-
const version = Number(row?.version ?? 0);
|
|
33
|
-
const minCompatible = Number(row?.min_compatible ?? 0);
|
|
34
|
-
return { version, minCompatible, writable: version <= SPEAKS || minCompatible <= SPEAKS };
|
|
29
|
+
const file = fileSchemaOf(database);
|
|
30
|
+
return { ...file, writable: writableBy(file) };
|
|
35
31
|
};
|
|
36
32
|
const count = (database, table) => Number(database.prepare(`SELECT count(*) AS n FROM ${table}`).get()?.n ?? 0);
|
|
37
33
|
/** Before version 6 the column does not exist, and a file behind this build is not migrated here. */
|
|
@@ -49,16 +45,6 @@ const reading = async (path, read) => {
|
|
|
49
45
|
database.close();
|
|
50
46
|
}
|
|
51
47
|
};
|
|
52
|
-
/** For a command that only reads: the connection refuses writes, and opening sets no journal mode. */
|
|
53
|
-
const readingOnly = async (path, read) => {
|
|
54
|
-
const { database } = await openSqlite(path, { readOnly: true });
|
|
55
|
-
try {
|
|
56
|
-
return read(database);
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
59
|
-
database.close();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
48
|
/** `doctor`'s short summary of the store. Must answer for a broken file, so an error is a field. */
|
|
63
49
|
export const storeSummary = async (env) => {
|
|
64
50
|
const path = storePath(env);
|
|
@@ -84,7 +70,7 @@ export const storeSummary = async (env) => {
|
|
|
84
70
|
/** A maintenance answer: one item, snake_case, its hints as steps where a registered one fits. */
|
|
85
71
|
const result = (command, value, next = []) => renderAnswer(command, outputFor(command), itemOf(snakeKeys(value), { next }));
|
|
86
72
|
export const storeMaintenanceCommands = (messenger) => [
|
|
87
|
-
|
|
73
|
+
storeInfoCommand(),
|
|
88
74
|
checkCommand(messenger),
|
|
89
75
|
migrateCommand(messenger),
|
|
90
76
|
reindexCommand(messenger),
|
|
@@ -94,6 +80,7 @@ export const storeMaintenanceCommands = (messenger) => [
|
|
|
94
80
|
repairCommand(messenger),
|
|
95
81
|
resetCommand(messenger),
|
|
96
82
|
copiesCommand(),
|
|
83
|
+
storeTablesCommand(messenger),
|
|
97
84
|
];
|
|
98
85
|
/** Renaming tables under a running `serve` would pull them from under its statements. */
|
|
99
86
|
const refuseWhileServing = (command, messenger) => {
|
|
@@ -162,31 +149,6 @@ const copiesCommand = () => new Command("copies").description("the tables `store
|
|
|
162
149
|
const deleted = await reading(path, (database) => deleteCopy(database, name));
|
|
163
150
|
result(this, { path, deleted });
|
|
164
151
|
}));
|
|
165
|
-
const infoCommand = () => annotate(new Command("info"), { output: { entity: "store_info" }, effects: LOCAL_READ })
|
|
166
|
-
.summary("the local archive's format, size and contents")
|
|
167
|
-
.description("the store file: where it is, its size, its schema and how many rows it holds, by provider, chat kind, account, year (UTC) and attachment kind, over every account; changes nothing")
|
|
168
|
-
.action(async function () {
|
|
169
|
-
const path = storePath(environmentOf(this).env ?? process.env);
|
|
170
|
-
if (!existsSync(path)) {
|
|
171
|
-
result(this, { path, exists: false });
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
const read = readingOnly(path, (database) => {
|
|
175
|
-
const { version, minCompatible, writable } = schemaOf(database);
|
|
176
|
-
return {
|
|
177
|
-
path,
|
|
178
|
-
exists: true,
|
|
179
|
-
bytes: { file: bytesOf(path), wal: bytesOf(`${path}-wal`) },
|
|
180
|
-
schema: { version, minCompatible, speaks: SPEAKS, writable },
|
|
181
|
-
rows: version > 0 ? rowCounts(database) : {},
|
|
182
|
-
pendingNormalization: pendingIfKnown(database),
|
|
183
|
-
wordIndex: searchIndexState(database) ?? null,
|
|
184
|
-
stemIndex: stemsState(database) ?? null,
|
|
185
|
-
...(version > 0 ? storeContents(database) : {}),
|
|
186
|
-
};
|
|
187
|
-
});
|
|
188
|
-
result(this, await read.catch((error) => ({ path, exists: true, opens: false, error: messageOf(error) })));
|
|
189
|
-
});
|
|
190
152
|
/**
|
|
191
153
|
* Reports and never repairs. The per-chat completeness is what tells "nothing was said" from "not
|
|
192
154
|
* fetched" (NEED-399 A). Times are the chat's newest message by the messenger's list against the
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type QueryRegistry } from "@wirecat/cli-base/query";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { Messenger } from "./context.js";
|
|
4
|
+
export declare const STORE_TABLES_QUERY: QueryRegistry;
|
|
5
|
+
export declare const storeTablesCommand: (messenger: Messenger) => Command;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { CliError } from "@wirecat/cli-base";
|
|
3
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
4
|
+
import { queryFieldsOf } from "@wirecat/cli-base/query";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { storeTable } from "../../entities/store-table.js";
|
|
7
|
+
import { storePath } from "../../store/path.js";
|
|
8
|
+
import { readStoreTables } from "../../store/store.js";
|
|
9
|
+
import { environmentOf, outputFor } from "../context.js";
|
|
10
|
+
import { LOCAL_READ } from "../effects.js";
|
|
11
|
+
import { listOf, renderAnswer } from "../envelope.js";
|
|
12
|
+
import { queryTerms, typedQuery, withQuery } from "../list-query.js";
|
|
13
|
+
const PATH = "store tables list";
|
|
14
|
+
export const STORE_TABLES_QUERY = {
|
|
15
|
+
entity: "store_table",
|
|
16
|
+
backend: "native",
|
|
17
|
+
fields: queryFieldsOf(storeTable, {
|
|
18
|
+
native: ["name", "kind"],
|
|
19
|
+
examples: { name: "name:messages", kind: "kind:data" },
|
|
20
|
+
}).map((field) => field.native
|
|
21
|
+
? { ...field, operators: field.operators.filter((operator) => operator === "term" || operator === "phrase") }
|
|
22
|
+
: field),
|
|
23
|
+
};
|
|
24
|
+
const filterOf = (words) => {
|
|
25
|
+
const terms = queryTerms(words, STORE_TABLES_QUERY, PATH);
|
|
26
|
+
const name = terms.get("name");
|
|
27
|
+
const kind = terms.get("kind");
|
|
28
|
+
return { ...(name === undefined ? {} : { name }), ...(kind === undefined ? {} : { kind }) };
|
|
29
|
+
};
|
|
30
|
+
export const storeTablesCommand = (messenger) => {
|
|
31
|
+
const tables = new Command("tables").description("the tables of the local archive");
|
|
32
|
+
withQuery(annotate(tables.command("list"), {
|
|
33
|
+
effects: LOCAL_READ,
|
|
34
|
+
examples: [
|
|
35
|
+
`${messenger.app.command} store tables list`,
|
|
36
|
+
`${messenger.app.command} store tables list kind:data`,
|
|
37
|
+
`${messenger.app.command} store tables list --full --json`,
|
|
38
|
+
],
|
|
39
|
+
}), STORE_TABLES_QUERY)
|
|
40
|
+
.summary("every table of the local archive, with its kind and row count")
|
|
41
|
+
.description("every table of the local archive: its kind (data, search index, part of a search index, internal) and its " +
|
|
42
|
+
"rows, a search index's rows not counted; --full adds each table's size on disk, which reads the whole file " +
|
|
43
|
+
"(about ten seconds for 3 GB); changes nothing")
|
|
44
|
+
.action(async function (words) {
|
|
45
|
+
const filter = filterOf(words);
|
|
46
|
+
const { full } = this.optsWithGlobals();
|
|
47
|
+
const path = storePath(environmentOf(this).env ?? process.env);
|
|
48
|
+
if (!existsSync(path))
|
|
49
|
+
throw new CliError("not_found", `no store at ${path}`);
|
|
50
|
+
const items = await readStoreTables(path, { filter, sizes: full === true });
|
|
51
|
+
renderAnswer(this, outputFor(this), listOf(PATH, {
|
|
52
|
+
items,
|
|
53
|
+
limit: Math.max(1, items.length),
|
|
54
|
+
has_more: false,
|
|
55
|
+
args: words.length ? { query: typedQuery(words) } : {},
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
return tables;
|
|
59
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type * as v from "valibot";
|
|
3
|
+
import type { storeInfo as storeInfoEntity } from "../entities/store-maintenance.js";
|
|
4
|
+
export type StoreInfo = v.InferOutput<typeof storeInfoEntity>;
|
|
5
|
+
/**
|
|
6
|
+
* The shared store as this build sees it, for any WireCat tool. Opened read-only: it never migrates, never sets a
|
|
7
|
+
* journal mode, and answers for a file newer than this build instead of refusing it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const storeInfo: (env: NodeJS.ProcessEnv) => Promise<StoreInfo>;
|
|
10
|
+
export declare const storeInfoCommand: () => Command;
|
|
11
|
+
/** `store info` for a tool with no `store` command of its own. */
|
|
12
|
+
export declare const sharedStoreCommand: () => Command;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { compatibilityOf, fileSchemaOf } from "../store/compatibility.js";
|
|
5
|
+
import { storePath } from "../store/path.js";
|
|
6
|
+
import { fileFacts, openSqlite, pendingNormalization, rowCounts, searchIndexState, stemsState, storeClients, storeContents, } from "../store/store.js";
|
|
7
|
+
import { environmentOf, outputFor } from "./context.js";
|
|
8
|
+
import { LOCAL_READ } from "./effects.js";
|
|
9
|
+
import { itemOf, renderAnswer, snakeKeys } from "./envelope.js";
|
|
10
|
+
/** Before version 6 the column does not exist, and a file behind this build is not migrated here. */
|
|
11
|
+
const pendingIfKnown = (database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get()
|
|
12
|
+
? pendingNormalization(database)
|
|
13
|
+
: null;
|
|
14
|
+
const bytesOf = (path) => (existsSync(path) ? statSync(path).size : 0);
|
|
15
|
+
const messageOf = (error) => (error instanceof Error ? error.message : String(error));
|
|
16
|
+
/** A file this build may not open may have renamed what the counts read, so only its schema is reported. */
|
|
17
|
+
const contentsOf = (database, version, writable) => version > 0 && writable
|
|
18
|
+
? {
|
|
19
|
+
rows: rowCounts(database),
|
|
20
|
+
pendingNormalization: pendingIfKnown(database),
|
|
21
|
+
wordIndex: searchIndexState(database) ?? null,
|
|
22
|
+
stemIndex: stemsState(database) ?? null,
|
|
23
|
+
...storeContents(database),
|
|
24
|
+
}
|
|
25
|
+
: { rows: {}, pendingNormalization: null, wordIndex: null, stemIndex: null };
|
|
26
|
+
/**
|
|
27
|
+
* The shared store as this build sees it, for any WireCat tool. Opened read-only: it never migrates, never sets a
|
|
28
|
+
* journal mode, and answers for a file newer than this build instead of refusing it.
|
|
29
|
+
*/
|
|
30
|
+
export const storeInfo = async (env) => {
|
|
31
|
+
const path = storePath(env);
|
|
32
|
+
if (!existsSync(path))
|
|
33
|
+
return snakeKeys({ path, exists: false, schema: compatibilityOf(undefined) });
|
|
34
|
+
let schema = compatibilityOf(undefined);
|
|
35
|
+
try {
|
|
36
|
+
const { database } = await openSqlite(path, { readOnly: true });
|
|
37
|
+
try {
|
|
38
|
+
schema = compatibilityOf(fileSchemaOf(database));
|
|
39
|
+
const answer = {
|
|
40
|
+
path,
|
|
41
|
+
exists: true,
|
|
42
|
+
...fileFacts(database, path),
|
|
43
|
+
bytes: { file: bytesOf(path), wal: bytesOf(`${path}-wal`) },
|
|
44
|
+
schema,
|
|
45
|
+
clients: storeClients(database).map(({ seenAt, ...client }) => ({
|
|
46
|
+
...client,
|
|
47
|
+
seenAt: new Date(seenAt).toISOString(),
|
|
48
|
+
})),
|
|
49
|
+
...contentsOf(database, schema.version, schema.writable),
|
|
50
|
+
};
|
|
51
|
+
return snakeKeys(answer);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
database.close();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
const { speaks } = schema;
|
|
59
|
+
return snakeKeys({ path, exists: true, opens: false, error: messageOf(error), schema: { speaks } });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export const storeInfoCommand = () => annotate(new Command("info"), { output: { entity: "store_info" }, effects: LOCAL_READ })
|
|
63
|
+
.summary("the shared store's format, size and contents, and whether this tool can read it")
|
|
64
|
+
.description("the store file: where it is, its size, its schema against the one this tool speaks, which tools used it and how many rows it holds, by provider, chat kind, account, year (UTC) and attachment kind, over every account; changes nothing")
|
|
65
|
+
.action(async function () {
|
|
66
|
+
const answer = await storeInfo(environmentOf(this).env ?? process.env);
|
|
67
|
+
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
68
|
+
});
|
|
69
|
+
/** `store info` for a tool with no `store` command of its own. */
|
|
70
|
+
export const sharedStoreCommand = () => annotate(new Command("store"), { effects: LOCAL_READ })
|
|
71
|
+
.description("the shared local store every WireCat tool reads")
|
|
72
|
+
.addCommand(storeInfoCommand());
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ import { savedSearch, searchHistoryClear } from "./saved-search.js";
|
|
|
75
75
|
import { sendAttempt } from "./send-attempt.js";
|
|
76
76
|
import { storeBackup, storeCheck, storeCopyRemoval, storeDecrypt, storeInfo, storeMigration, storeReindex, storeRepair, storeReset, storeRestore } from "./store-maintenance.js";
|
|
77
77
|
import { storeChatStatus, storeClear, storeExport, storeGapPlan, storeGapRepair, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry } from "./store-records.js";
|
|
78
|
+
import { storeTable } from "./store-table.js";
|
|
78
79
|
import { automaticTags, tagChange } from "./tag-change.js";
|
|
79
80
|
import { tagging } from "./tagging.js";
|
|
80
81
|
import { task } from "./task.js";
|
|
@@ -86,7 +87,7 @@ import { topic } from "./topic.js";
|
|
|
86
87
|
* subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
|
|
87
88
|
* is the target, not a description of today's output.
|
|
88
89
|
*/
|
|
89
|
-
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
90
|
+
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
90
91
|
export declare const ENTITIES: {
|
|
91
92
|
readonly meeting_ingestion: v.StrictObjectSchema<{
|
|
92
93
|
readonly meetings: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -9430,11 +9431,25 @@ export declare const ENTITIES: {
|
|
|
9430
9431
|
readonly store_info: v.UnionSchema<[v.StrictObjectSchema<{
|
|
9431
9432
|
readonly path: v.StringSchema<undefined>;
|
|
9432
9433
|
readonly exists: v.LiteralSchema<false, undefined>;
|
|
9434
|
+
readonly schema: v.StrictObjectSchema<{
|
|
9435
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9436
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9437
|
+
readonly writable: v.BooleanSchema<undefined>;
|
|
9438
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9439
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
9440
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
9441
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9442
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9443
|
+
}, undefined>, undefined>;
|
|
9444
|
+
}, undefined>;
|
|
9433
9445
|
}, undefined>, v.StrictObjectSchema<{
|
|
9434
|
-
path: v.StringSchema<undefined>;
|
|
9435
|
-
exists: v.LiteralSchema<true, undefined>;
|
|
9436
|
-
opens: v.LiteralSchema<false, undefined>;
|
|
9437
|
-
error: v.StringSchema<undefined>;
|
|
9446
|
+
readonly path: v.StringSchema<undefined>;
|
|
9447
|
+
readonly exists: v.LiteralSchema<true, undefined>;
|
|
9448
|
+
readonly opens: v.LiteralSchema<false, undefined>;
|
|
9449
|
+
readonly error: v.StringSchema<undefined>;
|
|
9450
|
+
readonly schema: v.StrictObjectSchema<{
|
|
9451
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9452
|
+
}, undefined>;
|
|
9438
9453
|
}, undefined>, v.StrictObjectSchema<{
|
|
9439
9454
|
readonly by_provider: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
9440
9455
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -9478,12 +9493,40 @@ export declare const ENTITIES: {
|
|
|
9478
9493
|
readonly file: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9479
9494
|
readonly wal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9480
9495
|
}, undefined>;
|
|
9496
|
+
readonly journal_mode: v.StringSchema<undefined>;
|
|
9497
|
+
readonly pages: v.StrictObjectSchema<{
|
|
9498
|
+
readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9499
|
+
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9500
|
+
readonly free: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9501
|
+
}, undefined>;
|
|
9502
|
+
readonly migrations: v.ArraySchema<v.StrictObjectSchema<{
|
|
9503
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9504
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9505
|
+
readonly applied_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9506
|
+
}, undefined>, undefined>;
|
|
9507
|
+
readonly backup: v.NullableSchema<v.StrictObjectSchema<{
|
|
9508
|
+
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9509
|
+
readonly file: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
9510
|
+
readonly checked: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
9511
|
+
}, undefined>, undefined>;
|
|
9481
9512
|
readonly schema: v.StrictObjectSchema<{
|
|
9482
9513
|
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9483
9514
|
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9484
9515
|
readonly writable: v.BooleanSchema<undefined>;
|
|
9485
9516
|
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9517
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
9518
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
9519
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9520
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9521
|
+
}, undefined>, undefined>;
|
|
9486
9522
|
}, undefined>;
|
|
9523
|
+
readonly clients: v.ArraySchema<v.StrictObjectSchema<{
|
|
9524
|
+
readonly command: v.StringSchema<undefined>;
|
|
9525
|
+
readonly version: v.StringSchema<undefined>;
|
|
9526
|
+
readonly core: v.StringSchema<undefined>;
|
|
9527
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9528
|
+
readonly seen_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9529
|
+
}, undefined>, undefined>;
|
|
9487
9530
|
readonly rows: Omit<v.StrictObjectSchema<{
|
|
9488
9531
|
readonly accounts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9489
9532
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -9809,6 +9852,12 @@ export declare const ENTITIES: {
|
|
|
9809
9852
|
readonly rows: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9810
9853
|
}, undefined>;
|
|
9811
9854
|
}, undefined>;
|
|
9855
|
+
readonly store_table: v.StrictObjectSchema<{
|
|
9856
|
+
readonly name: v.StringSchema<undefined>;
|
|
9857
|
+
readonly kind: v.PicklistSchema<readonly ["data", "search_index", "search_index_part", "internal"], undefined>;
|
|
9858
|
+
readonly rows: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
9859
|
+
readonly bytes: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
9860
|
+
}, undefined>;
|
|
9812
9861
|
readonly agenda: v.StrictObjectSchema<{
|
|
9813
9862
|
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9814
9863
|
readonly account: v.StringSchema<undefined>;
|
package/dist/entities/index.js
CHANGED
|
@@ -81,6 +81,7 @@ import { savedSearch, searchHistoryClear } from "./saved-search.js";
|
|
|
81
81
|
import { sendAttempt } from "./send-attempt.js";
|
|
82
82
|
import { storeBackup, storeCheck, storeCopyRemoval, storeDecrypt, storeInfo, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, } from "./store-maintenance.js";
|
|
83
83
|
import { storeChatStatus, storeClear, storeExport, storeGapPlan, storeGapRepair, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, syncProgress, } from "./store-records.js";
|
|
84
|
+
import { storeTable } from "./store-table.js";
|
|
84
85
|
import { automaticTags, tagChange } from "./tag-change.js";
|
|
85
86
|
import { tagging } from "./tagging.js";
|
|
86
87
|
import { task } from "./task.js";
|
|
@@ -92,7 +93,7 @@ import { topic } from "./topic.js";
|
|
|
92
93
|
* subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
|
|
93
94
|
* is the target, not a description of today's output.
|
|
94
95
|
*/
|
|
95
|
-
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
96
|
+
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
96
97
|
export const ENTITIES = {
|
|
97
98
|
sync_progress: syncProgress,
|
|
98
99
|
...MEETING_RESULT_ENTITIES,
|
|
@@ -291,6 +292,7 @@ export const ENTITIES = {
|
|
|
291
292
|
store_reset: storeReset,
|
|
292
293
|
store_repair: storeRepair,
|
|
293
294
|
store_copy_removal: storeCopyRemoval,
|
|
295
|
+
store_table: storeTable,
|
|
294
296
|
agenda,
|
|
295
297
|
model,
|
|
296
298
|
chat_group_change: chatGroupChange,
|
|
@@ -2,11 +2,25 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const storeInfo: v.UnionSchema<[v.StrictObjectSchema<{
|
|
3
3
|
readonly path: v.StringSchema<undefined>;
|
|
4
4
|
readonly exists: v.LiteralSchema<false, undefined>;
|
|
5
|
+
readonly schema: v.StrictObjectSchema<{
|
|
6
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
7
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
8
|
+
readonly writable: v.BooleanSchema<undefined>;
|
|
9
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
10
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
11
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
12
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
13
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
14
|
+
}, undefined>, undefined>;
|
|
15
|
+
}, undefined>;
|
|
5
16
|
}, undefined>, v.StrictObjectSchema<{
|
|
6
|
-
path: v.StringSchema<undefined>;
|
|
7
|
-
exists: v.LiteralSchema<true, undefined>;
|
|
8
|
-
opens: v.LiteralSchema<false, undefined>;
|
|
9
|
-
error: v.StringSchema<undefined>;
|
|
17
|
+
readonly path: v.StringSchema<undefined>;
|
|
18
|
+
readonly exists: v.LiteralSchema<true, undefined>;
|
|
19
|
+
readonly opens: v.LiteralSchema<false, undefined>;
|
|
20
|
+
readonly error: v.StringSchema<undefined>;
|
|
21
|
+
readonly schema: v.StrictObjectSchema<{
|
|
22
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
23
|
+
}, undefined>;
|
|
10
24
|
}, undefined>, v.StrictObjectSchema<{
|
|
11
25
|
readonly by_provider: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
12
26
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -50,12 +64,42 @@ export declare const storeInfo: v.UnionSchema<[v.StrictObjectSchema<{
|
|
|
50
64
|
readonly file: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
51
65
|
readonly wal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
52
66
|
}, undefined>;
|
|
67
|
+
readonly journal_mode: v.StringSchema<undefined>;
|
|
68
|
+
/** `free` pages hold nothing; a `VACUUM` would give them back. */
|
|
69
|
+
readonly pages: v.StrictObjectSchema<{
|
|
70
|
+
readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
71
|
+
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
72
|
+
readonly free: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
73
|
+
}, undefined>;
|
|
74
|
+
readonly migrations: v.ArraySchema<v.StrictObjectSchema<{
|
|
75
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
76
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
77
|
+
readonly applied_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
78
|
+
}, undefined>, undefined>;
|
|
79
|
+
/** From the marker a backup job leaves in `backups/last.json` beside the store; null without one. */
|
|
80
|
+
readonly backup: v.NullableSchema<v.StrictObjectSchema<{
|
|
81
|
+
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
82
|
+
readonly file: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
83
|
+
readonly checked: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
84
|
+
}, undefined>, undefined>;
|
|
53
85
|
readonly schema: v.StrictObjectSchema<{
|
|
54
86
|
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
55
87
|
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
56
88
|
readonly writable: v.BooleanSchema<undefined>;
|
|
57
89
|
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
90
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
91
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
92
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
93
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
94
|
+
}, undefined>, undefined>;
|
|
58
95
|
}, undefined>;
|
|
96
|
+
readonly clients: v.ArraySchema<v.StrictObjectSchema<{
|
|
97
|
+
readonly command: v.StringSchema<undefined>;
|
|
98
|
+
readonly version: v.StringSchema<undefined>;
|
|
99
|
+
readonly core: v.StringSchema<undefined>;
|
|
100
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
101
|
+
readonly seen_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
102
|
+
}, undefined>, undefined>;
|
|
59
103
|
readonly rows: Omit<v.StrictObjectSchema<{
|
|
60
104
|
readonly accounts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
61
105
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -2,6 +2,12 @@ import * as v from "valibot";
|
|
|
2
2
|
import { count, text, time } from "./fields.js";
|
|
3
3
|
const absent = v.strictObject({ path: text, exists: v.literal(false) });
|
|
4
4
|
const schema = v.strictObject({ version: count, min_compatible: count, writable: v.boolean(), speaks: count });
|
|
5
|
+
const infoSchema = v.strictObject({
|
|
6
|
+
...schema.entries,
|
|
7
|
+
reason: v.picklist(["missing", "older", "current", "newer", "too_new"]),
|
|
8
|
+
upgrade: v.nullable(v.strictObject({ version: count, min_compatible: count })),
|
|
9
|
+
});
|
|
10
|
+
const client = v.strictObject({ command: text, version: text, core: text, speaks: count, seen_at: time });
|
|
5
11
|
const wordIndex = v.strictObject({
|
|
6
12
|
watermark: count,
|
|
7
13
|
filled_through: count,
|
|
@@ -47,13 +53,20 @@ const contents = {
|
|
|
47
53
|
by_attachment_kind: v.optional(v.array(v.strictObject({ type: text, kind: text, count, bytes: count }))),
|
|
48
54
|
};
|
|
49
55
|
export const storeInfo = v.union([
|
|
50
|
-
absent,
|
|
51
|
-
v.strictObject(readFailure),
|
|
56
|
+
v.strictObject({ ...absent.entries, schema: infoSchema }),
|
|
57
|
+
v.strictObject({ ...readFailure, schema: v.strictObject({ speaks: count }) }),
|
|
52
58
|
v.strictObject({
|
|
53
59
|
path: text,
|
|
54
60
|
exists: v.literal(true),
|
|
55
61
|
bytes: v.strictObject({ file: count, wal: count }),
|
|
56
|
-
|
|
62
|
+
journal_mode: text,
|
|
63
|
+
/** `free` pages hold nothing; a `VACUUM` would give them back. */
|
|
64
|
+
pages: v.strictObject({ size: count, count, free: count }),
|
|
65
|
+
migrations: v.array(v.strictObject({ version: count, min_compatible: count, applied_at: time })),
|
|
66
|
+
/** From the marker a backup job leaves in `backups/last.json` beside the store; null without one. */
|
|
67
|
+
backup: v.nullable(v.strictObject({ at: time, file: v.nullable(text), checked: v.nullable(text) })),
|
|
68
|
+
schema: infoSchema,
|
|
69
|
+
clients: v.array(client),
|
|
57
70
|
rows,
|
|
58
71
|
pending_normalization: v.nullable(count),
|
|
59
72
|
word_index: v.nullable(wordIndex),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const TABLE_KINDS: readonly ["data", "search_index", "search_index_part", "internal"];
|
|
3
|
+
export declare const storeTable: v.StrictObjectSchema<{
|
|
4
|
+
readonly name: v.StringSchema<undefined>;
|
|
5
|
+
readonly kind: v.PicklistSchema<readonly ["data", "search_index", "search_index_part", "internal"], undefined>;
|
|
6
|
+
readonly rows: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
7
|
+
readonly bytes: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
8
|
+
}, undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { count, text } from "./fields.js";
|
|
3
|
+
export const TABLE_KINDS = ["data", "search_index", "search_index_part", "internal"];
|
|
4
|
+
export const storeTable = v.strictObject({
|
|
5
|
+
name: text,
|
|
6
|
+
kind: v.picklist(TABLE_KINDS),
|
|
7
|
+
rows: v.nullable(count),
|
|
8
|
+
bytes: v.optional(v.nullable(count)),
|
|
9
|
+
});
|
|
@@ -38,6 +38,7 @@ export declare const meetingTools: ({
|
|
|
38
38
|
max_read_bytes?: undefined;
|
|
39
39
|
cursor?: undefined;
|
|
40
40
|
} | {
|
|
41
|
+
limit?: undefined;
|
|
41
42
|
event_id?: undefined;
|
|
42
43
|
series_id?: undefined;
|
|
43
44
|
page?: undefined;
|
|
@@ -53,11 +54,11 @@ export declare const meetingTools: ({
|
|
|
53
54
|
format?: undefined;
|
|
54
55
|
transcript_id?: undefined;
|
|
55
56
|
query?: undefined;
|
|
56
|
-
limit?: undefined;
|
|
57
57
|
scan_limit?: undefined;
|
|
58
58
|
max_read_bytes?: undefined;
|
|
59
59
|
cursor?: undefined;
|
|
60
60
|
} | {
|
|
61
|
+
limit?: undefined;
|
|
61
62
|
event_id?: undefined;
|
|
62
63
|
series_id?: undefined;
|
|
63
64
|
page?: undefined;
|
|
@@ -75,11 +76,11 @@ export declare const meetingTools: ({
|
|
|
75
76
|
format?: undefined;
|
|
76
77
|
transcript_id?: undefined;
|
|
77
78
|
query?: undefined;
|
|
78
|
-
limit?: undefined;
|
|
79
79
|
scan_limit?: undefined;
|
|
80
80
|
max_read_bytes?: undefined;
|
|
81
81
|
cursor?: undefined;
|
|
82
82
|
} | {
|
|
83
|
+
limit?: undefined;
|
|
83
84
|
event_id?: undefined;
|
|
84
85
|
series_id?: undefined;
|
|
85
86
|
page?: undefined;
|
|
@@ -101,7 +102,6 @@ export declare const meetingTools: ({
|
|
|
101
102
|
minimum: number;
|
|
102
103
|
};
|
|
103
104
|
query?: undefined;
|
|
104
|
-
limit?: undefined;
|
|
105
105
|
scan_limit?: undefined;
|
|
106
106
|
max_read_bytes?: undefined;
|
|
107
107
|
cursor?: undefined;
|
|
@@ -188,6 +188,7 @@ export declare const meetingTools: ({
|
|
|
188
188
|
max_read_bytes?: undefined;
|
|
189
189
|
cursor?: undefined;
|
|
190
190
|
} | {
|
|
191
|
+
limit?: undefined;
|
|
191
192
|
event_id?: undefined;
|
|
192
193
|
series_id?: undefined;
|
|
193
194
|
page?: undefined;
|
|
@@ -203,11 +204,11 @@ export declare const meetingTools: ({
|
|
|
203
204
|
format?: undefined;
|
|
204
205
|
transcript_id?: undefined;
|
|
205
206
|
query?: undefined;
|
|
206
|
-
limit?: undefined;
|
|
207
207
|
scan_limit?: undefined;
|
|
208
208
|
max_read_bytes?: undefined;
|
|
209
209
|
cursor?: undefined;
|
|
210
210
|
} | {
|
|
211
|
+
limit?: undefined;
|
|
211
212
|
event_id?: undefined;
|
|
212
213
|
series_id?: undefined;
|
|
213
214
|
page?: undefined;
|
|
@@ -225,11 +226,11 @@ export declare const meetingTools: ({
|
|
|
225
226
|
format?: undefined;
|
|
226
227
|
transcript_id?: undefined;
|
|
227
228
|
query?: undefined;
|
|
228
|
-
limit?: undefined;
|
|
229
229
|
scan_limit?: undefined;
|
|
230
230
|
max_read_bytes?: undefined;
|
|
231
231
|
cursor?: undefined;
|
|
232
232
|
} | {
|
|
233
|
+
limit?: undefined;
|
|
233
234
|
event_id?: undefined;
|
|
234
235
|
series_id?: undefined;
|
|
235
236
|
page?: undefined;
|
|
@@ -251,7 +252,6 @@ export declare const meetingTools: ({
|
|
|
251
252
|
minimum: number;
|
|
252
253
|
};
|
|
253
254
|
query?: undefined;
|
|
254
|
-
limit?: undefined;
|
|
255
255
|
scan_limit?: undefined;
|
|
256
256
|
max_read_bytes?: undefined;
|
|
257
257
|
cursor?: undefined;
|
|
@@ -338,6 +338,7 @@ export declare const meetingTools: ({
|
|
|
338
338
|
max_read_bytes?: undefined;
|
|
339
339
|
cursor?: undefined;
|
|
340
340
|
} | {
|
|
341
|
+
limit?: undefined;
|
|
341
342
|
event_id?: undefined;
|
|
342
343
|
series_id?: undefined;
|
|
343
344
|
page?: undefined;
|
|
@@ -353,11 +354,11 @@ export declare const meetingTools: ({
|
|
|
353
354
|
format?: undefined;
|
|
354
355
|
transcript_id?: undefined;
|
|
355
356
|
query?: undefined;
|
|
356
|
-
limit?: undefined;
|
|
357
357
|
scan_limit?: undefined;
|
|
358
358
|
max_read_bytes?: undefined;
|
|
359
359
|
cursor?: undefined;
|
|
360
360
|
} | {
|
|
361
|
+
limit?: undefined;
|
|
361
362
|
event_id?: undefined;
|
|
362
363
|
series_id?: undefined;
|
|
363
364
|
page?: undefined;
|
|
@@ -375,11 +376,11 @@ export declare const meetingTools: ({
|
|
|
375
376
|
format?: undefined;
|
|
376
377
|
transcript_id?: undefined;
|
|
377
378
|
query?: undefined;
|
|
378
|
-
limit?: undefined;
|
|
379
379
|
scan_limit?: undefined;
|
|
380
380
|
max_read_bytes?: undefined;
|
|
381
381
|
cursor?: undefined;
|
|
382
382
|
} | {
|
|
383
|
+
limit?: undefined;
|
|
383
384
|
event_id?: undefined;
|
|
384
385
|
series_id?: undefined;
|
|
385
386
|
page?: undefined;
|
|
@@ -401,7 +402,6 @@ export declare const meetingTools: ({
|
|
|
401
402
|
minimum: number;
|
|
402
403
|
};
|
|
403
404
|
query?: undefined;
|
|
404
|
-
limit?: undefined;
|
|
405
405
|
scan_limit?: undefined;
|
|
406
406
|
max_read_bytes?: undefined;
|
|
407
407
|
cursor?: undefined;
|
|
@@ -488,6 +488,7 @@ export declare const meetingTools: ({
|
|
|
488
488
|
max_read_bytes?: undefined;
|
|
489
489
|
cursor?: undefined;
|
|
490
490
|
} | {
|
|
491
|
+
limit?: undefined;
|
|
491
492
|
event_id?: undefined;
|
|
492
493
|
series_id?: undefined;
|
|
493
494
|
page?: undefined;
|
|
@@ -503,11 +504,11 @@ export declare const meetingTools: ({
|
|
|
503
504
|
format?: undefined;
|
|
504
505
|
transcript_id?: undefined;
|
|
505
506
|
query?: undefined;
|
|
506
|
-
limit?: undefined;
|
|
507
507
|
scan_limit?: undefined;
|
|
508
508
|
max_read_bytes?: undefined;
|
|
509
509
|
cursor?: undefined;
|
|
510
510
|
} | {
|
|
511
|
+
limit?: undefined;
|
|
511
512
|
event_id?: undefined;
|
|
512
513
|
series_id?: undefined;
|
|
513
514
|
page?: undefined;
|
|
@@ -525,11 +526,11 @@ export declare const meetingTools: ({
|
|
|
525
526
|
format?: undefined;
|
|
526
527
|
transcript_id?: undefined;
|
|
527
528
|
query?: undefined;
|
|
528
|
-
limit?: undefined;
|
|
529
529
|
scan_limit?: undefined;
|
|
530
530
|
max_read_bytes?: undefined;
|
|
531
531
|
cursor?: undefined;
|
|
532
532
|
} | {
|
|
533
|
+
limit?: undefined;
|
|
533
534
|
event_id?: undefined;
|
|
534
535
|
series_id?: undefined;
|
|
535
536
|
page?: undefined;
|
|
@@ -551,7 +552,6 @@ export declare const meetingTools: ({
|
|
|
551
552
|
minimum: number;
|
|
552
553
|
};
|
|
553
554
|
query?: undefined;
|
|
554
|
-
limit?: undefined;
|
|
555
555
|
scan_limit?: undefined;
|
|
556
556
|
max_read_bytes?: undefined;
|
|
557
557
|
cursor?: undefined;
|
|
@@ -638,6 +638,7 @@ export declare const meetingTools: ({
|
|
|
638
638
|
max_read_bytes?: undefined;
|
|
639
639
|
cursor?: undefined;
|
|
640
640
|
} | {
|
|
641
|
+
limit?: undefined;
|
|
641
642
|
event_id?: undefined;
|
|
642
643
|
series_id?: undefined;
|
|
643
644
|
page?: undefined;
|
|
@@ -653,11 +654,11 @@ export declare const meetingTools: ({
|
|
|
653
654
|
format?: undefined;
|
|
654
655
|
transcript_id?: undefined;
|
|
655
656
|
query?: undefined;
|
|
656
|
-
limit?: undefined;
|
|
657
657
|
scan_limit?: undefined;
|
|
658
658
|
max_read_bytes?: undefined;
|
|
659
659
|
cursor?: undefined;
|
|
660
660
|
} | {
|
|
661
|
+
limit?: undefined;
|
|
661
662
|
event_id?: undefined;
|
|
662
663
|
series_id?: undefined;
|
|
663
664
|
page?: undefined;
|
|
@@ -675,11 +676,11 @@ export declare const meetingTools: ({
|
|
|
675
676
|
format?: undefined;
|
|
676
677
|
transcript_id?: undefined;
|
|
677
678
|
query?: undefined;
|
|
678
|
-
limit?: undefined;
|
|
679
679
|
scan_limit?: undefined;
|
|
680
680
|
max_read_bytes?: undefined;
|
|
681
681
|
cursor?: undefined;
|
|
682
682
|
} | {
|
|
683
|
+
limit?: undefined;
|
|
683
684
|
event_id?: undefined;
|
|
684
685
|
series_id?: undefined;
|
|
685
686
|
page?: undefined;
|
|
@@ -701,7 +702,6 @@ export declare const meetingTools: ({
|
|
|
701
702
|
minimum: number;
|
|
702
703
|
};
|
|
703
704
|
query?: undefined;
|
|
704
|
-
limit?: undefined;
|
|
705
705
|
scan_limit?: undefined;
|
|
706
706
|
max_read_bytes?: undefined;
|
|
707
707
|
cursor?: undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CacheDatabase } from "./driver.js";
|
|
2
|
+
import { type Migration } from "./migrations.js";
|
|
3
|
+
export declare const SPEAKS: number;
|
|
4
|
+
export interface FileSchema {
|
|
5
|
+
version: number;
|
|
6
|
+
minCompatible: number;
|
|
7
|
+
}
|
|
8
|
+
/** Where the file stands against this build: `missing` and `older` are what this build's next run migrates. */
|
|
9
|
+
export type SchemaReason = "missing" | "older" | "current" | "newer" | "too_new";
|
|
10
|
+
/** An empty file is normal: `openStore` creates it before the first migration runs. */
|
|
11
|
+
export declare const fileSchemaOf: (database: CacheDatabase) => FileSchema;
|
|
12
|
+
/** The negation of `migrate`'s refusal: a newer file stays open to this build until its minimum passes it. */
|
|
13
|
+
export declare const writableBy: ({ version, minCompatible }: FileSchema, speaks?: number) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* What this build makes of the file, and what its next run would leave behind: `upgrade.minCompatible` is the
|
|
16
|
+
* minimum the file will demand afterwards, so a caller can name every other tool that will then refuse it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const compatibilityOf: (file: FileSchema | undefined, migrations?: readonly Migration[]) => {
|
|
19
|
+
version: number;
|
|
20
|
+
minCompatible: number;
|
|
21
|
+
speaks: number;
|
|
22
|
+
writable: boolean;
|
|
23
|
+
reason: SchemaReason;
|
|
24
|
+
upgrade: {
|
|
25
|
+
version: number;
|
|
26
|
+
minCompatible: number;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MIGRATIONS } from "./migrations.js";
|
|
2
|
+
export const SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
3
|
+
/** An empty file is normal: `openStore` creates it before the first migration runs. */
|
|
4
|
+
export const fileSchemaOf = (database) => {
|
|
5
|
+
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
6
|
+
const row = tracked
|
|
7
|
+
? database.prepare("SELECT version, min_compatible FROM schema_migrations ORDER BY version DESC LIMIT 1").get()
|
|
8
|
+
: undefined;
|
|
9
|
+
return { version: Number(row?.version ?? 0), minCompatible: Number(row?.min_compatible ?? 0) };
|
|
10
|
+
};
|
|
11
|
+
/** The negation of `migrate`'s refusal: a newer file stays open to this build until its minimum passes it. */
|
|
12
|
+
export const writableBy = ({ version, minCompatible }, speaks = SPEAKS) => version <= speaks || minCompatible <= speaks;
|
|
13
|
+
/**
|
|
14
|
+
* What this build makes of the file, and what its next run would leave behind: `upgrade.minCompatible` is the
|
|
15
|
+
* minimum the file will demand afterwards, so a caller can name every other tool that will then refuse it.
|
|
16
|
+
*/
|
|
17
|
+
export const compatibilityOf = (file, migrations = MIGRATIONS) => {
|
|
18
|
+
const speaks = migrations.at(-1)?.version ?? 0;
|
|
19
|
+
const { version, minCompatible } = file ?? { version: 0, minCompatible: 0 };
|
|
20
|
+
const writable = writableBy({ version, minCompatible }, speaks);
|
|
21
|
+
const reason = !file
|
|
22
|
+
? "missing"
|
|
23
|
+
: version < speaks
|
|
24
|
+
? "older"
|
|
25
|
+
: version === speaks
|
|
26
|
+
? "current"
|
|
27
|
+
: writable
|
|
28
|
+
? "newer"
|
|
29
|
+
: "too_new";
|
|
30
|
+
const raisedTo = migrations
|
|
31
|
+
.filter((migration) => migration.version > version)
|
|
32
|
+
.reduce((highest, migration) => Math.max(highest, migration.minCompatible), minCompatible);
|
|
33
|
+
return {
|
|
34
|
+
version,
|
|
35
|
+
minCompatible,
|
|
36
|
+
speaks,
|
|
37
|
+
writable,
|
|
38
|
+
reason,
|
|
39
|
+
upgrade: version < speaks ? { version: speaks, minCompatible: raisedTo } : null,
|
|
40
|
+
};
|
|
41
|
+
};
|
package/dist/store/exports.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { type AttachmentTextEntry, type AttachmentView, attachmentColumns, type
|
|
|
19
19
|
export { pendingNormalization } from "./sqlite/backfill.js";
|
|
20
20
|
export type { ChatRekey, ChatRekeys } from "./sqlite/chat-rekey.js";
|
|
21
21
|
export { CHAT_COLUMNS, TRACKED_CHAT_COLUMNS, titlePart } from "./sqlite/chats.js";
|
|
22
|
+
export { storeClients } from "./sqlite/clients.js";
|
|
22
23
|
export { CHAT_LIST_KEY, type ChatCompleteness, fetchedKey, historyStartKey } from "./sqlite/completeness.js";
|
|
23
24
|
export { CONVERSATION_COLUMNS } from "./sqlite/conversations.js";
|
|
24
25
|
export type { CounterTarget } from "./sqlite/counters.js";
|
package/dist/store/exports.js
CHANGED
|
@@ -3,6 +3,7 @@ export { accountGroupsOf } from "./sqlite/account-groups.js";
|
|
|
3
3
|
export { attachmentColumns, resetAttachmentWords, } from "./sqlite/attachment-texts.js";
|
|
4
4
|
export { pendingNormalization } from "./sqlite/backfill.js";
|
|
5
5
|
export { CHAT_COLUMNS, TRACKED_CHAT_COLUMNS, titlePart } from "./sqlite/chats.js";
|
|
6
|
+
export { storeClients } from "./sqlite/clients.js";
|
|
6
7
|
export { CHAT_LIST_KEY, fetchedKey, historyStartKey } from "./sqlite/completeness.js";
|
|
7
8
|
export { CONVERSATION_COLUMNS } from "./sqlite/conversations.js";
|
|
8
9
|
export { messageOfEmail, threadConversation } from "./sqlite/emails.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { TABLE_KINDS } from "../../entities/store-table.js";
|
|
2
|
+
import type { CacheDatabase } from "../driver.js";
|
|
3
|
+
export type TableKind = (typeof TABLE_KINDS)[number];
|
|
4
|
+
export interface StoreTable {
|
|
5
|
+
name: string;
|
|
6
|
+
kind: TableKind;
|
|
7
|
+
/** Counted for data and internal tables only: a search index's row count is a scan of the whole index. */
|
|
8
|
+
rows: number | null;
|
|
9
|
+
/** With sizes: the pages the table and its indexes hold; null for a search index, whose parts hold its pages. */
|
|
10
|
+
bytes?: number | null;
|
|
11
|
+
}
|
|
12
|
+
export interface TableFilter {
|
|
13
|
+
name?: string;
|
|
14
|
+
kind?: TableKind;
|
|
15
|
+
}
|
|
16
|
+
/** Read-only by the connection itself: listing tables must not set a journal mode or migrate the file. */
|
|
17
|
+
export declare const readStoreTables: (path: string, options?: {
|
|
18
|
+
filter?: TableFilter;
|
|
19
|
+
sizes?: boolean;
|
|
20
|
+
}) => Promise<StoreTable[]>;
|
|
21
|
+
export declare const storeTables: (database: CacheDatabase, { filter, sizes }?: {
|
|
22
|
+
filter?: TableFilter;
|
|
23
|
+
sizes?: boolean;
|
|
24
|
+
}) => StoreTable[];
|
|
25
|
+
/** Facts about the file itself, cheap enough for `store info`: no page is read beyond the header and the history. */
|
|
26
|
+
export declare const fileFacts: (database: CacheDatabase, path: string) => {
|
|
27
|
+
journalMode: string;
|
|
28
|
+
pages: {
|
|
29
|
+
size: number;
|
|
30
|
+
count: number;
|
|
31
|
+
free: number;
|
|
32
|
+
};
|
|
33
|
+
migrations: {
|
|
34
|
+
version: number;
|
|
35
|
+
minCompatible: number;
|
|
36
|
+
appliedAt: string;
|
|
37
|
+
}[];
|
|
38
|
+
backup: {
|
|
39
|
+
at: string;
|
|
40
|
+
file: string | null;
|
|
41
|
+
checked: string | null;
|
|
42
|
+
} | null;
|
|
43
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { CliError } from "@wirecat/cli-base";
|
|
4
|
+
import { openSqlite } from "./open.js";
|
|
5
|
+
const BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
6
|
+
/** `PRAGMA table_list` names virtual and shadow tables itself, so a new search index needs no list kept here. */
|
|
7
|
+
const LISTED = `
|
|
8
|
+
SELECT name, CASE
|
|
9
|
+
WHEN type = 'virtual' THEN 'search_index'
|
|
10
|
+
WHEN type = 'shadow' THEN 'search_index_part'
|
|
11
|
+
WHEN name LIKE 'sqlite\\_%' ESCAPE '\\' OR name IN (${BOOKKEEPING.map((name) => `'${name}'`).join(", ")})
|
|
12
|
+
THEN 'internal'
|
|
13
|
+
ELSE 'data'
|
|
14
|
+
END AS kind
|
|
15
|
+
FROM pragma_table_list
|
|
16
|
+
WHERE schema = 'main' AND name <> 'sqlite_schema'`;
|
|
17
|
+
/** Read-only by the connection itself: listing tables must not set a journal mode or migrate the file. */
|
|
18
|
+
export const readStoreTables = async (path, options = {}) => {
|
|
19
|
+
const { database } = await openSqlite(path, { readOnly: true });
|
|
20
|
+
try {
|
|
21
|
+
return storeTables(database, options);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
database.close();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const storeTables = (database, { filter = {}, sizes = false } = {}) => {
|
|
28
|
+
const listed = database
|
|
29
|
+
.prepare(`SELECT name, kind FROM (${LISTED})
|
|
30
|
+
WHERE (? IS NULL OR name = ?) AND (? IS NULL OR kind = ?) ORDER BY name`)
|
|
31
|
+
.all(filter.name ?? null, filter.name ?? null, filter.kind ?? null, filter.kind ?? null)
|
|
32
|
+
.map((row) => ({ name: String(row.name), kind: String(row.kind) }));
|
|
33
|
+
const bytes = sizes ? pageBytes(database) : undefined;
|
|
34
|
+
return listed.map(({ name, kind }) => ({
|
|
35
|
+
name,
|
|
36
|
+
kind,
|
|
37
|
+
rows: kind === "data" || kind === "internal" ? rowCount(database, name) : null,
|
|
38
|
+
...(bytes ? { bytes: kind === "search_index" ? null : (bytes.get(name) ?? 0) } : {}),
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
const rowCount = (database, table) => Number(database.prepare(`SELECT count(*) AS n FROM "${table.replaceAll('"', '""')}"`).get()?.n ?? 0);
|
|
42
|
+
/** Every page of the file is read: about ten seconds for a 3 GB store whose pages are not in memory. */
|
|
43
|
+
const pageBytes = (database) => {
|
|
44
|
+
let rows;
|
|
45
|
+
try {
|
|
46
|
+
// Joined here, not in SQL: as the inner side of a join, dbstat walks the whole file once per outer row.
|
|
47
|
+
rows = database.prepare("SELECT name, pgsize FROM dbstat WHERE schema = 'main' AND aggregate = 1").all();
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (!/no such table: dbstat/.test(String(error)))
|
|
51
|
+
throw error;
|
|
52
|
+
throw new CliError("configuration_error", "this SQLite cannot measure table sizes (it was built without dbstat) — run the command under Node instead of Bun");
|
|
53
|
+
}
|
|
54
|
+
const owners = new Map(database
|
|
55
|
+
.prepare("SELECT name, tbl_name FROM sqlite_schema WHERE type = 'index'")
|
|
56
|
+
.all()
|
|
57
|
+
.map((row) => [String(row.name), String(row.tbl_name)]));
|
|
58
|
+
const bytes = new Map();
|
|
59
|
+
for (const { name, pgsize } of rows) {
|
|
60
|
+
const owner = owners.get(String(name)) ?? String(name);
|
|
61
|
+
bytes.set(owner, (bytes.get(owner) ?? 0) + Number(pgsize));
|
|
62
|
+
}
|
|
63
|
+
return bytes;
|
|
64
|
+
};
|
|
65
|
+
/** Facts about the file itself, cheap enough for `store info`: no page is read beyond the header and the history. */
|
|
66
|
+
export const fileFacts = (database, path) => {
|
|
67
|
+
const pragma = (name) => database.prepare(`PRAGMA ${name}`).get()?.[name];
|
|
68
|
+
const tracked = database.prepare("SELECT 1 FROM sqlite_schema WHERE name = 'schema_migrations'").get();
|
|
69
|
+
return {
|
|
70
|
+
journalMode: String(pragma("journal_mode")),
|
|
71
|
+
pages: {
|
|
72
|
+
size: Number(pragma("page_size")),
|
|
73
|
+
count: Number(pragma("page_count")),
|
|
74
|
+
free: Number(pragma("freelist_count")),
|
|
75
|
+
},
|
|
76
|
+
migrations: tracked
|
|
77
|
+
? database
|
|
78
|
+
.prepare("SELECT version, min_compatible, applied_at FROM schema_migrations ORDER BY version")
|
|
79
|
+
.all()
|
|
80
|
+
.map((row) => ({
|
|
81
|
+
version: Number(row.version),
|
|
82
|
+
minCompatible: Number(row.min_compatible),
|
|
83
|
+
appliedAt: new Date(Number(row.applied_at)).toISOString(),
|
|
84
|
+
}))
|
|
85
|
+
: [],
|
|
86
|
+
backup: lastBackup(path),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The marker the owner's backup job writes beside the store; cli-memo's `mail trash` already trusts it. Only its
|
|
91
|
+
* time, file name and check are passed on, and a marker that does not parse reads as none.
|
|
92
|
+
*/
|
|
93
|
+
const lastBackup = (path) => {
|
|
94
|
+
const marker = join(dirname(path), "backups", "last.json");
|
|
95
|
+
if (!existsSync(marker))
|
|
96
|
+
return null;
|
|
97
|
+
try {
|
|
98
|
+
const { at, file, checked } = JSON.parse(readFileSync(marker, "utf8"));
|
|
99
|
+
const time = typeof at === "string" ? Date.parse(at) : Number.NaN;
|
|
100
|
+
if (Number.isNaN(time))
|
|
101
|
+
return null;
|
|
102
|
+
return {
|
|
103
|
+
at: new Date(time).toISOString(),
|
|
104
|
+
file: typeof file === "string" ? file : null,
|
|
105
|
+
checked: typeof checked === "string" ? checked : null,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
};
|
package/dist/store/store.d.ts
CHANGED
|
@@ -106,5 +106,6 @@ export interface MessageStore {
|
|
|
106
106
|
close(): Promise<void>;
|
|
107
107
|
}
|
|
108
108
|
export { BACKFILL_ON_OPEN, type StoreOptions } from "./sqlite/open-store.js";
|
|
109
|
+
export { fileFacts, readStoreTables, type TableKind } from "./sqlite/store-tables.js";
|
|
109
110
|
export declare const openStore: (options?: StoreOptions) => Promise<MessageStore>;
|
|
110
111
|
export * from "./exports.js";
|
package/dist/store/store.js
CHANGED
|
@@ -41,6 +41,7 @@ import { syncStoreOver } from "./sync.js";
|
|
|
41
41
|
import { tagsStoreOver } from "./tags.js";
|
|
42
42
|
import { accountVectorsOver, vectorsStoreOver } from "./vectors.js";
|
|
43
43
|
export { BACKFILL_ON_OPEN } from "./sqlite/open-store.js";
|
|
44
|
+
export { fileFacts, readStoreTables } from "./sqlite/store-tables.js";
|
|
44
45
|
export const openStore = async (options = {}) => {
|
|
45
46
|
const context = await openStoreContext(options);
|
|
46
47
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.427.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
"@types/node": "^22.20.4",
|
|
214
214
|
"@types/pngjs": "6.0.5",
|
|
215
215
|
"@vitest/coverage-v8": "^5.0.2",
|
|
216
|
-
"@wirecat/cli-base": "0.
|
|
216
|
+
"@wirecat/cli-base": "0.56.0",
|
|
217
217
|
"@wirecat/cli-core-legacy-tags": "npm:@wirecat/cli-core@0.414.0",
|
|
218
218
|
"commander": "15.0.0",
|
|
219
219
|
"cspell": "10.3.6",
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
},
|
|
235
235
|
"peerDependencies": {
|
|
236
236
|
"@napi-rs/canvas": ">=0.1.69 <2",
|
|
237
|
-
"@wirecat/cli-base": ">=0.
|
|
237
|
+
"@wirecat/cli-base": ">=0.56.0 <0.57.0",
|
|
238
238
|
"commander": ">=15"
|
|
239
239
|
},
|
|
240
240
|
"bin": {
|
package/parity.json
CHANGED
|
@@ -4207,6 +4207,12 @@
|
|
|
4207
4207
|
}
|
|
4208
4208
|
},
|
|
4209
4209
|
"skill show": {
|
|
4210
|
+
"in": "all",
|
|
4211
|
+
"options": {
|
|
4212
|
+
"--for": "all"
|
|
4213
|
+
}
|
|
4214
|
+
},
|
|
4215
|
+
"skill status": {
|
|
4210
4216
|
"in": "all"
|
|
4211
4217
|
},
|
|
4212
4218
|
"stats": {
|
|
@@ -4614,6 +4620,12 @@
|
|
|
4614
4620
|
"store status": {
|
|
4615
4621
|
"in": "all"
|
|
4616
4622
|
},
|
|
4623
|
+
"store tables": {
|
|
4624
|
+
"in": "all"
|
|
4625
|
+
},
|
|
4626
|
+
"store tables list": {
|
|
4627
|
+
"in": "all"
|
|
4628
|
+
},
|
|
4617
4629
|
"tags": {
|
|
4618
4630
|
"in": "all"
|
|
4619
4631
|
},
|