@wirecat/cli-core 0.564.0 → 0.565.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 (51) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/calendar/busy.d.ts +10 -10
  3. package/dist/calendar/busy.js +9 -9
  4. package/dist/calendar/cli/answers.d.ts +7 -8
  5. package/dist/calendar/cli/answers.js +4 -5
  6. package/dist/calendar/cli/bodies.d.ts +33 -0
  7. package/dist/calendar/cli/bodies.js +52 -0
  8. package/dist/calendar/cli/files.d.ts +8 -0
  9. package/dist/calendar/cli/files.js +41 -0
  10. package/dist/calendar/cli/index.d.ts +58 -51
  11. package/dist/calendar/cli/index.js +311 -284
  12. package/dist/calendar/cli/remind.d.ts +2 -11
  13. package/dist/calendar/cli/remind.js +81 -81
  14. package/dist/calendar/cli/search-all.d.ts +3 -8
  15. package/dist/calendar/cli/search-all.js +47 -42
  16. package/dist/calendar/mcp/index.d.ts +13 -13
  17. package/dist/calendar/prepare.d.ts +1 -1
  18. package/dist/calendar/testing/answers.d.ts +27 -5
  19. package/dist/calendar/testing/answers.js +88 -17
  20. package/dist/calendar/testing/writer.d.ts +1 -0
  21. package/dist/calendar/testing/writer.js +6 -0
  22. package/dist/calendar/writer.d.ts +6 -1
  23. package/dist/calendar/writes.d.ts +3 -1
  24. package/dist/calendar/writes.js +42 -20
  25. package/dist/cli/config-command.js +1 -1
  26. package/dist/cli/config-issues.d.ts +3 -1
  27. package/dist/cli/config-issues.js +2 -2
  28. package/dist/cli/contract-evidence.d.ts +1 -1
  29. package/dist/cli/early-refusal.d.ts +2 -1
  30. package/dist/cli/early-refusal.js +4 -2
  31. package/dist/cli/entry.d.ts +6 -2
  32. package/dist/cli/entry.js +4 -1
  33. package/dist/cli/envelope.d.ts +2 -2
  34. package/dist/cli/index.d.ts +1 -0
  35. package/dist/cli/index.js +1 -0
  36. package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
  37. package/dist/cli/permission-keys.d.ts +3 -1
  38. package/dist/cli/permission-keys.js +2 -1
  39. package/dist/cli/preview.d.ts +12 -0
  40. package/dist/cli/preview.js +8 -1
  41. package/dist/cli/settings.d.ts +2 -0
  42. package/dist/cli/settings.js +8 -1
  43. package/dist/errors/reasons.js +14 -1
  44. package/dist/mcp/meeting-preparation.d.ts +1 -1
  45. package/dist/mcp/meeting-project-candidates.d.ts +1 -1
  46. package/dist/mcp/meeting-series-inventory.d.ts +1 -1
  47. package/dist/meetings/mcp/passage.d.ts +1 -1
  48. package/dist/meetings/mcp/project-evidence.d.ts +1 -1
  49. package/dist/meetings/mcp/search.d.ts +1 -1
  50. package/dist/services/metadata.d.ts +1 -1
  51. package/package.json +3 -3
@@ -1,12 +1,3 @@
1
1
  import type { Command } from "commander";
2
- import type { CalendarWrites } from "../writes.js";
3
- import type { CalendarCommandDeps } from "./index.js";
4
- interface RemindHelpers {
5
- deps: CalendarCommandDeps;
6
- now: () => number;
7
- zone: () => string;
8
- print: (value: unknown, command: Command) => void;
9
- example: (command: Command, ...lines: string[]) => Command;
10
- }
11
- export declare const addRemind: (events: Command, writes: CalendarWrites, { deps, now, zone, print, example }: RemindHelpers) => void;
12
- export {};
2
+ import type { CommandHelpers } from "./index.js";
3
+ export declare const addRemind: (events: Command, { within, now, zone, example }: CommandHelpers) => void;
@@ -11,9 +11,10 @@ import { DEFAULT_PERMISSIONS, levelFor } from "../../sends/permissions.js";
11
11
  import { dueEvents, openReminders, reminderItem, remindersPath, runHook } from "../remind.js";
12
12
  import { syncCalendars } from "../sync.js";
13
13
  import { CALENDAR_WRITE_DEFAULTS, EVENTS_REMIND_HOOK_KEY } from "../writer.js";
