@wirecat/cli-core 0.657.0 → 0.659.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 +35 -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/mcp/index.d.ts +12 -12
- package/dist/calendar/reads.d.ts +1 -0
- package/dist/calendar/reads.js +1 -1
- package/dist/cli/config-command.js +2 -9
- package/dist/cli/config-issues.js +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/listings.d.ts +46 -0
- package/dist/cli/listings.js +188 -0
- package/dist/cli/messenger/messages-delete-command.d.ts +2 -1
- package/dist/cli/messenger/messages-delete-command.js +2 -1
- package/dist/cli/messenger/serve-relay.d.ts +1 -1
- package/dist/{cli → domain}/config-repair.d.ts +7 -0
- package/dist/{cli → domain}/config-repair.js +53 -0
- package/dist/entities/listings.d.ts +514 -0
- package/dist/entities/listings.js +154 -0
- package/dist/errors/reasons.js +4 -0
- package/dist/kit/sync-after-install.js +5 -0
- package/dist/replies/rules.d.ts +1 -1
- package/dist/replies/rules.js +1 -1
- package/dist/sends/permissions.js +5 -4
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/listings.d.ts +74 -0
- package/dist/services/listings.js +285 -0
- package/dist/services/metadata.d.ts +1 -1
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.js +2 -0
- package/dist/store/shared-config.d.ts +2 -0
- package/dist/store/shared-config.js +38 -8
- package/dist/store/sqlite/calendar-events.d.ts +10 -0
- package/dist/store/sqlite/calendar-events.js +18 -8
- package/dist/store/sqlite/document-listing.d.ts +99 -0
- package/dist/store/sqlite/document-listing.js +292 -0
- package/dist/store/sqlite/files.d.ts +2 -0
- package/dist/store/sqlite/files.js +7 -3
- package/dist/store/sqlite/meeting-listing.d.ts +108 -0
- package/dist/store/sqlite/meeting-listing.js +431 -0
- package/dist/store/store.d.ts +4 -0
- package/dist/store/store.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@ 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.659.0 — 14.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **The shared config mends its own slips.** When `~/.config/WireCat/config.json` is not JSON only because of a
|
|
13
|
+
byte-order mark, a comment, a trailing comma or a missing comma between two lines, a reader mends it in place,
|
|
14
|
+
keeping every key, and keeps the old file beside it as `config.json.bak-<time>`. Any other damage is refused with
|
|
15
|
+
its line, column, the text around it (every value hidden) and the likely fix: "add a comma after `"tools": true`
|
|
16
|
+
on line 4". It still never makes a tool read-only.
|
|
17
|
+
|
|
18
|
+
### Changed — may break callers
|
|
19
|
+
|
|
20
|
+
- **Deleting messages and sending rule replies no longer wait for the owner** (owner, 2026-11-14). The built-in
|
|
21
|
+
levels of `messages.delete` and `bot.messages.delete` are now `allow`: `messages delete` deletes without a question
|
|
22
|
+
and without `--allow-dangerous`. `replies.send` is now `allow` (it was `deny`): `serve` sends the replies
|
|
23
|
+
of the rules the owner turned on, and a new rule still starts off. A profile that wants the old behaviour sets
|
|
24
|
+
`messages.delete: ask` or `replies.send: deny`. `mcp.authority` stays `deny`. Over MCP the same levels apply, and
|
|
25
|
+
a write at `ask` goes ahead, as before.
|
|
26
|
+
- **`syncAfterInstallCases` adds a shared config with a missing comma between two lines.** The reader mends it, so
|
|
27
|
+
a CLI's sync must exit 0 there; a CLI that reads the file with its own reader fails the new case.
|
|
28
|
+
|
|
29
|
+
## 0.658.0 — 13.11.2026
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **Every document and every meeting of every account, one list each.** `listDocuments`, `listDocumentSources` and
|
|
34
|
+
`showDocument` (`./services`) list the documents of Drive accounts, notes folders, added sources and imports with
|
|
35
|
+
their source, folder, kind, size, link and whether the store holds their text, page them with a total, and give
|
|
36
|
+
each account's folder tree with counts. `listMeetingEntries` and `showMeetingEntry` list meetings, calls and calendar
|
|
37
|
+
events as one row per real meeting in a time window (overlap, newest or oldest first), with participants and their
|
|
38
|
+
person refs, join links, recording, transcript and summary flags, linked documents and the findings waiting on the
|
|
39
|
+
owner; `show` adds the transcript lines with their times. `documentListRequest`, `meetingListRequest` and their
|
|
40
|
+
query registries (`./cli`) turn a list's words into those requests; `store.listings` holds the SQL. See
|
|
41
|
+
[Listings](docs/dev/LISTINGS.md).
|
|
42
|
+
|
|
8
43
|
## 0.657.0 — 13.11.2026
|
|
9
44
|
|
|
10
45
|
### Fixed
|
|
@@ -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
|
@@ -2,7 +2,7 @@ export type { CalendarAccessRole, CalendarInput, EntryAttachment, EntryAttachmen
|
|
|
2
2
|
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
|
-
export { accountsMeta, EVENT_TYPES, EVENTS_QUERY, EVENTS_QUERY_NOTE, eventAnswer, eventOf, eventsAnswer, eventsFilter, type ReadAccount, sourceAccounts, } from "./reads.js";
|
|
5
|
+
export { accountsMeta, EVENT_TYPES, EVENTS_QUERY, EVENTS_QUERY_NOTE, eventAnswer, eventIdOf, eventOf, eventsAnswer, eventsFilter, localDate, plusDays, type ReadAccount, sourceAccounts, } from "./reads.js";
|
|
6
6
|
export { repeatRule } 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";
|
package/dist/calendar/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
export { accountsMeta, EVENT_TYPES, EVENTS_QUERY, EVENTS_QUERY_NOTE, eventAnswer, eventOf, eventsAnswer, eventsFilter, sourceAccounts, } from "./reads.js";
|
|
4
|
+
export { accountsMeta, EVENT_TYPES, EVENTS_QUERY, EVENTS_QUERY_NOTE, eventAnswer, eventIdOf, eventOf, eventsAnswer, eventsFilter, localDate, plusDays, sourceAccounts, } from "./reads.js";
|
|
5
5
|
export { repeatRule } 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";
|
|
@@ -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;
|
package/dist/calendar/reads.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare const calendarItem: (one: StoredCalendar) => {
|
|
|
20
20
|
/** A stored calendar of the account by its id, the provider's id, or its title when only one has it. */
|
|
21
21
|
export declare const calendarIn: (store: EventStore, accountId: number, reference: string) => Promise<StoredCalendar>;
|
|
22
22
|
export declare const eventIdOf: (reference: string | number) => number;
|
|
23
|
+
export declare const localDate: (at: number, zone: string) => string;
|
|
23
24
|
export declare const plusDays: (date: string, days: number) => string;
|
|
24
25
|
/** The kinds a calendar entry is stored as (`EntryEventType`); a copy with none is `default`. */
|
|
25
26
|
export declare const EVENT_TYPES: readonly EntryEventType[];
|
package/dist/calendar/reads.js
CHANGED
|
@@ -65,7 +65,7 @@ export const eventIdOf = (reference) => {
|
|
|
65
65
|
throw new CliError("validation_error", "an event is its id or event:<id>");
|
|
66
66
|
return Number(text);
|
|
67
67
|
};
|
|
68
|
-
const localDate = (at, zone) => new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(at);
|
|
68
|
+
export const localDate = (at, zone) => new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(at);
|
|
69
69
|
export const plusDays = (date, days) => {
|
|
70
70
|
const [year, month, day] = date.split("-").map(Number);
|
|
71
71
|
return new Date(Date.UTC(year, month - 1, day + days)).toISOString().slice(0, 10);
|
|
@@ -2,11 +2,12 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import { CliError, pathsAreOverridden, writeSecurely } from "@wirecat/cli-base";
|
|
3
3
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
4
4
|
import { Command, Option } from "commander";
|
|
5
|
+
import { REPAIR_WORDS, repairConfigText } from "../domain/config-repair.js";
|
|
5
6
|
import { envName } from "../ports/app.js";
|
|
6
7
|
import { agentOf } from "../runs/run-context.js";
|
|
7
8
|
import { AUTHORITY_KEY, BOT_API_KEY, LEVELS, levelFor } from "../sends/permissions.js";
|
|
9
|
+
import { backupPathFor } from "../store/shared-config.js";
|
|
8
10
|
import { fixVerb } from "./config-issues.js";
|
|
9
|
-
import { REPAIR_WORDS, repairConfigText } from "./config-repair.js";
|
|
10
11
|
import { baseContext, environmentOf } from "./context.js";
|
|
11
12
|
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "./effects.js";
|
|
12
13
|
import { itemOf, renderAnswer } from "./envelope.js";
|
|
@@ -218,14 +219,6 @@ const repairCommand = (app, config) => profileFree(grantsAuthority(annotate(new
|
|
|
218
219
|
if (backup)
|
|
219
220
|
renderer.note(`the old file is kept as ${backup}`);
|
|
220
221
|
});
|
|
221
|
-
/** Beside the file, so the owner finds it; a second repair in the same millisecond never replaces the first. */
|
|
222
|
-
const backupPathFor = (file) => {
|
|
223
|
-
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
224
|
-
let path = `${file}.bak-${stamp}`;
|
|
225
|
-
for (let n = 2; existsSync(path); n++)
|
|
226
|
-
path = `${file}.bak-${stamp}-${n}`;
|
|
227
|
-
return path;
|
|
228
|
-
};
|
|
229
222
|
/**
|
|
230
223
|
* A key no command or write is checked against would be saved and do nothing (BUG-137) — whether it
|
|
231
224
|
* comes as `permissions.<key>` or inside a whole `permissions` object.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
import { repairConfigText } from "
|
|
3
|
+
import { repairConfigText } from "../domain/config-repair.js";
|
|
4
4
|
const isNode = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
const SECTIONS = ["personal", "bot"];
|
|
6
6
|
const SHELL_SAFE = /^[A-Za-z0-9_.:@-]*$/;
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { openOf, PROFILE_PLACEHOLDER, type ProfilesFor, profilesOn, type RefOpen
|
|
|
6
6
|
/** The shared entities `person_context`, `organization_context`, `deal_context` and `deal_context.brief`. */
|
|
7
7
|
export { dealBrief as dealBriefSchema, dealContext as dealContextSchema, organizationContext as organizationContextSchema, personContext as personContextSchema, } from "../entities/business-context.js";
|
|
8
8
|
export { botTemplate } from "../entities/list-results.js";
|
|
9
|
+
export { documentEntry, documentEntryDetails, documentSource, LISTING_ENTITIES, meetingEntry, meetingEntryDetails, } from "../entities/listings.js";
|
|
9
10
|
export { syncProgress } from "../entities/store-records.js";
|
|
10
11
|
export { isCliFailure, isCommanderFailure, storeDamaged } from "../errors/failures.js";
|
|
11
12
|
export { type AppErrors, failureContext } from "../errors/reasons.js";
|
|
@@ -97,6 +98,7 @@ export { type HelpSection, inSection, SECTIONS } from "./help/sections.js";
|
|
|
97
98
|
export { bufferedInput, type InputPolicy, inputPolicy, MAX_BUFFERED_INPUT, MAX_SECRET_INPUT, provideInputPolicy, } from "./input-policy.js";
|
|
98
99
|
export { answerFields, checkJson, type EntityFields, entityFields, type JsonFieldsResolver, type JsonRequest, liftJson, } from "./json-fields.js";
|
|
99
100
|
export { commandPath, LIST_QUERY_GUIDE, listQuery, nativeField, nativeTermLists, nativeTerms, negatableOf, pagedList, pageOf, type QueryWords, queryArgument, queryHelp, queryTerms, searchText, termField, timeBounds, typedQuery, unfilteredQuery, withQuery, } from "./list-query.js";
|
|
101
|
+
export { DOCUMENTS_LIST_QUERY, documentListRequest, MEETINGS_AHEAD_DAYS, MEETINGS_LIST_QUERY, MEETINGS_RECENT_DAYS, type MeetingWindowMeta, meetingListRequest, } from "./listings.js";
|
|
100
102
|
export { answerLocally, type ShownTime, wallClock } from "./local-times.js";
|
|
101
103
|
export { MCP_HTTP_DEFAULT_PORT, type McpServerOptions, type McpServerTarget, mcpServerCommand, } from "./mcp-server-command.js";
|
|
102
104
|
export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { openOf, PROFILE_PLACEHOLDER, profilesOn, refLabel, storedProfilesFor, w
|
|
|
6
6
|
/** The shared entities `person_context`, `organization_context`, `deal_context` and `deal_context.brief`. */
|
|
7
7
|
export { dealBrief as dealBriefSchema, dealContext as dealContextSchema, organizationContext as organizationContextSchema, personContext as personContextSchema, } from "../entities/business-context.js";
|
|
8
8
|
export { botTemplate } from "../entities/list-results.js";
|
|
9
|
+
export { documentEntry, documentEntryDetails, documentSource, LISTING_ENTITIES, meetingEntry, meetingEntryDetails, } from "../entities/listings.js";
|
|
9
10
|
export { syncProgress } from "../entities/store-records.js";
|
|
10
11
|
export { isCliFailure, isCommanderFailure, storeDamaged } from "../errors/failures.js";
|
|
11
12
|
export { failureContext } from "../errors/reasons.js";
|
|
@@ -88,6 +89,7 @@ export { inSection, SECTIONS } from "./help/sections.js";
|
|
|
88
89
|
export { bufferedInput, inputPolicy, MAX_BUFFERED_INPUT, MAX_SECRET_INPUT, provideInputPolicy, } from "./input-policy.js";
|
|
89
90
|
export { answerFields, checkJson, entityFields, liftJson, } from "./json-fields.js";
|
|
90
91
|
export { commandPath, LIST_QUERY_GUIDE, listQuery, nativeField, nativeTermLists, nativeTerms, negatableOf, pagedList, pageOf, queryArgument, queryHelp, queryTerms, searchText, termField, timeBounds, typedQuery, unfilteredQuery, withQuery, } from "./list-query.js";
|
|
92
|
+
export { DOCUMENTS_LIST_QUERY, documentListRequest, MEETINGS_AHEAD_DAYS, MEETINGS_LIST_QUERY, MEETINGS_RECENT_DAYS, meetingListRequest, } from "./listings.js";
|
|
91
93
|
export { answerLocally, wallClock } from "./local-times.js";
|
|
92
94
|
export { MCP_HTTP_DEFAULT_PORT, mcpServerCommand, } from "./mcp-server-command.js";
|
|
93
95
|
export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DocumentListRequest, MeetingListRequest } from "../services/listings.js";
|
|
2
|
+
import { type QueryWords } from "./list-query.js";
|
|
3
|
+
/** `documents list`: what the store filters, and `text`, which the notes search answers first. */
|
|
4
|
+
export declare const DOCUMENTS_LIST_QUERY: {
|
|
5
|
+
readonly entity: "document_entry";
|
|
6
|
+
readonly backend: "native";
|
|
7
|
+
readonly fields: readonly [import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec];
|
|
8
|
+
};
|
|
9
|
+
/** `meetings list`: the time window, and filters every row answers. */
|
|
10
|
+
export declare const MEETINGS_LIST_QUERY: {
|
|
11
|
+
readonly entity: "meeting_entry";
|
|
12
|
+
readonly backend: "native";
|
|
13
|
+
readonly fields: readonly [import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec];
|
|
14
|
+
};
|
|
15
|
+
/** Without `started_at`, the meetings list reads the last 30 days and the next 7: calls are all in the past. */
|
|
16
|
+
export declare const MEETINGS_RECENT_DAYS = 30;
|
|
17
|
+
export declare const MEETINGS_AHEAD_DAYS = 7;
|
|
18
|
+
/** `documents list`'s query and page, as `listDocuments` takes them. */
|
|
19
|
+
export declare const documentListRequest: (words: QueryWords, { limit, page, zone, now }: {
|
|
20
|
+
limit: number;
|
|
21
|
+
page: number;
|
|
22
|
+
zone?: string;
|
|
23
|
+
now?: number;
|
|
24
|
+
}, command?: string) => DocumentListRequest;
|
|
25
|
+
export interface MeetingWindowMeta {
|
|
26
|
+
timezone: string;
|
|
27
|
+
window: {
|
|
28
|
+
since?: string;
|
|
29
|
+
until?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** `meetings list`'s query and page, as `listMeetingEntries` takes them, and the window it read for `meta`. */
|
|
33
|
+
export declare const meetingListRequest: (words: QueryWords, { limit, page, from, to, order, zone, now, }: {
|
|
34
|
+
limit: number;
|
|
35
|
+
page: number;
|
|
36
|
+
/** Instants with their offset, as a calendar asks for its window; in place of a `started_at` term. */
|
|
37
|
+
from?: string;
|
|
38
|
+
to?: string;
|
|
39
|
+
/** `start`: oldest first, so a window cut at `limit` is whole up to its last row. */
|
|
40
|
+
order?: "newest" | "start";
|
|
41
|
+
zone?: string;
|
|
42
|
+
now?: number;
|
|
43
|
+
}, command?: string) => {
|
|
44
|
+
request: MeetingListRequest;
|
|
45
|
+
meta: MeetingWindowMeta;
|
|
46
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { dateRange, dayBoundary, timezoneOf, } from "@wirecat/cli-base/query";
|
|
3
|
+
import { localDate, plusDays } from "../calendar/index.js";
|
|
4
|
+
import { DOCUMENT_KINDS, MEETING_ROW_KINDS } from "../store/index.js";
|
|
5
|
+
import { listQuery, nativeField, nativeTermLists, termField, typedQuery } from "./list-query.js";
|
|
6
|
+
const SOURCE = termField("source", "kw", 'source:"google-drive:ana@example.com"', {
|
|
7
|
+
relation: "one account, provider:account, or every account of a provider; repeat for several",
|
|
8
|
+
});
|
|
9
|
+
/** `documents list`: what the store filters, and `text`, which the notes search answers first. */
|
|
10
|
+
export const DOCUMENTS_LIST_QUERY = {
|
|
11
|
+
entity: "document_entry",
|
|
12
|
+
backend: "native",
|
|
13
|
+
fields: [
|
|
14
|
+
nativeField({
|
|
15
|
+
name: "text",
|
|
16
|
+
type: "txt",
|
|
17
|
+
operators: ["term", "phrase"],
|
|
18
|
+
example: "text:budget",
|
|
19
|
+
relation: "words in the title or the text, found as search notes finds them; a bare word means text:",
|
|
20
|
+
}),
|
|
21
|
+
SOURCE,
|
|
22
|
+
termField("kind", "enum", "kind:pdf", { values: DOCUMENT_KINDS, relation: "repeat for any of several" }),
|
|
23
|
+
termField("folder", "kw", 'folder:"Projects/Acme"', {
|
|
24
|
+
relation: "in this folder of its account or in a folder under it",
|
|
25
|
+
}),
|
|
26
|
+
nativeField({
|
|
27
|
+
name: "source_modified_at",
|
|
28
|
+
type: "time",
|
|
29
|
+
operators: ["term", "range"],
|
|
30
|
+
example: "source_modified_at:[2026-10-01 TO 2026-11-01}",
|
|
31
|
+
}),
|
|
32
|
+
termField("has_text", "bool", "has_text:false", { relation: "whether the store holds its text" }),
|
|
33
|
+
termField("tag", "kw", "tag:budget", { relation: "a local owner tag" }),
|
|
34
|
+
termField("person", "kw", 'person:"person:12"', { relation: "a person it is linked to, as person:<id>" }),
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
/** `meetings list`: the time window, and filters every row answers. */
|
|
38
|
+
export const MEETINGS_LIST_QUERY = {
|
|
39
|
+
entity: "meeting_entry",
|
|
40
|
+
backend: "native",
|
|
41
|
+
fields: [
|
|
42
|
+
nativeField({
|
|
43
|
+
name: "text",
|
|
44
|
+
type: "txt",
|
|
45
|
+
operators: ["term", "phrase"],
|
|
46
|
+
example: "text:standup",
|
|
47
|
+
relation: "words its title holds, in any letter case; a bare word means text:",
|
|
48
|
+
}),
|
|
49
|
+
nativeField({
|
|
50
|
+
name: "started_at",
|
|
51
|
+
type: "time",
|
|
52
|
+
operators: ["term", "range"],
|
|
53
|
+
example: "started_at:[2026-11-02 TO 2026-11-09}",
|
|
54
|
+
relation: "rows that overlap this time; a week or a month for a calendar",
|
|
55
|
+
}),
|
|
56
|
+
SOURCE,
|
|
57
|
+
termField("kind", "enum", "kind:call", { values: MEETING_ROW_KINDS, relation: "repeat for any of several" }),
|
|
58
|
+
termField("person", "kw", 'person:"person:12"', {
|
|
59
|
+
relation: "invited, took part, or was on the other end of a call, as person:<id>",
|
|
60
|
+
}),
|
|
61
|
+
termField("has_transcript", "bool", "has_transcript:true", {
|
|
62
|
+
relation: "whether one of its meetings has a transcript",
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
/** Without `started_at`, the meetings list reads the last 30 days and the next 7: calls are all in the past. */
|
|
67
|
+
export const MEETINGS_RECENT_DAYS = 30;
|
|
68
|
+
export const MEETINGS_AHEAD_DAYS = 7;
|
|
69
|
+
const REPEATABLE = ["text", "source", "kind", "tag", "person"];
|
|
70
|
+
const bool = (node) => node.value.toLowerCase() === "true";
|
|
71
|
+
const termsOf = (words, registry, command) => nativeTermLists(listQuery(typedQuery(words), registry, command, { defaultField: "text" }), command, REPEATABLE);
|
|
72
|
+
const values = (terms, field) => (terms.get(field) ?? []).map(({ value }) => value);
|
|
73
|
+
const textOf = (nodes) => nodes.map((node) => (node.operator === "phrase" ? `"${node.value.replaceAll('"', "")}"` : node.value)).join(" ");
|
|
74
|
+
/** The query's terms as one AND, with repeated kinds as an OR inside it, for the store's own fields. */
|
|
75
|
+
const storeQueryOf = (terms, fields) => {
|
|
76
|
+
const span = { start: 0, end: 0 };
|
|
77
|
+
const clauses = [];
|
|
78
|
+
for (const field of fields) {
|
|
79
|
+
const nodes = terms.get(field) ?? [];
|
|
80
|
+
if (nodes.length === 0)
|
|
81
|
+
continue;
|
|
82
|
+
if (field === "kind" && nodes.length > 1)
|
|
83
|
+
clauses.push({
|
|
84
|
+
occur: "must",
|
|
85
|
+
node: { kind: "boolean", clauses: nodes.map((node) => ({ occur: "should", node })), span },
|
|
86
|
+
});
|
|
87
|
+
else
|
|
88
|
+
for (const node of nodes)
|
|
89
|
+
clauses.push({ occur: "must", node });
|
|
90
|
+
}
|
|
91
|
+
if (clauses.length === 0)
|
|
92
|
+
return undefined;
|
|
93
|
+
return { version: 1, language: "lucene-v1", root: { kind: "boolean", clauses, span } };
|
|
94
|
+
};
|
|
95
|
+
/** `documents list`'s query and page, as `listDocuments` takes them. */
|
|
96
|
+
export const documentListRequest = (words, { limit, page, zone = timezoneOf(), now = Date.now() }, command = "documents list") => {
|
|
97
|
+
const terms = termsOf(words, DOCUMENTS_LIST_QUERY, command);
|
|
98
|
+
const sources = values(terms, "source");
|
|
99
|
+
const text = textOf(terms.get("text") ?? []);
|
|
100
|
+
const query = storeQueryOf(terms, ["kind", "folder", "source_modified_at", "has_text", "tag", "person"]);
|
|
101
|
+
return {
|
|
102
|
+
...(sources.length ? { sources } : {}),
|
|
103
|
+
...(text ? { text } : {}),
|
|
104
|
+
...(query ? { query } : {}),
|
|
105
|
+
zone,
|
|
106
|
+
now,
|
|
107
|
+
limit,
|
|
108
|
+
offset: (page - 1) * limit,
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const midnight = (date, zone) => dayBoundary(date, zone, false, { start: 0, end: date.length });
|
|
112
|
+
/** A `started_at` term as the instants a row must overlap: from `lower` on, and before `upper`. */
|
|
113
|
+
const windowOf = (node, zone, now) => {
|
|
114
|
+
const range = dateRange(node.value, node.operator === "range" ? (node.upper ?? "*") : node.value, node.operator === "range" ? node.lower_inclusive !== false : true, node.operator === "range" ? node.upper_inclusive !== false : true, zone, node.span, now);
|
|
115
|
+
return {
|
|
116
|
+
...(range.lower === undefined ? {} : { from: range.lower_inclusive ? range.lower : range.lower + 1 }),
|
|
117
|
+
...(range.upper === undefined ? {} : { to: range.upper_inclusive ? range.upper + 1 : range.upper }),
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/** `meetings list`'s query and page, as `listMeetingEntries` takes them, and the window it read for `meta`. */
|
|
121
|
+
export const meetingListRequest = (words, { limit, page, from, to, order = "newest", zone = timezoneOf(), now = Date.now(), }, command = "meetings list") => {
|
|
122
|
+
const terms = termsOf(words, MEETINGS_LIST_QUERY, command);
|
|
123
|
+
const started = terms.get("started_at")?.[0];
|
|
124
|
+
const instant = (value, flag) => {
|
|
125
|
+
if (value === undefined)
|
|
126
|
+
return undefined;
|
|
127
|
+
const at = Date.parse(value);
|
|
128
|
+
if (!/(?:[zZ]|[+-]\d\d:?\d\d)$/u.test(value) || !Number.isFinite(at))
|
|
129
|
+
throw new CliError("validation_error", `${flag} takes an ISO 8601 instant with its offset, not ${value}`, {
|
|
130
|
+
reason: "input.invalid",
|
|
131
|
+
param: flag,
|
|
132
|
+
});
|
|
133
|
+
return at;
|
|
134
|
+
};
|
|
135
|
+
let bounds;
|
|
136
|
+
if (from !== undefined || to !== undefined) {
|
|
137
|
+
if (started)
|
|
138
|
+
throw new CliError("validation_error", "give the window as --from/--to or as started_at:, not both", {
|
|
139
|
+
reason: "query.unsupported-placement",
|
|
140
|
+
});
|
|
141
|
+
const lower = instant(from, "--from");
|
|
142
|
+
const upper = instant(to, "--to");
|
|
143
|
+
bounds = { ...(lower === undefined ? {} : { from: lower }), ...(upper === undefined ? {} : { to: upper }) };
|
|
144
|
+
}
|
|
145
|
+
else if (started)
|
|
146
|
+
bounds = windowOf(started, zone, now);
|
|
147
|
+
else {
|
|
148
|
+
const today = localDate(now, zone);
|
|
149
|
+
bounds = {
|
|
150
|
+
from: midnight(plusDays(today, -MEETINGS_RECENT_DAYS), zone),
|
|
151
|
+
to: midnight(plusDays(today, MEETINGS_AHEAD_DAYS + 1), zone),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (bounds.from !== undefined && bounds.to !== undefined && bounds.to <= bounds.from)
|
|
155
|
+
throw new CliError("validation_error", "started_at's window ends before it starts", {
|
|
156
|
+
reason: "query.empty-window",
|
|
157
|
+
});
|
|
158
|
+
const sources = values(terms, "source");
|
|
159
|
+
const kinds = values(terms, "kind").map((kind) => kind.toLowerCase());
|
|
160
|
+
const person = values(terms, "person");
|
|
161
|
+
if (person.length > 1)
|
|
162
|
+
throw new CliError("validation_error", "person: once here", { reason: "query.unsupported-placement" });
|
|
163
|
+
const transcript = terms.get("has_transcript")?.[0];
|
|
164
|
+
const titleWords = (terms.get("text") ?? []).map(({ value }) => value);
|
|
165
|
+
// All-day events have days, not instants: the store compares them by these local days.
|
|
166
|
+
const request = {
|
|
167
|
+
...(sources.length ? { sources } : {}),
|
|
168
|
+
...(kinds.length ? { kinds } : {}),
|
|
169
|
+
...(person[0] === undefined ? {} : { person: person[0] }),
|
|
170
|
+
...(transcript ? { hasTranscript: bool(transcript) } : {}),
|
|
171
|
+
...(titleWords.length ? { titleWords } : {}),
|
|
172
|
+
...(bounds.from === undefined ? {} : { from: bounds.from, fromDate: localDate(bounds.from, zone) }),
|
|
173
|
+
...(bounds.to === undefined ? {} : { to: bounds.to, toDate: plusDays(localDate(bounds.to - 1, zone), 1) }),
|
|
174
|
+
newest: order !== "start",
|
|
175
|
+
limit,
|
|
176
|
+
offset: (page - 1) * limit,
|
|
177
|
+
};
|
|
178
|
+
return {
|
|
179
|
+
request,
|
|
180
|
+
meta: {
|
|
181
|
+
timezone: zone,
|
|
182
|
+
window: {
|
|
183
|
+
...(bounds.from === undefined ? {} : { since: new Date(bounds.from).toISOString() }),
|
|
184
|
+
...(bounds.to === undefined ? {} : { until: new Date(bounds.to - 1).toISOString() }),
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { type Messenger } from "./context.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Deletes without a question at the default level, `allow` (owner, 2026-11-14); a profile at `ask` gets the
|
|
5
|
+
* question, and `--allow-dangerous` is the yes. For everyone only
|
|
5
6
|
* with `--for-everyone` (max-cli `NEED-239`), and never for an agent (NEED-1423).
|
|
6
7
|
*/
|
|
7
8
|
export declare const deleteCommand: (messenger: Messenger) => Command;
|
|
@@ -8,7 +8,8 @@ import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
|
8
8
|
import { lineOf } from "../steps.js";
|
|
9
9
|
import { messengerContext } from "./context.js";
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Deletes without a question at the default level, `allow` (owner, 2026-11-14); a profile at `ask` gets the
|
|
12
|
+
* question, and `--allow-dangerous` is the yes. For everyone only
|
|
12
13
|
* with `--for-everyone` (max-cli `NEED-239`), and never for an agent (NEED-1423).
|
|
13
14
|
*/
|
|
14
15
|
export const deleteCommand = (messenger) => annotate(new Command("delete"), {
|
|
@@ -35,7 +35,6 @@ export declare const serveRelay: (command: Command, messenger: Messenger) => {
|
|
|
35
35
|
historyOnDemand?: boolean;
|
|
36
36
|
unreadCounts?: "messenger" | "store";
|
|
37
37
|
serverSearch?: boolean | "chat";
|
|
38
|
-
services?: import("../../services/index.js").Override;
|
|
39
38
|
connection?: "exclusive";
|
|
40
39
|
pace?: import("../../sends/pace.js").PaceRate;
|
|
41
40
|
resolveSettings: (flags: import("../settings.js").GlobalFlags, options?: import("../settings.js").ResolveOptions) => import("../settings.js").Settings;
|
|
@@ -100,6 +99,7 @@ export declare const serveRelay: (command: Command, messenger: Messenger) => {
|
|
|
100
99
|
permissionKey?: import("../permission-keys.js").PermissionKeyOf;
|
|
101
100
|
skill?: URL;
|
|
102
101
|
diagnose?: (command: Command, context: import("../context.js").BaseContext) => Promise<Record<string, unknown>>;
|
|
102
|
+
services?: import("../../services/index.js").Override;
|
|
103
103
|
connect: (...args: Parameters<Messenger["connect"]>) => Promise<MessengerAdapter>;
|
|
104
104
|
};
|
|
105
105
|
arrived: (event: MessageEvent) => void;
|
|
@@ -24,3 +24,10 @@ export type RepairResult = {
|
|
|
24
24
|
/** What each fix mends, as a person reads it. */
|
|
25
25
|
export declare const REPAIR_WORDS: Record<RepairKind, string>;
|
|
26
26
|
export declare const repairConfigText: (text: string) => RepairResult;
|
|
27
|
+
/** Fixes with one reading that a reader may make on its own; the rest change what the owner wrote, so they ask. */
|
|
28
|
+
export declare const SAFE_REPAIRS: ReadonlySet<RepairKind>;
|
|
29
|
+
/**
|
|
30
|
+
* Why `text` is not JSON, for a person: the line and column, the line around it, and the likely fix. Only what a
|
|
31
|
+
* reader may not mend on its own (`SAFE_REPAIRS`) reaches here.
|
|
32
|
+
*/
|
|
33
|
+
export declare const explainBrokenJson: (text: string, result: RepairResult) => string;
|