@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cli/config-command.js +5 -2
  3. package/dist/cli/messenger/account-command.js +8 -3
  4. package/dist/cli/messenger/account-sessions-command.js +7 -2
  5. package/dist/cli/messenger/conversation-examples.d.ts +2 -0
  6. package/dist/cli/messenger/conversation-examples.js +25 -0
  7. package/dist/cli/messenger/conversations-command.js +2 -0
  8. package/dist/cli/messenger/mcp-command.js +12 -3
  9. package/dist/cli/messenger/models-command.js +15 -6
  10. package/dist/cli/messenger/polls-command.js +20 -5
  11. package/dist/cli/messenger/records-command.js +10 -2
  12. package/dist/cli/messenger/search-command.js +12 -0
  13. package/dist/cli/messenger/server-command.js +19 -7
  14. package/dist/cli/messenger/tasks-command.js +18 -6
  15. package/dist/cli/runs/command.js +11 -4
  16. package/dist/cli/skill-command.js +6 -1
  17. package/dist/entities/index.d.ts +1 -1
  18. package/dist/entities/saved-search.d.ts +1 -1
  19. package/dist/entities/saved-search.js +1 -1
  20. package/dist/errors/reasons.js +1 -0
  21. package/dist/meetings/cli/search.js +1 -1
  22. package/dist/meetings/hit-query.d.ts +10 -0
  23. package/dist/meetings/hit-query.js +85 -1
  24. package/dist/meetings/index.d.ts +1 -1
  25. package/dist/meetings/index.js +1 -1
  26. package/dist/meetings/mcp/index.d.ts +15 -15
  27. package/dist/services/index.d.ts +3 -2
  28. package/dist/services/index.js +2 -1
  29. package/dist/services/meeting-combined.d.ts +1 -1
  30. package/dist/services/meeting-combined.js +4 -3
  31. package/dist/services/meeting-hit-search.d.ts +1 -1
  32. package/dist/services/meeting-hit-search.js +4 -2
  33. package/dist/services/meeting-searches.d.ts +25 -0
  34. package/dist/services/meeting-searches.js +35 -0
  35. package/dist/services/search-record.d.ts +1 -1
  36. package/dist/services/searches.d.ts +1 -0
  37. package/dist/services/searches.js +17 -4
  38. package/dist/store/searches.d.ts +5 -4
  39. package/dist/store/searches.js +4 -4
  40. package/dist/store/sqlite/searches.d.ts +4 -4
  41. package/dist/store/sqlite/searches.js +21 -6
  42. 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 }) => database.prepare(`SELECT ${COLUMNS} FROM searches WHERE name IS NOT NULL ORDER BY name`).all().map(searchOf);
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) => database
67
- .prepare(`SELECT ${COLUMNS} FROM searches WHERE last_run_at IS NOT NULL ORDER BY last_run_at DESC, id DESC LIMIT ? OFFSET ?`)
68
- .all(limit + 1, offset)
69
- .map(searchOf);
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 }) => database.prepare("DELETE FROM searches WHERE name IS NULL").run().changes;
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.394.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",