@wirecat/cli-core 0.661.0 → 0.663.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 +109 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/calendar/cli/bodies.js +2 -1
- package/dist/calendar/cli/index.js +13 -10
- package/dist/calendar/mcp/index.d.ts +3 -1
- package/dist/calendar/mcp/index.js +4 -4
- package/dist/cli/ai-model-command.js +3 -3
- package/dist/cli/call-stats-command.d.ts +18 -0
- package/dist/cli/call-stats-command.js +52 -0
- package/dist/cli/command-availability.d.ts +1 -1
- package/dist/cli/command-availability.js +4 -4
- package/dist/cli/contract-templates.js +2 -0
- package/dist/cli/dry-run-guard.js +7 -5
- package/dist/cli/early-refusal.d.ts +1 -1
- package/dist/cli/early-refusal.js +2 -2
- package/dist/cli/effects.d.ts +9 -2
- package/dist/cli/effects.js +16 -4
- package/dist/cli/envelope.d.ts +0 -5
- package/dist/cli/envelope.js +25 -0
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.js +3 -2
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +7 -5
- package/dist/cli/meeting-preparation-command.js +5 -5
- package/dist/cli/meeting-preparation-read.d.ts +5 -5
- package/dist/cli/meeting-preparation-read.js +13 -21
- package/dist/cli/meeting-series-inventory-command.js +2 -2
- package/dist/cli/meeting-series-inventory-read.d.ts +2 -2
- package/dist/cli/meeting-series-inventory-read.js +7 -15
- package/dist/cli/messenger/admin-moderation-command.js +2 -2
- package/dist/cli/messenger/admin-statistics-command.js +2 -2
- package/dist/cli/messenger/archive-commands.js +2 -2
- package/dist/cli/messenger/context.d.ts +2 -2
- package/dist/cli/messenger/context.js +5 -3
- package/dist/cli/messenger/counters-command.js +2 -2
- package/dist/cli/messenger/media-archive-command.js +5 -4
- package/dist/cli/messenger/media-archive-move-command.js +1 -1
- package/dist/cli/messenger/media-archive-timer-command.js +5 -4
- package/dist/cli/messenger/metadata-command.js +3 -3
- package/dist/cli/messenger/rankings-command.js +3 -3
- package/dist/cli/messenger/tags-command.js +7 -2
- package/dist/cli/messenger/tasks-command.js +4 -3
- package/dist/cli/paging.d.ts +10 -0
- package/dist/cli/paging.js +29 -0
- package/dist/cli/preview.js +3 -5
- package/dist/cli/program.js +2 -2
- package/dist/cli/runs/command.js +6 -4
- package/dist/cli/runs/search-command.js +9 -5
- package/dist/cli/schedule/schedule-command.js +1 -5
- package/dist/cli/shadowed-options.d.ts +7 -0
- package/dist/cli/shadowed-options.js +26 -0
- package/dist/crm/cli/index.js +4 -2
- package/dist/domain/moment.d.ts +29 -0
- package/dist/domain/moment.js +58 -0
- package/dist/domain/providers.d.ts +6 -4
- package/dist/domain/providers.js +10 -5
- package/dist/domain/send-time.d.ts +3 -4
- package/dist/domain/send-time.js +10 -24
- package/dist/entities/fields.d.ts +2 -2
- package/dist/entities/fields.js +2 -2
- package/dist/entities/index.d.ts +92 -1
- package/dist/entities/index.js +3 -2
- package/dist/entities/meeting.d.ts +1 -1
- package/dist/entities/meeting.js +1 -1
- package/dist/errors/reasons.js +0 -1
- package/dist/kit/sync-after-install.d.ts +10 -1
- package/dist/kit/sync-after-install.js +35 -11
- package/dist/mail/cli/index.js +4 -2
- package/dist/mail/facts.d.ts +5 -2
- package/dist/mail/facts.js +6 -3
- package/dist/mail/index.d.ts +1 -1
- package/dist/mail/meeting-notes.js +1 -1
- package/dist/mail/probe.d.ts +5 -2
- package/dist/mail/probe.js +9 -5
- package/dist/mail/server-search.js +4 -4
- package/dist/mail/sync.js +1 -1
- package/dist/mcp/meeting-preparation.js +1 -1
- package/dist/mcp/meeting-series-inventory.js +1 -1
- package/dist/mcp/prompts.js +6 -9
- package/dist/mcp/server.js +4 -4
- package/dist/mcp/tool.js +3 -3
- package/dist/meetings/call-answers.d.ts +106 -0
- package/dist/meetings/call-answers.js +171 -0
- package/dist/meetings/call-stats.d.ts +121 -0
- package/dist/meetings/call-stats.js +211 -0
- package/dist/meetings/calls.d.ts +76 -0
- package/dist/meetings/calls.js +78 -0
- package/dist/meetings/cli/index.d.ts +8 -0
- package/dist/meetings/cli/index.js +10 -22
- package/dist/meetings/cli/search.d.ts +9 -2
- package/dist/meetings/cli/search.js +16 -26
- package/dist/meetings/index.d.ts +3 -0
- package/dist/meetings/index.js +3 -0
- package/dist/meetings/mcp/index.d.ts +21 -18
- package/dist/meetings/mcp/index.js +2 -4
- package/dist/meetings/mcp/search.d.ts +6 -1
- package/dist/meetings/mcp/search.js +3 -3
- package/dist/meetings/read-through.d.ts +2 -1
- package/dist/meetings/read-through.js +10 -1
- package/dist/meetings/stats.d.ts +3 -0
- package/dist/meetings/stats.js +3 -3
- package/dist/meetings/testing/index.d.ts +1 -0
- package/dist/meetings/testing/index.js +1 -0
- package/dist/meetings/testing/paging.d.ts +6 -0
- package/dist/meetings/testing/paging.js +5 -0
- package/dist/moderation/rules.d.ts +2 -0
- package/dist/moderation/rules.js +16 -2
- package/dist/search/fusion.d.ts +17 -0
- package/dist/search/fusion.js +17 -0
- package/dist/search/lucene/resolved.d.ts +2 -0
- package/dist/search/question-plan.d.ts +2 -0
- package/dist/search/question-plan.js +5 -0
- package/dist/search/service-query.d.ts +6 -1
- package/dist/search/service-query.js +9 -1
- package/dist/sends/guard.js +4 -20
- package/dist/sends/keyed-guard.d.ts +1 -1
- package/dist/sends/keyed-guard.js +2 -1
- package/dist/sends/permissions.d.ts +14 -0
- package/dist/sends/permissions.js +32 -0
- package/dist/services/agenda-mail.js +2 -1
- package/dist/services/agenda.js +5 -3
- package/dist/services/attachments.js +4 -2
- package/dist/services/call-stats.d.ts +17 -0
- package/dist/services/call-stats.js +41 -0
- package/dist/services/chats.js +4 -2
- package/dist/services/conversations.js +4 -2
- package/dist/services/deps.d.ts +1 -1
- package/dist/services/document-source.d.ts +1 -1
- package/dist/services/document-source.js +4 -3
- package/dist/services/documents/ingestion.js +11 -40
- package/dist/services/documents/plan.d.ts +1 -1
- package/dist/services/documents/plan.js +30 -17
- package/dist/services/documents/ports.d.ts +5 -0
- package/dist/services/documents/sync.js +1 -1
- package/dist/services/embeddings-search.js +20 -4
- package/dist/services/events-search.js +2 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/mail-search.d.ts +1 -1
- package/dist/services/mail-search.js +10 -11
- package/dist/services/media-archive-move.js +2 -4
- package/dist/services/media-archive.d.ts +0 -1
- package/dist/services/media-archive.js +2 -12
- package/dist/services/meeting-combined.js +1 -1
- package/dist/services/messages-combined.js +15 -4
- package/dist/services/moderation.js +10 -2
- package/dist/services/moment.d.ts +4 -10
- package/dist/services/moment.js +16 -44
- package/dist/services/notes-search.d.ts +0 -2
- package/dist/services/notes-search.js +1 -2
- package/dist/services/search-all.js +2 -1
- package/dist/services/server-search.js +1 -1
- package/dist/services/tags.js +4 -2
- package/dist/services/task-stats.js +2 -2
- package/dist/services/tasks.js +2 -2
- package/dist/store/accounts.js +2 -1
- package/dist/store/sqlite/account-purge.d.ts +3 -0
- package/dist/store/sqlite/account-purge.js +143 -0
- package/dist/store/sqlite/accounts.d.ts +0 -2
- package/dist/store/sqlite/accounts.js +2 -134
- package/dist/store/sqlite/calendar.d.ts +1 -0
- package/dist/store/sqlite/calendar.js +5 -5
- package/dist/store/sqlite/catalog.js +2 -16
- package/dist/store/sqlite/chats.js +2 -1
- package/dist/store/sqlite/context-document-source.d.ts +3 -3
- package/dist/store/sqlite/context-document-source.js +9 -7
- package/dist/store/sqlite/context-evidence.js +9 -3
- package/dist/store/sqlite/document-listing.js +2 -1
- package/dist/store/sqlite/events.js +2 -1
- package/dist/store/sqlite/file-note.d.ts +6 -0
- package/dist/store/sqlite/file-note.js +15 -0
- package/dist/store/sqlite/files.d.ts +3 -2
- package/dist/store/sqlite/files.js +5 -3
- package/dist/store/sqlite/identities.js +2 -1
- package/dist/store/sqlite/imported-documents.js +2 -2
- package/dist/store/sqlite/knowledge.js +19 -19
- package/dist/store/sqlite/lucene-fields.js +8 -12
- package/dist/store/sqlite/mail-rules.js +2 -1
- package/dist/store/sqlite/meeting-calls.d.ts +4 -0
- package/dist/store/sqlite/meeting-calls.js +66 -0
- package/dist/store/sqlite/meetings.d.ts +2 -2
- package/dist/store/sqlite/meetings.js +4 -1
- package/dist/store/sqlite/mention-sources.js +2 -1
- package/dist/store/sqlite/mentions.js +2 -2
- package/dist/store/sqlite/messages.js +6 -1
- package/dist/store/sqlite/note-search.js +8 -11
- package/dist/store/sqlite/notes.d.ts +2 -0
- package/dist/store/sqlite/notes.js +24 -13
- package/dist/store/sqlite/organizations.js +2 -2
- package/dist/store/sqlite/people-list.js +3 -3
- package/dist/store/sqlite/query-filter.d.ts +3 -3
- package/dist/store/sqlite/query-filter.js +3 -3
- package/dist/store/sqlite/reads.d.ts +4 -4
- package/dist/store/sqlite/reads.js +4 -4
- package/dist/store/sqlite/search.js +11 -7
- package/dist/store/sqlite/test-accounts.js +1 -1
- package/dist/store/sqlite/trigram-match.d.ts +9 -0
- package/dist/store/sqlite/trigram-match.js +28 -0
- package/dist/store/sqlite/work-tasks.js +1 -1
- package/package.json +3 -3
- package/parity.json +2 -1
|
@@ -111,8 +111,8 @@ const durationOf = (flag) => (typed) => {
|
|
|
111
111
|
const planOptions = (command, verb) => command
|
|
112
112
|
.option("--title <title>", `one line: the action and its object — ${verb}`)
|
|
113
113
|
.option("--description <text>", "the detail, in Markdown: who owes whom, done when, next step, keywords")
|
|
114
|
-
.option("--due <time>", "when it must be done: an ISO 8601 time or 2h, 3d from now; none clears it", dateOrNone("--due", { end: true }))
|
|
115
|
-
.option("--remind-time <time>", "when to look at it again: an ISO 8601 time or 2h, 3d from now; none clears it", dateOrNone("--remind-time"))
|
|
114
|
+
.option("--due <time>", "when it must be done: an ISO 8601 time, a date (its end), today, or 2h, 3d from now; none clears it", dateOrNone("--due", { end: true }))
|
|
115
|
+
.option("--remind-time <time>", "when to look at it again: an ISO 8601 time, a date (its start), today, or 2h, 3d from now; none clears it", dateOrNone("--remind-time"))
|
|
116
116
|
.option("--assignee <person...>", "who does it: sender (whoever sent the task's message) or person:<id>; none clears it. Leave it out when " +
|
|
117
117
|
"unsure: a task with no assignee is better than none");
|
|
118
118
|
const certaintyArgument = (typed) => {
|
|
@@ -441,9 +441,10 @@ export const tasksCommand = (messenger) => {
|
|
|
441
441
|
"Reads only the local store")
|
|
442
442
|
.argument("<chat...>", messenger.chatArgument)
|
|
443
443
|
.option("--last <n>", `read the newest n stored messages of each chat (default ${ARRIVAL_WINDOW}, at most 1000)`, positiveCount("--last"))
|
|
444
|
+
.option("--yes", "open and close the tasks it lists; otherwise only list them")
|
|
444
445
|
.action(async function (chats) {
|
|
445
446
|
const context = messengerContext(this, messenger);
|
|
446
|
-
const { last, yes = false } = this.
|
|
447
|
+
const { last, yes = false } = this.opts();
|
|
447
448
|
if (yes)
|
|
448
449
|
refuseLocalWrite(context, messenger.app.command, "tasks.scan");
|
|
449
450
|
const passes = await context.withStore(async (store, account) => {
|
package/dist/cli/paging.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ import type { Settings } from "./settings.js";
|
|
|
8
8
|
*/
|
|
9
9
|
/** Refused as typed: by the time a number reaches the settings, `abc` is `NaN` and `12abc` is `12`. */
|
|
10
10
|
export declare const positiveCount: (flag: string) => (value: string) => number;
|
|
11
|
+
/**
|
|
12
|
+
* The configured `limit`, for a command with no messenger context to read it from, such as `runs list`. A command
|
|
13
|
+
* whose own maximum is lower caps it there: a configured `limit: 200` is a listing's page, not a refused flag.
|
|
14
|
+
*/
|
|
15
|
+
export declare const configuredLimit: (command: Command, most?: number) => number;
|
|
11
16
|
export declare const withPaging: (command: Command) => Command;
|
|
12
17
|
/**
|
|
13
18
|
* Which rows to ask the store for. `--all` means no limit, which the store reads as "everything".
|
|
@@ -20,3 +25,8 @@ export declare const window: ({ limit, page, all }: Settings) => {
|
|
|
20
25
|
limit?: number;
|
|
21
26
|
offset: number;
|
|
22
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* `--limit` and `--page` of a command outside a messenger's context (`meetings list`, `events list`): the flag, else
|
|
30
|
+
* the profile's `defaults.limit`, as the shared listings resolve it. Outside `run()`, the shipped default.
|
|
31
|
+
*/
|
|
32
|
+
export declare const pagingOf: (command: Command) => Pick<Settings, "limit" | "page">;
|
package/dist/cli/paging.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { environmentOf, withAgentLevels } from "./context.js";
|
|
3
|
+
import { DEFAULT_CONFIG } from "./default-config.js";
|
|
2
4
|
/**
|
|
3
5
|
* The three flags every listing shares, so no command invents its own spelling of them.
|
|
4
6
|
*
|
|
@@ -11,6 +13,16 @@ export const positiveCount = (flag) => (value) => {
|
|
|
11
13
|
throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
|
|
12
14
|
return Number(value);
|
|
13
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* The configured `limit`, for a command with no messenger context to read it from, such as `runs list`. A command
|
|
18
|
+
* whose own maximum is lower caps it there: a configured `limit: 200` is a listing's page, not a refused flag.
|
|
19
|
+
*/
|
|
20
|
+
export const configuredLimit = (command, most = Number.POSITIVE_INFINITY) => {
|
|
21
|
+
const { resolveSettings, env } = environmentOf(command);
|
|
22
|
+
const { limit: _typed, ...flags } = command.optsWithGlobals();
|
|
23
|
+
const configured = resolveSettings?.(flags, { needsProfile: false, ...(env ? { env } : {}) }).limit ?? DEFAULT_CONFIG.defaults.limit;
|
|
24
|
+
return Math.min(configured, most);
|
|
25
|
+
};
|
|
14
26
|
export const withPaging = (command) => command
|
|
15
27
|
.option("--limit <n>", "how many to show", positiveCount("--limit"))
|
|
16
28
|
.option("--page <n>", "which page, starting at 1", positiveCount("--page"))
|
|
@@ -23,3 +35,20 @@ export const withPaging = (command) => command
|
|
|
23
35
|
* CLI that pages this way has this; it is in `--help` rather than engineered away.
|
|
24
36
|
*/
|
|
25
37
|
export const window = ({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit };
|
|
38
|
+
/**
|
|
39
|
+
* `--limit` and `--page` of a command outside a messenger's context (`meetings list`, `events list`): the flag, else
|
|
40
|
+
* the profile's `defaults.limit`, as the shared listings resolve it. Outside `run()`, the shipped default.
|
|
41
|
+
*/
|
|
42
|
+
export const pagingOf = (command) => {
|
|
43
|
+
const environment = environmentOf(command);
|
|
44
|
+
const flags = command.optsWithGlobals();
|
|
45
|
+
if (!environment.resolveSettings)
|
|
46
|
+
return { limit: flags.limit ?? DEFAULT_CONFIG.defaults.limit, page: flags.page ?? 1 };
|
|
47
|
+
const { limit, page } = environment.resolveSettings(withAgentLevels(command, command.optsWithGlobals()), {
|
|
48
|
+
env: environment.env ?? process.env,
|
|
49
|
+
needsProfile: false,
|
|
50
|
+
readOnly: true,
|
|
51
|
+
});
|
|
52
|
+
// A host's settings are force-cast to `Settings`; one that leaves these out must still page, not offset by NaN.
|
|
53
|
+
return { limit: limit ?? DEFAULT_CONFIG.defaults.limit, page: page ?? 1 };
|
|
54
|
+
};
|
package/dist/cli/preview.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { metaOf } from "@wirecat/cli-base/commands";
|
|
3
3
|
import { writes as writesAnything } from "@wirecat/cli-base/standards";
|
|
4
|
-
import {
|
|
4
|
+
import { keyForCommand, levelFor, readKeysForCommand, WRITE_KEYS } from "../sends/permissions.js";
|
|
5
5
|
import { commandPathOf } from "./command-contract.js";
|
|
6
6
|
import { fetchesOnly } from "./effects.js";
|
|
7
7
|
import { refuseUnknownPermissionKeys } from "./permission-keys.js";
|
|
@@ -14,9 +14,7 @@ export const preview = (command, settings, tool, keys, messenger = true) => {
|
|
|
14
14
|
const keyOf = typeof keys === "object" ? keys.keyOf : keys;
|
|
15
15
|
refuseUnknownPermissionKeys(command, settings, tool, declared ?? (keyOf && ((one) => keyOf(commandPathOf(one)))));
|
|
16
16
|
const key = declared ? declared.keyOf(path) : (keyOf?.(path) ?? keyForCommand(path));
|
|
17
|
-
const { level, key:
|
|
18
|
-
? levelFor(permissions, key, declared?.defaults)
|
|
19
|
-
: { level: "allow", key: null };
|
|
17
|
+
const { level } = key ? levelFor(permissions, key, declared?.defaults) : { level: "allow" };
|
|
20
18
|
for (const source of declared ? [] : readKeysForCommand(path)) {
|
|
21
19
|
if (levelFor(permissions, source).level === "deny")
|
|
22
20
|
throw new CliError("permission_error", `this profile does not permit ${source}`, { permission: source });
|
|
@@ -24,7 +22,7 @@ export const preview = (command, settings, tool, keys, messenger = true) => {
|
|
|
24
22
|
const meta = metaOf(command);
|
|
25
23
|
const writes = ((meta.effects !== undefined && writesAnything(meta.effects)) ||
|
|
26
24
|
(!declared && key !== null && key !== undefined && WRITE_KEYS.includes(key))) &&
|
|
27
|
-
!
|
|
25
|
+
!fetchesOnly(command);
|
|
28
26
|
if (level === "deny" || (writes && level === "readonly"))
|
|
29
27
|
throw new CliError("permission_error", `this profile does not permit ${path.join(" ")}`, { permission: key });
|
|
30
28
|
const also = (declared?.alsoChecks?.(path) ?? []).map((one) => {
|
package/dist/cli/program.js
CHANGED
|
@@ -38,6 +38,7 @@ import { PreviewComplete, preview } from "./preview.js";
|
|
|
38
38
|
import { commandWords, isProfileName, liftProfile, sampleCommand, takesProfile, valuedOptions } from "./profile.js";
|
|
39
39
|
import { absolutePaths, relayTarget } from "./relay-route.js";
|
|
40
40
|
import { NoProfileHere, namedProfile, settingsFor, } from "./settings.js";
|
|
41
|
+
import { shareShadowedOptions } from "./shadowed-options.js";
|
|
41
42
|
import { assertSharedContracts } from "./shared-contracts.js";
|
|
42
43
|
import { skillSourceOf } from "./skill-command.js";
|
|
43
44
|
import { refreshSkills, skipsSkillRefresh } from "./skill-refresh.js";
|
|
@@ -330,8 +331,7 @@ const runOnce = async (argv, definition, options) => {
|
|
|
330
331
|
if (flags.input === false || (headless && !options.answer))
|
|
331
332
|
environment.answer = () => null;
|
|
332
333
|
const localPreview = action.options.some((option) => option.long === "--dry-run");
|
|
333
|
-
|
|
334
|
-
action.setOptionValue("dryRun", true);
|
|
334
|
+
shareShadowedOptions(action);
|
|
335
335
|
refuseOfflineCommand(action, definition.app, flags.offline === true, flags.dryRun === true && localPreview);
|
|
336
336
|
const path = commandPathOf(action);
|
|
337
337
|
await enterCommandServer(action, command);
|
package/dist/cli/runs/command.js
CHANGED
|
@@ -7,7 +7,7 @@ import { LOCAL_READ, NO_EFFECTS } from "../effects.js";
|
|
|
7
7
|
import { itemOf, listOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
8
8
|
import { typedQuery, withQuery } from "../list-query.js";
|
|
9
9
|
import { answerLocally } from "../local-times.js";
|
|
10
|
-
import { positiveCount } from "../paging.js";
|
|
10
|
+
import { configuredLimit, positiveCount } from "../paging.js";
|
|
11
11
|
import { lineOf } from "../steps.js";
|
|
12
12
|
import { RUNS_QUERY, runListFilter } from "./query.js";
|
|
13
13
|
/** Reading the log is not itself worth recording, so **nothing here starts a run**. */
|
|
@@ -25,11 +25,13 @@ export const runsCommand = (app) => {
|
|
|
25
25
|
effects: LOCAL_READ,
|
|
26
26
|
}), RUNS_QUERY)
|
|
27
27
|
.description("recorded runs, newest first")
|
|
28
|
-
.option("--limit <n>", "how many to show", positiveCount("--limit")
|
|
29
|
-
.option("--page <n>", "which page, starting at 1", positiveCount("--page")
|
|
28
|
+
.option("--limit <n>", "how many to show", positiveCount("--limit"))
|
|
29
|
+
.option("--page <n>", "which page, starting at 1", positiveCount("--page"))
|
|
30
30
|
.action(function (words) {
|
|
31
31
|
const filter = runListFilter(words);
|
|
32
|
-
const
|
|
32
|
+
const typed = this.opts();
|
|
33
|
+
const limit = typed.limit ?? configuredLimit(this);
|
|
34
|
+
const page = typed.page ?? 1;
|
|
33
35
|
const output = outputFor(this);
|
|
34
36
|
const { renderer } = output;
|
|
35
37
|
const runs = listRuns(dir(this), { atLeast: page * limit + 1, filter });
|
|
@@ -5,22 +5,26 @@ import { environmentOf, outputFor } from "../context.js";
|
|
|
5
5
|
import { LOCAL_READ } from "../effects.js";
|
|
6
6
|
import { renderAnswer } from "../envelope.js";
|
|
7
7
|
import { typedQuery, withQuery } from "../list-query.js";
|
|
8
|
-
import { positiveCount } from "../paging.js";
|
|
8
|
+
import { configuredLimit, positiveCount } from "../paging.js";
|
|
9
9
|
import { runsFound, searchRuns } from "./search.js";
|
|
10
10
|
import { RUN_SEARCH_QUERY, runSearchFilter } from "./search-query.js";
|
|
11
11
|
/** Diagnostic files are independent of linked accounts and never start a recorded run themselves. */
|
|
12
12
|
export const runsSearchCommand = (app) => annotate(withQuery(new Command("runs")
|
|
13
13
|
.summary("search recorded diagnostic metadata and events")
|
|
14
14
|
.description("search recorded diagnostic metadata and events; literal words and field:value terms joined by AND; no message contents")
|
|
15
|
-
.option("--limit <n>", "matches per page, at most 100", positiveCount("--limit")
|
|
16
|
-
.option("--page <n>", "result page", positiveCount("--page")
|
|
15
|
+
.option("--limit <n>", "matches per page, at most 100", positiveCount("--limit"))
|
|
16
|
+
.option("--page <n>", "result page", positiveCount("--page")), RUN_SEARCH_QUERY), {
|
|
17
17
|
effects: LOCAL_READ,
|
|
18
18
|
output: { entity: "run", view: "hit" },
|
|
19
19
|
examples: [`${app.command} search runs timeout status:failed --limit 10`],
|
|
20
20
|
}).action(function (words) {
|
|
21
21
|
const filter = runSearchFilter(words);
|
|
22
|
-
const
|
|
22
|
+
const typed = this.opts();
|
|
23
23
|
const dir = runsDirFor(app, environmentOf(this).env ?? process.env);
|
|
24
|
-
const found = searchRuns(dir, {
|
|
24
|
+
const found = searchRuns(dir, {
|
|
25
|
+
...filter,
|
|
26
|
+
limit: typed.limit ?? configuredLimit(this, 100),
|
|
27
|
+
page: typed.page ?? 1,
|
|
28
|
+
});
|
|
25
29
|
renderAnswer(this, outputFor(this), runsFound(found, { query: typedQuery(words) }));
|
|
26
30
|
});
|
|
@@ -53,11 +53,7 @@ const whenOf = ({ every, at = [], atTime }, minimum) => {
|
|
|
53
53
|
}
|
|
54
54
|
if (atTime) {
|
|
55
55
|
// As messages send --at-time: a date alone would be its midnight, which nobody means by "send on the 20th".
|
|
56
|
-
|
|
57
|
-
throw new CliError("validation_error", `--at-time needs a time of day as well: ${atTime.trim()}T09:00`);
|
|
58
|
-
const time = aheadOf(atTime, "--at-time");
|
|
59
|
-
if (time <= Date.now())
|
|
60
|
-
throw new CliError("validation_error", "--at-time is in the past");
|
|
56
|
+
const time = aheadOf(atTime, "--at-time", Date.now(), { refuseDate: true, soonest: 0 });
|
|
61
57
|
return { once: new Date(time).toISOString() };
|
|
62
58
|
}
|
|
63
59
|
if (at.length > 0) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* commander gives a flag that the root and the command both declare (`--yes`, `--timeout`, `--dry-run`) to the root,
|
|
4
|
+
* so the command's own option stays empty (BUG-760). The value goes to the command's option too, through its own
|
|
5
|
+
* parser, so `--timeout 2m` on an option that takes seconds still arrives as seconds.
|
|
6
|
+
*/
|
|
7
|
+
export declare const shareShadowedOptions: (action: Command) => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const GIVEN = new Set(["cli", "env", "config"]);
|
|
2
|
+
/**
|
|
3
|
+
* commander gives a flag that the root and the command both declare (`--yes`, `--timeout`, `--dry-run`) to the root,
|
|
4
|
+
* so the command's own option stays empty (BUG-760). The value goes to the command's option too, through its own
|
|
5
|
+
* parser, so `--timeout 2m` on an option that takes seconds still arrives as seconds.
|
|
6
|
+
*/
|
|
7
|
+
export const shareShadowedOptions = (action) => {
|
|
8
|
+
const ancestors = [];
|
|
9
|
+
for (let at = action.parent; at; at = at.parent)
|
|
10
|
+
ancestors.push(at);
|
|
11
|
+
for (const option of action.options) {
|
|
12
|
+
const key = option.attributeName();
|
|
13
|
+
if (GIVEN.has(action.getOptionValueSource(key) ?? ""))
|
|
14
|
+
continue;
|
|
15
|
+
const holder = ancestors.find((one) => GIVEN.has(one.getOptionValueSource(key) ?? ""));
|
|
16
|
+
if (!holder)
|
|
17
|
+
continue;
|
|
18
|
+
const value = holder.getOptionValue(key);
|
|
19
|
+
const takesValue = option.required || option.optional;
|
|
20
|
+
if (typeof value === "boolean" && !takesValue)
|
|
21
|
+
action.setOptionValueWithSource(key, value, "cli");
|
|
22
|
+
// commander's own handler parses and validates it, as when typed; its types leave out that a Command is an emitter.
|
|
23
|
+
else if (typeof value === "string" && takesValue)
|
|
24
|
+
action.emit(`option:${option.name()}`, value);
|
|
25
|
+
}
|
|
26
|
+
};
|
package/dist/crm/cli/index.js
CHANGED
|
@@ -280,8 +280,10 @@ const addCrmCommandsDefinition = (program, options) => {
|
|
|
280
280
|
});
|
|
281
281
|
example(answerEntity(annotate(store.command("apply"), { effects: LOCAL_WRITE }), "crm_contacts_removed", crmContactsApplied).description("apply scope mine to the contacts already stored: remove those no deal or lead of the chosen users and no " +
|
|
282
282
|
"kept company names, and the people they leave empty; counts only unless --yes, under scope all too. A " +
|
|
283
|
-
"sync that narrows the scope, or sync --rescan under mine, does this itself"), "store apply", "store apply --yes")
|
|
284
|
-
|
|
283
|
+
"sync that narrows the scope, or sync --rescan under mine, does this itself"), "store apply", "store apply --yes")
|
|
284
|
+
.option("--yes", "remove the contacts it counts; otherwise only count them")
|
|
285
|
+
.action(async (opts, command) => {
|
|
286
|
+
const yes = opts.yes === true;
|
|
285
287
|
await within(command, async (run) => {
|
|
286
288
|
const scope = crmSettingKey(run.account, "scope");
|
|
287
289
|
if (yes && (await run.store.crm.scope(run.account)).mode !== "mine")
|
package/dist/domain/moment.d.ts
CHANGED
|
@@ -6,3 +6,32 @@ export interface MomentZone {
|
|
|
6
6
|
}
|
|
7
7
|
/** A typed date or time as epoch ms, with the flag named when it is not one. */
|
|
8
8
|
export declare const calendarMoment: (wanted: string, flag: string, { zone, end }?: MomentZone) => number;
|
|
9
|
+
export declare const MINUTE = 60000;
|
|
10
|
+
export declare const YEAR: number;
|
|
11
|
+
export interface Reading {
|
|
12
|
+
time: number;
|
|
13
|
+
/** Read in a zone: a date, `today`, or a time without an offset. A relative or offset time is not. */
|
|
14
|
+
local: boolean;
|
|
15
|
+
dateAlone: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The shared time grammar: an ISO date or date-time, seconds and zone optional, a space allowed for the `T`; `today`,
|
|
19
|
+
* `yesterday`; or `30m`, `2h`, `7d` counted by `direction` from now. `undefined` when the value has none of these shapes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const readMoment: (typed: string, flag: string, { zone, end, now, direction }?: MomentZone & {
|
|
22
|
+
now?: number;
|
|
23
|
+
direction?: 1 | -1;
|
|
24
|
+
}) => Reading | undefined;
|
|
25
|
+
export interface AheadOptions extends MomentZone {
|
|
26
|
+
/** A date alone has no time of day to act at: sending "on the 20th" means nobody knows when. */
|
|
27
|
+
refuseDate?: boolean;
|
|
28
|
+
/** The least lead from now, in ms: 0 refuses the past, a minute is what a messenger schedules at the soonest. */
|
|
29
|
+
soonest?: number;
|
|
30
|
+
/** The most lead from now, in ms, where a messenger caps it. */
|
|
31
|
+
latest?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A time ahead, the one parser of every future flag: the grammar of `readMoment`, relative times counted forward.
|
|
35
|
+
* `none` is not a time; a caller that clears a date checks for it first. The past is allowed unless `soonest` is given.
|
|
36
|
+
*/
|
|
37
|
+
export declare const aheadOf: (reference: string, flag: string, now?: number, options?: AheadOptions) => number;
|
package/dist/domain/moment.js
CHANGED
|
@@ -12,3 +12,61 @@ export const calendarMoment = (wanted, flag, { zone, end = false } = {}) => {
|
|
|
12
12
|
throw new CliError("validation_error", `${flag}: "${wanted}" is not a time${alternative ? ` — ${alternative}` : ""}`);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
export const MINUTE = 60_000;
|
|
16
|
+
export const YEAR = 365 * 24 * 60 * MINUTE;
|
|
17
|
+
const RELATIVE = /^(\d+)(m|h|d)$/;
|
|
18
|
+
const RELATIVE_MS = { m: MINUTE, h: 60 * MINUTE, d: 24 * 60 * MINUTE };
|
|
19
|
+
const DATE_ALONE = /^\d{4}-\d{2}-\d{2}$/;
|
|
20
|
+
const ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
21
|
+
/** `today` or `yesterday` as the date it is in `zone` at `now`. */
|
|
22
|
+
const dayWord = (word, zone, now) => {
|
|
23
|
+
const today = new Intl.DateTimeFormat("en-CA", { timeZone: zone }).format(now);
|
|
24
|
+
if (word === "today")
|
|
25
|
+
return today;
|
|
26
|
+
const date = new Date(`${today}T00:00:00Z`);
|
|
27
|
+
date.setUTCDate(date.getUTCDate() - 1);
|
|
28
|
+
return date.toISOString().slice(0, 10);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The shared time grammar: an ISO date or date-time, seconds and zone optional, a space allowed for the `T`; `today`,
|
|
32
|
+
* `yesterday`; or `30m`, `2h`, `7d` counted by `direction` from now. `undefined` when the value has none of these shapes.
|
|
33
|
+
*/
|
|
34
|
+
export const readMoment = (typed, flag, { zone, end = false, now = Date.now(), direction = -1 } = {}) => {
|
|
35
|
+
const wanted = typed.trim();
|
|
36
|
+
const [, amount, unit] = RELATIVE.exec(wanted) ?? [];
|
|
37
|
+
if (amount && unit)
|
|
38
|
+
return { time: now + direction * Number(amount) * (RELATIVE_MS[unit] ?? 0), local: false, dateAlone: false };
|
|
39
|
+
const word = wanted.toLowerCase();
|
|
40
|
+
const date = word === "today" || word === "yesterday" ? dayWord(word, timezoneOf(zone), now) : wanted;
|
|
41
|
+
// By shape: `Date.parse("12345")` is the year 12345, so a message id would pass as a date.
|
|
42
|
+
if (!/^\d{4}-\d{2}-\d{2}/.test(date))
|
|
43
|
+
return undefined;
|
|
44
|
+
const iso = date.replace(/^(\d{4}-\d{2}-\d{2}) +(?=\d)/, "$1T");
|
|
45
|
+
return {
|
|
46
|
+
time: calendarMoment(iso, flag, { ...(zone === undefined ? {} : { zone }), end }),
|
|
47
|
+
local: !ZONED.test(iso),
|
|
48
|
+
dateAlone: DATE_ALONE.test(iso),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const lead = (ms) => (ms === MINUTE ? "a minute" : ms === YEAR ? "a year" : `${Math.ceil(ms / MINUTE)} minutes`);
|
|
52
|
+
/**
|
|
53
|
+
* A time ahead, the one parser of every future flag: the grammar of `readMoment`, relative times counted forward.
|
|
54
|
+
* `none` is not a time; a caller that clears a date checks for it first. The past is allowed unless `soonest` is given.
|
|
55
|
+
*/
|
|
56
|
+
export const aheadOf = (reference, flag, now = Date.now(), options = {}) => {
|
|
57
|
+
const { refuseDate = false, soonest, latest, ...at } = options;
|
|
58
|
+
const read = readMoment(reference, flag, { ...at, now, direction: 1 });
|
|
59
|
+
if (read === undefined)
|
|
60
|
+
throw new CliError("validation_error", `${flag} takes an ISO 8601 time, today, or 30m, 2h, 3d from now — not "${reference.trim()}"`);
|
|
61
|
+
if (refuseDate && read.dateAlone)
|
|
62
|
+
throw new CliError("validation_error", DATE_ALONE.test(reference.trim())
|
|
63
|
+
? `${flag} needs a time of day as well: ${reference.trim()}T09:00`
|
|
64
|
+
: `${flag} needs a time of day as well, like 2026-11-20T09:00`);
|
|
65
|
+
if (soonest === 0 && read.time <= now)
|
|
66
|
+
throw new CliError("validation_error", `${flag} is in the past`);
|
|
67
|
+
if (soonest !== undefined && soonest > 0 && read.time < now + soonest)
|
|
68
|
+
throw new CliError("validation_error", `${flag} has to be at least ${lead(soonest)} from now`);
|
|
69
|
+
if (latest !== undefined && read.time > now + latest)
|
|
70
|
+
throw new CliError("validation_error", `${flag} can be at most ${lead(latest)} from now`);
|
|
71
|
+
return read.time;
|
|
72
|
+
};
|
|
@@ -46,11 +46,13 @@ export declare const folderProviderSql: (column?: string) => string;
|
|
|
46
46
|
export declare const folderProviderOf: (format: "obsidian" | "markdown") => "obsidian" | "local";
|
|
47
47
|
/**
|
|
48
48
|
* Providers whose account holds documents the way a notes folder does: one account per remote principal, its
|
|
49
|
-
* files as `documents` rows
|
|
50
|
-
*
|
|
49
|
+
* files as `documents` rows. Any registry entry of kind `documents` that a sync fills; an import-only one (`import`)
|
|
50
|
+
* keeps its documents beside its other records instead.
|
|
51
51
|
*/
|
|
52
|
-
export declare const
|
|
53
|
-
export declare const isDocumentAccountProvider: (provider:
|
|
52
|
+
export declare const documentAccountProviders: () => string[];
|
|
53
|
+
export declare const isDocumentAccountProvider: (provider: unknown) => boolean;
|
|
54
|
+
/** The documents account providers as a SQL list, for `IN (…)`; names are checked words, so they need no binding. */
|
|
55
|
+
export declare const documentAccountProvidersSql: () => string;
|
|
54
56
|
/**
|
|
55
57
|
* What the owner adds by hand (`saveAddedSource`): one account, `owner`. Neither a folder nor a documents account, so no
|
|
56
58
|
* folder can be bound to it and no sync deletes a source whose file is gone.
|
package/dist/domain/providers.js
CHANGED
|
@@ -20,6 +20,7 @@ export const PROVIDERS = [
|
|
|
20
20
|
{ name: "added", kind: "notes", aliases: [] },
|
|
21
21
|
{ name: "zoom", kind: "meetings", aliases: [] },
|
|
22
22
|
{ name: "google-meet", kind: "meetings", aliases: [], command: "gmeet" },
|
|
23
|
+
{ name: "google-drive", kind: "documents", aliases: [] },
|
|
23
24
|
// Its meetings come from the notes Telemost mails (`keeper@telemost.yandex.ru`), read by a mail rule.
|
|
24
25
|
{ name: "telemost", kind: "meetings", aliases: [] },
|
|
25
26
|
// A phone export's records: its SMS and its calls in the one account the import names.
|
|
@@ -55,11 +56,15 @@ export const folderProviderSql = (column = "provider") => `${column} IN (${FOLDE
|
|
|
55
56
|
export const folderProviderOf = (format) => format === "markdown" ? "local" : "obsidian";
|
|
56
57
|
/**
|
|
57
58
|
* Providers whose account holds documents the way a notes folder does: one account per remote principal, its
|
|
58
|
-
* files as `documents` rows
|
|
59
|
-
*
|
|
59
|
+
* files as `documents` rows. Any registry entry of kind `documents` that a sync fills; an import-only one (`import`)
|
|
60
|
+
* keeps its documents beside its other records instead.
|
|
60
61
|
*/
|
|
61
|
-
export const
|
|
62
|
-
export const isDocumentAccountProvider = (provider) =>
|
|
62
|
+
export const documentAccountProviders = () => registry.filter((entry) => entry.kind === "documents" && entry.imported !== true).map(({ name }) => name);
|
|
63
|
+
export const isDocumentAccountProvider = (provider) => typeof provider === "string" && documentAccountProviders().includes(provider);
|
|
64
|
+
/** The documents account providers as a SQL list, for `IN (…)`; names are checked words, so they need no binding. */
|
|
65
|
+
export const documentAccountProvidersSql = () => documentAccountProviders()
|
|
66
|
+
.map((name) => `'${name}'`)
|
|
67
|
+
.join(", ") || "NULL";
|
|
63
68
|
/**
|
|
64
69
|
* What the owner adds by hand (`saveAddedSource`): one account, `owner`. Neither a folder nor a documents account, so no
|
|
65
70
|
* folder can be bound to it and no sync deletes a source whose file is gone.
|
|
@@ -69,7 +74,7 @@ export const ADDED_ACCOUNT = "owner";
|
|
|
69
74
|
/** Documents `d` outside the added sources: a folder file joined to one would delete it when the file goes. */
|
|
70
75
|
export const notAdded = `d.account_id NOT IN (SELECT id FROM accounts WHERE provider = '${ADDED_PROVIDER}')`;
|
|
71
76
|
/** A folder, a documents account or the added sources, in SQL over an `accounts` row's `provider` column. */
|
|
72
|
-
export const filesAccountSql = (column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...
|
|
77
|
+
export const filesAccountSql = (column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...documentAccountProviders(), ADDED_PROVIDER].map((name) => `'${name}'`).join(", ")})`;
|
|
73
78
|
/** Notes written in memo have no account row; this is their account. */
|
|
74
79
|
export const INTERNAL_NOTES = "internal";
|
|
75
80
|
/** The reason a search gives for an account whose provider no entry names. */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `--at-time
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* offset is read in `zone`, the computer's zone when none is given.
|
|
2
|
+
* `--at-time`, a mute's `--until`, a link's `--expire-time`: `aheadOf` within the messenger's limits of a minute to a
|
|
3
|
+
* year, and never a date alone. Rounded down to the minute, because messengers send at the start of it (MAX measured,
|
|
4
|
+
* max-cli `FIND-141`), so the time printed is the time it goes.
|
|
6
5
|
*/
|
|
7
6
|
export declare const sendTime: (value: string, now?: number, flag?: string, zone?: string) => string;
|
package/dist/domain/send-time.js
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { calendarMoment } from "./moment.js";
|
|
3
|
-
const MINUTE = 60_000;
|
|
4
|
-
const YEAR = 365 * 24 * 60 * MINUTE;
|
|
5
|
-
const DELAY = /^(\d+)(m|h|d)$/;
|
|
6
|
-
const UNIT_MS = { m: MINUTE, h: 60 * MINUTE, d: 24 * 60 * MINUTE };
|
|
1
|
+
import { aheadOf, MINUTE, YEAR } from "./moment.js";
|
|
7
2
|
/**
|
|
8
|
-
* `--at-time
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* offset is read in `zone`, the computer's zone when none is given.
|
|
3
|
+
* `--at-time`, a mute's `--until`, a link's `--expire-time`: `aheadOf` within the messenger's limits of a minute to a
|
|
4
|
+
* year, and never a date alone. Rounded down to the minute, because messengers send at the start of it (MAX measured,
|
|
5
|
+
* max-cli `FIND-141`), so the time printed is the time it goes.
|
|
12
6
|
*/
|
|
13
7
|
export const sendTime = (value, now = Date.now(), flag = "--at-time", zone) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:
|
|
19
|
-
|
|
20
|
-
: Number.NaN;
|
|
21
|
-
if (Number.isNaN(at)) {
|
|
22
|
-
throw new CliError("validation_error", `${flag} takes a time like 2026-09-25T09:00 or a delay like 30m, 2h, 1d — not "${value}"`);
|
|
23
|
-
}
|
|
24
|
-
if (at < now + MINUTE)
|
|
25
|
-
throw new CliError("validation_error", `${flag} has to be at least a minute from now`);
|
|
26
|
-
if (at > now + YEAR)
|
|
27
|
-
throw new CliError("validation_error", `${flag} can be at most a year from now`);
|
|
8
|
+
const at = aheadOf(value, flag, now, {
|
|
9
|
+
...(zone === undefined ? {} : { zone }),
|
|
10
|
+
refuseDate: true,
|
|
11
|
+
soonest: MINUTE,
|
|
12
|
+
latest: YEAR,
|
|
13
|
+
});
|
|
28
14
|
return new Date(at - (at % MINUTE)).toISOString();
|
|
29
15
|
};
|
|
@@ -4,8 +4,8 @@ export { reference };
|
|
|
4
4
|
export declare const text: v.StringSchema<undefined>;
|
|
5
5
|
export declare const id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
6
6
|
export declare const time: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
7
|
-
/** A time a caller
|
|
8
|
-
export declare const
|
|
7
|
+
/** A time a caller types, read by the shared past-time grammar (`momentOf`). Answers carry `time`, always UTC. */
|
|
8
|
+
export declare const typedTime: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>;
|
|
9
9
|
export declare const count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
10
10
|
/** Fields of an answer item someone other than the owner wrote, as dotted paths: an agent reads them as data. */
|
|
11
11
|
export declare const untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
package/dist/entities/fields.js
CHANGED
|
@@ -5,8 +5,8 @@ export { reference };
|
|
|
5
5
|
export const text = v.string();
|
|
6
6
|
export const id = v.pipe(v.string(), v.minLength(1));
|
|
7
7
|
export const time = isoTime;
|
|
8
|
-
/** A time a caller
|
|
9
|
-
export const
|
|
8
|
+
/** A time a caller types, read by the shared past-time grammar (`momentOf`). Answers carry `time`, always UTC. */
|
|
9
|
+
export const typedTime = v.pipe(v.string(), v.minLength(1), v.maxLength(64), v.description("an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago"));
|
|
10
10
|
export const count = v.pipe(v.number(), v.integer(), v.minValue(0));
|
|
11
11
|
/** Fields of an answer item someone other than the owner wrote, as dotted paths: an agent reads them as data. */
|
|
12
12
|
export const untrusted = v.optional(v.array(text));
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -6579,6 +6579,97 @@ export declare const ENTITIES: {
|
|
|
6579
6579
|
}, undefined>, undefined>;
|
|
6580
6580
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
6581
6581
|
}, undefined>;
|
|
6582
|
+
readonly call_stats: v.GenericSchema<{
|
|
6583
|
+
time_zone: string;
|
|
6584
|
+
callback_within_ms: number;
|
|
6585
|
+
short_call_under_ms: number;
|
|
6586
|
+
calls: number;
|
|
6587
|
+
not_calls: number;
|
|
6588
|
+
known: {
|
|
6589
|
+
direction: number;
|
|
6590
|
+
outcome: number;
|
|
6591
|
+
wait_ms: number;
|
|
6592
|
+
talk_ms: number;
|
|
6593
|
+
duration_ms: number;
|
|
6594
|
+
roles: number;
|
|
6595
|
+
};
|
|
6596
|
+
by_direction?: {
|
|
6597
|
+
[x: string]: number;
|
|
6598
|
+
} | undefined;
|
|
6599
|
+
by_outcome?: {
|
|
6600
|
+
[x: string]: number;
|
|
6601
|
+
} | undefined;
|
|
6602
|
+
talk_ms?: number | undefined;
|
|
6603
|
+
mean_talk_ms?: number | undefined;
|
|
6604
|
+
duration_ms?: number | undefined;
|
|
6605
|
+
mean_wait_ms?: number | null | undefined;
|
|
6606
|
+
max_wait_ms?: number | null | undefined;
|
|
6607
|
+
short_calls?: number | undefined;
|
|
6608
|
+
employees: {
|
|
6609
|
+
key: string;
|
|
6610
|
+
name: string | null;
|
|
6611
|
+
identity_id: number | null;
|
|
6612
|
+
extension: string | null;
|
|
6613
|
+
calls: number;
|
|
6614
|
+
incoming: number;
|
|
6615
|
+
outgoing: number;
|
|
6616
|
+
internal: number;
|
|
6617
|
+
placed?: number | undefined;
|
|
6618
|
+
answered?: number | undefined;
|
|
6619
|
+
rang_not_answered?: number | undefined;
|
|
6620
|
+
talk_ms?: number | undefined;
|
|
6621
|
+
mean_talk_ms?: number | null | undefined;
|
|
6622
|
+
mean_wait_ms?: number | null | undefined;
|
|
6623
|
+
max_wait_ms?: number | null | undefined;
|
|
6624
|
+
}[];
|
|
6625
|
+
hours: {
|
|
6626
|
+
calls: number;
|
|
6627
|
+
incoming: number;
|
|
6628
|
+
outgoing: number;
|
|
6629
|
+
internal: number;
|
|
6630
|
+
answered?: number | undefined;
|
|
6631
|
+
missed?: number | undefined;
|
|
6632
|
+
talk_ms?: number | undefined;
|
|
6633
|
+
hour: number;
|
|
6634
|
+
}[];
|
|
6635
|
+
days: {
|
|
6636
|
+
calls: number;
|
|
6637
|
+
incoming: number;
|
|
6638
|
+
outgoing: number;
|
|
6639
|
+
internal: number;
|
|
6640
|
+
answered?: number | undefined;
|
|
6641
|
+
missed?: number | undefined;
|
|
6642
|
+
talk_ms?: number | undefined;
|
|
6643
|
+
date: string;
|
|
6644
|
+
}[];
|
|
6645
|
+
missed?: {
|
|
6646
|
+
calls: number;
|
|
6647
|
+
called_back: number;
|
|
6648
|
+
not_called_back: number;
|
|
6649
|
+
unknown_callback: number;
|
|
6650
|
+
unknown_outcome: number;
|
|
6651
|
+
items: {
|
|
6652
|
+
ref: string;
|
|
6653
|
+
meeting_id: number;
|
|
6654
|
+
started_at: string | null;
|
|
6655
|
+
outcome: "busy" | "no_answer" | "voicemail";
|
|
6656
|
+
client: {
|
|
6657
|
+
key: string;
|
|
6658
|
+
name: string | null;
|
|
6659
|
+
} | null;
|
|
6660
|
+
rang: string[];
|
|
6661
|
+
called_back?: boolean | undefined;
|
|
6662
|
+
callback?: {
|
|
6663
|
+
ref: string;
|
|
6664
|
+
meeting_id: number;
|
|
6665
|
+
started_at: string | null;
|
|
6666
|
+
after_ms: number;
|
|
6667
|
+
direction: "incoming" | "outgoing";
|
|
6668
|
+
} | null | undefined;
|
|
6669
|
+
}[];
|
|
6670
|
+
has_more: boolean;
|
|
6671
|
+
} | undefined;
|
|
6672
|
+
}>;
|
|
6582
6673
|
readonly meeting_speaker: v.StrictObjectSchema<{
|
|
6583
6674
|
readonly key: v.StringSchema<undefined>;
|
|
6584
6675
|
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -11967,7 +12058,7 @@ export declare const ENTITIES: {
|
|
|
11967
12058
|
export type EntityName = keyof typeof ENTITIES;
|
|
11968
12059
|
/** Every entity as a JSON Schema 2020-12 `$defs` entry, for bundling into an MCP tool's `outputSchema`. */
|
|
11969
12060
|
export declare const entityDefinitions: () => Record<EntityName, unknown>;
|
|
11970
|
-
export {
|
|
12061
|
+
export { typedTime } from "./fields.js";
|
|
11971
12062
|
export { mailFindings } from "./mail-findings.js";
|
|
11972
12063
|
export { meetingFindings } from "./meeting-findings.js";
|
|
11973
12064
|
export { meetingPreparation } from "./meeting-preparation.js";
|
package/dist/entities/index.js
CHANGED
|
@@ -49,7 +49,7 @@ import { messageEvent, serveSummary, watchedMessage, watchItem } from "./listene
|
|
|
49
49
|
import { mailCounts } from "./mail-counts.js";
|
|
50
50
|
import { mailFindings } from "./mail-findings.js";
|
|
51
51
|
import { mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer } from "./media-archive.js";
|
|
52
|
-
import { event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "./meeting.js";
|
|
52
|
+
import { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "./meeting.js";
|
|
53
53
|
import { meetingEvidence, meetingPersonContext } from "./meeting-evidence.js";
|
|
54
54
|
import { meetingFindings } from "./meeting-findings.js";
|
|
55
55
|
import { meetingPreparation } from "./meeting-preparation.js";
|
|
@@ -275,6 +275,7 @@ export const ENTITIES = {
|
|
|
275
275
|
meeting_link: meetingLink,
|
|
276
276
|
meeting_stats: meetingStats,
|
|
277
277
|
meeting_counts: meetingCounts,
|
|
278
|
+
call_stats: callStats,
|
|
278
279
|
meeting_speaker: meetingSpeaker,
|
|
279
280
|
meeting_participants: meetingParticipants,
|
|
280
281
|
meeting_passage: meetingPassage,
|
|
@@ -395,7 +396,7 @@ export const entityDefinitions = () => Object.fromEntries(Object.entries(ENTITIE
|
|
|
395
396
|
const { $schema: _, ...definition } = jsonSchemaOf(schema);
|
|
396
397
|
return [name, definition];
|
|
397
398
|
}));
|
|
398
|
-
export {
|
|
399
|
+
export { typedTime } from "./fields.js";
|
|
399
400
|
export { mailFindings } from "./mail-findings.js";
|
|
400
401
|
export { meetingFindings } from "./meeting-findings.js";
|
|
401
402
|
export { meetingPreparation } from "./meeting-preparation.js";
|