@wirecat/cli-core 0.665.0 → 0.667.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 (63) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/calendar/cli/conference.d.ts +3 -0
  3. package/dist/calendar/cli/conference.js +7 -0
  4. package/dist/calendar/cli/index.d.ts +1 -0
  5. package/dist/calendar/cli/index.js +4 -2
  6. package/dist/calendar/mcp/index.d.ts +62 -12
  7. package/dist/calendar/mcp/index.js +6 -0
  8. package/dist/calendar/testing/writer-contract.js +1 -0
  9. package/dist/calendar/testing/writer.d.ts +3 -0
  10. package/dist/calendar/testing/writer.js +9 -1
  11. package/dist/calendar/writer.d.ts +13 -0
  12. package/dist/calendar/writes.d.ts +3 -0
  13. package/dist/calendar/writes.js +21 -1
  14. package/dist/cli/documents/catalog.d.ts +87 -0
  15. package/dist/cli/documents/catalog.js +246 -0
  16. package/dist/cli/documents/documents.d.ts +32 -0
  17. package/dist/cli/documents/documents.js +76 -0
  18. package/dist/cli/documents/folders.d.ts +22 -0
  19. package/dist/cli/documents/folders.js +45 -0
  20. package/dist/cli/documents/index.d.ts +36 -0
  21. package/dist/cli/documents/index.js +32 -0
  22. package/dist/cli/documents/knowledge.d.ts +36 -0
  23. package/dist/cli/documents/knowledge.js +235 -0
  24. package/dist/cli/documents/mirrors.d.ts +46 -0
  25. package/dist/cli/documents/mirrors.js +198 -0
  26. package/dist/cli/documents/queries.d.ts +120 -0
  27. package/dist/cli/documents/queries.js +156 -0
  28. package/dist/cli/documents/search.d.ts +25 -0
  29. package/dist/cli/documents/search.js +34 -0
  30. package/dist/cli/documents/sync.d.ts +31 -0
  31. package/dist/cli/documents/sync.js +41 -0
  32. package/dist/cli/documents/testing/commands-contract.d.ts +35 -0
  33. package/dist/cli/documents/testing/commands-contract.js +205 -0
  34. package/dist/cli/documents/testing/index.d.ts +3 -0
  35. package/dist/cli/documents/testing/index.js +3 -0
  36. package/dist/cli/documents/testing/source-contract.d.ts +18 -0
  37. package/dist/cli/documents/testing/source-contract.js +112 -0
  38. package/dist/cli/documents/testing/source.d.ts +13 -0
  39. package/dist/cli/documents/testing/source.js +67 -0
  40. package/dist/cli/documents/words.d.ts +87 -0
  41. package/dist/cli/documents/words.js +79 -0
  42. package/dist/domain/providers.js +2 -1
  43. package/dist/entities/index.d.ts +6 -0
  44. package/dist/errors/reasons.js +16 -2
  45. package/dist/meetings/answers.d.ts +10 -0
  46. package/dist/meetings/answers.js +24 -1
  47. package/dist/meetings/cli/index.js +3 -2
  48. package/dist/meetings/cli/management.d.ts +1 -1
  49. package/dist/meetings/cli/management.js +67 -25
  50. package/dist/meetings/export.d.ts +2 -0
  51. package/dist/meetings/export.js +1 -0
  52. package/dist/meetings/index.d.ts +1 -1
  53. package/dist/meetings/index.js +1 -1
  54. package/dist/meetings/meeting-management.d.ts +68 -3
  55. package/dist/meetings/meeting-management.js +134 -17
  56. package/dist/meetings/read-answers.d.ts +1 -0
  57. package/dist/meetings/read-answers.js +1 -0
  58. package/dist/meetings/reads.d.ts +29 -2
  59. package/dist/meetings/reads.js +3 -2
  60. package/dist/meetings/result-items.d.ts +3 -0
  61. package/dist/meetings/result-items.js +9 -1
  62. package/dist/meetings/testing/management-contract.js +27 -5
  63. package/package.json +9 -1
