@wirecat/cli-core 0.622.0 → 0.623.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 +43 -0
- package/dist/background/budget.d.ts +2 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/background/schedules.d.ts +2 -9
- package/dist/background/schedules.js +10 -15
- package/dist/background/when.d.ts +28 -0
- package/dist/background/when.js +40 -0
- package/dist/calendar/mcp/index.d.ts +12 -12
- package/dist/cli/messenger/messages-search-command.js +4 -0
- package/dist/cli/program.js +6 -3
- package/dist/cli/schedule/schedule-command.js +14 -8
- package/dist/domain/display-names.d.ts +16 -0
- package/dist/domain/display-names.js +50 -0
- package/dist/errors/reasons.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/search/lucene/resolved.d.ts +1 -0
- package/dist/search/lucene/types.d.ts +8 -0
- package/dist/search/lucene/types.js +7 -0
- package/dist/services/messages-combined.js +3 -2
- package/dist/services/messages-discovery.js +3 -2
- package/dist/services/messages-search.js +1 -0
- package/dist/services/messages.d.ts +2 -0
- package/dist/services/people.js +1 -1
- package/dist/store/identity-links.d.ts +3 -3
- package/dist/store/identity-links.js +3 -3
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.js +1 -0
- package/dist/store/people.d.ts +21 -2
- package/dist/store/people.js +35 -15
- package/dist/store/sqlite/lucene.js +12 -11
- package/dist/store/sqlite/manifest.js +1 -0
- package/dist/store/sqlite/migrations.generated.js +7 -0
- package/dist/store/sqlite/name-traces.d.ts +17 -0
- package/dist/store/sqlite/name-traces.js +112 -0
- package/dist/store/sqlite/notes.js +6 -3
- package/dist/store/sqlite/people-list.d.ts +44 -0
- package/dist/store/sqlite/people-list.js +151 -0
- package/dist/store/sqlite/person-match-scan.js +33 -0
- package/dist/store/sqlite/person-ties.d.ts +14 -0
- package/dist/store/sqlite/person-ties.js +66 -0
- package/dist/store/sqlite/schema.d.ts +16 -0
- package/dist/store/sqlite/schema.js +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,49 @@ 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.623.0 — 09.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `store.people.list({ query, all, sort, limit, offset })`: people a page at a time, with `total` and `hidden`, each
|
|
13
|
+
with a cleaned `displayName` (no wrapping quotes or spaces; a name with no letter or digit shows the username, phone
|
|
14
|
+
or email), the first username, phone and email, and `ties`. By default it lists only people with a tie to the
|
|
15
|
+
owner: a one-to-one chat, a group of at most 10 (`SMALL_GROUP_MEMBERS`; a group of unknown size counts as large),
|
|
16
|
+
mail the owner wrote to them, a meeting or calendar entry, a CRM, or the address book. The owner, people added by
|
|
17
|
+
hand and anyone assigned a task are always listed; `all` adds the rest. Ties are read on every call; on a synthetic
|
|
18
|
+
store of 51,000 identities a first page takes about 100 ms
|
|
19
|
+
([cli-testing `performance/people/ties`](https://github.com/WireCatLabs/cli-testing/tree/main/performance/people/ties)).
|
|
20
|
+
- `store.people.similar(name, { limit })`: people whose name has a word starting with each typed word, in any order,
|
|
21
|
+
the same name first (`sameName`), for a form that adds a person.
|
|
22
|
+
- `store.people.saveAddressBook`: `contacts sync` now marks who is in the account's address book, and unmarks who left
|
|
23
|
+
it (`account_identities.address_book`, store version 61). Sync contacts once after upgrading: until then nobody has
|
|
24
|
+
the address-book tie.
|
|
25
|
+
- The people matcher proposes two people with one name (case, quotes, punctuation and word order set aside) who share
|
|
26
|
+
a phone, an address, a chat or a company's mail domain, as an `identity_link` with signal `name`. It never joins
|
|
27
|
+
them; a free mailbox's domain (gmail.com) or a role address (`info@`) is no trace, and a name more than six people
|
|
28
|
+
have is skipped.
|
|
29
|
+
- `store.people.ties(refs)`: why each person is shown, as the list gives it.
|
|
30
|
+
- `displayName` and `nameKey` from the package root.
|
|
31
|
+
- `schedule … --at 'mon 09:00'`: a weekday before the time makes a weekly run (systemd
|
|
32
|
+
`OnCalendar=Mon *-*-* 09:00:00`, launchd `Weekday`, Task Scheduler's weekly trigger). With `--every` it is refused.
|
|
33
|
+
- **`search messages --timeout 30s` may search for up to about 29 seconds.** A search stopped at 2 seconds whatever
|
|
34
|
+
time its caller gave the run, so a valid query over a large store failed in WireCat Desktop. With an explicit
|
|
35
|
+
`--timeout` (or `<PREFIX>_TIMEOUT`) the search uses that time less a second to answer; the error's `limit_ms` names
|
|
36
|
+
the limit that applied. Without one it stays 2 seconds, for agents and MCP too.
|
|
37
|
+
|
|
38
|
+
### Changed — may break callers
|
|
39
|
+
|
|
40
|
+
- `IDENTITY_LINK_SIGNALS` gains `name`, and a schedule's `When` gains `{ weekly, on }`: code that switches over every
|
|
41
|
+
signal or every `When` needs the new case. `AccountPeople` and `PeopleStore` gain `saveAddressBook`, `list`,
|
|
42
|
+
`similar` and `ties`, so a hand-written fake of either needs them.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- **A file's link that a program guessed waits for review again.** Since 0.621.0 every unconfirmed relationship a
|
|
47
|
+
file wrote became reported by the file's account, a guess (`provenance: "scan"`) included. Only a link whose
|
|
48
|
+
provenance names the file's own source, such as Drive's owner and last editor (`google-drive:files.get`), is
|
|
49
|
+
reported now.
|
|
50
|
+
|
|
8
51
|
## 0.622.0 — 09.11.2026
|
|
9
52
|
|
|
10
53
|
### Added
|
|
@@ -4,6 +4,8 @@ export type BudgetStop = "requests" | "deadline" | "cancelled";
|
|
|
4
4
|
export interface Deadline {
|
|
5
5
|
endsAt: number;
|
|
6
6
|
ms: number;
|
|
7
|
+
/** A person or a script set it (`--timeout`, `<PREFIX>_TIMEOUT`), not the command's default. */
|
|
8
|
+
explicit?: true;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* A sync asks it before each request to the source, so the run stops on its own, saves where it is, and says
|
|
@@ -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;
|
|
27
28
|
name: string;
|
|
28
29
|
installed: boolean;
|
|
29
30
|
active: boolean;
|
|
30
31
|
servicePath: string;
|
|
31
32
|
timerPath: string;
|
|
32
|
-
action?: undefined;
|
|
33
33
|
} | {
|
|
34
34
|
active?: undefined;
|
|
35
35
|
name: string;
|
|
@@ -2,14 +2,8 @@ import { type AppIdentity } from "../ports/app.js";
|
|
|
2
2
|
import { type Delivery } from "./deliver.js";
|
|
3
3
|
import { type ReportRun, type StoredTemplates } from "./report/render.js";
|
|
4
4
|
import type { ServerSystem } from "./system.js";
|
|
5
|
-
|
|
6
|
-
export type When
|
|
7
|
-
every: number;
|
|
8
|
-
} | {
|
|
9
|
-
daily: string;
|
|
10
|
-
} | {
|
|
11
|
-
once: string;
|
|
12
|
-
};
|
|
5
|
+
import { type When } from "./when.js";
|
|
6
|
+
export { describeWhen, WEEKDAYS, type Weekday, type When } from "./when.js";
|
|
13
7
|
export interface Schedule {
|
|
14
8
|
name: string;
|
|
15
9
|
kind: "command" | "agent";
|
|
@@ -144,7 +138,6 @@ export declare const scheduledRuns: (state: string) => {
|
|
|
144
138
|
last: LastRun | undefined;
|
|
145
139
|
}[];
|
|
146
140
|
export declare const listSchedules: (state: string, filter?: Partial<Pick<Schedule, "name" | "kind">>) => Schedule[];
|
|
147
|
-
export declare const describeWhen: (when: When) => string;
|
|
148
141
|
/** How one operating system starts `argv` at the schedule's times. Every timer runs the same thing: `<cli> schedule exec <file>`. */
|
|
149
142
|
export interface Timer {
|
|
150
143
|
install: (schedule: Schedule, argv: string[]) => Promise<void>;
|
|
@@ -12,6 +12,8 @@ import { readSharedSection, sharedConfigPath } from "../store/shared-config.js";
|
|
|
12
12
|
import { deliver } from "./deliver.js";
|
|
13
13
|
import { causeOf, gapsView, noticeView, weeklyGapsOf } from "./report/messages.js";
|
|
14
14
|
import { prepareMessage, prepareReport, } from "./report/render.js";
|
|
15
|
+
import { clockOf, describeWhen, localStamp, onCalendar, WEEKDAYS, WINDOWS_DAYS } from "./when.js";
|
|
16
|
+
export { describeWhen, WEEKDAYS } from "./when.js";
|
|
15
17
|
export const NOTIFY_WHEN = ["always", "failures", "never"];
|
|
16
18
|
/** A repeating agent would otherwise notify on every tick; any other schedule runs rarely enough to say each result. */
|
|
17
19
|
export const notifyOf = (schedule) => schedule.notify ?? (schedule.kind === "agent" && "every" in schedule.when ? "failures" : "always");
|
|
@@ -186,17 +188,6 @@ export const listSchedules = (state, filter = {}) => existsSync(schedulesDir(sta
|
|
|
186
188
|
(filter.kind === undefined || schedule.kind === filter.kind))
|
|
187
189
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
188
190
|
: [];
|
|
189
|
-
export const describeWhen = (when) => "every" in when
|
|
190
|
-
? `every ${when.every % 1440 === 0 ? `${when.every / 1440}d` : when.every % 60 === 0 ? `${when.every / 60}h` : `${when.every}m`}`
|
|
191
|
-
: "daily" in when
|
|
192
|
-
? `daily at ${when.daily}`
|
|
193
|
-
: `once at ${when.once}`;
|
|
194
|
-
/** A local wall-clock time, as both systemd's `OnCalendar=` and PowerShell's parser take it. */
|
|
195
|
-
const localStamp = (iso) => {
|
|
196
|
-
const at = new Date(iso);
|
|
197
|
-
const two = (n) => String(n).padStart(2, "0");
|
|
198
|
-
return `${at.getFullYear()}-${two(at.getMonth() + 1)}-${two(at.getDate())} ${two(at.getHours())}:${two(at.getMinutes())}:${two(at.getSeconds())}`;
|
|
199
|
-
};
|
|
200
191
|
const systemdQuote = (value) => `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("%", "%%").replaceAll("$", "$$$$")}"`;
|
|
201
192
|
const xml = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
202
193
|
const checked = async (system, env, argv, allowFailure = false) => {
|
|
@@ -231,7 +222,7 @@ export const systemdTimer = (app, system, env, home) => {
|
|
|
231
222
|
? // From when a run ends: counted from its start, a run longer than the interval left no next run.
|
|
232
223
|
[`OnActiveSec=${when.every}min`, `OnUnitInactiveSec=${when.every}min`]
|
|
233
224
|
: // Persistent: a run missed while the machine slept happens when it wakes.
|
|
234
|
-
[`OnCalendar=${
|
|
225
|
+
[`OnCalendar=${onCalendar(when)}`, "Persistent=true"]),
|
|
235
226
|
"",
|
|
236
227
|
"[Install]",
|
|
237
228
|
"WantedBy=timers.target",
|
|
@@ -256,7 +247,7 @@ export const launchdTimer = (app, system, env, home) => {
|
|
|
256
247
|
const calendar = (when) => {
|
|
257
248
|
if ("every" in when)
|
|
258
249
|
return [` <key>StartInterval</key><integer>${when.every * 60}</integer>`];
|
|
259
|
-
const [hour, minute] = ("
|
|
250
|
+
const [hour, minute] = ("once" in when ? localStamp(when.once).slice(11, 16) : clockOf(when)).split(":").map(Number);
|
|
260
251
|
const once = "once" in when ? new Date(when.once) : undefined;
|
|
261
252
|
return [
|
|
262
253
|
" <key>StartCalendarInterval</key>",
|
|
@@ -268,6 +259,8 @@ export const launchdTimer = (app, system, env, home) => {
|
|
|
268
259
|
` <key>Day</key><integer>${once.getDate()}</integer>`,
|
|
269
260
|
]
|
|
270
261
|
: []),
|
|
262
|
+
// launchd counts Sunday as 0.
|
|
263
|
+
...("weekly" in when ? [` <key>Weekday</key><integer>${(WEEKDAYS.indexOf(when.on) + 1) % 7}</integer>`] : []),
|
|
271
264
|
` <key>Hour</key><integer>${hour}</integer>`,
|
|
272
265
|
` <key>Minute</key><integer>${minute}</integer>`,
|
|
273
266
|
" </dict>",
|
|
@@ -318,6 +311,7 @@ export const windowsTimer = (app, system, env) => {
|
|
|
318
311
|
"$trigger = switch ($env:WIRECAT_KIND) {",
|
|
319
312
|
" 'every' { New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes ([int]$env:WIRECAT_MINUTES)) }",
|
|
320
313
|
" 'daily' { New-ScheduledTaskTrigger -Daily -At $env:WIRECAT_AT }",
|
|
314
|
+
" 'weekly' { New-ScheduledTaskTrigger -Weekly -DaysOfWeek $env:WIRECAT_DAY -At $env:WIRECAT_AT }",
|
|
321
315
|
" 'once' { New-ScheduledTaskTrigger -Once -At ([datetime]::ParseExact($env:WIRECAT_AT, 'yyyy-MM-dd HH:mm:ss', $null)) }",
|
|
322
316
|
"}",
|
|
323
317
|
"$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew",
|
|
@@ -325,9 +319,10 @@ export const windowsTimer = (app, system, env) => {
|
|
|
325
319
|
].join("\n"), {
|
|
326
320
|
WIRECAT_EXE: exe,
|
|
327
321
|
WIRECAT_ARGS: args.map((word) => `"${word.replaceAll('"', '\\"')}"`).join(" "),
|
|
328
|
-
WIRECAT_KIND: "every" in when ? "every" : "daily" in when ? "daily" : "once",
|
|
322
|
+
WIRECAT_KIND: "every" in when ? "every" : "daily" in when ? "daily" : "weekly" in when ? "weekly" : "once",
|
|
329
323
|
WIRECAT_MINUTES: "every" in when ? String(when.every) : "",
|
|
330
|
-
WIRECAT_AT: "
|
|
324
|
+
WIRECAT_AT: "every" in when ? "" : "once" in when ? localStamp(when.once) : clockOf(when),
|
|
325
|
+
WIRECAT_DAY: "weekly" in when ? WINDOWS_DAYS[when.on] : "",
|
|
331
326
|
WIRECAT_NAME: schedule.name,
|
|
332
327
|
WIRECAT_PATH: path,
|
|
333
328
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The days `--on` takes, Monday first. */
|
|
2
|
+
export declare const WEEKDAYS: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
3
|
+
export type Weekday = (typeof WEEKDAYS)[number];
|
|
4
|
+
/** Minutes between runs, a daily local time, a weekday's local time, or one local moment. */
|
|
5
|
+
export type When = {
|
|
6
|
+
every: number;
|
|
7
|
+
} | {
|
|
8
|
+
daily: string;
|
|
9
|
+
} | {
|
|
10
|
+
weekly: string;
|
|
11
|
+
on: Weekday;
|
|
12
|
+
} | {
|
|
13
|
+
once: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const WINDOWS_DAYS: Record<Weekday, string>;
|
|
16
|
+
/** The local time of a calendar schedule, `HH:MM`. */
|
|
17
|
+
export declare const clockOf: (when: {
|
|
18
|
+
daily: string;
|
|
19
|
+
} | {
|
|
20
|
+
weekly: string;
|
|
21
|
+
on: Weekday;
|
|
22
|
+
}) => string;
|
|
23
|
+
export declare const describeWhen: (when: When) => string;
|
|
24
|
+
export declare const onCalendar: (when: Exclude<When, {
|
|
25
|
+
every: number;
|
|
26
|
+
}>) => string;
|
|
27
|
+
/** A local wall-clock time, as both systemd's `OnCalendar=` and PowerShell's parser take it. */
|
|
28
|
+
export declare const localStamp: (iso: string) => string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** The days `--on` takes, Monday first. */
|
|
2
|
+
export const WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
3
|
+
const SYSTEMD_DAYS = {
|
|
4
|
+
mon: "Mon",
|
|
5
|
+
tue: "Tue",
|
|
6
|
+
wed: "Wed",
|
|
7
|
+
thu: "Thu",
|
|
8
|
+
fri: "Fri",
|
|
9
|
+
sat: "Sat",
|
|
10
|
+
sun: "Sun",
|
|
11
|
+
};
|
|
12
|
+
export const WINDOWS_DAYS = {
|
|
13
|
+
mon: "Monday",
|
|
14
|
+
tue: "Tuesday",
|
|
15
|
+
wed: "Wednesday",
|
|
16
|
+
thu: "Thursday",
|
|
17
|
+
fri: "Friday",
|
|
18
|
+
sat: "Saturday",
|
|
19
|
+
sun: "Sunday",
|
|
20
|
+
};
|
|
21
|
+
/** The local time of a calendar schedule, `HH:MM`. */
|
|
22
|
+
export const clockOf = (when) => "daily" in when ? when.daily : when.weekly;
|
|
23
|
+
export const describeWhen = (when) => "every" in when
|
|
24
|
+
? `every ${when.every % 1440 === 0 ? `${when.every / 1440}d` : when.every % 60 === 0 ? `${when.every / 60}h` : `${when.every}m`}`
|
|
25
|
+
: "daily" in when
|
|
26
|
+
? `daily at ${when.daily}`
|
|
27
|
+
: "weekly" in when
|
|
28
|
+
? `weekly on ${SYSTEMD_DAYS[when.on]} at ${when.weekly}`
|
|
29
|
+
: `once at ${when.once}`;
|
|
30
|
+
export const onCalendar = (when) => "once" in when
|
|
31
|
+
? localStamp(when.once)
|
|
32
|
+
: "weekly" in when
|
|
33
|
+
? `${SYSTEMD_DAYS[when.on]} *-*-* ${when.weekly}:00`
|
|
34
|
+
: `*-*-* ${when.daily}:00`;
|
|
35
|
+
/** A local wall-clock time, as both systemd's `OnCalendar=` and PowerShell's parser take it. */
|
|
36
|
+
export const localStamp = (iso) => {
|
|
37
|
+
const at = new Date(iso);
|
|
38
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
39
|
+
return `${at.getFullYear()}-${two(at.getMonth() + 1)}-${two(at.getDate())} ${two(at.getHours())}:${two(at.getMinutes())}:${two(at.getSeconds())}`;
|
|
40
|
+
};
|
|
@@ -10,13 +10,13 @@ export declare const calendarTools: ({
|
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: string;
|
|
12
12
|
properties: {
|
|
13
|
-
limit?: undefined;
|
|
14
13
|
account_id: {
|
|
15
14
|
type: string;
|
|
16
15
|
minimum: number;
|
|
17
16
|
};
|
|
18
17
|
query?: undefined;
|
|
19
18
|
timezone?: undefined;
|
|
19
|
+
limit?: undefined;
|
|
20
20
|
page?: undefined;
|
|
21
21
|
event?: undefined;
|
|
22
22
|
} | {
|
|
@@ -45,9 +45,9 @@ export declare const calendarTools: ({
|
|
|
45
45
|
};
|
|
46
46
|
event?: undefined;
|
|
47
47
|
} | {
|
|
48
|
-
limit?: undefined;
|
|
49
48
|
query?: undefined;
|
|
50
49
|
timezone?: undefined;
|
|
50
|
+
limit?: undefined;
|
|
51
51
|
page?: undefined;
|
|
52
52
|
event: {
|
|
53
53
|
type: string;
|
|
@@ -58,9 +58,9 @@ export declare const calendarTools: ({
|
|
|
58
58
|
minimum: number;
|
|
59
59
|
};
|
|
60
60
|
} | {
|
|
61
|
-
limit?: undefined;
|
|
62
61
|
query?: undefined;
|
|
63
62
|
timezone?: undefined;
|
|
63
|
+
limit?: undefined;
|
|
64
64
|
page?: undefined;
|
|
65
65
|
event?: undefined;
|
|
66
66
|
account_id?: undefined;
|
|
@@ -80,13 +80,13 @@ export declare const calendarTools: ({
|
|
|
80
80
|
inputSchema: {
|
|
81
81
|
type: string;
|
|
82
82
|
properties: {
|
|
83
|
-
limit?: undefined;
|
|
84
83
|
account_id: {
|
|
85
84
|
type: string;
|
|
86
85
|
minimum: number;
|
|
87
86
|
};
|
|
88
87
|
query?: undefined;
|
|
89
88
|
timezone?: undefined;
|
|
89
|
+
limit?: undefined;
|
|
90
90
|
page?: undefined;
|
|
91
91
|
event?: undefined;
|
|
92
92
|
} | {
|
|
@@ -115,9 +115,9 @@ export declare const calendarTools: ({
|
|
|
115
115
|
};
|
|
116
116
|
event?: undefined;
|
|
117
117
|
} | {
|
|
118
|
-
limit?: undefined;
|
|
119
118
|
query?: undefined;
|
|
120
119
|
timezone?: undefined;
|
|
120
|
+
limit?: undefined;
|
|
121
121
|
page?: undefined;
|
|
122
122
|
event: {
|
|
123
123
|
type: string;
|
|
@@ -128,9 +128,9 @@ export declare const calendarTools: ({
|
|
|
128
128
|
minimum: number;
|
|
129
129
|
};
|
|
130
130
|
} | {
|
|
131
|
-
limit?: undefined;
|
|
132
131
|
query?: undefined;
|
|
133
132
|
timezone?: undefined;
|
|
133
|
+
limit?: undefined;
|
|
134
134
|
page?: undefined;
|
|
135
135
|
event?: undefined;
|
|
136
136
|
account_id?: undefined;
|
|
@@ -150,13 +150,13 @@ export declare const calendarTools: ({
|
|
|
150
150
|
inputSchema: {
|
|
151
151
|
type: string;
|
|
152
152
|
properties: {
|
|
153
|
-
limit?: undefined;
|
|
154
153
|
account_id: {
|
|
155
154
|
type: string;
|
|
156
155
|
minimum: number;
|
|
157
156
|
};
|
|
158
157
|
query?: undefined;
|
|
159
158
|
timezone?: undefined;
|
|
159
|
+
limit?: undefined;
|
|
160
160
|
page?: undefined;
|
|
161
161
|
event?: undefined;
|
|
162
162
|
} | {
|
|
@@ -185,9 +185,9 @@ export declare const calendarTools: ({
|
|
|
185
185
|
};
|
|
186
186
|
event?: undefined;
|
|
187
187
|
} | {
|
|
188
|
-
limit?: undefined;
|
|
189
188
|
query?: undefined;
|
|
190
189
|
timezone?: undefined;
|
|
190
|
+
limit?: undefined;
|
|
191
191
|
page?: undefined;
|
|
192
192
|
event: {
|
|
193
193
|
type: string;
|
|
@@ -198,9 +198,9 @@ export declare const calendarTools: ({
|
|
|
198
198
|
minimum: number;
|
|
199
199
|
};
|
|
200
200
|
} | {
|
|
201
|
-
limit?: undefined;
|
|
202
201
|
query?: undefined;
|
|
203
202
|
timezone?: undefined;
|
|
203
|
+
limit?: undefined;
|
|
204
204
|
page?: undefined;
|
|
205
205
|
event?: undefined;
|
|
206
206
|
account_id?: undefined;
|
|
@@ -220,13 +220,13 @@ export declare const calendarTools: ({
|
|
|
220
220
|
inputSchema: {
|
|
221
221
|
type: string;
|
|
222
222
|
properties: {
|
|
223
|
-
limit?: undefined;
|
|
224
223
|
account_id: {
|
|
225
224
|
type: string;
|
|
226
225
|
minimum: number;
|
|
227
226
|
};
|
|
228
227
|
query?: undefined;
|
|
229
228
|
timezone?: undefined;
|
|
229
|
+
limit?: undefined;
|
|
230
230
|
page?: undefined;
|
|
231
231
|
event?: undefined;
|
|
232
232
|
} | {
|
|
@@ -255,9 +255,9 @@ export declare const calendarTools: ({
|
|
|
255
255
|
};
|
|
256
256
|
event?: undefined;
|
|
257
257
|
} | {
|
|
258
|
-
limit?: undefined;
|
|
259
258
|
query?: undefined;
|
|
260
259
|
timezone?: undefined;
|
|
260
|
+
limit?: undefined;
|
|
261
261
|
page?: undefined;
|
|
262
262
|
event: {
|
|
263
263
|
type: string;
|
|
@@ -268,9 +268,9 @@ export declare const calendarTools: ({
|
|
|
268
268
|
minimum: number;
|
|
269
269
|
};
|
|
270
270
|
} | {
|
|
271
|
-
limit?: undefined;
|
|
272
271
|
query?: undefined;
|
|
273
272
|
timezone?: undefined;
|
|
273
|
+
limit?: undefined;
|
|
274
274
|
page?: undefined;
|
|
275
275
|
event?: undefined;
|
|
276
276
|
account_id?: undefined;
|
|
@@ -6,6 +6,7 @@ import { SAVE_HELP } from "../../meetings/index.js";
|
|
|
6
6
|
import { syncsOneChat } from "../../ports/traits.js";
|
|
7
7
|
import { renderMessages } from "../../render/messages.js";
|
|
8
8
|
import { renderThreadLinks } from "../../render/thread-context.js";
|
|
9
|
+
import { searchTimeLimit } from "../../search/lucene/types.js";
|
|
9
10
|
import { environmentOf } from "../context.js";
|
|
10
11
|
import { REMOTE_READ } from "../effects.js";
|
|
11
12
|
import { renderAnswer } from "../envelope.js";
|
|
@@ -69,6 +70,7 @@ const searchAction = (messenger) => async function (given) {
|
|
|
69
70
|
context.track({ close: async () => controller.abort() });
|
|
70
71
|
const external = environmentOf(this).signal;
|
|
71
72
|
const signal = external ? AbortSignal.any([external, controller.signal]) : controller.signal;
|
|
73
|
+
const timeLimitMs = searchTimeLimit(environmentOf(this).deadline?.());
|
|
72
74
|
const typed = {
|
|
73
75
|
...(source === undefined ? {} : { source }),
|
|
74
76
|
...(discover === undefined ? {} : { discover }),
|
|
@@ -91,6 +93,7 @@ const searchAction = (messenger) => async function (given) {
|
|
|
91
93
|
limit,
|
|
92
94
|
...withOffset(page, limit),
|
|
93
95
|
signal,
|
|
96
|
+
...(timeLimitMs === undefined ? {} : { timeLimitMs }),
|
|
94
97
|
newest: newest === true,
|
|
95
98
|
context: around ?? (context.format === "pretty" ? 2 : 0),
|
|
96
99
|
});
|
|
@@ -110,6 +113,7 @@ const searchAction = (messenger) => async function (given) {
|
|
|
110
113
|
limit,
|
|
111
114
|
...withOffset(page, limit),
|
|
112
115
|
signal,
|
|
116
|
+
...(timeLimitMs === undefined ? {} : { timeLimitMs }),
|
|
113
117
|
newest: params.newest === true,
|
|
114
118
|
...(params.discover === undefined ? {} : { discover: params.discover }),
|
|
115
119
|
...(params.exact ? { exact: true } : {}),
|
package/dist/cli/program.js
CHANGED
|
@@ -170,7 +170,10 @@ const runOnce = async (argv, definition, options) => {
|
|
|
170
170
|
let afterPhase;
|
|
171
171
|
let running;
|
|
172
172
|
const startDeadline = (ms) => {
|
|
173
|
-
running =
|
|
173
|
+
running =
|
|
174
|
+
ms === undefined
|
|
175
|
+
? undefined
|
|
176
|
+
: { endsAt: Date.now() + ms, ms, ...(explicitEnd === undefined ? {} : { explicit: true }) };
|
|
174
177
|
control.start(ms);
|
|
175
178
|
};
|
|
176
179
|
let finished = false;
|
|
@@ -418,11 +421,11 @@ const runOnce = async (argv, definition, options) => {
|
|
|
418
421
|
});
|
|
419
422
|
throw new Relayed(code);
|
|
420
423
|
}
|
|
424
|
+
if (timeout !== undefined && deadline !== undefined)
|
|
425
|
+
explicitEnd = Date.now() + deadline;
|
|
421
426
|
startDeadline(deadline);
|
|
422
427
|
oneShot = deadline;
|
|
423
428
|
afterPhase = timeout !== undefined || persistent || job || interactiveLogin ? deadline : DEFAULT_COMMAND_MS;
|
|
424
|
-
if (timeout !== undefined && deadline !== undefined)
|
|
425
|
-
explicitEnd = Date.now() + deadline;
|
|
426
429
|
// An agent's run shares this process's directory; a chat folder's name is not a path to resolve.
|
|
427
430
|
if (options.relayed && !options.agent)
|
|
428
431
|
absolutePaths(action, options.relayed.cwd);
|
|
@@ -7,7 +7,7 @@ import { backfillSchedule } from "../../background/backfill.js";
|
|
|
7
7
|
import { parseRoute, ROUTE_HELP, routeText } from "../../background/deliver.js";
|
|
8
8
|
import { REPORT_CHANNELS } from "../../background/report/render.js";
|
|
9
9
|
import { keyOfKind } from "../../background/report/stored-templates.js";
|
|
10
|
-
import { describeWhen, findProgram, lastRun, listSchedules, NOTIFY_WHEN, notifyOf, readSchedule, recordSkip, runSchedule, SCHEDULE_DEFAULTS, SKIP_REASONS, scheduleFile, scheduleName, spentToday, timerFor, } from "../../background/schedules.js";
|
|
10
|
+
import { describeWhen, findProgram, lastRun, listSchedules, NOTIFY_WHEN, notifyOf, readSchedule, recordSkip, runSchedule, SCHEDULE_DEFAULTS, SKIP_REASONS, scheduleFile, scheduleName, spentToday, timerFor, WEEKDAYS, } from "../../background/schedules.js";
|
|
11
11
|
import { thisMachine } from "../../background/system.js";
|
|
12
12
|
import { locationVariables } from "../../background/units.js";
|
|
13
13
|
import { parseDuration } from "../../domain/duration.js";
|
|
@@ -40,7 +40,7 @@ const isModel = (model) => /^([A-Za-z0-9][\w.:/@[\]-]*)?$/.test(model);
|
|
|
40
40
|
const LEAN_CLAUDE = ["--tools", "Bash", "--strict-mcp-config", "--disable-slash-commands", "--setting-sources", ""];
|
|
41
41
|
const whenOf = ({ every, at, atTime }, minimum) => {
|
|
42
42
|
if ([every ?? at, atTime].filter(Boolean).length !== 1) {
|
|
43
|
-
throw new CliError("validation_error", "say when: --every <30m|2h|1d>, --at HH:MM (daily), or --at-time <30m|2d|ISO time>");
|
|
43
|
+
throw new CliError("validation_error", "say when: --every <30m|2h|1d>, --at HH:MM (daily) or --at 'mon HH:MM' (weekly), or --at-time <30m|2d|ISO time>");
|
|
44
44
|
}
|
|
45
45
|
if (atTime) {
|
|
46
46
|
const time = aheadOf(atTime, "--at-time");
|
|
@@ -49,12 +49,18 @@ const whenOf = ({ every, at, atTime }, minimum) => {
|
|
|
49
49
|
return { once: new Date(time).toISOString() };
|
|
50
50
|
}
|
|
51
51
|
if (at) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const [, word, clock = ""] = /^\s*(?:([a-z]+)\s+)?(\S+)\s*$/i.exec(at) ?? [];
|
|
53
|
+
if (!/^([01]\d|2[0-3]):[0-5]\d$/.test(clock))
|
|
54
|
+
throw new CliError("validation_error", `--at takes HH:MM, or a weekday and HH:MM such as 'mon 09:00'; not "${at}"`);
|
|
55
|
+
const day = word?.toLowerCase().slice(0, 3);
|
|
56
|
+
if (word !== undefined && !WEEKDAYS.includes(day ?? ""))
|
|
57
|
+
throw new CliError("validation_error", `--at takes a weekday, ${WEEKDAYS.join(", ")}; not "${word}"`);
|
|
58
|
+
if (every && (day !== undefined || parseDuration(every, "--every") !== 86_400_000)) {
|
|
59
|
+
throw new CliError("validation_error", day === undefined
|
|
60
|
+
? "--at runs once a day; leave out --every, or use --every 1d"
|
|
61
|
+
: "a weekday in --at runs once a week; leave out --every");
|
|
56
62
|
}
|
|
57
|
-
return { daily:
|
|
63
|
+
return day === undefined ? { daily: clock } : { weekly: clock, on: day };
|
|
58
64
|
}
|
|
59
65
|
const minutes = parseDuration(every ?? "", "--every") / 60_000;
|
|
60
66
|
if (!Number.isInteger(minutes) || minutes < minimum) {
|
|
@@ -86,7 +92,7 @@ const scheduleAnswer = ({ environment, createdAt, to, ...schedule }, extra) => (
|
|
|
86
92
|
});
|
|
87
93
|
const withWhen = (command) => command
|
|
88
94
|
.option("--every <duration>", "repeat: 30m, 2h, 1d")
|
|
89
|
-
.option("--at <HH:MM>",
|
|
95
|
+
.option("--at <HH:MM>", `every day at this local time; 'mon 09:00' once a week (${WEEKDAYS.join(", ")})`)
|
|
90
96
|
.option("--at-time <time>", "one run: 30m, 2d from now, or an ISO time; the schedule removes itself after it")
|
|
91
97
|
.addOption(new Option("--notify-on <when>", "desktop notice after a run (default failures for an agent that repeats with --every, else always)").choices(NOTIFY_WHEN))
|
|
92
98
|
.option("--deliver-to <route>", `also send the result, when --notify-on says so, by the owner's own tg or mail: ${ROUTE_HELP}; repeat it for more`, (route, routes = []) => [...routes, routeText(parseRoute(route))]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** What a person can be shown as when their name has nothing to read. */
|
|
2
|
+
export interface NameFallbacks {
|
|
3
|
+
username?: string | null;
|
|
4
|
+
phone?: string | null;
|
|
5
|
+
email?: string | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A name as it is shown: no wrapping quotes, no repeated or edge spaces. One with no letter or digit (`!`, `!$`) gives
|
|
9
|
+
* way to the username, then the phone, then the email; the stored name stays as it came.
|
|
10
|
+
*/
|
|
11
|
+
export declare const displayName: (name: string | null | undefined, fallbacks?: NameFallbacks) => string | null;
|
|
12
|
+
/**
|
|
13
|
+
* The name two people share when case, quotes, punctuation and word order are ignored: `"Ivanov Ivan"` and
|
|
14
|
+
* `ivan IVANOV` give one key. `null` for a name with no letter or digit, which matches nobody.
|
|
15
|
+
*/
|
|
16
|
+
export declare const nameKey: (name: string | null | undefined) => string | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { foldName } from "../resolve.js";
|
|
2
|
+
const QUOTES = [
|
|
3
|
+
['"', '"'],
|
|
4
|
+
["'", "'"],
|
|
5
|
+
["«", "»"],
|
|
6
|
+
["“", "”"],
|
|
7
|
+
["„", "“"],
|
|
8
|
+
["‘", "’"],
|
|
9
|
+
["`", "`"],
|
|
10
|
+
];
|
|
11
|
+
const READABLE = /[\p{L}\p{N}]/u;
|
|
12
|
+
const unquoted = (text) => {
|
|
13
|
+
let at = text.replace(/\s+/gu, " ").trim();
|
|
14
|
+
for (;;) {
|
|
15
|
+
const pair = QUOTES.find(([open, close]) => at.length >= 2 && at.startsWith(open) && at.endsWith(close));
|
|
16
|
+
if (pair === undefined)
|
|
17
|
+
return at;
|
|
18
|
+
at = at.slice(pair[0].length, at.length - pair[1].length).trim();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const given = (value) => {
|
|
22
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
23
|
+
return text === "" ? undefined : text;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A name as it is shown: no wrapping quotes, no repeated or edge spaces. One with no letter or digit (`!`, `!$`) gives
|
|
27
|
+
* way to the username, then the phone, then the email; the stored name stays as it came.
|
|
28
|
+
*/
|
|
29
|
+
export const displayName = (name, fallbacks = {}) => {
|
|
30
|
+
const cleaned = typeof name === "string" ? unquoted(name) : "";
|
|
31
|
+
if (READABLE.test(cleaned))
|
|
32
|
+
return cleaned;
|
|
33
|
+
const username = given(fallbacks.username);
|
|
34
|
+
return ((username === undefined ? undefined : username.startsWith("@") ? username : `@${username}`) ??
|
|
35
|
+
given(fallbacks.phone) ??
|
|
36
|
+
given(fallbacks.email) ??
|
|
37
|
+
(cleaned === "" ? null : cleaned));
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The name two people share when case, quotes, punctuation and word order are ignored: `"Ivanov Ivan"` and
|
|
41
|
+
* `ivan IVANOV` give one key. `null` for a name with no letter or digit, which matches nobody.
|
|
42
|
+
*/
|
|
43
|
+
export const nameKey = (name) => {
|
|
44
|
+
if (typeof name !== "string")
|
|
45
|
+
return null;
|
|
46
|
+
const words = foldName(unquoted(name))
|
|
47
|
+
.split(/[^\p{L}\p{N}]+/u)
|
|
48
|
+
.filter((word) => word !== "");
|
|
49
|
+
return words.length === 0 ? null : words.sort().join(" ");
|
|
50
|
+
};
|
package/dist/errors/reasons.js
CHANGED
|
@@ -381,6 +381,7 @@ const OTHERS = [
|
|
|
381
381
|
],
|
|
382
382
|
validation("identity.same", "the two identities are one person already"),
|
|
383
383
|
validation("identity.shared-phone", "more than six people share the phone number, so it proposes no one"),
|
|
384
|
+
validation("identity.common-name", "more than six people have the name, so it proposes no one"),
|
|
384
385
|
validation("identity.shared-email", "more than six people share the address, so it proposes no one"),
|
|
385
386
|
validation("identity-link.dedicated-review", "an identity link is staged and decided through the people review"),
|
|
386
387
|
["transcription.no-key", "authentication_error", "no OpenAI key is set for transcription"],
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type { CounterField, CounterObservation, CounterObservations, CounterStat
|
|
|
5
5
|
export { COUNTER_FIELDS, counterValue, observedCounters } from "./domain/counters.js";
|
|
6
6
|
export { CRM_KINDS, type CrmDepartment, type CrmField, type CrmItem, type CrmKind, type CrmOrganization, type CrmPerson, type CrmPipeline, type CrmRecords, type CrmScope, type CrmScopeSetting, type CrmStage, type CrmUser, type CrmValue, isCrmUserId, isItemKind, normalCrmUserId, } from "./domain/crm.js";
|
|
7
7
|
export { DEAL_KINDS, DEAL_ROLES, DEAL_STATUSES, type DealKind, type DealRole, type DealStatus, STAGE_OUTCOMES, type StageOutcome, } from "./domain/deals.js";
|
|
8
|
+
export { displayName, type NameFallbacks, nameKey } from "./domain/display-names.js";
|
|
8
9
|
export { FINANCE_REVIEWS, type FinanceReview, INVOICE_DIRECTIONS, INVOICE_STATUSES, type InvoiceDirection, type InvoiceStatus, MONEY_DIRECTIONS, type MoneyDirection, } from "./domain/finance.js";
|
|
9
10
|
export { type FormattedText, type HtmlFormatting, type MarkdownFormatting, type TextSpan, validateFormattedText, } from "./domain/formatting.js";
|
|
10
11
|
export { DEFAULT_LINK_CONFIG, type DeepLinkTarget, formatLink, LINK_VERSION, type LinkConfig, type LinkForm, linkConfigOf, linkFor, linkTargetOf, parseLink, refsForLink, } from "./domain/links.js";
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { bareCheck, checkWords } from "./domain/checks.js";
|
|
|
4
4
|
export { COUNTER_FIELDS, counterValue, observedCounters } from "./domain/counters.js";
|
|
5
5
|
export { CRM_KINDS, isCrmUserId, isItemKind, normalCrmUserId, } from "./domain/crm.js";
|
|
6
6
|
export { DEAL_KINDS, DEAL_ROLES, DEAL_STATUSES, STAGE_OUTCOMES, } from "./domain/deals.js";
|
|
7
|
+
export { displayName, nameKey } from "./domain/display-names.js";
|
|
7
8
|
export { FINANCE_REVIEWS, INVOICE_DIRECTIONS, INVOICE_STATUSES, MONEY_DIRECTIONS, } from "./domain/finance.js";
|
|
8
9
|
export { validateFormattedText, } from "./domain/formatting.js";
|
|
9
10
|
export { DEFAULT_LINK_CONFIG, formatLink, LINK_VERSION, linkConfigOf, linkFor, linkTargetOf, parseLink, refsForLink, } from "./domain/links.js";
|