@wirecat/cli-core 0.394.0 → 0.395.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 +47 -0
- package/dist/cli/config-command.js +5 -2
- package/dist/cli/messenger/account-command.js +8 -3
- package/dist/cli/messenger/account-sessions-command.js +7 -2
- package/dist/cli/messenger/conversation-examples.d.ts +2 -0
- package/dist/cli/messenger/conversation-examples.js +25 -0
- package/dist/cli/messenger/conversations-command.js +2 -0
- package/dist/cli/messenger/mcp-command.js +12 -3
- package/dist/cli/messenger/models-command.js +15 -6
- package/dist/cli/messenger/polls-command.js +20 -5
- package/dist/cli/messenger/records-command.js +10 -2
- package/dist/cli/messenger/search-command.js +12 -0
- package/dist/cli/messenger/server-command.js +19 -7
- package/dist/cli/messenger/tasks-command.js +18 -6
- package/dist/cli/runs/command.js +11 -4
- package/dist/cli/skill-command.js +6 -1
- package/dist/entities/index.d.ts +1 -1
- package/dist/entities/saved-search.d.ts +1 -1
- package/dist/entities/saved-search.js +1 -1
- package/dist/errors/reasons.js +1 -0
- package/dist/meetings/cli/search.js +1 -1
- package/dist/meetings/hit-query.d.ts +10 -0
- package/dist/meetings/hit-query.js +85 -1
- package/dist/meetings/index.d.ts +1 -1
- package/dist/meetings/index.js +1 -1
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/services/index.d.ts +3 -2
- package/dist/services/index.js +2 -1
- package/dist/services/meeting-combined.d.ts +1 -1
- package/dist/services/meeting-combined.js +4 -3
- package/dist/services/meeting-hit-search.d.ts +1 -1
- package/dist/services/meeting-hit-search.js +4 -2
- package/dist/services/meeting-searches.d.ts +25 -0
- package/dist/services/meeting-searches.js +35 -0
- package/dist/services/search-record.d.ts +1 -1
- package/dist/services/searches.d.ts +1 -0
- package/dist/services/searches.js +17 -4
- package/dist/store/searches.d.ts +5 -4
- package/dist/store/searches.js +4 -4
- package/dist/store/sqlite/searches.d.ts +4 -4
- package/dist/store/sqlite/searches.js +21 -6
- package/package.json +1 -1
|
@@ -2,6 +2,9 @@ import { CliError, singleLine } from "@wirecat/cli-base";
|
|
|
2
2
|
import { toIso } from "./values.js";
|
|
3
3
|
/** Unnamed runs kept, newest first; a saved search is never pruned. */
|
|
4
4
|
export const HISTORY_KEPT = 1000;
|
|
5
|
+
const commandFilter = (commands) => commands
|
|
6
|
+
? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] }
|
|
7
|
+
: { sql: "", values: [] };
|
|
5
8
|
const COLUMNS = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
6
9
|
const searchOf = (row) => ({
|
|
7
10
|
id: String(row.id),
|
|
@@ -61,16 +64,28 @@ export const saveSearch = (context, name, search, replace) => {
|
|
|
61
64
|
.run(...values, now(), name);
|
|
62
65
|
return mustFind(context, name);
|
|
63
66
|
};
|
|
64
|
-
export const savedSearches = ({ database }) =>
|
|
67
|
+
export const savedSearches = ({ database }, commands) => {
|
|
68
|
+
const only = commandFilter(commands);
|
|
69
|
+
return database
|
|
70
|
+
.prepare(`SELECT ${COLUMNS} FROM searches WHERE name IS NOT NULL${only.sql} ORDER BY name`)
|
|
71
|
+
.all(...only.values)
|
|
72
|
+
.map(searchOf);
|
|
73
|
+
};
|
|
65
74
|
/** Runs, newest first: unnamed ones and saved searches that have run. One more than `limit` says there are more. */
|
|
66
|
-
export const searchHistory = ({ database }, limit, offset = 0) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
export const searchHistory = ({ database }, limit, offset = 0, commands) => {
|
|
76
|
+
const only = commandFilter(commands);
|
|
77
|
+
return database
|
|
78
|
+
.prepare(`SELECT ${COLUMNS} FROM searches WHERE last_run_at IS NOT NULL${only.sql} ORDER BY last_run_at DESC, id DESC LIMIT ? OFFSET ?`)
|
|
79
|
+
.all(...only.values, limit + 1, offset)
|
|
80
|
+
.map(searchOf);
|
|
81
|
+
};
|
|
70
82
|
export const deleteSearch = (context, reference) => {
|
|
71
83
|
const found = mustFind(context, reference);
|
|
72
84
|
context.database.prepare("DELETE FROM searches WHERE id = ?").run(Number(found.id));
|
|
73
85
|
return found;
|
|
74
86
|
};
|
|
75
87
|
/** Unnamed runs only; saved searches stay. */
|
|
76
|
-
export const clearHistory = ({ database }) =>
|
|
88
|
+
export const clearHistory = ({ database }, commands) => {
|
|
89
|
+
const only = commandFilter(commands);
|
|
90
|
+
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
91
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.395.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",
|