@@ -0,0 +1,112 @@
1
+ import assert from "node:assert/strict";
2
+ import { isCliError } from "@wirecat/cli-base";
3
+ const MAX_ENTRIES = 500;
4
+ const walk = async ({ source, root, isFolder }) => {
5
+ const seen = new Map();
6
+ const stack = [root];
7
+ while (stack.length) {
8
+ const parent = stack.pop();
9
+ for (const child of await source.children(parent)) {
10
+ assert.ok(child.parents.includes(parent), `${child.id} is a child of ${parent} and names it among its parents`);
11
+ if (seen.has(child.id))
12
+ continue;
13
+ seen.set(child.id, child);
14
+ assert.ok(seen.size <= MAX_ENTRIES, `more than ${MAX_ENTRIES} entries under the fixture's root`);
15
+ if (isFolder(child))
16
+ stack.push(child.id);
17
+ }
18
+ }
19
+ return [...seen.values()];
20
+ };
21
+ /** What the sync imports: a file, or a folder the provider calls a document too. */
22
+ const isImported = (fixture, entry) => !fixture.isFolder(entry) || fixture.isDocument?.(entry) === true;
23
+ const isTime = (value) => value === undefined || !Number.isNaN(Date.parse(value));
24
+ /** What every documents adapter answers, whatever the provider: run each case in the adapter's tests. */
25
+ export const documentSourceContract = (make) => {
26
+ const cases = [
27
+ {
28
+ name: "identity: the signed-in account, the same on every call",
29
+ async run() {
30
+ const { source } = await make();
31
+ const first = await source.identity();
32
+ assert.equal(typeof first, "string");
33
+ assert.ok(first.trim(), "identity() names the account");
34
+ assert.equal(await source.identity(), first, "identity() does not change between calls");
35
+ },
36
+ },
37
+ {
38
+ name: "metadata: the root is a readable folder under its own id",
39
+ async run() {
40
+ const fixture = await make();
41
+ const root = await fixture.source.metadata(fixture.root);
42
+ assert.equal(root.id, fixture.root);
43
+ assert.ok(fixture.isFolder(root), "the root is a folder");
44
+ assert.equal(root.trashed, false);
45
+ },
46
+ },
47
+ {
48
+ name: "children: every entry has an id, a name, a URL and times that parse, and metadata gives it back",
49
+ async run() {
50
+ const fixture = await make();
51
+ const entries = await walk(fixture);
52
+ assert.ok(entries.some((entry) => isImported(fixture, entry)), "the root has at least one document below it");
53
+ for (const entry of entries) {
54
+ assert.ok(entry.id && entry.name.trim(), `${entry.id} has an id and a name`);
55
+ assert.equal(typeof entry.url, "string", `${entry.id} has a URL`);
56
+ assert.equal(typeof entry.canDownload, "boolean", `${entry.id} says whether it can be downloaded`);
57
+ assert.ok(isTime(entry.modifiedAt) && isTime(entry.createdAt), `${entry.id}'s times parse`);
58
+ assert.equal((await fixture.source.metadata(entry.id)).id, entry.id, `metadata(${entry.id}) is the same file`);
59
+ }
60
+ },
61
+ },
62
+ {
63
+ name: "content: a document's text, Markdown, tabs and bytes, under its own metadata",
64
+ async run() {
65
+ const fixture = await make();
66
+ const files = (await walk(fixture)).filter((entry) => isImported(fixture, entry) && entry.canDownload);
67
+ assert.ok(files.length > 0, "the root has a file that can be downloaded");
68
+ for (const file of files.slice(0, 5)) {
69
+ const content = await fixture.source.content(file.id);
70
+ assert.equal(content.metadata.id, file.id);
71
+ assert.equal(typeof content.text, "string");
72
+ assert.equal(typeof content.markdown, "string");
73
+ assert.ok(Array.isArray(content.tabs), "tabs is a list, empty for a document without tabs");
74
+ for (const tab of content.tabs)
75
+ assert.ok(typeof tab.id === "string" && typeof tab.title === "string" && typeof tab.text === "string");
76
+ const bytes = await fixture.source.bytes(file.id);
77
+ assert.ok(bytes instanceof Uint8Array, `bytes(${file.id}) is a Uint8Array`);
78
+ }
79
+ },
80
+ },
81
+ {
82
+ name: "changes: a start token, then pages that each give the next cursor and say what was removed",
83
+ async run() {
84
+ const fixture = await make();
85
+ const { source } = fixture;
86
+ const token = await source.startToken();
87
+ assert.ok(typeof token === "string" && token, "startToken() gives a cursor");
88
+ await fixture.change?.();
89
+ const page = await source.changes(token);
90
+ assert.ok(Array.isArray(page.items), "a change page has items");
91
+ if (fixture.change)
92
+ assert.ok(page.items.length > 0, "the change made after startToken() is in the feed");
93
+ assert.ok(typeof page.cursor === "string" && page.cursor, "a change page gives the next cursor");
94
+ for (const item of page.items) {
95
+ assert.equal(typeof item.removed, "boolean", `change ${item.id} says whether it was removed`);
96
+ if (!item.removed && item.file)
97
+ assert.equal(item.file.id, item.id, `change ${item.id} carries its file`);
98
+ }
99
+ },
100
+ },
101
+ ];
102
+ cases.push({
103
+ name: "metadata: an id the provider does not know is not_found",
104
+ async run() {
105
+ const { source, missing } = await make();
106
+ if (missing === undefined)
107
+ return;
108
+ await assert.rejects(source.metadata(missing), (error) => isCliError(error) && error.code === "not_found");
109
+ },
110
+ });
111
+ return cases;
112
+ };
@@ -0,0 +1,13 @@
1
+ import type { DocumentSource, SourceFile } from "../../../documents.js";
2
+ /** The folder type of the fake source: no provider's own. */
3
+ export declare const FAKE_FOLDER = "inode/directory";
4
+ export declare const fakeFile: (id: string, parents?: string[], mime?: string) => SourceFile;
5
+ export interface FakeDocumentSource extends DocumentSource {
6
+ files: Map<string, SourceFile>;
7
+ /** Puts a file or folder in, or changes it, and lists it in the next change feed. */
8
+ put(file: SourceFile, text?: string): void;
9
+ /** Takes one out, and lists it as removed in the next change feed. */
10
+ remove(id: string): void;
11
+ }
12
+ /** A provider in memory: a root folder, a nested folder and two text files, with a change feed and a cursor. */
13
+ export declare const fakeDocumentSource: (account?: string) => FakeDocumentSource;
@@ -0,0 +1,67 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ /** The folder type of the fake source: no provider's own. */
3
+ export const FAKE_FOLDER = "inode/directory";
4
+ export const fakeFile = (id, parents = ["root"], mime = "text/plain") => ({
5
+ id,
6
+ name: id,
7
+ parents,
8
+ mime,
9
+ url: `https://example.invalid/${id}`,
10
+ trashed: false,
11
+ canDownload: true,
12
+ version: "1",
13
+ modifiedAt: "2026-10-16T00:00:00.000Z",
14
+ });
15
+ /** A provider in memory: a root folder, a nested folder and two text files, with a change feed and a cursor. */
16
+ export const fakeDocumentSource = (account = "alpha") => {
17
+ const files = new Map();
18
+ const texts = new Map();
19
+ let feed = [];
20
+ let cursor = 0;
21
+ const metadata = async (id) => {
22
+ const found = files.get(id);
23
+ if (!found)
24
+ throw new CliError("not_found", "no such synthetic file", { reason: "document.not-found" });
25
+ return structuredClone(found);
26
+ };
27
+ const source = {
28
+ files,
29
+ put(file, text) {
30
+ files.set(file.id, file);
31
+ if (text !== undefined)
32
+ texts.set(file.id, text);
33
+ feed.push({ id: file.id, removed: false, file: structuredClone(file) });
34
+ },
35
+ remove(id) {
36
+ files.delete(id);
37
+ texts.delete(id);
38
+ feed.push({ id, removed: true });
39
+ },
40
+ identity: async () => account,
41
+ metadata,
42
+ children: async (id) => [...files.values()].filter((item) => item.parents.includes(id)).map((item) => structuredClone(item)),
43
+ startToken: async () => `cursor-${cursor}`,
44
+ changes: async (token) => {
45
+ if (!/^cursor-\d+$/.test(token))
46
+ throw new CliError("validation_error", "unknown synthetic cursor");
47
+ const items = feed;
48
+ feed = [];
49
+ cursor += 1;
50
+ return { items, cursor: `cursor-${cursor}` };
51
+ },
52
+ content: async (id, maxChars) => {
53
+ const file = await metadata(id);
54
+ if (file.mime === FAKE_FOLDER)
55
+ throw new CliError("validation_error", "a folder has no content");
56
+ const text = (texts.get(id) ?? `budget ${id}`).slice(0, maxChars);
57
+ return { metadata: file, markdown: `# ${file.name}\n\n${text}\n`, text, tabs: [] };
58
+ },
59
+ bytes: async (id) => new TextEncoder().encode((await source.content(id)).text),
60
+ };
61
+ source.put(fakeFile("root", [], FAKE_FOLDER));
62
+ source.put(fakeFile("nested", ["root"], FAKE_FOLDER));
63
+ source.put(fakeFile("a", ["nested"]), "quarterly budget for the alpha team");
64
+ source.put(fakeFile("b"), "notes from the planning review");
65
+ feed = [];
66
+ return source;
67
+ };
@@ -0,0 +1,87 @@
1
+ import { type Command } from "commander";
2
+ import { type ListBody } from "../envelope.js";
3
+ /** How a documents CLI names itself and its provider in the shared commands' help, examples and answers. */
4
+ export interface DocumentWords {
5
+ /** The command: the first word of every example (`drive`). */
6
+ app: string;
7
+ /** The profile examples name. */
8
+ profile?: string;
9
+ /** The provider's side, as the user types it: `mirrors sync --keep local|<remote>|both`, `<remote>-id`. */
10
+ remote: string;
11
+ /** The provider in sentences (`Google`). */
12
+ provider: string;
13
+ /** The place files live, in sentences (`Google Drive`); the provider when absent. */
14
+ place?: string;
15
+ /** The store's provider name, which an issue names as its `source` (`google-drive`). */
16
+ source: string;
17
+ /** Texts that differ from the ones made from the words above. */
18
+ text?: Partial<DocumentTexts>;
19
+ }
20
+ export interface DocumentTexts {
21
+ documents: string;
22
+ documentsList: string;
23
+ documentArgument: string;
24
+ knowledgeArgument: string;
25
+ catalog: string;
26
+ catalogArgument: string;
27
+ treeArgument: string;
28
+ folders: string;
29
+ folderArgument: string;
30
+ syncLimit: string;
31
+ identities: string;
32
+ identitiesList: string;
33
+ identitiesLink: string;
34
+ identityArgument: string;
35
+ mirrors: string;
36
+ mirrorsAdd: string;
37
+ mirrorsSync: string;
38
+ mirrorParent: string;
39
+ }
40
+ export interface Words extends Required<Omit<DocumentWords, "text">> {
41
+ text: DocumentTexts;
42
+ /** `drive personal`: what every example starts with. */
43
+ prefix: string;
44
+ }
45
+ export declare const wordsOf: (words: DocumentWords) => Words;
46
+ export declare const examples: (command: Command, lines: string[]) => Command;
47
+ export declare const positive: (input: string) => number;
48
+ export declare const nonnegative: (input: string) => number;
49
+ /** A list that is never paged: everything there is, in one answer. */
50
+ export declare const allOf: <T>(items: T[]) => ListBody<T>;
51
+ /** The `documents` group, made once: the shared commands and the CLI's live ones join it in the order they are added. */
52
+ export declare const documentsGroup: (program: Command, words: Words) => Command;
53
+ export interface CopyAge {
54
+ synced_at: string | null;
55
+ age_days: number | null;
56
+ }
57
+ export declare const ageOf: (lastSync: string | undefined, now?: number) => CopyAge;
58
+ export declare const staleCopy: (provider: string, lastSync: string | undefined, now?: number) => {
59
+ next?: undefined;
60
+ readonly missing?: undefined;
61
+ meta?: undefined;
62
+ } | {
63
+ missing: {
64
+ field: string;
65
+ why: string;
66
+ step: string;
67
+ }[];
68
+ next: ({
69
+ kind: "command";
70
+ step: string;
71
+ command: string;
72
+ args: {
73
+ [x: string]: unknown;
74
+ };
75
+ line?: string | undefined;
76
+ why: string;
77
+ safe_to_auto_execute: boolean;
78
+ } | {
79
+ kind: "user_action";
80
+ step: string;
81
+ why: string;
82
+ safe_to_auto_execute: false;
83
+ })[];
84
+ meta: {
85
+ complete: false;
86
+ };
87
+ };
@@ -0,0 +1,79 @@
1
+ import { annotate } from "@wirecat/cli-base/commands";
2
+ import { defineSteps, stepOf } from "@wirecat/cli-base/standards";
3
+ import { InvalidArgumentError } from "commander";
4
+ import { listOf } from "../envelope.js";
5
+ export const wordsOf = (words) => {
6
+ const profile = words.profile ?? "personal";
7
+ const place = words.place ?? words.provider;
8
+ const { provider } = words;
9
+ return {
10
+ ...words,
11
+ profile,
12
+ place,
13
+ prefix: `${words.app} ${profile}`,
14
+ text: {
15
+ documents: `read imported documents and ${provider} documents`,
16
+ documentsList: `list imported documents with their ${provider} URLs`,
17
+ documentArgument: `document id, ${provider} URL, or a search hit's document: ref`,
18
+ knowledgeArgument: `${provider} file or folder id or URL in the local catalog, or a document:<n> ref`,
19
+ catalog: `browse stored ${place} files and folders offline`,
20
+ catalogArgument: `${provider} file or folder id, or its URL`,
21
+ treeArgument: `${provider} folder id or URL; defaults to the explicitly selected profile's roots`,
22
+ folders: `choose the ${place} folders that sync imports`,
23
+ folderArgument: `folder id or ${place} URL`,
24
+ syncLimit: `how many documents to read from ${provider} in this run`,
25
+ identities: `the ${provider} accounts seen on a document, and the people they belong to`,
26
+ identitiesList: `list the people ${provider} shows for a document`,
27
+ identitiesLink: `record that a ${provider} account belongs to a known person`,
28
+ identityArgument: `${provider} account id, as identities list prints it`,
29
+ mirrors: `keep local folders mirrored into ${place}`,
30
+ mirrorsAdd: `mirror a local folder into ${place}`,
31
+ mirrorsSync: `sync both ways with ${place}; a part changed on both sides is reported`,
32
+ mirrorParent: `the ${place} folder to write into, by id or URL`,
33
+ ...words.text,
34
+ },
35
+ };
36
+ };
37
+ export const examples = (command, lines) => annotate(command, { examples: lines });
38
+ export const positive = (input) => {
39
+ const n = Number(input);
40
+ if (!Number.isSafeInteger(n) || n < 1)
41
+ throw new InvalidArgumentError("use a positive integer");
42
+ return n;
43
+ };
44
+ export const nonnegative = (input) => {
45
+ const n = Number(input);
46
+ if (!Number.isSafeInteger(n) || n < 0)
47
+ throw new InvalidArgumentError("use a nonnegative integer");
48
+ return n;
49
+ };
50
+ /** A list that is never paged: everything there is, in one answer. */
51
+ export const allOf = (items) => listOf("", { items, limit: Math.max(1, items.length), has_more: false });
52
+ /** The `documents` group, made once: the shared commands and the CLI's live ones join it in the order they are added. */
53
+ export const documentsGroup = (program, words) => program.commands.find((command) => command.name() === "documents") ??
54
+ annotate(program.command("documents"), { effects: { remote: "none", local: "read" } }).description(words.text.documents);
55
+ const DAY = 24 * 60 * 60 * 1000;
56
+ export const ageOf = (lastSync, now = Date.now()) => {
57
+ const at = lastSync ? Date.parse(lastSync) : Number.NaN;
58
+ return Number.isNaN(at)
59
+ ? { synced_at: null, age_days: null }
60
+ : { synced_at: lastSync ?? null, age_days: Math.max(0, Math.floor((now - at) / DAY)) };
61
+ };
62
+ // Only the local copy is read: when it is older than a day, say so instead of letting it pass for current.
63
+ export const staleCopy = (provider, lastSync, now = Date.now()) => {
64
+ const sync = defineSteps([
65
+ { id: "sync.run", command: "sync", args: [], why: `copy the changes ${provider} has made into the local store` },
66
+ ])[0];
67
+ const { synced_at, age_days } = ageOf(lastSync, now);
68
+ const old = synced_at === null || now - Date.parse(synced_at) > DAY;
69
+ if (!old)
70
+ return {};
71
+ const why = age_days === null
72
+ ? `the local copy has no sync time; ${provider} may have changed the document since it was copied`
73
+ : `the local copy was synced ${age_days} day${age_days === 1 ? "" : "s"} ago; ${provider} may have changed the document since`;
74
+ return {
75
+ missing: [{ field: "synced_at", why, step: sync.id }],
76
+ next: [stepOf(sync)],
77
+ meta: { complete: false },
78
+ };
79
+ };
@@ -19,7 +19,8 @@ export const PROVIDERS = [
19
19
  { name: "obsidian", kind: "notes", aliases: [] },
20
20
  { name: "added", kind: "notes", aliases: [] },
21
21
  { name: "zoom", kind: "meetings", aliases: [] },
22
- { name: "google-meet", kind: "meetings", aliases: [], command: "gmeet" },
22
+ // Google Meet has no tool of its own: its meetings are gcal's, since every meeting is on the calendar.
23
+ { name: "google-meet", kind: "meetings", aliases: [], command: "gcal" },
23
24
  { name: "google-drive", kind: "documents", aliases: [] },
24
25
  // Its meetings come from the notes Telemost mails (`keeper@telemost.yandex.ru`), read by a mail rule.
25
26
  { name: "telemost", kind: "meetings", aliases: [] },
@@ -107,6 +107,7 @@ export declare const ENTITIES: {
107
107
  readonly duration_minutes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
108
108
  readonly timezone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
109
109
  readonly agenda: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
110
+ readonly settings: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>], undefined>, undefined>, undefined>;
110
111
  }, undefined>, undefined>;
