@wirecat/cli-core 0.690.0 → 0.692.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 +27 -0
- package/README.md +142 -204
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/cli/documents/folders.js +1 -1
- package/dist/cli/documents/search.js +3 -3
- package/dist/cli/documents/words.d.ts +2 -0
- package/dist/cli/documents/words.js +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/meeting-answer-body.d.ts +8 -0
- package/dist/cli/meeting-answer-body.js +37 -0
- package/dist/cli/service-api-call.d.ts +26 -0
- package/dist/cli/service-api-call.js +34 -0
- package/dist/cli/service-api-manifest.d.ts +4 -0
- package/dist/cli/service-api-manifest.js +1 -1
- package/dist/crm/index.d.ts +2 -0
- package/dist/crm/index.js +2 -0
- package/dist/crm/manifest/manifest.d.ts +176 -0
- package/dist/crm/manifest/manifest.js +156 -0
- package/dist/crm/manifest/map.d.ts +53 -0
- package/dist/crm/manifest/map.js +234 -0
- package/dist/crm/manifest/source.d.ts +18 -0
- package/dist/crm/manifest/source.js +314 -0
- package/dist/errors/reasons.js +1 -0
- package/dist/meetings/cli/index.d.ts +2 -1
- package/dist/meetings/cli/index.js +1 -1
- package/dist/meetings/mcp/index.d.ts +373 -1
- package/dist/meetings/mcp/index.js +74 -14
- package/dist/services/metadata.d.ts +1 -1
- package/package.json +2 -1
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { errorObjectOf, mcpErrorResult } from "@wirecat/cli-base";
|
|
2
2
|
import { exportMeeting } from "../export.js";
|
|
3
|
+
import { BACKENDS } from "../index.js";
|
|
3
4
|
import { MEETING_QUERY } from "../item.js";
|
|
4
|
-
import {
|
|
5
|
+
import { meetingShowThrough, meetingsListThrough } from "../read-through.js";
|
|
6
|
+
import { MeetingError, meetingDetailsAnswer, meetingDetailsBody, meetingPeople, meetingSummaryAnswer, meetingsList, meetingsQuery, meetingTranscriptAnswer, positiveInteger, } from "../reads.js";
|
|
5
7
|
import { agentResult, UNTRUSTED_NEUTRAL } from "./agent-text.js";
|
|
6
8
|
const integer = { type: "integer", minimum: 1 };
|
|
7
9
|
const text = { type: "string", minLength: 1 };
|
|
10
|
+
const backend = {
|
|
11
|
+
type: "string",
|
|
12
|
+
enum: [...BACKENDS],
|
|
13
|
+
description: "where to read: the store (archive), the service (server), or both, kept in the store; without it both, and the " +
|
|
14
|
+
"store alone when the service cannot be asked, said in `missing`",
|
|
15
|
+
};
|
|
8
16
|
export const meetingTools = [
|
|
9
17
|
{
|
|
10
18
|
name: "meetings_list",
|
|
11
|
-
description: "
|
|
12
|
-
|
|
19
|
+
description: "meetings, newest first: the service's, kept in the store, and the stored ones, as `backend` says; each item " +
|
|
20
|
+
"says found_in archive, server or both when the service was asked. `query` narrows them by field:value terms " +
|
|
21
|
+
`(Lucene: AND OR NOT, [a TO b], > <) over ${MEETING_QUERY.fields.map((field) => field.name).join(", ")}, ` +
|
|
22
|
+
"e.g. started_at:[2026-10-01 TO 2026-10-31]",
|
|
13
23
|
properties: {
|
|
14
24
|
account_id: integer,
|
|
15
25
|
event_id: integer,
|
|
@@ -17,14 +27,17 @@ export const meetingTools = [
|
|
|
17
27
|
query: text,
|
|
18
28
|
limit: integer,
|
|
19
29
|
page: integer,
|
|
30
|
+
backend,
|
|
20
31
|
},
|
|
21
32
|
required: [],
|
|
33
|
+
remote: true,
|
|
22
34
|
},
|
|
23
35
|
{
|
|
24
36
|
name: "meeting_show",
|
|
25
|
-
description: "show a stored meeting",
|
|
26
|
-
properties: { meeting: integer, account_id: integer },
|
|
37
|
+
description: "show a stored meeting, read again from the service with its people, transcript and documents, as `backend` says",
|
|
38
|
+
properties: { meeting: integer, account_id: integer, backend },
|
|
27
39
|
required: ["meeting"],
|
|
40
|
+
remote: true,
|
|
28
41
|
},
|
|
29
42
|
{
|
|
30
43
|
name: "meeting_transcript",
|
|
@@ -62,11 +75,12 @@ export const meetingTools = [
|
|
|
62
75
|
},
|
|
63
76
|
required: ["query"],
|
|
64
77
|
},
|
|
65
|
-
].map(({ properties, required, description, ...tool }) => ({
|
|
78
|
+
].map(({ properties, required, description, remote = false, ...tool }) => ({
|
|
66
79
|
...tool,
|
|
67
80
|
description: `${description}. ${UNTRUSTED_NEUTRAL}`,
|
|
68
81
|
inputSchema: { type: "object", properties, required, additionalProperties: false },
|
|
69
|
-
|
|
82
|
+
// A read of the service keeps what it returns, as `meetings list` does, which still counts as a read (WC-CMD-17).
|
|
83
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: remote },
|
|
70
84
|
}));
|
|
71
85
|
const argumentsOf = (name, input) => {
|
|
72
86
|
const tool = meetingTools.find((t) => t.name === name);
|
|
@@ -102,32 +116,78 @@ const argumentsOf = (name, input) => {
|
|
|
102
116
|
throw new MeetingError("validation_error", "query must not be empty");
|
|
103
117
|
else if (key === "cursor" && (typeof value !== "string" || !value))
|
|
104
118
|
throw new MeetingError("validation_error", "cursor must not be empty");
|
|
119
|
+
else if (key === "backend" && !BACKENDS.includes(value))
|
|
120
|
+
throw new MeetingError("validation_error", "backend must be archive, server or both");
|
|
105
121
|
}
|
|
106
122
|
return args;
|
|
107
123
|
};
|
|
108
|
-
|
|
124
|
+
/** The run's account, which the tool caller may name but never change: the service is that account's. */
|
|
125
|
+
const accountOf = (args, bound) => {
|
|
126
|
+
const named = args.account_id;
|
|
127
|
+
if (bound === undefined || named === undefined || named === bound)
|
|
128
|
+
return bound ?? named;
|
|
129
|
+
throw new MeetingError("validation_error", `account_id ${named} is not this run's account; the tools read account ${bound} only`);
|
|
130
|
+
};
|
|
131
|
+
const NO_SERVICE = {
|
|
132
|
+
field: "server",
|
|
133
|
+
why: "this host gives the tool no service to ask — the answer is the store's",
|
|
134
|
+
};
|
|
135
|
+
export const callMeetingTool = async (store, name, input, { limit: configured, failure = {}, source, accountId: bound, signal, timezone, now, offline, }) => {
|
|
136
|
+
const remote = bound !== undefined && (name === "meetings_list" || name === "meeting_show");
|
|
109
137
|
try {
|
|
138
|
+
if (source && bound === undefined)
|
|
139
|
+
throw new MeetingError("configuration_error", "a meetings service needs the run's account (accountId)");
|
|
110
140
|
const args = argumentsOf(name, input);
|
|
141
|
+
const accountId = accountOf(args, bound);
|
|
111
142
|
const filter = {
|
|
112
|
-
accountId
|
|
143
|
+
accountId,
|
|
113
144
|
eventId: args.event_id,
|
|
114
145
|
meetingSeriesId: args.series_id,
|
|
115
146
|
};
|
|
147
|
+
const typed = args.backend;
|
|
148
|
+
if (bound === undefined && typed === "server")
|
|
149
|
+
throw new MeetingError("validation_error", "backend server: this host gives the tool no service to ask");
|
|
150
|
+
const access = {
|
|
151
|
+
...(typed === undefined ? {} : { backend: typed }),
|
|
152
|
+
...(offline ? { offline } : {}),
|
|
153
|
+
...(timezone === undefined ? {} : { timezone }),
|
|
154
|
+
...(now === undefined ? {} : { now }),
|
|
155
|
+
...(signal ? { signal } : {}),
|
|
156
|
+
};
|
|
157
|
+
const unasked = bound === undefined && typed === "both" ? { missing: [NO_SERVICE] } : {};
|
|
116
158
|
let result;
|
|
117
159
|
switch (name) {
|
|
118
160
|
case "meetings_list": {
|
|
119
161
|
const limit = args.limit ?? configured;
|
|
120
|
-
|
|
162
|
+
const listFilter = {
|
|
121
163
|
...filter,
|
|
122
164
|
limit,
|
|
123
165
|
offset: ((args.page ?? 1) - 1) * limit,
|
|
124
166
|
query: meetingsQuery(args.query),
|
|
125
|
-
}
|
|
167
|
+
};
|
|
168
|
+
if (bound === undefined) {
|
|
169
|
+
result = { ...(await meetingsList(store, listFilter)), ...unasked };
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
// The standard envelope has no place for the counts; what the reader must know is in `missing` and `meta`.
|
|
173
|
+
const { server: _server, ...answer } = await meetingsListThrough(source, store, { ...listFilter, accountId: bound }, access);
|
|
174
|
+
result = answer;
|
|
126
175
|
break;
|
|
127
176
|
}
|
|
128
|
-
case "meeting_show":
|
|
129
|
-
|
|
177
|
+
case "meeting_show": {
|
|
178
|
+
if (bound === undefined) {
|
|
179
|
+
result = { ...(await meetingDetailsAnswer(store, args.meeting, filter.accountId)), ...unasked };
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
const shown = await meetingShowThrough(source, store, bound, String(args.meeting), access);
|
|
183
|
+
const { item } = await meetingDetailsBody(store, shown.details);
|
|
184
|
+
result = {
|
|
185
|
+
item: shown.foundIn ? { ...item, found_in: shown.foundIn } : item,
|
|
186
|
+
...(shown.missing ? { missing: shown.missing } : {}),
|
|
187
|
+
...(shown.meta ? { meta: shown.meta } : {}),
|
|
188
|
+
};
|
|
130
189
|
break;
|
|
190
|
+
}
|
|
131
191
|
case "meeting_transcript":
|
|
132
192
|
result = await meetingTranscriptAnswer(store, args.meeting, filter.accountId, {
|
|
133
193
|
history: args.history,
|
|
@@ -157,7 +217,7 @@ export const callMeetingTool = async (store, name, input, { limit: configured, f
|
|
|
157
217
|
});
|
|
158
218
|
}
|
|
159
219
|
catch (error) {
|
|
160
|
-
const { content, structuredContent } = agentResult(mcpErrorResult(errorObjectOf(error, { ...failure, effects: { remote: "none", local: "read" } })));
|
|
220
|
+
const { content, structuredContent } = agentResult(mcpErrorResult(errorObjectOf(error, { ...failure, effects: { remote: remote ? "read" : "none", local: "read" } })));
|
|
161
221
|
return { content, structuredContent, isError: true };
|
|
162
222
|
}
|
|
163
223
|
};
|
|
@@ -14,12 +14,12 @@ export declare const metadataService: (deps: ServiceDeps) => {
|
|
|
14
14
|
dryRun?: boolean;
|
|
15
15
|
}) => Promise<{
|
|
16
16
|
items: ({
|
|
17
|
-
error?: undefined;
|
|
18
17
|
chatId: string;
|
|
19
18
|
tags: import("../domain/channel-tags.js").ChannelTagMatch[];
|
|
20
19
|
algorithm: string;
|
|
21
20
|
fetchedAt: string | null;
|
|
22
21
|
source: string;
|
|
22
|
+
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
tags?: undefined;
|
|
25
25
|
algorithm?: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.692.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",
|
|
@@ -239,6 +239,7 @@
|
|
|
239
239
|
"search:docs": "pnpm build && node scripts/search-docs.ts",
|
|
240
240
|
"check:agent-process": "pnpm build && node --experimental-strip-types scripts/check-agent-process.ts",
|
|
241
241
|
"standards:check": "node config/wirecat/check.mjs",
|
|
242
|
+
"docs:images": "node docs/images/src/render.ts",
|
|
242
243
|
"docs:lint": "markdownlint-cli2",
|
|
243
244
|
"docs:spell": "cspell lint --config cspell.json --no-progress README.md",
|
|
244
245
|
"ci:quick": "pnpm typecheck && vitest run src/cli/command-lint.test.ts",
|