@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.
- package/CHANGELOG.md +82 -0
- package/dist/calendar/cli/conference.d.ts +3 -0
- package/dist/calendar/cli/conference.js +7 -0
- package/dist/calendar/cli/index.d.ts +1 -0
- package/dist/calendar/cli/index.js +4 -2
- package/dist/calendar/mcp/index.d.ts +62 -12
- package/dist/calendar/mcp/index.js +6 -0
- package/dist/calendar/testing/writer-contract.js +1 -0
- package/dist/calendar/testing/writer.d.ts +3 -0
- package/dist/calendar/testing/writer.js +9 -1
- package/dist/calendar/writer.d.ts +13 -0
- package/dist/calendar/writes.d.ts +3 -0
- package/dist/calendar/writes.js +21 -1
- package/dist/cli/documents/catalog.d.ts +87 -0
- package/dist/cli/documents/catalog.js +246 -0
- package/dist/cli/documents/documents.d.ts +32 -0
- package/dist/cli/documents/documents.js +76 -0
- package/dist/cli/documents/folders.d.ts +22 -0
- package/dist/cli/documents/folders.js +45 -0
- package/dist/cli/documents/index.d.ts +36 -0
- package/dist/cli/documents/index.js +32 -0
- package/dist/cli/documents/knowledge.d.ts +36 -0
- package/dist/cli/documents/knowledge.js +235 -0
- package/dist/cli/documents/mirrors.d.ts +46 -0
- package/dist/cli/documents/mirrors.js +198 -0
- package/dist/cli/documents/queries.d.ts +120 -0
- package/dist/cli/documents/queries.js +156 -0
- package/dist/cli/documents/search.d.ts +25 -0
- package/dist/cli/documents/search.js +34 -0
- package/dist/cli/documents/sync.d.ts +31 -0
- package/dist/cli/documents/sync.js +41 -0
- package/dist/cli/documents/testing/commands-contract.d.ts +35 -0
- package/dist/cli/documents/testing/commands-contract.js +205 -0
- package/dist/cli/documents/testing/index.d.ts +3 -0
- package/dist/cli/documents/testing/index.js +3 -0
- package/dist/cli/documents/testing/source-contract.d.ts +18 -0
- package/dist/cli/documents/testing/source-contract.js +112 -0
- package/dist/cli/documents/testing/source.d.ts +13 -0
- package/dist/cli/documents/testing/source.js +67 -0
- package/dist/cli/documents/words.d.ts +87 -0
- package/dist/cli/documents/words.js +79 -0
- package/dist/domain/providers.js +2 -1
- package/dist/entities/index.d.ts +6 -0
- package/dist/errors/reasons.js +16 -2
- package/dist/meetings/answers.d.ts +10 -0
- package/dist/meetings/answers.js +24 -1
- package/dist/meetings/cli/index.js +3 -2
- package/dist/meetings/cli/management.d.ts +1 -1
- package/dist/meetings/cli/management.js +67 -25
- package/dist/meetings/export.d.ts +2 -0
- package/dist/meetings/export.js +1 -0
- package/dist/meetings/index.d.ts +1 -1
- package/dist/meetings/index.js +1 -1
- package/dist/meetings/meeting-management.d.ts +68 -3
- package/dist/meetings/meeting-management.js +134 -17
- package/dist/meetings/read-answers.d.ts +1 -0
- package/dist/meetings/read-answers.js +1 -0
- package/dist/meetings/reads.d.ts +29 -2
- package/dist/meetings/reads.js +3 -2
- package/dist/meetings/result-items.d.ts +3 -0
- package/dist/meetings/result-items.js +9 -1
- package/dist/meetings/testing/management-contract.js +27 -5
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,88 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
|
|
|
5
5
|
minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
|
|
6
6
|
shape of this file.
|
|
7
7
|
|
|
8
|
+
## 0.667.0 — 15.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **A meetings service declares what `meetings create` and `meetings update` take.** `MeetingManagementPorts.fields`
|
|
13
|
+
names, for `create` and `update`, the portable fields the service reads (`title`, `kind`, `startTime`,
|
|
14
|
+
`durationMinutes`, `timezone`, `agenda`) and its own settings (`MeetingSetting`: a snake_case name, a description,
|
|
15
|
+
and `choice` with its values, `boolean` or `text`). The settings are given as `--setting <name>=<value>`, repeated
|
|
16
|
+
for more; `--setting`'s description and the command's help list them, so `commands --json` shows them too. The
|
|
17
|
+
receipt's `change.settings` carries them, and it marks `meeting.title`, `meeting.agenda` and `meeting.join_url`
|
|
18
|
+
untrusted. A port that declares nothing reads every portable field and no setting.
|
|
19
|
+
See [Remote management](docs/dev/MEETING-PROVIDERS.md#remote-management).
|
|
20
|
+
|
|
21
|
+
- **`events create|update --conference <service>` add a meeting link to an event.** A calendar writer that can make
|
|
22
|
+
one names its services in `CalendarWriter.conferences` (`google-meet`), and `options.writes.conferences` mounts the
|
|
23
|
+
option with them as its choices. It is a change of its own, so `events update event:42 --conference google-meet`
|
|
24
|
+
needs no other field. The writer gets `conference: { provider, requestId }` with a new request id each time, never
|
|
25
|
+
the event's id. An event that already has a link is refused (`event.conference-exists`), so the attendees' link is
|
|
26
|
+
never replaced. See [Calendars](docs/dev/CALENDARS.md#commands-and-mcp-tools).
|
|
27
|
+
|
|
28
|
+
### Changed — may break callers
|
|
29
|
+
|
|
30
|
+
- **A meeting needs no title, and a service that cannot schedule creates meetings that start now.**
|
|
31
|
+
`meetings create` and `createMeetingManagement` no longer require a title. A service that declares no `startTime`
|
|
32
|
+
(Meet) creates an instant meeting that starts when it is sent, after the owner's question
|
|
33
|
+
(`createMeetingManagement(scope, ports, { now })` sets the clock). A service that can schedule (Zoom, or a port that
|
|
34
|
+
declares nothing) still needs `--start-time` or `--kind instant`, so a forgotten start is an error, not a live
|
|
35
|
+
meeting. The refusal names the options: `give --start-time, or --kind instant for a meeting that starts now`.
|
|
36
|
+
- **A field the service does not take is refused with `validation_error`, naming the options it takes.** Before, every
|
|
37
|
+
portable field reached every port. A blank `text` setting is refused unless it is declared `clearable`.
|
|
38
|
+
`validateMeetingChange(change, create, { declared })` takes the declaration; called with two arguments it keeps the
|
|
39
|
+
portable fields.
|
|
40
|
+
- **`meetings create|update|cancel` ask the owner after the change is validated.** A change the service cannot take
|
|
41
|
+
is refused without the question. `MeetingMutationOptions.confirm` runs between validation and dispatch, only when
|
|
42
|
+
the write will go; the commands pass `askFirst` there.
|
|
43
|
+
- **The `google-meet` provider's tool is `gcal`.** Google Meet has no tool of its own: its meetings are part of
|
|
44
|
+
Google Calendar's tool, since every meeting is on the calendar. A hint that opens a Meet meeting now points at `gcal`.
|
|
45
|
+
|
|
46
|
+
### Security
|
|
47
|
+
|
|
48
|
+
- **The shared meetings answers mark other people's text untrusted.** `meetings show` marks participants' names and
|
|
49
|
+
emails, the chat, the series title, attachment and document names; `meetings transcript` marks each line's text and
|
|
50
|
+
speaker; summaries mark their text; `meetings export` marks `content`; `meetings people` marks each match's
|
|
51
|
+
`display_name` and `email`. In a scheduled agent's run they arrive between the run's markers, as calendar events do.
|
|
52
|
+
|
|
53
|
+
## 0.666.0 — 15.11.2026
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- **Shared documents commands, in `@wirecat/cli-core/documents/cli`.** `addDocumentCommands(program, options)` mounts
|
|
58
|
+
`folders add|list|remove`, `sync`, `status`, `documents list|show|export|context`, `search`, `catalog`, `tags`,
|
|
59
|
+
`relationships`, `notes`, `memories`, `facts`, `identities` and `mirrors` over the CLI's own ports, so every
|
|
60
|
+
documents and wiki CLI has the same commands, options and answers. One builder per group
|
|
61
|
+
(`addDocumentFolderCommands`, `addDocumentSyncCommands`, `addLocalDocumentCommands`, `addDocumentSearchCommand`,
|
|
62
|
+
`addDocumentCatalogCommands`, `addDocumentKnowledgeCommands`, `addDocumentMirrorCommands`) lets a CLI put its own
|
|
63
|
+
groups between them, and each honours a global `--dry-run`. `words` names the CLI and its provider: the remote
|
|
64
|
+
side's word (`mirrors sync --keep local|<remote>|both`, `identities link <remote>-id`), and the store provider an
|
|
65
|
+
issue names. The answers use the same entities and fields in every CLI: `document` in the `imported` and `catalog`
|
|
66
|
+
views, `document_tag`, `document_relationship`, `document_identity` (`remote_id`, `provider`, `role`, `person`),
|
|
67
|
+
`selected_folder` and `mirror`. The `documents` group the builders return takes the CLI's live subcommands (`get`,
|
|
68
|
+
`create`, …), and `folders` takes its own `browse` outside the shared contract. drive-cli's commands, moved here
|
|
69
|
+
([DOCUMENTS.md](docs/dev/DOCUMENTS.md#shared-commands)).
|
|
70
|
+
- **`catalog tree` reads only what it shows.** Each shown entry's children come from the store by parent, 1 000 a
|
|
71
|
+
page, and the branches cut at `--depth` are checked 200 at a time. Any entry with children can be a root or a
|
|
72
|
+
branch, so a page with sub-pages works. An entry in two folders is shown in full once and marked `repeated` at its
|
|
73
|
+
other place. Over 10 000 entries the answer is `catalog.tree-limit`, which says to name a smaller folder or lower
|
|
74
|
+
`--depth`.
|
|
75
|
+
- **A documents contract kit, in `@wirecat/cli-core/documents/testing`.** `documentSourceContract` checks a
|
|
76
|
+
`DocumentSource` adapter: identity, the folder walk, content and bytes, the change feed with a change in it
|
|
77
|
+
(`change`), `not_found`, and pages that are folders and documents at once (`isDocument`).
|
|
78
|
+
`documentCommandsContract` checks a CLI's shared commands over its fakes: every shared path mounted, still
|
|
79
|
+
cli-core's and not overridden, its effects, the remote word, and sync → list → show → search, tags and notes by id.
|
|
80
|
+
`fakeDocumentSource` is a provider in memory.
|
|
81
|
+
|
|
82
|
+
### Changed — may break callers
|
|
83
|
+
|
|
84
|
+
- **The shared documents commands' error reasons are cli-core's.** `catalog.unavailable`, `catalog.not-found`,
|
|
85
|
+
`catalog.depth-invalid`, `catalog.cycle`, `catalog.tree-limit`, `mirror.none`, `mirror.not-found`,
|
|
86
|
+
`mirror.not-folder`, `export.exists` and `listing.too-large`. An app that lists one of them under the same code
|
|
87
|
+
still starts, as a CLI released before the move does. An app that lists one under another code fails at start.
|
|
88
|
+
- **`sync.partial` names no provider:** "some sources did not sync; the next sync retries them".
|
|
89
|
+
|
|
8
90
|
## 0.665.0 — 14.11.2026
|
|
9
91
|
|
|
10
92
|
### Added
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Option } from "commander";
|
|
2
|
+
/** `--conference`, only where the writer names services that make a meeting link (`CalendarWriter.conferences`). */
|
|
3
|
+
export const withConference = (command, services = []) => services.length
|
|
4
|
+
? command.addOption(new Option("--conference <service>", "make a new meeting link with it; never replaces a link").choices([
|
|
5
|
+
...services,
|
|
6
|
+
]))
|
|
7
|
+
: command;
|
|
@@ -57,6 +57,7 @@ export interface CalendarCommandOptions {
|
|
|
57
57
|
quickAdd?: boolean;
|
|
58
58
|
move?: boolean;
|
|
59
59
|
importEvent?: boolean;
|
|
60
|
+
conferences?: readonly string[];
|
|
60
61
|
};
|
|
61
62
|
/** Reads `events import`'s file; a file on disk, at most 10 MB, when absent. */
|
|
62
63
|
readFile?: (path: string) => Promise<string>;
|
|
@@ -25,6 +25,7 @@ import { calendarStatus } from "../sync.js";
|
|
|
25
25
|
import { createEvent, createEventFromText, deleteEvent, EVENT_RESPONSES, IMPORT_MAX, importEvents, moveEvent, respondToEvent, updateEvent, } from "../writes.js";
|
|
26
26
|
import { CALENDARS_QUERY, declareCalendarAnswers, PEOPLE_QUERY } from "./answers.js";
|
|
27
27
|
import { hitsBody, itemBody, listBody, messagesOf, pathOf } from "./bodies.js";
|
|
28
|
+
import { withConference } from "./conference.js";
|
|
28
29
|
import { ICS_MAX_BYTES, readIcsFile, writeIcsFile } from "./files.js";
|
|
29
30
|
import { localTimesView } from "./local-times.js";
|
|
30
31
|
import { addPeopleLink } from "./people-link.js";
|
|
@@ -498,6 +499,7 @@ const addEventWrites = (events, traits, { within, now, zone, example, readFile }
|
|
|
498
499
|
series: "--series",
|
|
499
500
|
following: "--following",
|
|
500
501
|
repeat: "--repeat",
|
|
502
|
+
conference: "--conference",
|
|
501
503
|
},
|
|
502
504
|
};
|
|
503
505
|
};
|
|
@@ -534,7 +536,7 @@ const addEventWrites = (events, traits, { within, now, zone, example, readFile }
|
|
|
534
536
|
.argument("<event>", "the event's id, or event:<id>")
|
|
535
537
|
.option("--calendar <id>", "the calendar, by id or title, when the event is on more than one of the account's");
|
|
536
538
|
const quick = traits.quickAdd === true;
|
|
537
|
-
const create = example(notify(fields(write("create"), false)
|
|
539
|
+
const create = example(notify(withConference(fields(write("create"), false), traits.conferences)
|
|
538
540
|
.description(quick
|
|
539
541
|
? "add an event to a calendar; with --repeat, one that repeats; with --text, one the provider reads " +
|
|
540
542
|
"from a line such as 'Lunch with Ana tomorrow 1pm'"
|
|
@@ -559,7 +561,7 @@ const addEventWrites = (events, traits, { within, now, zone, example, readFile }
|
|
|
559
561
|
}
|
|
560
562
|
await written(command, (context) => createEvent(context, calendar, fieldsOf(rest), options));
|
|
561
563
|
});
|
|
562
|
-
example(notify(target(fields(write("update"), true))
|
|
564
|
+
example(notify(target(withConference(fields(write("update"), true), traits.conferences))
|
|
563
565
|
.description("change an event; with --series every occurrence of the repeating event, with --following this " +
|
|
564
566
|
"occurrence and every later one; new times or dates switch it between timed and all-day")
|
|
565
567
|
.option("--series", "change the whole repeating event, not only this occurrence")
|
|
@@ -10,13 +10,13 @@ export declare const calendarTools: ({
|
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: string;
|
|
12
12
|
properties: {
|
|
13
|
+
limit?: undefined;
|
|
13
14
|
account_id: {
|
|
14
15
|
type: string;
|
|
15
16
|
minimum: number;
|
|
16
17
|
};
|
|
17
18
|
query?: undefined;
|
|
18
19
|
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;
|
|
48
49
|
query?: undefined;
|
|
49
50
|
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;
|
|
61
62
|
query?: undefined;
|
|
62
63
|
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;
|
|
83
84
|
account_id: {
|
|
84
85
|
type: string;
|
|
85
86
|
minimum: number;
|
|
86
87
|
};
|
|
87
88
|
query?: undefined;
|
|
88
89
|
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;
|
|
118
119
|
query?: undefined;
|
|
119
120
|
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;
|
|
131
132
|
query?: undefined;
|
|
132
133
|
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;
|
|
153
154
|
account_id: {
|
|
154
155
|
type: string;
|
|
155
156
|
minimum: number;
|
|
156
157
|
};
|
|
157
158
|
query?: undefined;
|
|
158
159
|
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;
|
|
188
189
|
query?: undefined;
|
|
189
190
|
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;
|
|
201
202
|
query?: undefined;
|
|
202
203
|
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;
|
|
223
224
|
account_id: {
|
|
224
225
|
type: string;
|
|
225
226
|
minimum: number;
|
|
226
227
|
};
|
|
227
228
|
query?: undefined;
|
|
228
229
|
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;
|
|
258
259
|
query?: undefined;
|
|
259
260
|
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;
|
|
271
272
|
query?: undefined;
|
|
272
273
|
timezone?: undefined;
|
|
273
|
-
limit?: undefined;
|
|
274
274
|
page?: undefined;
|
|
275
275
|
event?: undefined;
|
|
276
276
|
account_id?: undefined;
|
|
@@ -344,6 +344,11 @@ export declare const calendarWriteTools: ({
|
|
|
344
344
|
minLength: number;
|
|
345
345
|
description: string;
|
|
346
346
|
};
|
|
347
|
+
conference: {
|
|
348
|
+
type: string;
|
|
349
|
+
minLength: number;
|
|
350
|
+
description: string;
|
|
351
|
+
};
|
|
347
352
|
account_id: {
|
|
348
353
|
type: string;
|
|
349
354
|
minimum: number;
|
|
@@ -411,6 +416,11 @@ export declare const calendarWriteTools: ({
|
|
|
411
416
|
minLength: number;
|
|
412
417
|
description: string;
|
|
413
418
|
};
|
|
419
|
+
conference: {
|
|
420
|
+
type: string;
|
|
421
|
+
minLength: number;
|
|
422
|
+
description: string;
|
|
423
|
+
};
|
|
414
424
|
account_id: {
|
|
415
425
|
type: string;
|
|
416
426
|
minimum: number;
|
|
@@ -578,6 +588,11 @@ export declare const calendarWriteTools: ({
|
|
|
578
588
|
minLength: number;
|
|
579
589
|
description: string;
|
|
580
590
|
};
|
|
591
|
+
conference: {
|
|
592
|
+
type: string;
|
|
593
|
+
minLength: number;
|
|
594
|
+
description: string;
|
|
595
|
+
};
|
|
581
596
|
account_id: {
|
|
582
597
|
type: string;
|
|
583
598
|
minimum: number;
|
|
@@ -645,6 +660,11 @@ export declare const calendarWriteTools: ({
|
|
|
645
660
|
minLength: number;
|
|
646
661
|
description: string;
|
|
647
662
|
};
|
|
663
|
+
conference: {
|
|
664
|
+
type: string;
|
|
665
|
+
minLength: number;
|
|
666
|
+
description: string;
|
|
667
|
+
};
|
|
648
668
|
account_id: {
|
|
649
669
|
type: string;
|
|
650
670
|
minimum: number;
|
|
@@ -812,6 +832,11 @@ export declare const calendarWriteTools: ({
|
|
|
812
832
|
minLength: number;
|
|
813
833
|
description: string;
|
|
814
834
|
};
|
|
835
|
+
conference: {
|
|
836
|
+
type: string;
|
|
837
|
+
minLength: number;
|
|
838
|
+
description: string;
|
|
839
|
+
};
|
|
815
840
|
account_id: {
|
|
816
841
|
type: string;
|
|
817
842
|
minimum: number;
|
|
@@ -879,6 +904,11 @@ export declare const calendarWriteTools: ({
|
|
|
879
904
|
minLength: number;
|
|
880
905
|
description: string;
|
|
881
906
|
};
|
|
907
|
+
conference: {
|
|
908
|
+
type: string;
|
|
909
|
+
minLength: number;
|
|
910
|
+
description: string;
|
|
911
|
+
};
|
|
882
912
|
account_id: {
|
|
883
913
|
type: string;
|
|
884
914
|
minimum: number;
|
|
@@ -1046,6 +1076,11 @@ export declare const calendarWriteTools: ({
|
|
|
1046
1076
|
minLength: number;
|
|
1047
1077
|
description: string;
|
|
1048
1078
|
};
|
|
1079
|
+
conference: {
|
|
1080
|
+
type: string;
|
|
1081
|
+
minLength: number;
|
|
1082
|
+
description: string;
|
|
1083
|
+
};
|
|
1049
1084
|
account_id: {
|
|
1050
1085
|
type: string;
|
|
1051
1086
|
minimum: number;
|
|
@@ -1113,6 +1148,11 @@ export declare const calendarWriteTools: ({
|
|
|
1113
1148
|
minLength: number;
|
|
1114
1149
|
description: string;
|
|
1115
1150
|
};
|
|
1151
|
+
conference: {
|
|
1152
|
+
type: string;
|
|
1153
|
+
minLength: number;
|
|
1154
|
+
description: string;
|
|
1155
|
+
};
|
|
1116
1156
|
account_id: {
|
|
1117
1157
|
type: string;
|
|
1118
1158
|
minimum: number;
|
|
@@ -1280,6 +1320,11 @@ export declare const calendarWriteTools: ({
|
|
|
1280
1320
|
minLength: number;
|
|
1281
1321
|
description: string;
|
|
1282
1322
|
};
|
|
1323
|
+
conference: {
|
|
1324
|
+
type: string;
|
|
1325
|
+
minLength: number;
|
|
1326
|
+
description: string;
|
|
1327
|
+
};
|
|
1283
1328
|
account_id: {
|
|
1284
1329
|
type: string;
|
|
1285
1330
|
minimum: number;
|
|
@@ -1347,6 +1392,11 @@ export declare const calendarWriteTools: ({
|
|
|
1347
1392
|
minLength: number;
|
|
1348
1393
|
description: string;
|
|
1349
1394
|
};
|
|
1395
|
+
conference: {
|
|
1396
|
+
type: string;
|
|
1397
|
+
minLength: number;
|
|
1398
|
+
description: string;
|
|
1399
|
+
};
|
|
1350
1400
|
account_id: {
|
|
1351
1401
|
type: string;
|
|
1352
1402
|
minimum: number;
|
|
@@ -92,6 +92,10 @@ const fields = {
|
|
|
92
92
|
description: { ...anyText, description: "empty clears it" },
|
|
93
93
|
attendees: { type: "array", items: text, description: "email addresses; on a change, the whole new list" },
|
|
94
94
|
repeat: { ...text, description: `how it repeats: ${REPEAT_HELP}; on a change, only with series` },
|
|
95
|
+
conference: {
|
|
96
|
+
...text,
|
|
97
|
+
description: "a meeting service to make a new meeting link with, one the calendar offers; never replaces a link",
|
|
98
|
+
},
|
|
95
99
|
};
|
|
96
100
|
const target = {
|
|
97
101
|
account_id: integer,
|
|
@@ -323,6 +327,7 @@ const fieldsOf = (args) => ({
|
|
|
323
327
|
...(args.description === undefined ? {} : { description: args.description }),
|
|
324
328
|
...(args.attendees === undefined ? {} : { attendees: args.attendees }),
|
|
325
329
|
...(args.repeat === undefined ? {} : { repeat: args.repeat }),
|
|
330
|
+
...(args.conference === undefined ? {} : { conference: args.conference }),
|
|
326
331
|
});
|
|
327
332
|
/** The one account a write acts in: the one named, or the only one that holds what it names; never a guess. */
|
|
328
333
|
const accountFor = async (accounts, asked, holds, what) => {
|
|
@@ -370,6 +375,7 @@ const writeTool = async (store, name, args, { asked, accounts, now, writes, }) =
|
|
|
370
375
|
series: "series",
|
|
371
376
|
following: "following",
|
|
372
377
|
repeat: "repeat",
|
|
378
|
+
conference: "conference",
|
|
373
379
|
},
|
|
374
380
|
};
|
|
375
381
|
const choice = args.notify === undefined ? {} : { notify: args.notify };
|
|
@@ -22,8 +22,11 @@ export interface FakeCalendarWriter extends CalendarWriter {
|
|
|
22
22
|
loseNextAnswer(): void;
|
|
23
23
|
held(calendar: string): EntryInput[];
|
|
24
24
|
readonly calls: FakeCalendarWriterCall[];
|
|
25
|
+
/** Every conference request id it was sent, in order. */
|
|
26
|
+
readonly conferenceRequests: string[];
|
|
25
27
|
}
|
|
26
28
|
export declare const fakeCalendarWriter: (options?: {
|
|
27
29
|
provider?: string;
|
|
28
30
|
now?: () => number;
|
|
31
|
+
conferences?: readonly string[];
|
|
29
32
|
}) => FakeCalendarWriter;
|
|
@@ -5,6 +5,7 @@ export const fakeCalendarWriter = (options = {}) => {
|
|
|
5
5
|
const calendars = new Map();
|
|
6
6
|
const made = new Map();
|
|
7
7
|
const calls = [];
|
|
8
|
+
const conferenceRequests = [];
|
|
8
9
|
let version = 0;
|
|
9
10
|
let lose = false;
|
|
10
11
|
const of = (calendar) => {
|
|
@@ -28,9 +29,14 @@ export const fakeCalendarWriter = (options = {}) => {
|
|
|
28
29
|
return found;
|
|
29
30
|
};
|
|
30
31
|
const fields = (patch) => {
|
|
31
|
-
const { attendees, title, ...rest } = patch;
|
|
32
|
+
const { attendees, title, conference, ...rest } = patch;
|
|
33
|
+
if (conference)
|
|
34
|
+
conferenceRequests.push(conference.requestId);
|
|
32
35
|
return {
|
|
33
36
|
...rest,
|
|
37
|
+
...(conference
|
|
38
|
+
? { conference: conference.provider, joinUrl: `https://meet.example.com/${conference.requestId.slice(0, 8)}` }
|
|
39
|
+
: {}),
|
|
34
40
|
...(title === undefined ? {} : { title }),
|
|
35
41
|
...(patch.startDate === undefined ? {} : { allDay: true, startsAt: null, endsAt: null }),
|
|
36
42
|
...(patch.startsAt === undefined ? {} : { allDay: false, startDate: null, endDate: null }),
|
|
@@ -41,7 +47,9 @@ export const fakeCalendarWriter = (options = {}) => {
|
|
|
41
47
|
};
|
|
42
48
|
return {
|
|
43
49
|
provider: options.provider ?? "example-calendar",
|
|
50
|
+
...(options.conferences ? { conferences: options.conferences } : {}),
|
|
44
51
|
calls,
|
|
52
|
+
conferenceRequests,
|
|
45
53
|
put(calendar, ...entries) {
|
|
46
54
|
return entries.map((entry) => {
|
|
47
55
|
const held = entry.etag ? entry : stamp(entry);
|
|
@@ -21,6 +21,14 @@ export interface EventDraft {
|
|
|
21
21
|
optional?: boolean;
|
|
22
22
|
}[];
|
|
23
23
|
recurrence?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* A new meeting link to make and attach, from one of the writer's `conferences`. `requestId` is new for every write:
|
|
26
|
+
* Google ignores a request id it has seen. A create retry stays safe through the event's own id.
|
|
27
|
+
*/
|
|
28
|
+
conference?: {
|
|
29
|
+
provider: string;
|
|
30
|
+
requestId: string;
|
|
31
|
+
};
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* Only the fields to change; `null` clears one. `attendees` and `recurrence` replace the whole list. A patch with
|
|
@@ -42,6 +50,11 @@ export type EventResponse = Extract<ParticipantResponse, "accepted" | "tentative
|
|
|
42
50
|
*/
|
|
43
51
|
export interface CalendarWriter {
|
|
44
52
|
readonly provider: string;
|
|
53
|
+
/**
|
|
54
|
+
* The meeting services this writer can make a link with on an event (`google-meet` for Calendar's
|
|
55
|
+
* `conferenceData.createRequest`); `events create|update --conference` takes one of them.
|
|
56
|
+
*/
|
|
57
|
+
readonly conferences?: readonly string[];
|
|
45
58
|
/**
|
|
46
59
|
* `id` is chosen here and journaled before the call: a create with an id the provider already holds returns that
|
|
47
60
|
* event instead of making a second one, so a retry after `outcome_unknown` is safe.
|
|
@@ -32,6 +32,8 @@ export interface EventFields {
|
|
|
32
32
|
attendees?: string[];
|
|
33
33
|
/** An RFC 5545 rule, with or without `RRULE:`; on a change, only with the series' scope. */
|
|
34
34
|
repeat?: string;
|
|
35
|
+
/** A meeting service to make a new meeting link with, one of the writer's `conferences`. */
|
|
36
|
+
conference?: string;
|
|
35
37
|
}
|
|
36
38
|
export interface WriteContext {
|
|
37
39
|
store: EventStore;
|
|
@@ -49,6 +51,7 @@ export interface WriteContext {
|
|
|
49
51
|
series: string;
|
|
50
52
|
following: string;
|
|
51
53
|
repeat: string;
|
|
54
|
+
conference: string;
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
/**
|
package/dist/calendar/writes.js
CHANGED
|
@@ -82,10 +82,26 @@ export const draftOf = (fields, zone, { whole, allDay = false }) => {
|
|
|
82
82
|
allDay: patch.startDate !== undefined || (patch.startsAt === undefined && allDay),
|
|
83
83
|
}),
|
|
84
84
|
];
|
|
85
|
+
if (fields.conference !== undefined)
|
|
86
|
+
patch.conference = { provider: fields.conference, requestId: randomUUID() };
|
|
85
87
|
if (!whole && Object.keys(patch).length === 0)
|
|
86
88
|
throw new CliError("validation_error", "nothing to change");
|
|
87
89
|
return patch;
|
|
88
90
|
};
|
|
91
|
+
/** A meeting link only from a service the writer names, and never over a link the attendees already have. */
|
|
92
|
+
const checkConference = (context, fields, existing = []) => {
|
|
93
|
+
const wanted = fields.conference;
|
|
94
|
+
if (wanted === undefined)
|
|
95
|
+
return;
|
|
96
|
+
const offered = context.writes.writer.conferences ?? [];
|
|
97
|
+
const flag = context.names.conference;
|
|
98
|
+
if (!offered.includes(wanted))
|
|
99
|
+
throw new CliError("validation_error", offered.length
|
|
100
|
+
? `${flag} takes ${offered.join(", ")}, not ${wanted}`
|
|
101
|
+
: `this calendar cannot add a meeting link; leave out ${flag}`, { param: flag });
|
|
102
|
+
if (existing.some(({ joinUrl }) => joinUrl))
|
|
103
|
+
throw new CliError("validation_error", `the event already has a meeting link, which its attendees use; leave out ${flag}`, { reason: "event.conference-exists", param: flag });
|
|
104
|
+
};
|
|
89
105
|
/** The profile's guard over the write's main key and its other keys (`keyedGuard`). */
|
|
90
106
|
const writeGuard = (context, extra) => {
|
|
91
107
|
const settings = context.writes.settings();
|
|
@@ -155,6 +171,7 @@ const writable = (calendar) => {
|
|
|
155
171
|
};
|
|
156
172
|
export const createEvent = async (context, calendarReference, fields, options = {}) => {
|
|
157
173
|
const calendar = writable(await calendarIn(context.store, context.accountId, calendarReference));
|
|
174
|
+
checkConference(context, fields);
|
|
158
175
|
const draft = draftOf(fields, context.zone, { whole: true });
|
|
159
176
|
const id = idOf(context, options.id);
|
|
160
177
|
const notify = notifyOf(context, options.notify, (draft.attendees?.length ?? 0) > 0);
|
|
@@ -352,7 +369,8 @@ export const updateEvent = async (context, reference, fields, options = {}) => {
|
|
|
352
369
|
throw new CliError("validation_error", `a repeat rule belongs to the whole series: add ${context.names.series}`, {
|
|
353
370
|
param: context.names.series,
|
|
354
371
|
});
|
|
355
|
-
const { calendar, target, participants } = await targetOf(context, reference, { ...options, scope });
|
|
372
|
+
const { calendar, entry: named, target, participants } = await targetOf(context, reference, { ...options, scope });
|
|
373
|
+
checkConference(context, fields, [named, target]);
|
|
356
374
|
const patch = draftOf(fields, context.zone, { whole: false, allDay: target.allDay });
|
|
357
375
|
const kept = (target.recurrence ?? []).filter((line) => !/^RRULE:/iu.test(line));
|
|
358
376
|
if (patch.recurrence)
|
|
@@ -451,6 +469,8 @@ const afterCreate = async (context, id, write) => {
|
|
|
451
469
|
* later slots show twice, never none.
|
|
452
470
|
*/
|
|
453
471
|
const updateFollowing = async (context, reference, fields, options) => {
|
|
472
|
+
if (fields.conference !== undefined)
|
|
473
|
+
throw new CliError("validation_error", `${context.names.conference} goes with one occurrence or ${context.names.series}, not ${context.names.following}`, { param: context.names.conference });
|
|
454
474
|
const found = await targetOf(context, reference, { ...options, scope: "following" });
|
|
455
475
|
const { calendar, entry, target, participants } = found;
|
|
456
476
|
const split = splitOf(context, reference, found);
|