111
112
  readonly applied: v.BooleanSchema<undefined>;
112
113
  readonly meeting: v.OptionalSchema<v.StrictObjectSchema<{
@@ -119,6 +120,7 @@ export declare const ENTITIES: {
119
120
  readonly agenda: v.NullableSchema<v.StringSchema<undefined>, undefined>;
120
121
  readonly join_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
121
122
  }, undefined>, undefined>;
123
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
122
124
  }, undefined>;
123
125
  readonly meeting_invitation: v.StrictObjectSchema<{
124
126
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
@@ -141,6 +143,7 @@ export declare const ENTITIES: {
141
143
  readonly format: v.PicklistSchema<["markdown", "vtt"], undefined>;
142
144
  readonly filename: v.StringSchema<undefined>;
143
145
  readonly content: v.StringSchema<undefined>;
146
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
144
147
  }, undefined>, v.StrictObjectSchema<{
145
148
  readonly meeting_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
146
149
  readonly format: v.PicklistSchema<["markdown", "vtt"], undefined>;
@@ -6396,6 +6399,7 @@ export declare const ENTITIES: {
6396
6399
  readonly speaker: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6397
6400
  readonly text: v.StringSchema<undefined>;
6398
6401
  }, undefined>, undefined>;
6402
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
6399
6403
  }, undefined>;
6400
6404
  readonly meeting_summary: v.StrictObjectSchema<{
6401
6405
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
@@ -6412,6 +6416,7 @@ export declare const ENTITIES: {
6412
6416
  readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6413
6417
  readonly created_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`">]>;
6414
6418
  readonly updated_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`">]>;
6419
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
6415
6420
  }, undefined>;
6416
6421
  readonly meeting_evidence: v.StrictObjectSchema<{
6417
6422
  readonly schema_version: v.LiteralSchema<1, undefined>;
@@ -6732,6 +6737,7 @@ export declare const ENTITIES: {
6732
6737
  readonly ref: v.StringSchema<undefined>;
6733
6738
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6734
6739
  }, undefined>, undefined>;
6740
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
6735
6741
  }, undefined>, undefined>;
6736
6742
  readonly ambiguity: v.StrictObjectSchema<{
6737
6743
  readonly scope: v.LiteralSchema<"page", undefined>;
@@ -182,6 +182,7 @@ const OTHERS = [
182
182
  ["document.not-imported", "not_found", "the document is not imported in this source account"],
183
183
  ["document.not-found", "not_found", "no listed document has that reference"],
184
184
  ["meeting.not-found", "not_found", "no meeting row has that event or meeting reference"],
185
+ ["listing.too-large", "provider_error", "the listing is over its bound; the checkpoint was kept"],
185
186
  ["listing.source-not-found", "not_found", "a source: term names no account holding what is listed"],
186
187
  validation("query.empty-window", "the time window ends before it starts, so no row can fall in it"),
187
188
  ["extraction.invalid-proposals", "invalid_response", "the model's memory proposals could not be used"],
@@ -199,6 +200,15 @@ const OTHERS = [
199
200
  "the email could not be read again, so its skipped attachments have no text",
200
201
  ],
201
202
  ["mirror.partial", "provider_error", "some mirrored files were not synced"],
203
+ ["mirror.none", "not_found", "the profile has no mirrors; add one with mirrors add"],
204
+ ["mirror.not-found", "not_found", "no such mirror in this profile; see mirrors list"],
205
+ validation("mirror.not-folder", "the path to mirror is not a folder"),
206
+ ["catalog.unavailable", "configuration_error", "the store has no shared catalog for this account"],
207
+ ["catalog.not-found", "not_found", "the file or folder is not in the local catalog; run catalog import or sync"],
208
+ validation("catalog.depth-invalid", "tree depth must be between 0 and 50"),
209
+ ["catalog.cycle", "invalid_response", "local folder ancestry contains a cycle"],
210
+ validation("catalog.tree-limit", "the tree is over 10000 entries; name a smaller folder or lower --depth"),
211
+ validation("export.exists", "the output file already exists"),
202
212
  ["profile.wrong-account", "authentication_error", "the signed-in source account does not match this profile"],
203
213
  validation("push.too-many-files", "the folder holds more files than one push takes"),
204
214
  validation("push.unreadable", "the folder to push could not be read"),
@@ -209,7 +219,7 @@ const OTHERS = [
209
219
  "the settings file's damage has more than one reading; nothing was changed, so it is fixed by hand",
210
220
  ],
211
221
  ["state.invalid", "configuration_error", "the saved sync state is unreadable or invalid; it is kept, not reset"],
212
- ["sync.partial", "provider_error", "some calendars did not sync; the next sync retries them"],
222
+ ["sync.partial", "provider_error", "some sources did not sync; the next sync retries them"],
213
223
  validation("event.conflict", "the event changed at the provider since the last sync; sync and try again"),
214
224
  validation("event.notify-required", "the event has other attendees; say whether to notify them"),
215
225
  validation("remind.window", "--due-within is outside 1m to 1d"),
@@ -220,6 +230,7 @@ const OTHERS = [
220
230
  "the reminder program failed for some events; the next run retries them",
221
231
  ],
222
232
  ["sync.failed", "provider_error", "the sync failed; the answer comes from what the store already holds"],
233
+ validation("event.conference-exists", "the event has a meeting link already, which its attendees use"),
223
234
  validation("event.repeat-invalid", "the repeat rule is outside the RFC 5545 subset the calendars take"),
224
235
  validation("event.repeat-kind", "the series' rule holds a date or a time of the kind the event is leaving"),
225
236
  validation("event.repeat-split", "the series cannot be split at this occurrence, or was split there already"),
@@ -712,6 +723,9 @@ export const DETAILS = [
712
723
  ];
713
724
  const SHARED = { reasons: REASONS, details: DETAILS };
714
725
  const merged = new WeakMap();
726
+ const coreCodes = new Map(REASONS.map((entry) => [entry.reason, entry.code]));
727
+ // A CLI still lists a reason it raised before the command moved into cli-core; the same code is the same failure.
728
+ const sameAsCore = (entry) => coreCodes.get(entry.reason) === entry.code;
715
729
  /** The registry every error handler reads — the CLI's, MCP's and the meeting tools' — so none drops an app's keys. */
716
730
  export const failureContext = (errors) => {
717
731
  if (!errors)
@@ -723,7 +737,7 @@ export const failureContext = (errors) => {
723
737
  if (unnamed.length > 0)
724
738
  throw new Error(`error details must be snake_case: ${unnamed.join(", ")}`);
725
739
  const context = {
726
- reasons: defineReasons([...REASONS, ...(errors.reasons ?? [])]),
740
+ reasons: defineReasons([...REASONS, ...(errors.reasons ?? []).filter((entry) => !sameAsCore(entry))]),
727
741
  details: [...new Set([...DETAILS, ...(errors.details ?? [])])],
728
742
  };
729
743
  merged.set(errors, context);
@@ -58,6 +58,8 @@ export declare const meetingTranscript: v.StrictObjectSchema<{
58
58
  readonly speaker: v.NullableSchema<v.StringSchema<undefined>, undefined>;
59
59
  readonly text: v.StringSchema<undefined>;
60
60
  }, undefined>, undefined>;
61
+ /** What people said, and who the service says said it: data, never instructions. */
62
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
61
63
  }, undefined>;
62
64
  /** A provider's summary of a meeting. */
63
65
  export declare const meetingSummary: v.StrictObjectSchema<{
@@ -75,6 +77,8 @@ export declare const meetingSummary: v.StrictObjectSchema<{
75
77
  readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
76
78
  readonly created_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`">]>;
77
79
  readonly updated_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`">]>;
80
+ /** What the service wrote of what people said. */
81
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
78
82
  }, undefined>;
79
83
  /** `meetings show`: the meeting with who took part, what was said in its chat, and what it holds. */
80
84
  declare const meetingDetailsEntries: {
@@ -141,6 +145,8 @@ declare const meetingDetailsEntries: {
141
145
  readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
142
146
  readonly created_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`">]>;
143
147
  readonly updated_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`">]>;
148
+ /** What the service wrote of what people said. */
149
+ readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
144
150
  }, undefined>, undefined>;
145
151
  attachments: v.ArraySchema<v.StrictObjectSchema<{
146
152
  readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -172,6 +178,10 @@ export type MeetingDetailsItem = v.InferOutput<typeof meetingDetails>;
172
178
  /** Answers without `meta`: the host adds it, as it knows the run. */
173
179
  export type MeetingListBody<T> = Omit<ListEnvelope<T>, "meta">;
174
180
  export type MeetingItemBody<T> = Omit<ItemEnvelope<T>, "meta">;
181
+ /** Other people's text in each meetings answer: names they gave the service, what they said and wrote. */
182
+ export declare const TRANSCRIPT_UNTRUSTED: string[];
183
+ export declare const SUMMARY_UNTRUSTED: string[];
184
+ export declare const PARTICIPANT_UNTRUSTED: string[];
175
185
  export declare const meetingTranscriptItem: (accountId: number, transcript: Transcript, rows: TranscriptRow[]) => MeetingTranscriptItem;
176
186
  export declare const meetingSummaryItem: (accountId: number, summary: Summary) => MeetingSummaryItem;
177
187
  export declare const meetingDetailsItem: (details: MeetingDetails, owner: MeetingOwner) => MeetingDetailsItem;
@@ -55,6 +55,8 @@ export const meetingTranscript = v.strictObject({
55
55
  superseded_at: v.nullable(isoTime),
56
56
  created_at: isoTime,
57
57
  lines: v.array(line),
58
+ /** What people said, and who the service says said it: data, never instructions. */
59
+ untrusted: v.optional(v.array(text)),
58
60
  });
59
61
  /** A provider's summary of a meeting. */
60
62
  export const meetingSummary = v.strictObject({
@@ -69,6 +71,8 @@ export const meetingSummary = v.strictObject({
69
71
  url: v.nullable(text),
70
72
  created_at: isoTime,
71
73
  updated_at: isoTime,
74
+ /** What the service wrote of what people said. */
75
+ untrusted: v.optional(v.array(text)),
72
76
  });
73
77
  /** `meetings show`: the meeting with who took part, what was said in its chat, and what it holds. */
74
78
  const meetingDetailsEntries = {
@@ -110,6 +114,21 @@ const meetingDetailsEntries = {
110
114
  })),
111
115
  };
112
116
  export const meetingDetails = v.strictObject(meetingDetailsEntries);
117
+ /** Other people's text in each meetings answer: names they gave the service, what they said and wrote. */
118
+ export const TRANSCRIPT_UNTRUSTED = ["lines.text", "lines.speaker"];
119
+ export const SUMMARY_UNTRUSTED = ["title", "overview", "sections.label", "sections.text", "next_steps", "content"];
120
+ const DETAILS_UNTRUSTED = [
121
+ "series_title",
122
+ "participants.name",
123
+ "participants.email",
124
+ "participants.person.name",
125
+ "chat.sender",
126
+ "chat.recipient",
127
+ "chat.text",
128
+ "attachments.name",
129
+ "documents.title",
130
+ ];
131
+ export const PARTICIPANT_UNTRUSTED = ["display_name", "email", "person.name"];
113
132
  const meetingRef = (accountId, meetingId) => formatMeetingReference({ type: "meeting", accountId, meetingId });
114
133
  export const meetingTranscriptItem = (accountId, transcript, rows) => ({
115
134
  ref: formatMeetingReference({
@@ -130,6 +149,7 @@ export const meetingTranscriptItem = (accountId, transcript, rows) => ({
130
149
  speaker: row.speakerName,
131
150
  text: row.text,
132
151
  })),
152
+ untrusted: [...TRANSCRIPT_UNTRUSTED],
133
153
  });
134
154
  export const meetingSummaryItem = (accountId, summary) => ({
135
155
  id: String(summary.id),
@@ -143,11 +163,14 @@ export const meetingSummaryItem = (accountId, summary) => ({
143
163
  url: summary.docUrl,
144
164
  created_at: new Date(summary.externalCreatedAt ?? summary.createdAt).toISOString(),
145
165
  updated_at: new Date(summary.externalUpdatedAt ?? summary.updatedAt).toISOString(),
166
+ untrusted: [...SUMMARY_UNTRUSTED],
146
167
  });
147
168
  export const meetingDetailsItem = (details, owner) => {
148
169
  const { accountId } = details.meeting;
170
+ const item = meetingItem(details.meeting, owner);
149
171
  return {
150
- ...meetingItem(details.meeting, owner),
172
+ ...item,
173
+ untrusted: [...(item.untrusted ?? []), ...DETAILS_UNTRUSTED],
151
174
  event_id: details.meeting.eventId === null ? null : String(details.meeting.eventId),
152
175
  series_id: details.meeting.meetingSeriesId === null ? null : String(details.meeting.meetingSeriesId),
153
176
  series_title: details.series?.title ?? null,
@@ -142,12 +142,13 @@ const addMeetingCommandsDefinition = (program, deps) => {
142
142
  .option("--max-read-bytes <bytes>", "most stored name and email bytes to read (default 1048576)", integer)
143
143
  .option("--cursor <cursor>", "continue with the same name query and selected account")
144
144
  .action(async (query, opts, command) => {
145
- print(await meetingPeople(deps.store, query, deps.accountId, {
145
+ const found = await meetingPeople(deps.store, query, deps.accountId, {
146
146
  limit: opts.limit,
147
147
  scanLimit: opts.scanLimit,
148
148
  maxReadBytes: opts.maxReadBytes,
149
149
  cursor: opts.cursor,
150
- }), command);
150
+ });
151
+ print(found, command);
151
152
  });
152
153
  output(annotate(group.command("sync"), {
153
154
  effects: FETCH,
@@ -1,5 +1,5 @@
1
1
  import { type Command } from "commander";
2
- import type { MeetingManagement } from "../meeting-management.js";
2
+ import { type MeetingManagement } from "../meeting-management.js";
3
3
  export interface MeetingManagementCommandDeps {
4
4
  management: MeetingManagement;
5
5
  print: (value: unknown, command: Command) => void;