@wirecat/cli-core 0.663.0 → 0.665.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 +141 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/calendar/index.d.ts +1 -1
- package/dist/calendar/index.js +1 -1
- package/dist/calendar/prepare.d.ts +2 -2
- package/dist/calendar/reads.d.ts +5 -5
- package/dist/calendar/writes.d.ts +4 -4
- package/dist/cli/chat-sending-command.d.ts +14 -0
- package/dist/cli/chat-sending-command.js +64 -0
- package/dist/cli/context.d.ts +7 -0
- package/dist/cli/context.js +12 -4
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/meeting-meaning-command.d.ts +47 -0
- package/dist/cli/meeting-meaning-command.js +136 -0
- package/dist/cli/meeting-preparation-answer.d.ts +6 -0
- package/dist/cli/meeting-preparation-projects.d.ts +6 -0
- package/dist/cli/meeting-preparation-read.d.ts +6 -0
- package/dist/cli/meeting-tags-command.d.ts +18 -0
- package/dist/cli/meeting-tags-command.js +74 -0
- package/dist/cli/messenger/conversation-answers.d.ts +1 -1
- package/dist/cli/messenger/conversation-answers.js +1 -0
- package/dist/cli/messenger/conversations-command.js +38 -12
- package/dist/cli/messenger/models-command.js +7 -0
- package/dist/cli/messenger/records-command.d.ts +4 -1
- package/dist/cli/messenger/records-command.js +6 -1
- package/dist/cli/model-catalogue-command.js +2 -0
- package/dist/cli/profile-token.d.ts +15 -1
- package/dist/cli/profile-token.js +103 -7
- package/dist/cli/program.js +2 -2
- package/dist/domain/links.d.ts +11 -0
- package/dist/domain/links.js +4 -0
- package/dist/entities/chat-sending.d.ts +10 -0
- package/dist/entities/chat-sending.js +11 -0
- package/dist/entities/index.d.ts +43 -1
- package/dist/entities/index.js +6 -2
- package/dist/entities/listings.d.ts +60 -0
- package/dist/entities/listings.js +15 -0
- package/dist/entities/meeting-preparation.d.ts +6 -0
- package/dist/entities/meeting.d.ts +1 -1
- package/dist/entities/meeting.js +1 -1
- package/dist/errors/reasons.js +25 -1
- package/dist/mcp/meeting-preparation.d.ts +6 -0
- package/dist/meetings/answers.d.ts +7 -0
- package/dist/meetings/answers.js +4 -0
- package/dist/meetings/event-store.d.ts +2 -1
- package/dist/meetings/event-store.js +6 -0
- package/dist/meetings/index.d.ts +2 -1
- package/dist/meetings/index.js +2 -1
- package/dist/meetings/mcp/search.d.ts +6 -0
- package/dist/meetings/project-evidence-answer.d.ts +6 -0
- package/dist/meetings/tag-answers.d.ts +43 -0
- package/dist/meetings/tag-answers.js +41 -0
- package/dist/models/chat-sending.d.ts +24 -0
- package/dist/models/chat-sending.js +40 -0
- package/dist/runs/events.d.ts +1 -1
- package/dist/search/question-plan.d.ts +5 -0
- package/dist/search/question-plan.js +5 -0
- package/dist/search/task-similarity.d.ts +1 -0
- package/dist/search/task-similarity.js +1 -1
- package/dist/services/embeddings-search.js +19 -5
- package/dist/services/embeddings.d.ts +4 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2 -0
- package/dist/services/listings.js +17 -2
- package/dist/services/meeting-meaning.d.ts +47 -0
- package/dist/services/meeting-meaning.js +158 -0
- package/dist/services/meeting-tags.d.ts +27 -0
- package/dist/services/meeting-tags.js +81 -0
- package/dist/services/messages-discovery.js +2 -2
- package/dist/sftp/index.d.ts +1 -1
- package/dist/sftp/index.js +1 -1
- package/dist/sftp/session.d.ts +30 -4
- package/dist/sftp/session.js +195 -11
- package/dist/sftp/ssh2.d.ts +19 -4
- package/dist/sftp/ssh2.js +144 -17
- package/dist/speech/cloud.d.ts +47 -0
- package/dist/speech/cloud.js +73 -0
- package/dist/speech/decode.d.ts +36 -9
- package/dist/speech/decode.js +208 -61
- package/dist/speech/index.d.ts +2 -1
- package/dist/speech/index.js +2 -1
- package/dist/speech/openai.d.ts +4 -0
- package/dist/speech/openai.js +13 -12
- package/dist/sql/index.d.ts +1 -0
- package/dist/sql/index.js +1 -0
- package/dist/sql/reader.d.ts +95 -0
- package/dist/sql/reader.js +214 -0
- package/dist/store/sqlite/drizzle/bun.js +4 -4
- package/dist/store/sqlite/drizzle/bun.js.map +1 -1
- package/dist/store/sqlite/drizzle/core.js +5 -5
- package/dist/store/sqlite/drizzle/core.js.map +1 -1
- package/dist/store/sqlite/drizzle/node.js +4 -4
- package/dist/store/sqlite/drizzle/node.js.map +1 -1
- package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js → shared-5XR7K42U.js} +58 -58
- package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js.map → shared-5XR7K42U.js.map} +1 -1
- package/dist/store/sqlite/knowledge.d.ts +1 -1
- package/dist/store/sqlite/knowledge.js +8 -4
- package/dist/store/sqlite/labelled.d.ts +5 -0
- package/dist/store/sqlite/labelled.js +6 -0
- package/dist/store/sqlite/link-row.d.ts +1 -0
- package/dist/store/sqlite/link-row.js +2 -0
- package/dist/store/sqlite/meeting-listing.d.ts +12 -0
- package/dist/store/sqlite/meeting-listing.js +20 -5
- package/dist/store/sqlite/notes.d.ts +1 -1
- package/dist/store/sqlite/notes.js +1 -1
- package/package.json +18 -3
- package/parity.json +20 -1
- package/skills/link-conversations/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,147 @@ 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.665.0 — 14.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`meeting_entry` carries what the calendar knows about the invitation.** Each calendar source has the copy's own
|
|
13
|
+
page (`page_url`, Google's `htmlLink`, `https` only), the owner's answer in that calendar (`own_response`) and the
|
|
14
|
+
conference's product (`conference`). Each participant has their `response` (`null` for a meeting's participant).
|
|
15
|
+
A row has `series_id` and `recurrence` (the series' `RRULE:` line), and `meeting_entry_details` lists the calendar's
|
|
16
|
+
Drive files under `attachments`. memo's `meetings list|show` and WireCat Desktop's meeting card read them.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- `search messages --discover` no longer reads a date or another field value written with hyphens
|
|
21
|
+
(`date:2026-10-08`) as a word to look up joined: only words with letters on both sides of a hyphen are (0.664.0
|
|
22
|
+
lowered a dated question's `coverage` with a made-up `20261008`).
|
|
23
|
+
|
|
24
|
+
## 0.664.0 — 14.11.2026
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **Tags on calls and other meetings, from a search: `addMeetingTagsCommand`** in `@wirecat/cli-core/cli` mounts
|
|
29
|
+
`tags add|remove|list` for a host whose meetings are its records, such as pbx and beeline.
|
|
30
|
+
`tags add complaint --matching "refund OR complaint"` labels every meeting of the account where `search meetings`
|
|
31
|
+
finds the query; `--meeting <id>` (repeatable) labels by id. A rerun after new calls are transcribed labels only
|
|
32
|
+
those, and `changed` in the `meeting_tag_change` answer says which. `tags list tag:complaint` answers
|
|
33
|
+
`meeting_tagging` items with the call's title marked untrusted. The labels are the store's ordinary taggings, so
|
|
34
|
+
`search meetings --tag complaint` and memo's `tags list` see them. The service is `meetingTags` in
|
|
35
|
+
`@wirecat/cli-core/services`. A mark stays when a new transcript of the call no longer says the words.
|
|
36
|
+
- cli-core's command lint now also checks a calls host's program: `stats calls show`, `search meetings` and the
|
|
37
|
+
meeting `tags`, with cli-base's `calls`, `--matching` and `--tag`.
|
|
38
|
+
- **Search by meaning for any host of stored meetings, from cli-core.** `addMeetingCombinedSearchCommand` in
|
|
39
|
+
`@wirecat/cli-core/cli` mounts `search meetings`: words by default, and words and meaning ranked together with
|
|
40
|
+
`--model <model>`, which first splits new transcripts and builds the missing vectors. A hit says how it was found
|
|
41
|
+
(`by`), its similarity (`score`) and the passage meaning matched, and marks `excerpt`, the passage and the title
|
|
42
|
+
untrusted. `addMeetingEmbeddingCommand` mounts `meetings embed`: a preview, and `--yes` splits every transcript and builds one batch of the missing
|
|
43
|
+
vectors; a rerun builds the next.
|
|
44
|
+
Without `--model` it uses the `models` command's default local text model, so the transcripts stay on this
|
|
45
|
+
computer; `--base-url` sends passages to a remote service only when given, and `--offline` refuses it. Both run over
|
|
46
|
+
`meetingMeaning(store, accountId)` in `@wirecat/cli-core/services`. These moved from zoom-cli, which can mount them
|
|
47
|
+
in place of its own copies; pbx and beeline mount them for calls.
|
|
48
|
+
- `meeting_hit` takes the optional `by`, `score` and `passage` of a search by meaning.
|
|
49
|
+
- **A profile can keep a second secret, in its one keyring entry.** `ProfileTokenStore` takes named secrets beside
|
|
50
|
+
the token: `writeSecret(profile, "ssh", secret)`, `readSecret(profile, "ssh")` and `removeSecret(profile, "ssh")`,
|
|
51
|
+
so a CLI can keep a database password and an SSH or SFTP password for one profile. They live in the same
|
|
52
|
+
`token:<profile>` entry as one value, as an OAuth entry holds its tokens and client secret: the keyring gets no
|
|
53
|
+
second entry (WC-SECR-4). An entry with only the token stays the plain value it was, so every entry written before
|
|
54
|
+
reads as before. `<PREFIX>_TOKEN_<NAME>` (`secretVariable(name)`) overrides one for CI, as `<PREFIX>_TOKEN` does the
|
|
55
|
+
token. Changing the token keeps the named secrets and the other way round; `remove` still forgets the whole entry,
|
|
56
|
+
as `session end` wants. A run with moved folders writes them to its temporary entry and never touches the owner's
|
|
57
|
+
(WC-SECR-24).
|
|
58
|
+
- **A link can open a call or meeting in WireCat Desktop.** `linkFor({ type: "meeting", provider, account, meeting })`
|
|
59
|
+
builds `wirecat://open/v1/meeting/<provider>/<account>/<meeting>` (or the web form) from the provider's own ids, as
|
|
60
|
+
a message link does: `asterisk`, the account as the provider knows it, and the call's id there. It is built only
|
|
61
|
+
from that target: `meeting:<account>/<meeting>` stays a store reference and never becomes a link.
|
|
62
|
+
`test/fixtures/links-v1.json` has the cases under `target_only`, since no ref names them, and two refused paths.
|
|
63
|
+
- **`readStream` on the SFTP client reads a file of any size in pieces.** It gives the file in order, 64 KiB at a
|
|
64
|
+
time with about a megabyte read ahead, so a Master.csv of gigabytes or a recording for ffmpeg is never held whole.
|
|
65
|
+
`maxBytes` is optional. A connection that breaks halfway is opened again and the read goes on where it stopped,
|
|
66
|
+
once the bytes just before that point read the same; a file replaced meanwhile is refused (`sftp.file-changed`).
|
|
67
|
+
Host-key pinning and the read-only rules are the same as for `readFile`. Each attempt is an `sftp.stream` event.
|
|
68
|
+
See [SFTP](docs/sftp.md#read).
|
|
69
|
+
- **`openSshTunnel` reaches a database that listens only on its own server** (a FreePBX CDR database) with no
|
|
70
|
+
`ssh -L` by hand. It signs in with the pinned host key, only forwards (no shell, no command, no SFTP), and opens no
|
|
71
|
+
port on this computer: `connect(host, port)` answers a stream shaped as a socket, which `pg` and `mysql2` take as
|
|
72
|
+
their `stream`. `close()` ends it at the end of the run. Its events are `ssh.connect` and `ssh.forward`
|
|
73
|
+
(`transport: "ssh"`), with no forwarded address. See
|
|
74
|
+
[SFTP, "A tunnel to a database behind the server"](docs/sftp.md#a-tunnel-to-a-database-behind-the-server).
|
|
75
|
+
- **`@wirecat/cli-core/sql`: a read-only MySQL, MariaDB and PostgreSQL reader for a host's own table.**
|
|
76
|
+
`openSqlReader` opens a read-only session with TLS checked and connect and query timeouts, keeps a time without a
|
|
77
|
+
zone as its text, reads in pages by the last row's key (or by offset), checks every name as an identifier and
|
|
78
|
+
sends every value as a parameter, takes a tunnel's stream as `socket`, and maps driver errors to reasons without
|
|
79
|
+
their text (`db.refused`, `db.no-table`, `db.no-select`, `db.read-only`…; `sqlFailure` for a host's own code).
|
|
80
|
+
`mysql2` and `pg` are optional peers, loaded on first use. It is the generic half of pbx's CDR reader; the
|
|
81
|
+
schema mapping stays in pbx. See [SQL](docs/sql.md).
|
|
82
|
+
- **Recordings that ffmpeg reads keep their channels.** `decodeChannels` gives a stereo WAV, GSM, AAC or M4A call
|
|
83
|
+
two channels, one speaker each, as it already did for MP3, Ogg and FLAC. A mono file stays one channel, and a file
|
|
84
|
+
of more channels is mixed down to two. Each channel still stops at an hour of audio, and ffmpeg's output is split
|
|
85
|
+
into channels as it arrives, so the interleaved samples are never held whole. `decodeChannelsFile(path, { maxBytes })`
|
|
86
|
+
hands a WAV or GSM file to ffmpeg by its path, so a recording of gigabytes is not read into memory first;
|
|
87
|
+
`runFfmpegFile(path)` is the step under it, and `mixDown` averages channels into one.
|
|
88
|
+
- **`cloudSpeech` lets a host send a profile's recordings to an OpenAI-compatible speech-to-text, when that profile
|
|
89
|
+
asks.** It is `null` unless the profile's own settings say `transcribeWith: "openai"`. The audio goes to OpenAI, or
|
|
90
|
+
to the address the shared AI model is set to (`models ai set openai --base-url … --secret-stdin`), with the key
|
|
91
|
+
kept for that address. The model is the profile's `transcribeModel` (`gpt-transcribe` when not set). The host's
|
|
92
|
+
`notify` gets one line naming the host before the first audio leaves the computer. It refuses in a read-only
|
|
93
|
+
process, with local only on, and without a key (`transcription.no-key`, naming the command that sets it). Long
|
|
94
|
+
audio goes in pieces of at most ten minutes, under the provider's 25 MB limit. See
|
|
95
|
+
[MEETING-PROVIDERS.md, "Decoding a recording, and cloud speech"](docs/dev/MEETING-PROVIDERS.md#decoding-a-recording-and-cloud-speech).
|
|
96
|
+
- `transcribeOpenAI` takes `label` and `keyHint`, so a compatible service's errors name that service and the command
|
|
97
|
+
that sets its key, not OpenAI. A compatible server on this computer needs no key.
|
|
98
|
+
- **`models chats show|set allowed|ask|denied`: one setting for chat text sent to a model outside this
|
|
99
|
+
computer.** It decides what `conversations embed` and `conversations links rebuild --analyze` do with a model that
|
|
100
|
+
is not on this computer. `allowed` sends without a yes, in a terminal and over MCP. `ask`, the default, needs a yes
|
|
101
|
+
as before. `denied` refuses. The setting is shared by every WireCat tool. Messenger CLIs mount it under `models`,
|
|
102
|
+
and so does the model catalogue for the tool that turns on enrichment. Only the owner makes it less strict: `set`
|
|
103
|
+
is no MCP tool, and an agent's run is refused unless it passes `--from-app`.
|
|
104
|
+
- **`conversations embed` and `conversations links rebuild` take their own `--yes`**, so an agent can pass `yes`
|
|
105
|
+
over MCP under `ask`. Before, they read only the root program's `--yes`, which a tool call cannot pass, so an
|
|
106
|
+
agent got `confirmation_required … add --yes` and could not go on.
|
|
107
|
+
|
|
108
|
+
### Changed — may break callers
|
|
109
|
+
|
|
110
|
+
- **`SftpClient` has `readStream`.** A fake typed as `SftpClient` in a host's tests adds it.
|
|
111
|
+
- **No MCP server offers `chats delete` or `chats clear`.** Over MCP an `ask` level goes ahead without a question, so
|
|
112
|
+
an agent could delete a whole chat or its history from the account. Both stay on the command line, where `ask` still
|
|
113
|
+
asks first.
|
|
114
|
+
- **`Ffmpeg` (the seam of `decodeChannels` and `decodeAudio`) may answer `Pcm[]`, one per channel,** and `runFfmpeg`
|
|
115
|
+
now does. A seam that still answers one `Pcm` works, and `decodeChannels` then says `mixed: true`. `mixed` is no
|
|
116
|
+
longer true for every file ffmpeg read.
|
|
117
|
+
- **`decodeAudio` mixes every channel into one,** where it gave the first channel of a stereo MP3, Ogg or FLAC. A
|
|
118
|
+
stereo voice message or audio file now keeps both sides in its one text.
|
|
119
|
+
- **Under `models chats denied`, `conversations embed` and `--analyze` to a model outside this computer refuse even
|
|
120
|
+
with `--yes`** and even with a consent remembered for the chat: `permission_error`, reason `chat-sending.denied`.
|
|
121
|
+
The message names the owner's command, `<cli> models chats set ask`. Without the setting nothing changes.
|
|
122
|
+
- **`--analyze` with a model on this computer no longer asks for consent or remembers one**, the same as
|
|
123
|
+
`conversations embed` with a local model. A caller that expected `confirmation_required` there now gets the
|
|
124
|
+
analysis.
|
|
125
|
+
- **The refusal under `ask` without a yes** now has reason `chat-sending.ask`, and its message says an agent may
|
|
126
|
+
pass yes or ask the owner to run `<cli> models chats set allowed`.
|
|
127
|
+
|
|
128
|
+
### Fixed
|
|
129
|
+
|
|
130
|
+
- **`knowledge.labelled` with an account lists only that account's meetings, and never a deleted meeting.** With
|
|
131
|
+
`null`, as memo calls it, it still lists every account's meetings, now without the deleted ones.
|
|
132
|
+
- cli-base 0.101.0, whose vocabulary has `calls`, `--matching` and `--tag`; the peer range moves to it.
|
|
133
|
+
- **A command's own `--fields` is no longer read as `--json`'s field list.** A generated Google API command such as
|
|
134
|
+
`gcal <profile> api calendar-events-list --fields 'items(id)' --json` failed with "--json takes comma-separated field
|
|
135
|
+
paths", because the command's `--fields` (Google's partial-response mask) stood in for the root's. Only
|
|
136
|
+
`--json=a,b` now picks the answer's fields, in `outputFor`, `baseContext` and the program's own output.
|
|
137
|
+
- **A project's status no longer crashes on a link whose chat was deleted.** `knowledge.relations` leaves out a link
|
|
138
|
+
whose start or end no longer exists, such as a `member-of` link from a chat the store has since removed. Before,
|
|
139
|
+
it returned the link with `from: null`, and `projectStatus` failed on it, so memo's `review agenda` and the morning
|
|
140
|
+
digest stopped with `command.crashed`.
|
|
141
|
+
- `search conversations` no longer fails on a long sentence over a large store: when the word half runs out of time,
|
|
142
|
+
the meaning half still answers, and the answer says so (`meta.words: "out-of-time"`, a note in pretty output).
|
|
143
|
+
Stop words (`что`, `какие`, `what`, `the`…) no longer go into the word half, unless the query holds nothing else.
|
|
144
|
+
- `search conversations` follows an explicit `--timeout`, as `search messages` does: the word half gets the longer
|
|
145
|
+
time limit.
|
|
146
|
+
- `search messages --discover` finds a name written as one word when the question spells it with a hyphen
|
|
147
|
+
(`Альфа-банк` finds `АльфаБанк`).
|
|
148
|
+
|
|
8
149
|
## 0.663.0 — 14.11.2026
|
|
9
150
|
|
|
10
151
|
### Added
|
|
@@ -24,12 +24,12 @@ export interface DailyArchiveTimerInput {
|
|
|
24
24
|
}
|
|
25
25
|
export declare const dailyArchiveTimer: (input: DailyArchiveTimerInput) => DailyArchiveTimer;
|
|
26
26
|
export declare const manageDailyArchiveTimer: (plan: DailyArchiveTimer, action: "install" | "start" | "stop" | "status" | "uninstall", system: Pick<ServerSystem, "platform" | "run">, env: NodeJS.ProcessEnv, signal?: AbortSignal) => Promise<{
|
|
27
|
-
action?: undefined;
|
|
28
27
|
name: string;
|
|
29
28
|
installed: boolean;
|
|
30
29
|
active: boolean;
|
|
31
30
|
servicePath: string;
|
|
32
31
|
timerPath: string;
|
|
32
|
+
action?: undefined;
|
|
33
33
|
} | {
|
|
34
34
|
active?: undefined;
|
|
35
35
|
name: string;
|
package/dist/calendar/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { expandSeries, localMoment, unexpandable } from "./expand.js";
|
|
|
3
3
|
export { type CalendarFeeds, FEED_LIMITS, FEED_PREFIX, type FeedLimits, type FeedRecord, type FeedRegistry, type FeedSyncStats, type FeedsSyncReport, feedAddress, fetchFeed, icsFeeds, isFeedCalendar, readFeed, syncWithFeeds, } from "./feeds.js";
|
|
4
4
|
export { type IcsEvent, type IcsOverride, type IcsRead, type IcsSkip, readIcs, writeIcs } from "./ics.js";
|
|
5
5
|
export { accountsMeta, EVENT_TYPES, EVENTS_QUERY, EVENTS_QUERY_NOTE, eventAnswer, eventIdOf, eventOf, eventsAnswer, eventsFilter, localDate, plusDays, type ReadAccount, sourceAccounts, } from "./reads.js";
|
|
6
|
-
export { repeatRule } from "./recurrence.js";
|
|
6
|
+
export { repeatRule, ruleLine } from "./recurrence.js";
|
|
7
7
|
export type { BusyTimes, CalendarExpander, CalendarSource, CalendarSourceTraits, ChangePage, ChangeResult, FreeBusyRequest, SearchPage, SyncWindow, } from "./source.js";
|
|
8
8
|
export { type CalendarCursor, type CalendarSyncOptions, type CalendarSyncReport, type CalendarSyncResult, calendarStatus, calendarSyncWindow, type PendingRound, parseCalendarCursor, syncCalendars, } from "./sync.js";
|
|
9
9
|
export { CALENDAR_WRITE_DEFAULTS, CALENDAR_WRITE_KEYS, type CalendarWrite, type CalendarWriter, calendarConflict, EVENTS_DELETE_SERIES_KEY, EVENTS_NOTIFY_KEY, EVENTS_REMIND_HOOK_KEY, type EventDraft, type EventPatch, type EventResponse, type FollowingScope, type WriteScope, } from "./writer.js";
|
package/dist/calendar/index.js
CHANGED
|
@@ -2,6 +2,6 @@ export { expandSeries, localMoment, unexpandable } from "./expand.js";
|
|
|
2
2
|
export { FEED_LIMITS, FEED_PREFIX, feedAddress, fetchFeed, icsFeeds, isFeedCalendar, readFeed, syncWithFeeds, } from "./feeds.js";
|
|
3
3
|
export { readIcs, writeIcs } from "./ics.js";
|
|
4
4
|
export { accountsMeta, EVENT_TYPES, EVENTS_QUERY, EVENTS_QUERY_NOTE, eventAnswer, eventIdOf, eventOf, eventsAnswer, eventsFilter, localDate, plusDays, sourceAccounts, } from "./reads.js";
|
|
5
|
-
export { repeatRule } from "./recurrence.js";
|
|
5
|
+
export { repeatRule, ruleLine } from "./recurrence.js";
|
|
6
6
|
export { calendarStatus, calendarSyncWindow, parseCalendarCursor, syncCalendars, } from "./sync.js";
|
|
7
7
|
export { CALENDAR_WRITE_DEFAULTS, CALENDAR_WRITE_KEYS, calendarConflict, EVENTS_DELETE_SERIES_KEY, EVENTS_NOTIFY_KEY, EVENTS_REMIND_HOOK_KEY, } from "./writer.js";
|
|
@@ -67,7 +67,7 @@ export declare const eventPreparation: (details: EventDetails, options: Preparat
|
|
|
67
67
|
title: string | null;
|
|
68
68
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
69
69
|
event_type: import("../meetings/event-store.js").EntryEventType | null;
|
|
70
|
-
own_response:
|
|
70
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
71
71
|
starts_at: string | null;
|
|
72
72
|
ends_at: string | null;
|
|
73
73
|
join_url: string | null;
|
|
@@ -77,7 +77,7 @@ export declare const eventPreparation: (details: EventDetails, options: Preparat
|
|
|
77
77
|
attendees: {
|
|
78
78
|
email: string;
|
|
79
79
|
name: string | null;
|
|
80
|
-
response:
|
|
80
|
+
response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
81
81
|
organizer: boolean;
|
|
82
82
|
optional: boolean;
|
|
83
83
|
resource: boolean;
|
package/dist/calendar/reads.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export declare const entryItem: (entry: StoredEntry) => {
|
|
|
57
57
|
title: string | null;
|
|
58
58
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
59
59
|
event_type: EntryEventType | null;
|
|
60
|
-
own_response:
|
|
60
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
61
61
|
starts_at: string | null;
|
|
62
62
|
ends_at: string | null;
|
|
63
63
|
join_url: string | null;
|
|
@@ -98,7 +98,7 @@ export declare const eventAnswer: (details: EventDetails, personOf?: PersonOfEma
|
|
|
98
98
|
title: string | null;
|
|
99
99
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
100
100
|
event_type: EntryEventType | null;
|
|
101
|
-
own_response:
|
|
101
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
102
102
|
starts_at: string | null;
|
|
103
103
|
ends_at: string | null;
|
|
104
104
|
join_url: string | null;
|
|
@@ -108,7 +108,7 @@ export declare const eventAnswer: (details: EventDetails, personOf?: PersonOfEma
|
|
|
108
108
|
attendees: {
|
|
109
109
|
email: string;
|
|
110
110
|
name: string | null;
|
|
111
|
-
response:
|
|
111
|
+
response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
112
112
|
organizer: boolean;
|
|
113
113
|
optional: boolean;
|
|
114
114
|
resource: boolean;
|
|
@@ -140,7 +140,7 @@ export declare const peopleAnswer: (store: EventStore, accountId: number, option
|
|
|
140
140
|
items: {
|
|
141
141
|
email: string;
|
|
142
142
|
name: string | null;
|
|
143
|
-
response:
|
|
143
|
+
response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
144
144
|
organizer: boolean;
|
|
145
145
|
optional: boolean;
|
|
146
146
|
resource: boolean;
|
|
@@ -154,7 +154,7 @@ export declare const peopleAnswer: (store: EventStore, accountId: number, option
|
|
|
154
154
|
items: {
|
|
155
155
|
email: string;
|
|
156
156
|
name: string | null;
|
|
157
|
-
response:
|
|
157
|
+
response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
158
158
|
organizer: boolean;
|
|
159
159
|
optional: boolean;
|
|
160
160
|
resource: boolean;
|
|
@@ -75,7 +75,7 @@ export declare const createEvent: (context: WriteContext, calendarReference: str
|
|
|
75
75
|
title: string | null;
|
|
76
76
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
77
77
|
event_type: import("../meetings/event-store.js").EntryEventType | null;
|
|
78
|
-
own_response:
|
|
78
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
79
79
|
starts_at: string | null;
|
|
80
80
|
ends_at: string | null;
|
|
81
81
|
join_url: string | null;
|
|
@@ -103,7 +103,7 @@ export declare const createEventFromText: (context: WriteContext, calendarRefere
|
|
|
103
103
|
title: string | null;
|
|
104
104
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
105
105
|
event_type: import("../meetings/event-store.js").EntryEventType | null;
|
|
106
|
-
own_response:
|
|
106
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
107
107
|
starts_at: string | null;
|
|
108
108
|
ends_at: string | null;
|
|
109
109
|
join_url: string | null;
|
|
@@ -156,7 +156,7 @@ export declare const respondToEvent: (context: WriteContext, reference: string,
|
|
|
156
156
|
title: string | null;
|
|
157
157
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
158
158
|
event_type: import("../meetings/event-store.js").EntryEventType | null;
|
|
159
|
-
own_response:
|
|
159
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
160
160
|
starts_at: string | null;
|
|
161
161
|
ends_at: string | null;
|
|
162
162
|
join_url: string | null;
|
|
@@ -184,7 +184,7 @@ export declare const moveEvent: (context: WriteContext, reference: string, toCal
|
|
|
184
184
|
title: string | null;
|
|
185
185
|
status: import("../meetings/event-store.js").EntryStatus;
|
|
186
186
|
event_type: import("../meetings/event-store.js").EntryEventType | null;
|
|
187
|
-
own_response:
|
|
187
|
+
own_response: "accepted" | "declined" | "delegated" | "needs-action" | "tentative" | null;
|
|
188
188
|
starts_at: string | null;
|
|
189
189
|
ends_at: string | null;
|
|
190
190
|
join_url: string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { AppIdentity } from "../ports/app.js";
|
|
3
|
+
import { type Body } from "./envelope.js";
|
|
4
|
+
export interface ChatSendingCommandOptions {
|
|
5
|
+
env: (command: Command) => NodeJS.ProcessEnv;
|
|
6
|
+
output: (answer: Body, command: Command) => void;
|
|
7
|
+
/** The command line as the owner types it, such as `tg personal`; the app's command when absent. */
|
|
8
|
+
tool?: (command: Command) => string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `models chats`: whether `conversations embed` and `conversations links rebuild --analyze` may send chat text
|
|
12
|
+
* to a model outside this computer. One setting for every WireCat tool; a model on this computer is not affected.
|
|
13
|
+
*/
|
|
14
|
+
export declare const chatSendingCommand: (app: AppIdentity, options: ChatSendingCommandOptions) => Command;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { CHAT_SENDING_MODES, chatSendingMode, loosens, readChatSending, writeChatSending, } from "../models/chat-sending.js";
|
|
5
|
+
import { agentOf } from "../runs/run-context.js";
|
|
6
|
+
import { environmentOf } from "./context.js";
|
|
7
|
+
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "./effects.js";
|
|
8
|
+
import { itemOf } from "./envelope.js";
|
|
9
|
+
const MEANING = {
|
|
10
|
+
allowed: "chat text goes to a model outside this computer without a yes, in a terminal and over MCP",
|
|
11
|
+
ask: "each send to a model outside this computer needs a yes: --yes, which an agent may pass",
|
|
12
|
+
denied: "chat text never goes to a model outside this computer, even with --yes",
|
|
13
|
+
};
|
|
14
|
+
const view = (env) => {
|
|
15
|
+
const mode = chatSendingMode(env);
|
|
16
|
+
return { mode, meaning: MEANING[mode], since: readChatSending(env)?.at ?? null };
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* `models chats`: whether `conversations embed` and `conversations links rebuild --analyze` may send chat text
|
|
20
|
+
* to a model outside this computer. One setting for every WireCat tool; a model on this computer is not affected.
|
|
21
|
+
*/
|
|
22
|
+
export const chatSendingCommand = (app, options) => {
|
|
23
|
+
const tool = (command) => options.tool?.(command) ?? app.command;
|
|
24
|
+
const sending = annotate(new Command("chats"), { effects: LOCAL_READ }).description("whether chat text may go to a model off this computer: allowed, ask or denied");
|
|
25
|
+
annotate(sending.command("show"), {
|
|
26
|
+
effects: LOCAL_READ,
|
|
27
|
+
output: { entity: "chat_sending" },
|
|
28
|
+
examples: [`${app.command} models chats show`],
|
|
29
|
+
})
|
|
30
|
+
.description("whether chat text may go to a model outside this computer, and since when")
|
|
31
|
+
.action(function () {
|
|
32
|
+
options.output(itemOf(view(options.env(this))), this);
|
|
33
|
+
});
|
|
34
|
+
grantsAuthority(annotate(sending.command("set"), {
|
|
35
|
+
effects: LOCAL_WRITE,
|
|
36
|
+
mcp: false,
|
|
37
|
+
output: { entity: "chat_sending" },
|
|
38
|
+
examples: [
|
|
39
|
+
`${app.command} models chats set allowed`,
|
|
40
|
+
`${app.command} models chats set ask`,
|
|
41
|
+
`${app.command} models chats set denied`,
|
|
42
|
+
],
|
|
43
|
+
}))
|
|
44
|
+
.summary("allowed, ask (the default) or denied; only you make it less strict")
|
|
45
|
+
.description("allowed: no yes needed; ask: --yes needed, an agent may pass it; denied: refused even with --yes. " +
|
|
46
|
+
"Only you make it less strict")
|
|
47
|
+
.argument("<mode>", "allowed, ask or denied")
|
|
48
|
+
.option("--from-app", "you did this in WireCat Desktop")
|
|
49
|
+
.action(function (given) {
|
|
50
|
+
if (!CHAT_SENDING_MODES.includes(given))
|
|
51
|
+
throw new CliError("validation_error", "say allowed, ask or denied");
|
|
52
|
+
const mode = given;
|
|
53
|
+
const env = options.env(this);
|
|
54
|
+
const before = chatSendingMode(env);
|
|
55
|
+
if (loosens(before, mode) &&
|
|
56
|
+
(environmentOf(this).agent || agentOf(env)) &&
|
|
57
|
+
!this.opts().fromApp)
|
|
58
|
+
throw new CliError("permission_error", `only the owner makes \`models chats\` less strict, not an agent: ask the owner to run \`${tool(this)} models chats set ${mode}\``, { reason: "chat-sending.owner-only" });
|
|
59
|
+
if (before !== mode)
|
|
60
|
+
writeChatSending(env, mode);
|
|
61
|
+
options.output(itemOf({ ...view(env), changed: before !== mode }), this);
|
|
62
|
+
});
|
|
63
|
+
return sending;
|
|
64
|
+
};
|
package/dist/cli/context.d.ts
CHANGED
|
@@ -138,6 +138,13 @@ export declare const withAgentLevels: <F extends {
|
|
|
138
138
|
* output goes and a test that captures it sees it. `readSecret(prompt, { ...secretInputOf(this), echo: true })`.
|
|
139
139
|
*/
|
|
140
140
|
export declare const secretInputOf: (command: Command) => Pick<SecretInput, "input" | "output">;
|
|
141
|
+
/**
|
|
142
|
+
* `--json=a,b` sets the root's `fields`. A command may declare a `--fields` of its own (Google's partial-response
|
|
143
|
+
* mask), which `optsWithGlobals` would put in its place.
|
|
144
|
+
*/
|
|
145
|
+
export declare const outputFieldsOf: (command: Command) => {
|
|
146
|
+
fields?: string;
|
|
147
|
+
};
|
|
141
148
|
/** Whether the run asked for one line per item (WC-OUT-24). */
|
|
142
149
|
export declare const compactOf: (command: Command) => boolean;
|
|
143
150
|
/** For the commands that print but never need settings or a connection. */
|
package/dist/cli/context.js
CHANGED
|
@@ -60,13 +60,23 @@ const detailOf = ({ brief, full }) => {
|
|
|
60
60
|
return brief ? { hitDetail: "brief" } : full ? { hitDetail: "full" } : {};
|
|
61
61
|
};
|
|
62
62
|
const COMPACT_KEY = new Option(COMPACT_FLAG).attributeName();
|
|
63
|
+
/**
|
|
64
|
+
* `--json=a,b` sets the root's `fields`. A command may declare a `--fields` of its own (Google's partial-response
|
|
65
|
+
* mask), which `optsWithGlobals` would put in its place.
|
|
66
|
+
*/
|
|
67
|
+
export const outputFieldsOf = (command) => {
|
|
68
|
+
const fields = rootOf(command).getOptionValue("fields");
|
|
69
|
+
return typeof fields === "string" ? { fields } : {};
|
|
70
|
+
};
|
|
63
71
|
/** Whether the run asked for one line per item (WC-OUT-24). */
|
|
64
72
|
export const compactOf = (command) => command.optsWithGlobals()[COMPACT_KEY] === true;
|
|
65
73
|
/** For the commands that print but never need settings or a connection. */
|
|
66
74
|
export const outputFor = (command) => {
|
|
67
75
|
const { streams, tty, env, agent } = environmentOf(command);
|
|
76
|
+
const { fields: _own, ...flags } = command.optsWithGlobals();
|
|
68
77
|
return resolveOutput({
|
|
69
|
-
...
|
|
78
|
+
...flags,
|
|
79
|
+
...outputFieldsOf(command),
|
|
70
80
|
...detailOf(command.optsWithGlobals()),
|
|
71
81
|
compact: compactOf(command),
|
|
72
82
|
...(agent ? { capture: agent.result } : {}),
|
|
@@ -85,9 +95,7 @@ export const baseContext = (command, resolveSettings) => {
|
|
|
85
95
|
env,
|
|
86
96
|
compact: compactOf(command),
|
|
87
97
|
...detailOf(command.optsWithGlobals()),
|
|
88
|
-
...(command
|
|
89
|
-
? { fields: command.optsWithGlobals().fields }
|
|
90
|
-
: {}),
|
|
98
|
+
...outputFieldsOf(command),
|
|
91
99
|
...(environment.agent ? { capture: environment.agent.result } : {}),
|
|
92
100
|
...(environment.streams ? { streams: environment.streams } : {}),
|
|
93
101
|
...(environment.tty === undefined ? {} : { tty: environment.tty }),
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -106,11 +106,13 @@ export { answerLocally, type ShownTime, wallClock } from "./local-times.js";
|
|
|
106
106
|
export { MCP_HTTP_DEFAULT_PORT, type McpServerOptions, type McpServerTarget, mcpServerCommand, } from "./mcp-server-command.js";
|
|
107
107
|
export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
|
|
108
108
|
export { meetingEvidenceItem, meetingPersonContextItem } from "./meeting-evidence-answer.js";
|
|
109
|
+
export { addMeetingCombinedSearchCommand, addMeetingEmbeddingCommand, type MeetingCombinedSearchDeps, type MeetingEmbeddingCommandDeps, type MeetingSearchRun, } from "./meeting-meaning-command.js";
|
|
109
110
|
export { meetingPreparationAnswer } from "./meeting-preparation-answer.js";
|
|
110
111
|
export { type MeetingPreparationReader, meetingPreparationInput, readMeetingPreparation, } from "./meeting-preparation-read.js";
|
|
111
112
|
export { readMeetingProjectCandidates } from "./meeting-project-candidates-read.js";
|
|
112
113
|
export { meetingResultItem } from "./meeting-results.js";
|
|
113
114
|
export { type MeetingSeriesInventoryReader, readMeetingSeriesInventory } from "./meeting-series-inventory-read.js";
|
|
115
|
+
export { addMeetingTagsCommand, type MeetingTagsCommandDeps } from "./meeting-tags-command.js";
|
|
114
116
|
export { accountFileFor, profilesHere, rememberAccount } from "./messenger/accounts.js";
|
|
115
117
|
export { terminalAsker } from "./messenger/ask.js";
|
|
116
118
|
export type { CompletionOptions } from "./messenger/complete-command.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -97,11 +97,13 @@ export { answerLocally, wallClock } from "./local-times.js";
|
|
|
97
97
|
export { MCP_HTTP_DEFAULT_PORT, mcpServerCommand, } from "./mcp-server-command.js";
|
|
98
98
|
export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
|
|
99
99
|
export { meetingEvidenceItem, meetingPersonContextItem } from "./meeting-evidence-answer.js";
|
|
100
|
+
export { addMeetingCombinedSearchCommand, addMeetingEmbeddingCommand, } from "./meeting-meaning-command.js";
|
|
100
101
|
export { meetingPreparationAnswer } from "./meeting-preparation-answer.js";
|
|
101
102
|
export { meetingPreparationInput, readMeetingPreparation, } from "./meeting-preparation-read.js";
|
|
102
103
|
export { readMeetingProjectCandidates } from "./meeting-project-candidates-read.js";
|
|
103
104
|
export { meetingResultItem } from "./meeting-results.js";
|
|
104
105
|
export { readMeetingSeriesInventory } from "./meeting-series-inventory-read.js";
|
|
106
|
+
export { addMeetingTagsCommand } from "./meeting-tags-command.js";
|
|
105
107
|
export { accountFileFor, profilesHere, rememberAccount } from "./messenger/accounts.js";
|
|
106
108
|
export { terminalAsker } from "./messenger/ask.js";
|
|
107
109
|
export { connectFor, messengerContext, } from "./messenger/context.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Command } from "commander";
|
|
2
|
+
import { type MeetingHitSearch, type MeetingSearchFlags } from "../meetings/cli/index.js";
|
|
3
|
+
import type { MeetingMeaning } from "../services/meeting-meaning.js";
|
|
4
|
+
import { type Body } from "./envelope.js";
|
|
5
|
+
interface MeaningFlags {
|
|
6
|
+
model?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
dims?: number;
|
|
9
|
+
maxChunks?: number;
|
|
10
|
+
maxRows?: number;
|
|
11
|
+
maxTextBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
type SearchFlags = MeetingSearchFlags & MeaningFlags;
|
|
14
|
+
export interface MeetingCombinedSearchDeps {
|
|
15
|
+
words: () => Promise<MeetingHitSearch>;
|
|
16
|
+
meaning: () => Promise<MeetingMeaning>;
|
|
17
|
+
signal: () => AbortSignal | undefined;
|
|
18
|
+
/** The page without `--limit`: `pagingOf` from `@wirecat/cli-core/cli`, which reads the profile's limit. */
|
|
19
|
+
pagingOf: (command: Command) => {
|
|
20
|
+
limit: number;
|
|
21
|
+
};
|
|
22
|
+
output: (body: Body, command: Command) => void;
|
|
23
|
+
/** One to three examples that run as written, with the host's command and a profile. */
|
|
24
|
+
examples: string[];
|
|
25
|
+
}
|
|
26
|
+
export type MeetingSearchRun = (query: string, options: SearchFlags, command: Command) => Promise<Body>;
|
|
27
|
+
/**
|
|
28
|
+
* `search meetings` by words, and by words and meaning ranked together with `--model`, for any host of stored
|
|
29
|
+
* meetings. Returns the run, so a host's saved searches replay it.
|
|
30
|
+
*/
|
|
31
|
+
export declare const addMeetingCombinedSearchCommand: (program: Command, deps: MeetingCombinedSearchDeps) => MeetingSearchRun;
|
|
32
|
+
export interface MeetingEmbeddingCommandDeps {
|
|
33
|
+
meaning: () => Promise<MeetingMeaning>;
|
|
34
|
+
/** The local model used without `--model`: the `models` command's default text model. */
|
|
35
|
+
defaultModel: () => string;
|
|
36
|
+
signal: () => AbortSignal | undefined;
|
|
37
|
+
output: (body: Body, command: Command) => void;
|
|
38
|
+
/** Where a write's answer goes when the host keeps a receipt of it; `output` otherwise. */
|
|
39
|
+
receipt?: (body: Body, command: Command) => Promise<void>;
|
|
40
|
+
examples: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `meetings embed`: previews the vectors a search by meaning needs, and `--yes` splits every transcript and embeds one
|
|
44
|
+
* batch of the passages without a vector; run it again for the next batch.
|
|
45
|
+
*/
|
|
46
|
+
export declare const addMeetingEmbeddingCommand: (program: Command, deps: MeetingEmbeddingCommandDeps) => void;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate, overrideSharedContract } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { InvalidArgumentError } from "commander";
|
|
4
|
+
import { createMeetingSearchCommand, meetingHitSearchRequest, meetingSearchArguments, meetingSearchMeta, } from "../meetings/cli/index.js";
|
|
5
|
+
import { meetingHitsList } from "../meetings/index.js";
|
|
6
|
+
import { FETCH } from "./effects.js";
|
|
7
|
+
import { itemOf, listOf } from "./envelope.js";
|
|
8
|
+
const count = (value) => {
|
|
9
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
10
|
+
throw new InvalidArgumentError("expected a positive integer");
|
|
11
|
+
return Number(value);
|
|
12
|
+
};
|
|
13
|
+
const FLAG = {
|
|
14
|
+
maxReadBytes: "--max-read-bytes",
|
|
15
|
+
baseUrl: "--base-url",
|
|
16
|
+
dims: "--dims",
|
|
17
|
+
maxChunks: "--max-chunks",
|
|
18
|
+
maxRows: "--max-rows",
|
|
19
|
+
maxTextBytes: "--max-text-bytes",
|
|
20
|
+
};
|
|
21
|
+
const refuse = (options, keys, mode) => {
|
|
22
|
+
const given = keys.filter((key) => options[key] !== undefined).map((key) => FLAG[key]);
|
|
23
|
+
if (given.length)
|
|
24
|
+
throw new CliError("validation_error", `${given.join(", ")} do not apply ${mode}`);
|
|
25
|
+
};
|
|
26
|
+
// The root `--offline`: a remote `--base-url` would send the passages out.
|
|
27
|
+
const offline = (command) => command.optsWithGlobals().offline === true;
|
|
28
|
+
/** Combined hits as the list answer: each cites a line, says how it was found, and keeps its passage. */
|
|
29
|
+
const combinedList = (found, limit, args) => listOf("search meetings", {
|
|
30
|
+
items: found.items.map((hit) => ({
|
|
31
|
+
ref: hit.ref,
|
|
32
|
+
meeting: hit.ref.split("/").slice(0, 2).join("/"),
|
|
33
|
+
scope: hit.scope,
|
|
34
|
+
excerpt: hit.text,
|
|
35
|
+
offset_ms: hit.startMs,
|
|
36
|
+
by: hit.by,
|
|
37
|
+
score: hit.score,
|
|
38
|
+
...(hit.passage ? { passage: hit.passage } : {}),
|
|
39
|
+
...(hit.match ? { match: hit.match } : {}),
|
|
40
|
+
...(hit.corrections ? { corrections: hit.corrections } : {}),
|
|
41
|
+
source: {
|
|
42
|
+
ref: hit.ref,
|
|
43
|
+
title: hit.source.title,
|
|
44
|
+
started_at: hit.source.startedAt === null ? null : new Date(hit.source.startedAt).toISOString(),
|
|
45
|
+
url: hit.source.url,
|
|
46
|
+
},
|
|
47
|
+
untrusted: ["excerpt", "passage.first", "passage.last", "source.title"],
|
|
48
|
+
})),
|
|
49
|
+
limit,
|
|
50
|
+
has_more: found.hasMore,
|
|
51
|
+
paging: "cursor",
|
|
52
|
+
...(found.nextCursor ? { cursor: found.nextCursor } : {}),
|
|
53
|
+
args,
|
|
54
|
+
missing: [
|
|
55
|
+
...(found.coverage.meaningScanComplete
|
|
56
|
+
? []
|
|
57
|
+
: [{ field: "items", why: `meaning compared only ${found.coverage.scanned} passages; raise --max-chunks` }]),
|
|
58
|
+
...(found.words.refused ? [{ field: "items", why: `found by meaning only: ${found.words.refused}` }] : []),
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
const MEANING_REASON = "search meetings also ranks by meaning with --model, over vectors built on this computer";
|
|
62
|
+
const withMeaningOptions = (command) => overrideSharedContract(command, MEANING_REASON, (one) => {
|
|
63
|
+
one
|
|
64
|
+
.description("find words in stored meetings, and by meaning with --model")
|
|
65
|
+
.option("--model <model>", "rank words and meaning together with this embedding model, building missing vectors first; local stays here")
|
|
66
|
+
.option("--base-url <url>", "remote embedding service for --model; the passages are sent there")
|
|
67
|
+
.option("--dims <n>", "vector size the remote service returns, in dimensions", count)
|
|
68
|
+
.option("--max-chunks <n>", "by meaning: most stored passages to compare (default 10000)", count)
|
|
69
|
+
.option("--max-rows <n>", "by meaning: most transcript lines to read, 1 through 100000", count)
|
|
70
|
+
.option("--max-text-bytes <bytes>", "by meaning: most transcript text to read (default 4 MiB)", count);
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* `search meetings` by words, and by words and meaning ranked together with `--model`, for any host of stored
|
|
74
|
+
* meetings. Returns the run, so a host's saved searches replay it.
|
|
75
|
+
*/
|
|
76
|
+
export const addMeetingCombinedSearchCommand = (program, deps) => {
|
|
77
|
+
const execute = async (query, options, command) => {
|
|
78
|
+
const request = meetingHitSearchRequest(query, options, deps.pagingOf(command).limit, deps.signal());
|
|
79
|
+
if (options.model !== undefined) {
|
|
80
|
+
refuse(options, ["maxReadBytes"], "to a search by meaning");
|
|
81
|
+
const { limit, after, maxReadBytes: _bytes, signal, ...selection } = request;
|
|
82
|
+
if (options.baseUrl !== undefined && offline(command))
|
|
83
|
+
throw new CliError("configuration_error", "remote embeddings require network access; remove --offline");
|
|
84
|
+
const meaning = {
|
|
85
|
+
model: options.model,
|
|
86
|
+
baseUrl: options.baseUrl,
|
|
87
|
+
dims: options.dims,
|
|
88
|
+
limit,
|
|
89
|
+
maxChunks: options.maxChunks,
|
|
90
|
+
after,
|
|
91
|
+
selection,
|
|
92
|
+
maxRows: options.maxRows,
|
|
93
|
+
maxTextBytes: options.maxTextBytes,
|
|
94
|
+
buildMissing: true,
|
|
95
|
+
signal,
|
|
96
|
+
};
|
|
97
|
+
return combinedList(await (await deps.meaning()).search(query, meaning), limit, meetingSearchArguments(query, options));
|
|
98
|
+
}
|
|
99
|
+
refuse(options, ["baseUrl", "dims", "maxChunks", "maxRows", "maxTextBytes"], "without --model");
|
|
100
|
+
return meetingHitsList(await (await deps.words())(query, request), request.limit, "search meetings", meetingSearchArguments(query, options), meetingSearchMeta(options));
|
|
101
|
+
};
|
|
102
|
+
const command = withMeaningOptions(createMeetingSearchCommand(program)).action(async (query, options, self) => deps.output(await execute(query, options, self), self));
|
|
103
|
+
overrideSharedContract(command, "a search by meaning may build missing vectors, so it writes to the store", (one) => annotate(one, { origin: "handwritten", effects: FETCH, examples: deps.examples }));
|
|
104
|
+
return execute;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* `meetings embed`: previews the vectors a search by meaning needs, and `--yes` splits every transcript and embeds one
|
|
108
|
+
* batch of the passages without a vector; run it again for the next batch.
|
|
109
|
+
*/
|
|
110
|
+
export const addMeetingEmbeddingCommand = (program, deps) => {
|
|
111
|
+
const meetings = program.commands.find((command) => command.name() === "meetings");
|
|
112
|
+
if (!meetings)
|
|
113
|
+
throw new CliError("configuration_error", "meeting command group is unavailable");
|
|
114
|
+
annotate(meetings
|
|
115
|
+
.command("embed")
|
|
116
|
+
.description("preview building the vectors search by meaning reads; --yes builds one batch, rerun for the next")
|
|
117
|
+
.option("--model <model>", "embedding model: a local one (default: the models command's default text model)")
|
|
118
|
+
.option("--base-url <url>", "remote embedding service; the passages are sent there. OpenAI reads OPENAI_API_KEY")
|
|
119
|
+
.option("--dims <n>", "vector size the remote service returns, in dimensions", count)
|
|
120
|
+
.option("--limit <n>", "how many passages in one batch, 1 through 1000 (default 100)", count)
|
|
121
|
+
.option("--max-rows <n>", "most transcript lines to read, 1 through 100000", count)
|
|
122
|
+
.option("--max-text-bytes <bytes>", "most transcript text to read, in bytes (default 4 MiB)", count)
|
|
123
|
+
.option("--yes", "split transcripts and build their vectors; otherwise only preview")
|
|
124
|
+
.action(async (flags, command) => {
|
|
125
|
+
if (flags.baseUrl !== undefined && flags.model === undefined)
|
|
126
|
+
throw new CliError("validation_error", "a remote --base-url needs its own --model");
|
|
127
|
+
if (flags.baseUrl !== undefined && offline(command))
|
|
128
|
+
throw new CliError("configuration_error", "remote embeddings require network access; remove --offline");
|
|
129
|
+
const options = { ...flags, model: flags.model ?? deps.defaultModel(), signal: deps.signal() };
|
|
130
|
+
const body = itemOf(await (await deps.meaning()).generate(options));
|
|
131
|
+
if (options.yes && deps.receipt)
|
|
132
|
+
await deps.receipt(body, command);
|
|
133
|
+
else
|
|
134
|
+
deps.output(body, command);
|
|
135
|
+
}), { origin: "handwritten", effects: FETCH, examples: deps.examples });
|
|
136
|
+
};
|