14
+ import { listBody } from "./bodies.js";
14
15
  const REMIND_MIN_MS = 60_000;
15
16
  const REMIND_MAX_MS = 86_400_000;
16
- export const addRemind = (events, writes, { deps, now, zone, print, example }) => {
17
+ export const addRemind = (events, { within, now, zone, example }) => {
17
18
  const remind = example(destroysNothing(annotate(events.command("remind"), { effects: FETCH, mcp: false, literal_after_dashes: true }))
18
19
  .description("tell once about each event that starts within --due-within: print it, or run your program for it with the " +
19
20
  "event as JSON on its standard input; for cron or a timer every few minutes, syncing first unless --offline")
@@ -23,94 +24,93 @@ export const addRemind = (events, writes, { deps, now, zone, print, example }) =
23
24
  .option("--due-within <duration>", "the events that start within this long from now, 1m to 1d", "10m")
24
25
  .option("--dry-run", "say what it would remind; run nothing, sync nothing, remember nothing");
25
26
  remind.action(async (program, opts, command) => {
26
- const within = parseDuration(opts.dueWithin, "--due-within");
27
- if (within < REMIND_MIN_MS || within > REMIND_MAX_MS)
27
+ const dueWithin = parseDuration(opts.dueWithin, "--due-within");
28
+ if (dueWithin < REMIND_MIN_MS || dueWithin > REMIND_MAX_MS)
28
29
  throw new CliError("validation_error", "--due-within takes 1m to 1d", { reason: "remind.window" });
29
- const settings = writes.settings();
30
- const env = writes.env ?? process.env;
31
- const hook = program.length > 0;
32
- const defaults = { ...DEFAULT_PERMISSIONS, ...CALENDAR_WRITE_DEFAULTS, ...settings.permissionDefaults };
33
- const { level, key: named } = levelFor(settings.permissions, EVENTS_REMIND_HOOK_KEY, defaults);
34
- if (hook && !opts.dryRun) {
35
- if (settings.readOnlyLock)
36
- throw readOnlyRefusal(settings.readOnlyLock, "run a program for a reminder");
37
- if (level === "deny" || level === "readonly")
38
- throw levelRefusal({
39
- profile: settings.profile,
40
- command: writes.app.command,
41
- key: EVENTS_REMIND_HOOK_KEY,
42
- level,
43
- named,
44
- permissionSources: settings.permissionSources,
45
- });
46
- }
47
- const at = now();
48
- const issues = [];
49
- const accountName = `${deps.account.provider}:${deps.account.account}`;
50
- if (!opts.dryRun && deps.source && !command.optsWithGlobals().offline) {
51
- // A reminder from what the store already holds beats none: a failed sync is said in meta and the run goes on.
52
- try {
53
- // Feeds wait for `sync`: a timer runs this every few minutes, and a feed's server is not Google.
54
- const report = await syncCalendars(deps.source, deps.store, {
55
- accountId: deps.accountId,
56
- now: at,
57
- budget: runBudgetOf(command),
58
- ...(deps.expand ? { expand: deps.expand } : {}),
59
- });
60
- if (report.synced.some((one) => one.error !== undefined))
61
- issues.push({ code: "provider_error", reason: "sync.partial", source: accountName });
62
- }
63
- catch (error) {
64
- issues.push({
65
- code: error instanceof CliError ? error.code : "provider_error",
66
- reason: "sync.failed",
67
- source: accountName,
68
- });
30
+ await within(command, async (run) => {
31
+ if (!run.writes)
32
+ throw new CliError("configuration_error", "this profile cannot run reminders");
33
+ const writes = run.writes();
34
+ const settings = writes.settings();
35
+ const env = writes.env ?? process.env;
36
+ const hook = program.length > 0;
37
+ const defaults = { ...DEFAULT_PERMISSIONS, ...CALENDAR_WRITE_DEFAULTS, ...settings.permissionDefaults };
38
+ const { level, key: named } = levelFor(settings.permissions, EVENTS_REMIND_HOOK_KEY, defaults);
39
+ if (hook && !opts.dryRun) {
40
+ if (settings.readOnlyLock)
41
+ throw readOnlyRefusal(settings.readOnlyLock, "run a program for a reminder");
42
+ if (level === "deny" || level === "readonly")
43
+ throw levelRefusal({
44
+ profile: settings.profile,
45
+ command: writes.app.command,
46
+ key: EVENTS_REMIND_HOOK_KEY,
47
+ level,
48
+ named,
49
+ permissionSources: settings.permissionSources,
50
+ });
69
51
  }
70
- }
71
- const window = { from: at, to: at + within };
72
- const path = remindersPath(resolvePaths({ appName: writes.app.appName, prefix: writes.app.envPrefix, env }).state, settings.profile);
73
- const reminders = opts.dryRun ? undefined : openReminders(path, at);
74
- try {
75
- const due = await dueEvents(deps.store, deps.accountId, window, reminders?.reminded ?? {});
76
- if (hook && !opts.dryRun && due.length > 0 && level === "ask")
77
- await terminalAsker(command)(EVENTS_REMIND_HOOK_KEY, { chatId: null, count: due.length });
78
- const items = [];
79
- const failed = [];
80
- for (const details of due) {
81
- const item = reminderItem(details);
82
- if (hook && !opts.dryRun) {
83
- const exitCode = await runHook(program, `${JSON.stringify(item)}\n`, {
84
- ...env,
85
- [`${writes.app.envPrefix}_PROFILE`]: settings.profile,
86
- [`${writes.app.envPrefix}_EVENT`]: item.ref,
52
+ const at = now();
53
+ const issues = [];
54
+ const accountName = `${run.account.provider}:${run.account.account}`;
55
+ if (!opts.dryRun && !command.optsWithGlobals().offline) {
56
+ // A reminder from what the store already holds beats none: a failed sync is said in meta and the run goes on.
57
+ try {
58
+ // Feeds wait for `sync`: a timer runs this every few minutes, and a feed's server is not Google.
59
+ const report = await syncCalendars(run.source(), run.store, {
60
+ accountId: run.accountId,
61
+ now: at,
62
+ budget: runBudgetOf(command),
63
+ ...(run.expand ? { expand: run.expand } : {}),
64
+ });
65
+ if (report.synced.some((one) => one.error !== undefined))
66
+ issues.push({ code: "provider_error", reason: "sync.partial", source: accountName });
67
+ }
68
+ catch (error) {
69
+ issues.push({
70
+ code: error instanceof CliError ? error.code : "provider_error",
71
+ reason: "sync.failed",
72
+ source: accountName,
87
73
  });
88
- if (exitCode !== 0) {
89
- failed.push({ ref: item.ref, exit_code: exitCode });
90
- continue;
91
- }
92
74
  }
93
- reminders?.remember(details);
94
- items.push(item);
95
75
  }
96
- if (failed.length)
97
- throw new CliError("configuration_error", `${program[0]} failed for ${failed.length} of ${due.length} events ` +
98
- `(${failed.map((one) => `${one.ref}: exit ${one.exit_code}`).join(", ")}); the next run tries them again`, { reason: "remind.hook-failed", reminded: items.map(({ ref }) => ref), failed, retryable: true });
99
- print({
100
- items,
101
- page: 1,
102
- limit: Math.max(1, items.length),
103
- hasMore: false,
104
- meta: {
76
+ const window = { from: at, to: at + dueWithin };
77
+ const path = remindersPath(resolvePaths({ appName: writes.app.appName, prefix: writes.app.envPrefix, env }).state, settings.profile);
78
+ const reminders = opts.dryRun ? undefined : openReminders(path, at);
79
+ try {
80
+ const due = await dueEvents(run.store, run.accountId, window, reminders?.reminded ?? {});
81
+ if (hook && !opts.dryRun && due.length > 0 && level === "ask")
82
+ await terminalAsker(command)(EVENTS_REMIND_HOOK_KEY, { chatId: null, count: due.length });
83
+ const items = [];
84
+ const failed = [];
85
+ for (const details of due) {
86
+ const item = reminderItem(details);
87
+ if (hook && !opts.dryRun) {
88
+ const exitCode = await runHook(program, `${JSON.stringify(item)}\n`, {
89
+ ...env,
90
+ [`${writes.app.envPrefix}_PROFILE`]: settings.profile,
91
+ [`${writes.app.envPrefix}_EVENT`]: item.ref,
92
+ });
93
+ if (exitCode !== 0) {
94
+ failed.push({ ref: item.ref, exit_code: exitCode });
95
+ continue;
96
+ }
97
+ }
98
+ reminders?.remember(details);
99
+ items.push(item);
100
+ }
101
+ if (failed.length)
102
+ throw new CliError("configuration_error", `${program[0]} failed for ${failed.length} of ${due.length} events ` +
103
+ `(${failed.map((one) => `${one.ref}: exit ${one.exit_code}`).join(", ")}); the next run tries them again`, { reason: "remind.hook-failed", reminded: items.map(({ ref }) => ref), failed, retryable: true });
104
+ return listBody(command, { items, page: 1 }, {
105
105
  complete: issues.length === 0,
106
106
  ...(issues.length ? { issues } : {}),
107
107
  window: { since: new Date(window.from).toISOString(), until: new Date(window.to).toISOString() },
108
108
  ...clockMeta(at, zone()),
109
- },
110
- }, command);
111
- }
112
- finally {
113
- reminders?.close();
114
- }
109
+ });
110
+ }
111
+ finally {
112
+ reminders?.close();
113
+ }
114
+ });
115
115
  });
116
116
  };
@@ -1,17 +1,12 @@
1
1
  import { Command } from "commander";
2
2
  import type { AppIdentity } from "../../ports/app.js";
3
- import type { CalendarCommandDeps } from "./index.js";
4
- interface SearchAllHelpers {
5
- /** Read through, never copied: a CLI's deps may be getters that work only once a profile is open. */
6
- deps: CalendarCommandDeps;
3
+ import type { CommandHelpers } from "./index.js";
4
+ interface SearchAllHelpers extends Pick<CommandHelpers, "within" | "zone" | "example"> {
7
5
  app: AppIdentity;
8
- zone: () => string;
9
- messages: (what: string) => NonNullable<CalendarCommandDeps["messages"]>;
10
- example: (command: Command, ...lines: string[]) => Command;
11
6
  }
12
7
  /**
13
8
  * `search all` beside `search events`: the messenger's shared search over the store, without a messenger server.
14
9
  * Events are the calendar's own kind and always read; meeting transcripts only when `--source` names a meeting account.
15
10
  */
16
- export declare const addSearchAll: (searches: Command, { deps, app, zone, messages, example }: SearchAllHelpers) => void;
11
+ export declare const addSearchAll: (searches: Command, { within, app, zone, example }: SearchAllHelpers) => void;
17
12
  export {};
@@ -1,6 +1,7 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { annotate } from "@wirecat/cli-base/commands";
3
3
  import { Command } from "commander";
4
+ import { outputFor } from "../../cli/context.js";
4
5
  import { LOCAL_READ } from "../../cli/effects.js";
5
6
  import { historySkipsOf } from "../../cli/messenger/history-gaps.js";
6
7
  import { allAnswer, offsetOf, SOURCE_SEARCHED } from "../../cli/messenger/search-answers.js";
@@ -8,12 +9,13 @@ import { searchAllLine, searchAllOptions } from "../../cli/messenger/search-comm
8
9
  import { SAVE_HELP } from "../../meetings/index.js";
9
10
  import { meaningLane } from "../../services/messages-meaning.js";
10
11
  import { searchAllWithMeetings } from "../../services/search-all-meetings.js";
12
+ import { messagesOf } from "./bodies.js";
11
13
  const DEFAULT_LIMIT = 20;
12
14
  /**
13
15
  * `search all` beside `search events`: the messenger's shared search over the store, without a messenger server.
14
16
  * Events are the calendar's own kind and always read; meeting transcripts only when `--source` names a meeting account.
15
17
  */
16
- export const addSearchAll = (searches, { deps, app, zone, messages, example }) => {
18
+ export const addSearchAll = (searches, { within, app, zone, example }) => {
17
19
  const all = annotate(new Command("all"), { effects: LOCAL_READ, partial: true, output: { entity: "hit" } })
18
20
  .summary("search stored messages, notes, calendar events and selected meeting transcripts")
19
21
  .description("search calendar events, messages from the other WireCat tools and notes in the local store, and a meeting " +
@@ -27,46 +29,49 @@ export const addSearchAll = (searches, { deps, app, zone, messages, example }) =
27
29
  example(all, "search all roadmap", 'search all "quarterly review" --source telegram,gcal --json');
28
30
  all.action(async (words, _opts, leaf) => {
29
31
  const opts = leaf.opts();
30
- if (deps.locked && opts.source !== undefined)
31
- throw new CliError("permission_error", "this process is locked to one profile; search all reads its own calendar only, without --source", { reason: "profile.locked" });
32
- const store = messages("search all");
33
- const limit = opts.limit ?? DEFAULT_LIMIT;
34
- const offset = offsetOf(opts.page, limit);
35
- const env = deps.writes?.env ?? process.env;
36
- const found = await searchAllWithMeetings(store, deps.account, {
37
- text: words.join(" "),
38
- limit,
39
- ...(offset === undefined ? {} : { offset }),
40
- ...(opts.exact ? { exact: true } : {}),
41
- timezone: opts.timezone ?? zone(),
42
- env,
43
- only: opts.only ?? SOURCE_SEARCHED,
44
- ...(opts.source === undefined ? {} : { source: opts.source }),
45
- ...(opts.maxMeetings === undefined ? {} : { maxMeetings: opts.maxMeetings }),
46
- ...(deps.locked ? { scope: { events: [deps.account] } } : {}),
47
- }, { app }, undefined, meaningLane({ env, messenger: { app }, store: async () => store }));
48
- const note = deps.note ?? (() => undefined);
49
- const globals = leaf.optsWithGlobals();
50
- const format = globals.json ? "json" : globals.jsonl ? "jsonl" : "text";
51
- if (format === "text")
52
- note(`searched: ${found.accounts.map(({ provider, account }) => `${provider}:${account}`).join(", ") || "nothing"}`);
53
- for (const { resource, source, reason } of found.skipped)
54
- note(`${resource ?? source} not searched: ${reason}`);
55
- if (found.notes?.meaningSkipped)
56
- note(`notes by words only: ${found.notes.meaningSkipped}`);
57
- if (found.events?.meaningSkipped)
58
- note(`events by words only: ${found.events.meaningSkipped}`);
59
- const again = {
60
- query: words.join(" "),
61
- ...(opts.only === undefined ? {} : { only: opts.only.join(",") }),
62
- ...(opts.source === undefined ? {} : { source: opts.source }),
63
- ...(opts.maxMeetings === undefined ? {} : { max_meetings: opts.maxMeetings }),
64
- ...(opts.exact ? { exact: true } : {}),
65
- ...(opts.timezone === undefined ? {} : { timezone: opts.timezone }),
66
- };
67
- if (!found.items.length)
68
- note("nothing found in what the local store holds");
69
- const skips = await historySkipsOf(store, found.accounts).catch(() => []);
70
- deps.write(allAnswer("search all", found, { limit, page: opts.page ?? 1, again }, opts.exact === true, skips), format, () => found.items.map(searchAllLine).join(""));
32
+ let lines = "";
33
+ await within(leaf, async (run) => {
34
+ if (run.locked && opts.source !== undefined)
35
+ throw new CliError("permission_error", "this process is locked to one profile; search all reads its own calendar only, without --source", { reason: "profile.locked" });
36
+ const store = messagesOf(run, "search all");
37
+ const limit = opts.limit ?? DEFAULT_LIMIT;
38
+ const offset = offsetOf(opts.page, limit);
39
+ const env = run.env ?? process.env;
40
+ const found = await searchAllWithMeetings(store, run.account, {
41
+ text: words.join(" "),
42
+ limit,
43
+ ...(offset === undefined ? {} : { offset }),
44
+ ...(opts.exact ? { exact: true } : {}),
45
+ timezone: opts.timezone ?? zone(),
46
+ env,
47
+ only: opts.only ?? SOURCE_SEARCHED,
48
+ ...(opts.source === undefined ? {} : { source: opts.source }),
49
+ ...(opts.maxMeetings === undefined ? {} : { maxMeetings: opts.maxMeetings }),
50
+ ...(run.locked ? { scope: { events: [run.account] } } : {}),
51
+ }, { app }, undefined, meaningLane({ env, messenger: { app }, store: async () => store }));
52
+ const note = (text) => outputFor(leaf).renderer.note(text);
53
+ const globals = leaf.optsWithGlobals();
54
+ if (!globals.json && !globals.jsonl)
55
+ note(`searched: ${found.accounts.map(({ provider, account }) => `${provider}:${account}`).join(", ") || "nothing"}`);
56
+ for (const { resource, source, reason } of found.skipped)
57
+ note(`${resource ?? source} not searched: ${reason}`);
58
+ if (found.notes?.meaningSkipped)
59
+ note(`notes by words only: ${found.notes.meaningSkipped}`);
60
+ if (found.events?.meaningSkipped)
61
+ note(`events by words only: ${found.events.meaningSkipped}`);
62
+ const again = {
63
+ query: words.join(" "),
64
+ ...(opts.only === undefined ? {} : { only: opts.only.join(",") }),
65
+ ...(opts.source === undefined ? {} : { source: opts.source }),
66
+ ...(opts.maxMeetings === undefined ? {} : { max_meetings: opts.maxMeetings }),
67
+ ...(opts.exact ? { exact: true } : {}),
68
+ ...(opts.timezone === undefined ? {} : { timezone: opts.timezone }),
69
+ };
70
+ if (!found.items.length)
71
+ note("nothing found in what the local store holds");
72
+ const skips = await historySkipsOf(store, found.accounts).catch(() => []);
73
+ lines = found.items.map(searchAllLine).join("");
74
+ return allAnswer("search all", found, { limit, page: opts.page ?? 1, again }, opts.exact === true, skips);
75
+ }, () => lines);
71
76
  });
72
77
  };
@@ -10,13 +10,13 @@ export declare const calendarTools: ({
10
10
  inputSchema: {
11
11
  type: string;
12
12
  properties: {
13
- limit?: undefined;
14
13
  account_id: {
15
14
  type: string;
16
15
  minimum: number;
17
16
  };
18
17
  query?: undefined;
19
18
  timezone?: undefined;
19
+ limit?: undefined;
20
20
  page?: undefined;
21
21
  event?: undefined;
22
22
  } | {
@@ -45,9 +45,9 @@ export declare const calendarTools: ({
45
45
  };
46
46
  event?: undefined;
47
47
  } | {
48
- limit?: undefined;
49
48
  query?: undefined;
50
49
  timezone?: undefined;
50
+ limit?: undefined;
51
51
  page?: undefined;
52
52
  event: {
53
53
  type: string;
@@ -58,9 +58,9 @@ export declare const calendarTools: ({
58
58
  minimum: number;
59
59
  };
60
60
  } | {
61
- limit?: undefined;
62
61
  query?: undefined;
63
62
  timezone?: undefined;
63
+ limit?: undefined;
64
64
  page?: undefined;
65
65
  event?: undefined;
66
66
  account_id?: undefined;
@@ -80,13 +80,13 @@ export declare const calendarTools: ({
80
80
  inputSchema: {
81
81
  type: string;
82
82
  properties: {
83
- limit?: undefined;
84
83
  account_id: {
85
84
  type: string;
86
85
  minimum: number;
87
86
  };
88
87
  query?: undefined;
89
88
  timezone?: undefined;
89
+ limit?: undefined;
90
90
  page?: undefined;
91
91
  event?: undefined;
92
92
  } | {
@@ -115,9 +115,9 @@ export declare const calendarTools: ({
115
115
  };
116
116
  event?: undefined;
117
117
  } | {
118
- limit?: undefined;
119
118
  query?: undefined;
120
119
  timezone?: undefined;
120
+ limit?: undefined;
121
121
  page?: undefined;
122
122
  event: {
123
123
  type: string;
@@ -128,9 +128,9 @@ export declare const calendarTools: ({
128
128
  minimum: number;
129
129
  };
130
130
  } | {
131
- limit?: undefined;
132
131
  query?: undefined;
133
132
  timezone?: undefined;
133
+ limit?: undefined;
134
134
  page?: undefined;
135
135
  event?: undefined;
136
136
  account_id?: undefined;
@@ -150,13 +150,13 @@ export declare const calendarTools: ({
150
150
  inputSchema: {
151
151
  type: string;
152
152
  properties: {
153
- limit?: undefined;
154
153
  account_id: {
155
154
  type: string;
156
155
  minimum: number;
157
156
  };
158
157
  query?: undefined;
159
158
  timezone?: undefined;
159
+ limit?: undefined;
160
160
  page?: undefined;
161
161
  event?: undefined;
162
162
  } | {
@@ -185,9 +185,9 @@ export declare const calendarTools: ({
185
185
  };
186
186
  event?: undefined;
187
187
  } | {
188
- limit?: undefined;
189
188
  query?: undefined;
190
189
  timezone?: undefined;
190
+ limit?: undefined;
191
191
  page?: undefined;
192
192
  event: {
193
193
  type: string;
@@ -198,9 +198,9 @@ export declare const calendarTools: ({
198
198
  minimum: number;
199
199
  };
200
200
  } | {
201
- limit?: undefined;
202
201
  query?: undefined;
203
202
  timezone?: undefined;
203
+ limit?: undefined;
204
204
  page?: undefined;
205
205
  event?: undefined;
206
206
  account_id?: undefined;
@@ -220,13 +220,13 @@ export declare const calendarTools: ({
220
220
  inputSchema: {
221
221
  type: string;
222
222
  properties: {
223
- limit?: undefined;
224
223
  account_id: {
225
224
  type: string;
226
225
  minimum: number;
227
226
  };
228
227
  query?: undefined;
229
228
  timezone?: undefined;
229
+ limit?: undefined;
230
230
  page?: undefined;
231
231
  event?: undefined;
232
232
  } | {
@@ -255,9 +255,9 @@ export declare const calendarTools: ({
255
255
  };
256
256
  event?: undefined;
257
257
  } | {
258
- limit?: undefined;
259
258
  query?: undefined;
260
259
  timezone?: undefined;
260
+ limit?: undefined;
261
261
  page?: undefined;
262
262
  event: {
263
263
  type: string;
@@ -268,9 +268,9 @@ export declare const calendarTools: ({
268
268
  minimum: number;
269
269
  };
270
270
  } | {
271
- limit?: undefined;
272
271
  query?: undefined;
273
272
  timezone?: undefined;
273
+ limit?: undefined;
274
274
  page?: undefined;
275
275
  event?: undefined;
276
276
  account_id?: undefined;
@@ -1479,7 +1479,7 @@ export declare const callCalendarTool: (store: EventStore, name: string, input:
1479
1479
  }[];
1480
1480
  structuredContent: {
1481
1481
  error: {
1482
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
1482
+ code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "conflict" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
1483
1483
  reason: string;
1484
1484
  message: string;
1485
1485
  param?: string | undefined;
@@ -125,7 +125,7 @@ export declare const eventPreparation: (details: EventDetails, options: Preparat
125
125
  accounts?: string[] | undefined;
126
126
  complete: boolean;
127
127
  issues?: {
128
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
128
+ code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "conflict" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
129
129
  reason?: string | undefined;
130
130
  source: string;
131
131
  }[] | undefined;
@@ -1,7 +1,29 @@
1
- import type { Command } from "commander";
1
+ import { Command } from "commander";
2
+ import type { AppIdentity } from "../../ports/app.js";
3
+ import { type CalendarCommandOptions, type CalendarRun } from "../cli/index.js";
4
+ /** Each item of a printed calendar answer, parsed against the command's declared entity. */
5
+ export declare const checkCalendarAnswer: (root: Command, argv: readonly string[], envelope: unknown) => void;
6
+ export declare const CALENDAR_TEST_APP: AppIdentity;
7
+ /** A printed answer: an item's fields beside `meta` and `next`, or the list's `items` and `page`. */
8
+ export type CalendarAnswer = Record<string, unknown> & {
9
+ items: Record<string, unknown>[];
10
+ meta: Record<string, unknown>;
11
+ };
12
+ export interface CalendarTestProgram {
13
+ root: Command;
14
+ /** Runs the words with `--json` and gives what was printed, its item spread at the top; checked by its entity. */
15
+ cli: (...args: string[]) => Promise<CalendarAnswer>;
16
+ /** Runs the words as a person at a terminal would, and gives the text printed. */
17
+ text: (...args: string[]) => Promise<string>;
18
+ /** Every line on stderr. */
19
+ stderr: string[];
20
+ /** How many times the profile was opened, and how. */
21
+ opened: {
22
+ readOnly: boolean;
23
+ }[];
24
+ }
2
25
  /**
3
- * Parses what a shared calendar command handed its host against the command's entity, as a host prints it: keys in
4
- * snake_case, a list's items one by one, a search's hits each with the search's `untrusted`, and no `next`. A `meta`
5
- * goes into the host's envelope, never into the item.
26
+ * The shared calendar commands on a bare program over `run`, as an app mounts them, printing to captured streams. A
27
+ * test of the commands themselves; an app's own tests go through its `run()`.
6
28
  */
7
- export declare const checkCalendarAnswer: (root: Command, argv: readonly string[], value: unknown) => void;
29
+ export declare const calendarTestProgram: (run: CalendarRun, options?: Partial<CalendarCommandOptions>) => CalendarTestProgram;