@wirecat/cli-core 0.619.0 → 0.621.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 +144 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/calendar/cli/search-all.d.ts +1 -1
- package/dist/calendar/cli/search-all.js +9 -10
- package/dist/calendar/prepare.js +1 -0
- package/dist/cli/base-stages-command.d.ts +1 -1
- package/dist/cli/base-stages-command.js +1 -1
- package/dist/cli/bot/buttons.d.ts +3 -0
- package/dist/cli/bot/buttons.js +24 -0
- package/dist/cli/bot/messages.js +14 -1
- package/dist/cli/bot/port.d.ts +8 -0
- package/dist/cli/contract-templates.js +31 -2
- package/dist/cli/messenger/contacts-command.js +2 -1
- package/dist/cli/messenger/conversations-command.js +2 -1
- package/dist/cli/messenger/message-items.js +1 -1
- package/dist/cli/messenger/search-answers.d.ts +5 -5
- package/dist/cli/messenger/search-answers.js +9 -20
- package/dist/cli/messenger/search-command.d.ts +2 -2
- package/dist/cli/messenger/search-command.js +8 -18
- package/dist/cli/model-catalogue-command.js +3 -1
- package/dist/cli/search-harder-consents-command.d.ts +21 -0
- package/dist/cli/search-harder-consents-command.js +112 -0
- package/dist/cli/steps.js +0 -6
- package/dist/cli/templates-command.js +4 -4
- package/dist/crm/cli/index.js +2 -2
- package/dist/crm/cli/search-all.js +7 -6
- package/dist/crm/source.d.ts +8 -0
- package/dist/crm/sync.d.ts +1 -1
- package/dist/crm/sync.js +13 -1
- package/dist/domain/models.d.ts +2 -0
- package/dist/domain/relations.d.ts +1 -0
- package/dist/domain/relations.js +5 -1
- package/dist/entities/contact-context.d.ts +3 -0
- package/dist/entities/contact-context.js +4 -0
- package/dist/entities/hit.d.ts +9 -2
- package/dist/entities/hit.js +6 -2
- package/dist/entities/index.d.ts +9 -1
- package/dist/errors/reasons.js +3 -0
- package/dist/meetings/hit-query.d.ts +1 -1
- package/dist/meetings/hit-query.js +2 -2
- package/dist/meetings/index.d.ts +1 -0
- package/dist/meetings/index.js +1 -0
- package/dist/meetings/store.d.ts +4 -0
- package/dist/meetings/store.js +2 -1
- package/dist/models/anthropic.js +5 -0
- package/dist/search/question-period.d.ts +10 -0
- package/dist/search/question-period.js +133 -0
- package/dist/sends/buttons.d.ts +2 -0
- package/dist/sends/buttons.js +6 -1
- package/dist/services/enrichment-setting.d.ts +6 -0
- package/dist/services/enrichment-setting.js +5 -1
- package/dist/services/enrichment.d.ts +5 -0
- package/dist/services/enrichment.js +1 -1
- package/dist/services/index.d.ts +4 -2
- package/dist/services/index.js +3 -1
- package/dist/services/messages.d.ts +1 -4
- package/dist/services/messages.js +0 -2
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/person-context.d.ts +3 -1
- package/dist/services/person-context.js +21 -8
- package/dist/services/person-preparation.d.ts +5 -1
- package/dist/services/person-preparation.js +10 -3
- package/dist/services/person-timeline.d.ts +6 -1
- package/dist/services/person-timeline.js +10 -2
- package/dist/services/search-all-deprecated.d.ts +40 -0
- package/dist/services/search-all-deprecated.js +10 -0
- package/dist/services/search-all-meetings.d.ts +50 -52
- package/dist/services/search-all-meetings.js +265 -272
- package/dist/services/search-all.d.ts +34 -6
- package/dist/services/search-all.js +119 -24
- package/dist/services/search-harder.d.ts +90 -0
- package/dist/services/search-harder.js +264 -0
- package/dist/store/chats.d.ts +3 -1
- package/dist/store/chats.js +6 -0
- package/dist/store/people.d.ts +6 -2
- package/dist/store/sqlite/added-sources.d.ts +15 -3
- package/dist/store/sqlite/added-sources.js +26 -5
- package/dist/store/sqlite/chats.d.ts +2 -0
- package/dist/store/sqlite/chats.js +6 -0
- package/dist/store/sqlite/involvements.d.ts +1 -1
- package/dist/store/sqlite/involvements.js +4 -2
- package/dist/store/sqlite/meeting-hit-query.d.ts +5 -0
- package/dist/store/sqlite/meeting-hit-query.js +33 -0
- package/dist/store/sqlite/meeting-hit-search.js +10 -8
- package/dist/store/sqlite/meetings.js +1 -1
- package/dist/store/sqlite/notes.d.ts +7 -0
- package/dist/store/sqlite/notes.js +23 -7
- package/dist/store/sqlite/person-preparation.d.ts +7 -3
- package/dist/store/sqlite/person-preparation.js +20 -6
- package/dist/store/sqlite/relation-list.js +4 -2
- package/dist/store/sqlite/reported-relations.d.ts +0 -1
- package/dist/store/sqlite/reported-relations.js +1 -4
- package/package.json +1 -1
- package/parity.json +26 -12
|
@@ -22,44 +22,35 @@ export const searchAllOnlyOf = (value, allowed = SOURCE_SEARCHED) => {
|
|
|
22
22
|
throw new CliError("validation_error", "mail is searched by the separate memo CLI: install @wirecat/cli-memo, then `memo search mail …`");
|
|
23
23
|
const unknown = chosen.find((one) => !allowed.includes(one));
|
|
24
24
|
if (unknown !== undefined || chosen.length === 0)
|
|
25
|
-
throw new CliError("validation_error", `--only takes ${allowed.join(", ")}, separated by commas
|
|
25
|
+
throw new CliError("validation_error", `--only takes ${allowed.join(", ")}, separated by commas`);
|
|
26
26
|
return [...new Set(chosen)];
|
|
27
27
|
};
|
|
28
28
|
/** One `search all` hit as a person reads it. */
|
|
29
29
|
export const searchAllLine = (item) => item.kind === "meeting"
|
|
30
30
|
? `meeting · ${item.provider} · ${singleLine(item.title ?? "")} ${item.ref}\n ${item.timestamp ?? "time unknown"} ${singleLine(item.text).slice(0, 200)}\n`
|
|
31
31
|
: `${item.kind} · ${item.provider} · ${singleLine(item.title ?? "")} ${item.ref}${item.url ? `\n ${singleLine(item.url)}` : ""}\n ${item.timestamp}${item.from?.name ? ` ${singleLine(item.from.name)}` : ""} ${singleLine(item.text)}\n`;
|
|
32
|
-
const maxMeetingsOf = (value) => {
|
|
33
|
-
if (value === "all")
|
|
34
|
-
return "all";
|
|
35
|
-
if (!/^[1-9]\d*$/.test(value))
|
|
36
|
-
throw new CliError("validation_error", "--max-meetings takes a whole number from 1, or all");
|
|
37
|
-
return Number(value);
|
|
38
|
-
};
|
|
39
32
|
/**
|
|
40
33
|
* `search all`'s scope, paging and matching options, the same in every CLI that mounts it (WC-ACCT-8): a messenger's
|
|
41
34
|
* and a calendar's.
|
|
42
35
|
*/
|
|
43
36
|
/** `allowed`: the resources `--only` takes, a CRM CLI's with `crm`. */
|
|
44
37
|
export const searchAllOptions = (command, allowed = SOURCE_SEARCHED) => command
|
|
45
|
-
.option("--only <resources>", `only these resources, separated by commas: ${allowed.
|
|
46
|
-
"meetings when --source names a meeting account", (value) => searchAllOnlyOf(value, allowed))
|
|
38
|
+
.option("--only <resources>", `only these resources, separated by commas: ${allowed.join(", ")}`, (value) => searchAllOnlyOf(value, allowed))
|
|
47
39
|
.option("--source <accounts>", "only these accounts, separated by commas: provider:account as a hit shows it, a provider, a kind or " +
|
|
48
|
-
"group:<name>; each resource reads the ones of its kind
|
|
49
|
-
.option("--max-meetings <n>", "how many of the meeting account's meetings to look through, newest first, or all for every one (default 100)", maxMeetingsOf)
|
|
40
|
+
"group:<name>; each resource reads the ones of its kind")
|
|
50
41
|
.option("--limit <n>", "how many", positiveCount("--limit"))
|
|
51
42
|
.option("--page <n>", "which page, starting at 1", positiveCount("--page"))
|
|
52
43
|
.option("--exact", "bare words and quotes match their exact form only, as exact:word does")
|
|
53
44
|
.option("--timezone <zone>", "the IANA timezone for calendar date boundaries");
|
|
54
45
|
const allCommand = (messenger) => {
|
|
55
46
|
const command = annotate(new Command("all"), { effects: REMOTE_READ, partial: true })
|
|
56
|
-
.summary("search stored messages, notes, calendar events and
|
|
47
|
+
.summary("search stored messages, notes, calendar events and meetings")
|
|
57
48
|
.description((messenger.serverSearch
|
|
58
49
|
? "search messenger messages and notes in the local store, and by default the messenger's server for " +
|
|
59
50
|
"messages too (notes and events are local only; --backend archive or --offline keeps it to the local store)"
|
|
60
51
|
: "search messenger messages and notes in the local store") +
|
|
61
52
|
", calendar events when the store holds a calendar" +
|
|
62
|
-
", and
|
|
53
|
+
", and meeting transcripts, chat and summaries when it holds a meeting account — best match first; not mail (the separate memo CLI searches it: memo search mail), " +
|
|
63
54
|
"tasks, people, memories or projects. Use it when you do not know where something was written; search messages " +
|
|
64
55
|
"or notes reads one kind with all its fields")
|
|
65
56
|
.argument("<query...>", 'strict Lucene query: words, "phrases", AND/OR/NOT, field groups and date ranges')
|
|
@@ -68,10 +59,10 @@ const allCommand = (messenger) => {
|
|
|
68
59
|
--json: the list is items; each result's reference is ref, with its kind.`);
|
|
69
60
|
return backendOptions(annotate(searchAllOptions(command), { output: { entity: "hit" } }), messenger).action(async function (words) {
|
|
70
61
|
const context = messengerContext(this, messenger);
|
|
71
|
-
const { only, source,
|
|
62
|
+
const { only, source, limit: typed, page, exact, timezone, } = this.opts();
|
|
72
63
|
const limit = typed ?? context.settings.limit;
|
|
73
64
|
const offset = offsetOf(page, limit);
|
|
74
|
-
const found = await context.withServices((services) => services.messages.
|
|
65
|
+
const found = await context.withServices((services) => services.messages.searchAll({
|
|
75
66
|
text: words.join(" "),
|
|
76
67
|
limit,
|
|
77
68
|
...(offset === undefined ? {} : { offset }),
|
|
@@ -80,8 +71,8 @@ const allCommand = (messenger) => {
|
|
|
80
71
|
...backendRequest(this),
|
|
81
72
|
env: context.env,
|
|
82
73
|
only: only ?? SOURCE_SEARCHED,
|
|
74
|
+
...(only?.includes("meetings") ? { meetingsAsked: true } : {}),
|
|
83
75
|
...(source === undefined ? {} : { source }),
|
|
84
|
-
...(maxMeetings === undefined ? {} : { maxMeetings }),
|
|
85
76
|
}));
|
|
86
77
|
noteServer(context, found.server);
|
|
87
78
|
if (context.format === "pretty")
|
|
@@ -98,7 +89,6 @@ const allCommand = (messenger) => {
|
|
|
98
89
|
query: words.join(" "),
|
|
99
90
|
...(only === undefined ? {} : { only: only.join(",") }),
|
|
100
91
|
...(source === undefined ? {} : { source }),
|
|
101
|
-
...(maxMeetings === undefined ? {} : { max_meetings: maxMeetings }),
|
|
102
92
|
...(exact ? { exact: true } : {}),
|
|
103
93
|
...(timezone === undefined ? {} : { timezone }),
|
|
104
94
|
};
|
|
@@ -16,6 +16,7 @@ import { FETCH, grantsAuthority, LOCAL_READ, LOCAL_WRITE, NO_EFFECTS } from "./e
|
|
|
16
16
|
import { enrichmentConsentsCommand } from "./enrichment-consents-command.js";
|
|
17
17
|
import { itemOf, listOf } from "./envelope.js";
|
|
18
18
|
import { listQuery, nativeTerms, termField, typedQuery, withQuery } from "./list-query.js";
|
|
19
|
+
import { harderConsentsCommand } from "./search-harder-consents-command.js";
|
|
19
20
|
export const MODEL_CATALOGUE_QUERY = defineQuery({
|
|
20
21
|
entity: "model",
|
|
21
22
|
backend: "native",
|
|
@@ -142,6 +143,7 @@ export const modelCatalogueCommand = (app, options) => {
|
|
|
142
143
|
}
|
|
143
144
|
if (options.enrichment === true) {
|
|
144
145
|
models.addCommand(enrichmentConsentsCommand(app, options));
|
|
146
|
+
models.addCommand(harderConsentsCommand(app, options));
|
|
145
147
|
models.addCommand(providerKeysCommand(app, options));
|
|
146
148
|
}
|
|
147
149
|
if (options.jsonOption)
|
|
@@ -158,7 +160,7 @@ const providerOf = (given) => {
|
|
|
158
160
|
};
|
|
159
161
|
/** The enrichment provider's key in the tool's keyring entry `embeddings:<provider>`; never printed, never an argument. */
|
|
160
162
|
const providerKeysCommand = (app, options) => {
|
|
161
|
-
const keys = new Command("keys").description("the API key write-time enrichment
|
|
163
|
+
const keys = new Command("keys").description("the API key write-time enrichment and search all --harder send with each request");
|
|
162
164
|
const store = () => embeddingKeys(app, options.env(), options.keyring);
|
|
163
165
|
grantsAuthority(annotate(keys.command("set"), {
|
|
164
166
|
effects: LOCAL_WRITE,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type KeyringStore } from "@wirecat/cli-base";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { AppIdentity } from "../ports/app.js";
|
|
4
|
+
import { type HarderSetting } from "../services/search-harder.js";
|
|
5
|
+
import { type Body } from "./envelope.js";
|
|
6
|
+
export interface HarderConsentsOptions {
|
|
7
|
+
env: () => NodeJS.ProcessEnv;
|
|
8
|
+
/** Where the key is looked for; the system keyring when absent. Tests pass memoryKeyring(). */
|
|
9
|
+
keyring?: KeyringStore;
|
|
10
|
+
output: (answer: Body, command: Command) => void;
|
|
11
|
+
diagnostic: (line: string) => void;
|
|
12
|
+
}
|
|
13
|
+
type Choice = Pick<HarderSetting, "provider" | "model" | "base_url">;
|
|
14
|
+
/** What the owner agrees to; a window can write the same text from the answer's fields. */
|
|
15
|
+
export declare const harderConsentWording: (command: string, chosen: Choice) => string;
|
|
16
|
+
/**
|
|
17
|
+
* The owner's consent that `search all --harder` may send a question and its hits to a hosted model. Off until
|
|
18
|
+
* `set … --yes`; with it, still only a search that asks with --harder sends anything.
|
|
19
|
+
*/
|
|
20
|
+
export declare const harderConsentsCommand: (app: AppIdentity, options: HarderConsentsOptions) => Command;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { agentOf } from "../runs/run-context.js";
|
|
5
|
+
import { keyLookup, keyVariable } from "../services/enrichment.js";
|
|
6
|
+
import { ENRICHMENT_PROVIDERS, enrichmentEndpoint, enrichmentPrice, isEnrichmentProvider, readEnrichmentSetting, } from "../services/enrichment-setting.js";
|
|
7
|
+
import { HARDER_CANDIDATES, HARDER_CHARS, HARDER_MODELS, readHarderSetting, writeHarderSetting, } from "../services/search-harder.js";
|
|
8
|
+
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "./effects.js";
|
|
9
|
+
import { itemOf } from "./envelope.js";
|
|
10
|
+
/** What the owner agrees to; a window can write the same text from the answer's fields. */
|
|
11
|
+
export const harderConsentWording = (command, chosen) => `\`${command} search all --harder\` sends the question and its first ${HARDER_CANDIDATES} hits (each one's title, ` +
|
|
12
|
+
`date and up to ${HARDER_CHARS} characters of its text) to ${chosen.provider} ` +
|
|
13
|
+
`(${new URL(enrichmentEndpoint(chosen)).host}), model ${chosen.model}, which puts the hits that answer it first. ` +
|
|
14
|
+
"Only a search with --harder sends anything; with claude-haiku-5-5 one costs about $0.0003 and adds 1 to 2 seconds. " +
|
|
15
|
+
`\`${command} models search-consents revoke\` turns it off.`;
|
|
16
|
+
const state = (app, options, given) => {
|
|
17
|
+
const env = options.env();
|
|
18
|
+
const setting = readHarderSetting(env);
|
|
19
|
+
// Enrichment's choice is only proposed: this consent is the owner's own, given here.
|
|
20
|
+
const enrichment = setting === undefined && given === undefined ? readEnrichmentSetting(env) : undefined;
|
|
21
|
+
const chosen = given ??
|
|
22
|
+
setting ??
|
|
23
|
+
(enrichment
|
|
24
|
+
? {
|
|
25
|
+
provider: enrichment.provider,
|
|
26
|
+
model: enrichment.base_url === undefined ? HARDER_MODELS[enrichment.provider] : enrichment.model,
|
|
27
|
+
...(enrichment.base_url === undefined ? {} : { base_url: enrichment.base_url }),
|
|
28
|
+
}
|
|
29
|
+
: { provider: "anthropic", model: HARDER_MODELS.anthropic });
|
|
30
|
+
const found = keyLookup({ env, app, ...(options.keyring ? { keyring: options.keyring } : {}) }, chosen);
|
|
31
|
+
const price = enrichmentPrice(chosen.provider, chosen.model, chosen.base_url);
|
|
32
|
+
return {
|
|
33
|
+
on: setting !== undefined,
|
|
34
|
+
provider: chosen.provider,
|
|
35
|
+
model: chosen.model,
|
|
36
|
+
endpoint: enrichmentEndpoint(chosen),
|
|
37
|
+
...(enrichment ? { proposed_from: "enrichment" } : {}),
|
|
38
|
+
consented_at: setting?.consented_at ?? null,
|
|
39
|
+
candidates: HARDER_CANDIDATES,
|
|
40
|
+
chars_per_hit: HARDER_CHARS,
|
|
41
|
+
usd_per_million: price
|
|
42
|
+
? { input: Math.round(price.input * 1e8) / 100, output: Math.round(price.output * 1e8) / 100 }
|
|
43
|
+
: null,
|
|
44
|
+
key: { present: found !== undefined, source: found?.source ?? null, env_var: keyVariable(chosen.provider) },
|
|
45
|
+
consent: harderConsentWording(app.command, chosen),
|
|
46
|
+
off_command: `${app.command} models search-consents revoke`,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The owner's consent that `search all --harder` may send a question and its hits to a hosted model. Off until
|
|
51
|
+
* `set … --yes`; with it, still only a search that asks with --harder sends anything.
|
|
52
|
+
*/
|
|
53
|
+
export const harderConsentsCommand = (app, options) => {
|
|
54
|
+
const consents = annotate(new Command("search-consents"), { effects: LOCAL_READ }).description("consent that search all --harder sends the question and its first hits to a hosted model; off by default");
|
|
55
|
+
annotate(consents.command("show"), { effects: LOCAL_READ, examples: [`${app.command} models search-consents show`] })
|
|
56
|
+
.description("whether search all --harder may call the model, which one, and whether its key is found")
|
|
57
|
+
.action(function () {
|
|
58
|
+
options.output(itemOf(state(app, options)), this);
|
|
59
|
+
});
|
|
60
|
+
grantsAuthority(annotate(consents.command("set"), {
|
|
61
|
+
effects: LOCAL_WRITE,
|
|
62
|
+
examples: [
|
|
63
|
+
`${app.command} models search-consents set anthropic --yes`,
|
|
64
|
+
`${app.command} models search-consents set openai --base-url https://openrouter.ai/api/v1 --model deepseek/deepseek-chat`,
|
|
65
|
+
],
|
|
66
|
+
}))
|
|
67
|
+
.description("allow search all --harder to call the model; without --yes, say what it sends and change nothing")
|
|
68
|
+
.argument("<provider>", `the provider that receives the question and hits: ${ENRICHMENT_PROVIDERS.join(" or ")}`)
|
|
69
|
+
.option("--model <model>", `the provider's model; ${HARDER_MODELS.anthropic} or ${HARDER_MODELS.openai} if left out`)
|
|
70
|
+
.option("--base-url <url>", "the address of an OpenAI-compatible model API (OpenRouter…); needs --model")
|
|
71
|
+
.option("--yes", "agree that a --harder search sends its question and hits, and allow it")
|
|
72
|
+
.action(function (provider, given) {
|
|
73
|
+
if (!isEnrichmentProvider(provider))
|
|
74
|
+
throw new CliError("validation_error", `search all --harder calls ${ENRICHMENT_PROVIDERS.join(" or ")}, not ${provider}`);
|
|
75
|
+
// Another API's models have other names: a default from this list would be a guess.
|
|
76
|
+
if (given.baseUrl !== undefined && given.model === undefined)
|
|
77
|
+
throw new CliError("validation_error", "--base-url needs --model: name the model that API serves");
|
|
78
|
+
const env = options.env();
|
|
79
|
+
// An agent that turned this on would decide for the owner that his records may leave the machine.
|
|
80
|
+
if (agentOf(env) && given.yes)
|
|
81
|
+
throw new CliError("permission_error", "only the owner allows search all --harder, not an agent", {
|
|
82
|
+
reason: "search-harder.owner-only",
|
|
83
|
+
});
|
|
84
|
+
const chosen = {
|
|
85
|
+
provider,
|
|
86
|
+
model: given.model ?? HARDER_MODELS[provider],
|
|
87
|
+
...(given.baseUrl === undefined ? {} : { base_url: given.baseUrl }),
|
|
88
|
+
};
|
|
89
|
+
if (!given.yes) {
|
|
90
|
+
const now = state(app, options, chosen);
|
|
91
|
+
options.diagnostic(`${now.consent}\nNothing changed — add --yes to allow it.`);
|
|
92
|
+
options.output(itemOf({ ...now, changed: false }), this);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
writeHarderSetting(env, { ...chosen, consented_at: new Date().toISOString() });
|
|
96
|
+
options.diagnostic(`search all --harder may now call ${provider} ${chosen.model}`);
|
|
97
|
+
options.output(itemOf({ ...state(app, options), changed: true }), this);
|
|
98
|
+
});
|
|
99
|
+
grantsAuthority(annotate(consents.command("revoke"), {
|
|
100
|
+
effects: LOCAL_WRITE,
|
|
101
|
+
examples: [`${app.command} models search-consents revoke`],
|
|
102
|
+
}))
|
|
103
|
+
.description("stop search all --harder from calling the model; it gives the plain order again")
|
|
104
|
+
.action(function () {
|
|
105
|
+
const env = options.env();
|
|
106
|
+
const was = readHarderSetting(env);
|
|
107
|
+
writeHarderSetting(env, undefined);
|
|
108
|
+
options.diagnostic(`search all --harder sends nothing now${was ? ` (was ${was.provider} ${was.model})` : ""}`);
|
|
109
|
+
options.output(itemOf({ ...state(app, options), changed: was !== undefined }), this);
|
|
110
|
+
});
|
|
111
|
+
return consents;
|
|
112
|
+
};
|
package/dist/cli/steps.js
CHANGED
|
@@ -225,12 +225,6 @@ export const STEPS = defineSteps([
|
|
|
225
225
|
args: [],
|
|
226
226
|
why: "the store file is damaged; this says what is lost and the commands that recover it",
|
|
227
227
|
},
|
|
228
|
-
{
|
|
229
|
-
id: "search.meetings",
|
|
230
|
-
command: "*",
|
|
231
|
-
args: [{ name: "max_meetings", required: true }],
|
|
232
|
-
why: "stopped after {scanned} meetings; more may match",
|
|
233
|
-
},
|
|
234
228
|
]);
|
|
235
229
|
/** A step from its registered definition; an argument left undefined is left out, as the command line would. */
|
|
236
230
|
export const nextStep = (id, input) => {
|
|
@@ -154,7 +154,7 @@ export const templatesCommand = (app, options) => {
|
|
|
154
154
|
.argument("<key>", "the template, such as report/morning-digest")
|
|
155
155
|
.addOption(channelOption())
|
|
156
156
|
.addOption(localeOption())
|
|
157
|
-
.option("--file <file>", "take the new template from this file instead of opening an editor")
|
|
157
|
+
.option("--file <file>", "take the new template from this file instead of opening an editor; - reads stdin")
|
|
158
158
|
.addOption(new Option("--undo", "put back the body your last change replaced; twice is back where you were").conflicts("file"))
|
|
159
159
|
.action(async function (key, given) {
|
|
160
160
|
const env = options.env();
|
|
@@ -175,7 +175,7 @@ export const templatesCommand = (app, options) => {
|
|
|
175
175
|
body = previous;
|
|
176
176
|
}
|
|
177
177
|
else if (given.file !== undefined) {
|
|
178
|
-
body = readFileSync(given.file, "utf8");
|
|
178
|
+
body = readFileSync(given.file === "-" ? 0 : given.file, "utf8");
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
181
181
|
draft = join(mkdtempSync(join(tmpdir(), "wirecat-template-")), `${key.replace("/", "-")}.${channel}.${address.language}.liquid`);
|
|
@@ -225,12 +225,12 @@ export const templatesCommand = (app, options) => {
|
|
|
225
225
|
.argument("<key>", "the template, such as report/morning-digest")
|
|
226
226
|
.addOption(channelOption())
|
|
227
227
|
.addOption(localeOption())
|
|
228
|
-
.option("--file <file>", "preview this draft instead of the template that applies")
|
|
228
|
+
.option("--file <file>", "preview this draft instead of the template that applies; - reads stdin")
|
|
229
229
|
.action(async function (key, given) {
|
|
230
230
|
const env = options.env();
|
|
231
231
|
const { address, kind, channel } = await addressOf(key, given, env);
|
|
232
232
|
const stored = given.file === undefined ? await withStore(env, (store) => store.templates.get(address)?.body) : undefined;
|
|
233
|
-
const body = given.file === undefined ? stored : readFileSync(given.file, "utf8");
|
|
233
|
+
const body = given.file === undefined ? stored : readFileSync(given.file === "-" ? 0 : given.file, "utf8");
|
|
234
234
|
const { against, view } = previewView(stateOf(app, env), kind, address.language, Date.now());
|
|
235
235
|
const rendering = await renderReport(view, channel, body === undefined ? {} : { template: body });
|
|
236
236
|
const problems = body === undefined ? [] : (await checkTemplate(view, channel, body)).problems;
|
package/dist/crm/cli/index.js
CHANGED
|
@@ -295,7 +295,7 @@ const addCrmCommandsDefinition = (program, options) => {
|
|
|
295
295
|
});
|
|
296
296
|
example(annotate(group.command("show"), { effects: LOCAL_READ, output: { entity: kind } })
|
|
297
297
|
.description(`one ${kind} with its pipeline, stage, status, amount and the people on it`)
|
|
298
|
-
.argument(
|
|
298
|
+
.argument(`<${kind}>`, `${kind}:<id>, as a list shows it`), `${plural} show ${kind}:12`).action(async (reference, _opts, command) => {
|
|
299
299
|
await within(command, async (run) => {
|
|
300
300
|
const found = await ownCopy(run, kind, reference);
|
|
301
301
|
return itemOf({ ...dealKeys(found), untrusted: DEAL_UNTRUSTED });
|
|
@@ -344,7 +344,7 @@ const addCrmCommandsDefinition = (program, options) => {
|
|
|
344
344
|
command.option("--operation-id <id>", "the operation_id a write that ended in outcome_unknown named: the CRM answers the repeat from its record");
|
|
345
345
|
return command;
|
|
346
346
|
};
|
|
347
|
-
const reference = (command) => command.argument(
|
|
347
|
+
const reference = (command) => command.argument(`<${kind}>`, `${kind}:<id>, as a list shows it`);
|
|
348
348
|
const fields = (command) => command
|
|
349
349
|
.option("--title <title>", `the ${kind}'s title`)
|
|
350
350
|
.option("--pipeline <pipeline>", "pipeline:<id>, or a name only one of the CRM's pipelines has")
|
|
@@ -11,7 +11,7 @@ import { commandAt, rootOf } from "../../cli/steps.js";
|
|
|
11
11
|
import { DEAL_KINDS } from "../../domain/deals.js";
|
|
12
12
|
import { SAVE_HELP } from "../../meetings/index.js";
|
|
13
13
|
import { meaningLane } from "../../services/messages-meaning.js";
|
|
14
|
-
import {
|
|
14
|
+
import { searchAll } from "../../services/search-all.js";
|
|
15
15
|
/** What a CRM CLI's `search all` reads: its deals and leads first, then what the other tools stored. */
|
|
16
16
|
const SEARCHED = ["crm", ...SOURCE_SEARCHED];
|
|
17
17
|
const DEFAULT_LIMIT = 20;
|
|
@@ -21,9 +21,10 @@ const DEFAULT_LIMIT = 20;
|
|
|
21
21
|
*/
|
|
22
22
|
export const addCrmSearchAll = (searches, { within, app, example, }) => {
|
|
23
23
|
const all = annotate(new Command("all"), { effects: LOCAL_READ, partial: true, output: { entity: "hit" } })
|
|
24
|
-
.summary("search stored deals and leads, messages, notes
|
|
25
|
-
.description("search the CRM's deals and leads by the words of their title, and messages, notes
|
|
26
|
-
"WireCat tools stored — best match first. Use it when you do not know where something was
|
|
24
|
+
.summary("search stored deals and leads, messages, notes, calendar events and meetings")
|
|
25
|
+
.description("search the CRM's deals and leads by the words of their title, and messages, notes, calendar events and " +
|
|
26
|
+
"meetings other WireCat tools stored — best match first. Use it when you do not know where something was " +
|
|
27
|
+
"written")
|
|
27
28
|
.argument("<query...>", 'words and "phrases"; deals and leads match the words of their title')
|
|
28
29
|
.addHelpText("after", SAVE_HELP);
|
|
29
30
|
searches.addCommand(searchAllOptions(all, SEARCHED));
|
|
@@ -46,7 +47,7 @@ export const addCrmSearchAll = (searches, { within, app, example, }) => {
|
|
|
46
47
|
const limit = opts.limit ?? DEFAULT_LIMIT;
|
|
47
48
|
const offset = offsetOf(opts.page, limit);
|
|
48
49
|
const env = run.env ?? process.env;
|
|
49
|
-
const found = await
|
|
50
|
+
const found = await searchAll(run.store, run.account, {
|
|
50
51
|
text: words.join(" "),
|
|
51
52
|
limit,
|
|
52
53
|
...(offset === undefined ? {} : { offset }),
|
|
@@ -54,9 +55,9 @@ export const addCrmSearchAll = (searches, { within, app, example, }) => {
|
|
|
54
55
|
...(opts.timezone === undefined ? {} : { timezone: opts.timezone }),
|
|
55
56
|
env,
|
|
56
57
|
only,
|
|
58
|
+
...(opts.only?.includes("meetings") ? { meetingsAsked: true } : {}),
|
|
57
59
|
...(crmKinds.length < DEAL_KINDS.length ? { crmKinds } : {}),
|
|
58
60
|
...(opts.source === undefined ? {} : { source: opts.source }),
|
|
59
|
-
...(opts.maxMeetings === undefined ? {} : { maxMeetings: opts.maxMeetings }),
|
|
60
61
|
...(run.locked ? { scope: { crm: [run.account] } } : {}),
|
|
61
62
|
}, { app, hintCommand: commandAt(rootOf(leaf), "models download") ? app.command : null }, undefined, meaningLane({ env, messenger: { app }, store: async () => run.store }));
|
|
62
63
|
const note = (text) => outputFor(leaf).renderer.note(text);
|
package/dist/crm/source.d.ts
CHANGED
|
@@ -68,6 +68,14 @@ export interface CrmSource {
|
|
|
68
68
|
* account's copy belongs to one user: another sign-in's user is refused.
|
|
69
69
|
*/
|
|
70
70
|
self?(): string | Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Which of the `unassigned` users this sign-in may count as nobody's, asked at every sync under `mine`; absent, all
|
|
73
|
+
* of them. The engine copies no deal or lead of a user left out, and names them with `message`, the CRM's reason.
|
|
74
|
+
*/
|
|
75
|
+
unassigned?(users: readonly string[]): Promise<{
|
|
76
|
+
kept: string[];
|
|
77
|
+
message?: string;
|
|
78
|
+
}>;
|
|
71
79
|
/** One kind's pipelines with their stages; a CRM whose leads have no pipelines answers one of its own making. */
|
|
72
80
|
pipelines(kind: DealKind, context?: CrmCallContext): Promise<CrmPipeline[]>;
|
|
73
81
|
/**
|
package/dist/crm/sync.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface CrmSyncOptions {
|
|
|
50
50
|
export interface CrmSyncIssue {
|
|
51
51
|
/** `user`: the account's users and departments. */
|
|
52
52
|
kind: CrmKind | "user";
|
|
53
|
-
reason: CrmSkipped["reason"] | CrmRelationIssue["reason"] | "crm.unlisted-held" | "crm.narrowing-held" | "crm.not-reported" | "crm.pending-dropped";
|
|
53
|
+
reason: CrmSkipped["reason"] | CrmRelationIssue["reason"] | "crm.unlisted-held" | "crm.narrowing-held" | "crm.unassigned-dropped" | "crm.not-reported" | "crm.pending-dropped";
|
|
54
54
|
message: string;
|
|
55
55
|
externalId?: string;
|
|
56
56
|
}
|
package/dist/crm/sync.js
CHANGED
|
@@ -397,8 +397,13 @@ export const syncCrm = async (source, store, account, options = {}) => {
|
|
|
397
397
|
`"config unset ${setting}" gives the copy to this sign-in`, { setting });
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
+
const listed = setting.mode === "mine" ? setting.also.map(normalCrmUserId) : [];
|
|
401
|
+
const allowed = self !== undefined && source.unassigned && listed.length && listed.every(isCrmUserId)
|
|
402
|
+
? await source.unassigned(listed)
|
|
403
|
+
: { kept: listed };
|
|
404
|
+
const dropped = listed.filter((id) => !allowed.kept.includes(id));
|
|
400
405
|
const scope = self !== undefined && setting.mode === "mine"
|
|
401
|
-
? { mode: "mine", self, also:
|
|
406
|
+
? { mode: "mine", self, also: listed.filter((id) => !dropped.includes(id)) }
|
|
402
407
|
: { mode: "all" };
|
|
403
408
|
const report = {
|
|
404
409
|
provider: source.provider,
|
|
@@ -412,6 +417,13 @@ export const syncCrm = async (source, store, account, options = {}) => {
|
|
|
412
417
|
state: "complete",
|
|
413
418
|
progress: { requests: 0, saved: 0, steps: 0 },
|
|
414
419
|
};
|
|
420
|
+
if (dropped.length)
|
|
421
|
+
report.issues.push({
|
|
422
|
+
kind: "deal",
|
|
423
|
+
reason: "crm.unassigned-dropped",
|
|
424
|
+
message: `${crmSettingKey(account, "unassigned")} names user ${dropped.join(", ")}, not counted as nobody's: ` +
|
|
425
|
+
`${allowed.message ?? `${source.provider} refused them`}; their deals and leads are not copied`,
|
|
426
|
+
});
|
|
415
427
|
let steps = 0;
|
|
416
428
|
const run = {
|
|
417
429
|
source,
|
package/dist/domain/models.d.ts
CHANGED
|
@@ -219,6 +219,8 @@ export interface Button {
|
|
|
219
219
|
kind: ButtonKind;
|
|
220
220
|
text: string;
|
|
221
221
|
url?: string;
|
|
222
|
+
/** What a `callback` button sends the bot, where the adapter can read it; used to refuse owner-only buttons, never printed. */
|
|
223
|
+
data?: string;
|
|
222
224
|
}
|
|
223
225
|
/** Where one attachment's bytes can be fetched. */
|
|
224
226
|
export interface AttachmentLink {
|
|
@@ -140,6 +140,7 @@ export declare const standingOf: (link: StandingFields, now: number) => Standing
|
|
|
140
140
|
/** A relationship a context or a traversal counts: the owner's, or a source's that still holds. */
|
|
141
141
|
export declare const isUsable: (standing: Standing) => boolean;
|
|
142
142
|
export declare const usableLink: (link: StandingFields, now: number) => boolean;
|
|
143
|
+
export declare const KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
|
|
143
144
|
/**
|
|
144
145
|
* The `links` row aliased `alias` has no owner link overriding it (`metadata.overrides`, an owner's edit of a link a
|
|
145
146
|
* source reported): where one does, the override is the answer.
|
package/dist/domain/relations.js
CHANGED
|
@@ -129,11 +129,15 @@ export const standingOf = (link, now) => {
|
|
|
129
129
|
/** A relationship a context or a traversal counts: the owner's, or a source's that still holds. */
|
|
130
130
|
export const isUsable = (standing) => standing === "confirmed" || standing === "reported";
|
|
131
131
|
export const usableLink = (link, now) => isUsable(standingOf(link, now));
|
|
132
|
+
// links_relationship_key's WHERE, word for word: without it SQLite cannot use that partial index, picks
|
|
133
|
+
// (to_type, to_id) and reads every link of a busy end, such as a deal owner's, for each relationship (#2623).
|
|
134
|
+
export const KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
|
|
132
135
|
/**
|
|
133
136
|
* The `links` row aliased `alias` has no owner link overriding it (`metadata.overrides`, an owner's edit of a link a
|
|
134
137
|
* source reported): where one does, the override is the answer.
|
|
135
138
|
*/
|
|
136
|
-
export const notOverriddenSql = (alias) => `NOT EXISTS (SELECT 1 FROM links override WHERE
|
|
139
|
+
export const notOverriddenSql = (alias) => `NOT EXISTS (SELECT 1 FROM links override WHERE ${KEYED} AND override.kind = ${alias}.kind ` +
|
|
140
|
+
`AND override.from_type = ${alias}.from_type ` +
|
|
137
141
|
`AND override.from_id = ${alias}.from_id AND override.to_type = ${alias}.to_type AND override.to_id = ${alias}.to_id ` +
|
|
138
142
|
`AND json_extract(override.metadata, '$.overrides') = ${alias}.id)`;
|
|
139
143
|
/** `usableLink` as SQL over the `links` row aliased `alias`; without `now` an end date is not checked. */
|
|
@@ -1847,18 +1847,21 @@ export declare const contactPreparation: v.StrictObjectSchema<{
|
|
|
1847
1847
|
readonly cut_by: v.NullableSchema<v.PicklistSchema<["limit", "bytes"], undefined>, undefined>;
|
|
1848
1848
|
readonly selection: v.LiteralSchema<"open, assigned to them in any role", undefined>;
|
|
1849
1849
|
readonly accounts: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
1850
|
+
readonly scopes: v.ArraySchema<v.PicklistSchema<["personal", "work"], undefined>, undefined>;
|
|
1850
1851
|
}, undefined>;
|
|
1851
1852
|
readonly facts: v.StrictObjectSchema<{
|
|
1852
1853
|
readonly included: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1853
1854
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
1854
1855
|
readonly cut_by: v.NullableSchema<v.PicklistSchema<["limit", "bytes"], undefined>, undefined>;
|
|
1855
1856
|
readonly selection: v.LiteralSchema<"accepted, about them or a project they are a member of", undefined>;
|
|
1857
|
+
readonly scopes: v.ArraySchema<v.PicklistSchema<["personal", "work"], undefined>, undefined>;
|
|
1856
1858
|
}, undefined>;
|
|
1857
1859
|
readonly notes: v.StrictObjectSchema<{
|
|
1858
1860
|
readonly included: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1859
1861
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
1860
1862
|
readonly cut_by: v.NullableSchema<v.PicklistSchema<["limit", "bytes"], undefined>, undefined>;
|
|
1861
1863
|
readonly selection: v.LiteralSchema<"written by you, about them", undefined>;
|
|
1864
|
+
readonly scopes: v.ArraySchema<v.PicklistSchema<["personal", "work"], undefined>, undefined>;
|
|
1862
1865
|
readonly withheld: v.OptionalSchema<v.LiteralSchema<"contacts.notes.list", undefined>, undefined>;
|
|
1863
1866
|
}, undefined>;
|
|
1864
1867
|
readonly meetings: v.StrictObjectSchema<{
|
|
@@ -139,6 +139,7 @@ export const meetingCue = v.strictObject({
|
|
|
139
139
|
text,
|
|
140
140
|
revision: v.picklist(["current", "superseded"]),
|
|
141
141
|
});
|
|
142
|
+
const scopes = v.array(v.picklist(["personal", "work"]));
|
|
142
143
|
export const contactPreparation = v.strictObject({
|
|
143
144
|
...context.entries,
|
|
144
145
|
prepare: v.strictObject({
|
|
@@ -183,14 +184,17 @@ export const contactPreparation = v.strictObject({
|
|
|
183
184
|
...coverage.entries,
|
|
184
185
|
selection: v.literal("open, assigned to them in any role"),
|
|
185
186
|
accounts: v.array(text),
|
|
187
|
+
scopes,
|
|
186
188
|
}),
|
|
187
189
|
facts: v.strictObject({
|
|
188
190
|
...coverage.entries,
|
|
189
191
|
selection: v.literal("accepted, about them or a project they are a member of"),
|
|
192
|
+
scopes,
|
|
190
193
|
}),
|
|
191
194
|
notes: v.strictObject({
|
|
192
195
|
...coverage.entries,
|
|
193
196
|
selection: v.literal("written by you, about them"),
|
|
197
|
+
scopes,
|
|
194
198
|
withheld: v.optional(v.literal("contacts.notes.list")),
|
|
195
199
|
}),
|
|
196
200
|
meetings: v.strictObject({
|
package/dist/entities/hit.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export declare const hit: v.StrictObjectSchema<{
|
|
|
23
23
|
readonly found_by: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["title", "words", "meaning"], undefined>, undefined>, undefined>;
|
|
24
24
|
/** How far into the meeting the passage is. */
|
|
25
25
|
readonly offset_ms: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
26
|
-
/** A meeting
|
|
27
|
-
readonly scope: v.OptionalSchema<v.PicklistSchema<["transcript", "chat", "summary"], undefined>, undefined>;
|
|
26
|
+
/** A meeting hit's place: its title, transcript, chat or summary. */
|
|
27
|
+
readonly scope: v.OptionalSchema<v.PicklistSchema<["title", "transcript", "chat", "summary"], undefined>, undefined>;
|
|
28
28
|
/** A meeting transcript hit's cue, which `meetings passage` opens with the lines around it. */
|
|
29
29
|
readonly cue_ref: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
30
30
|
/** A meeting transcript hit's transcript language (`ru`, `en`…), `null` when unknown. */
|
|
@@ -32,6 +32,13 @@ export declare const hit: v.StrictObjectSchema<{
|
|
|
32
32
|
/** A meeting transcript hit's line, from 1, of `lines_total` lines in its transcript. */
|
|
33
33
|
readonly line: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
34
34
|
readonly lines_total: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
35
|
+
/** `corrected`: a meeting hit found only through a spelling speech recognition may have garbled. */
|
|
36
|
+
readonly match: v.OptionalSchema<v.PicklistSchema<["corrected"], undefined>, undefined>;
|
|
37
|
+
/** For a `corrected` hit, the stored words each such query word matched. */
|
|
38
|
+
readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
39
|
+
readonly from: v.StringSchema<undefined>;
|
|
40
|
+
readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
41
|
+
}, undefined>, undefined>, undefined>;
|
|
35
42
|
/** A meeting passage's stored line, so two passages of one meeting stay apart; `search meetings` gives the same. */
|
|
36
43
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
37
44
|
/** A business hit's: `proposed` waits for the owner; a product or a wallet has no review and is `confirmed`. */
|
package/dist/entities/hit.js
CHANGED
|
@@ -26,8 +26,8 @@ export const hit = v.strictObject({
|
|
|
26
26
|
found_by: v.optional(v.array(v.picklist(["title", "words", "meaning"]))),
|
|
27
27
|
/** How far into the meeting the passage is. */
|
|
28
28
|
offset_ms: v.optional(v.nullable(count)),
|
|
29
|
-
/** A meeting
|
|
30
|
-
scope: v.optional(v.picklist(["transcript", "chat", "summary"])),
|
|
29
|
+
/** A meeting hit's place: its title, transcript, chat or summary. */
|
|
30
|
+
scope: v.optional(v.picklist(["title", "transcript", "chat", "summary"])),
|
|
31
31
|
/** A meeting transcript hit's cue, which `meetings passage` opens with the lines around it. */
|
|
32
32
|
cue_ref: v.optional(reference),
|
|
33
33
|
/** A meeting transcript hit's transcript language (`ru`, `en`…), `null` when unknown. */
|
|
@@ -35,6 +35,10 @@ export const hit = v.strictObject({
|
|
|
35
35
|
/** A meeting transcript hit's line, from 1, of `lines_total` lines in its transcript. */
|
|
36
36
|
line: v.optional(v.pipe(count, v.minValue(1))),
|
|
37
37
|
lines_total: v.optional(count),
|
|
38
|
+
/** `corrected`: a meeting hit found only through a spelling speech recognition may have garbled. */
|
|
39
|
+
match: v.optional(v.picklist(["corrected"])),
|
|
40
|
+
/** For a `corrected` hit, the stored words each such query word matched. */
|
|
41
|
+
corrections: v.optional(v.array(v.strictObject({ from: text, to: v.array(text) }))),
|
|
38
42
|
/** A meeting passage's stored line, so two passages of one meeting stay apart; `search meetings` gives the same. */
|
|
39
43
|
id: v.optional(v.pipe(v.string(), v.minLength(1))),
|
|
40
44
|
/** A business hit's: `proposed` waits for the owner; a product or a wallet has no review and is `confirmed`. */
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -3721,18 +3721,21 @@ export declare const ENTITIES: {
|
|
|
3721
3721
|
readonly cut_by: v.NullableSchema<v.PicklistSchema<["limit", "bytes"], undefined>, undefined>;
|
|
3722
3722
|
readonly selection: v.LiteralSchema<"open, assigned to them in any role", undefined>;
|
|
3723
3723
|
readonly accounts: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
3724
|
+
readonly scopes: v.ArraySchema<v.PicklistSchema<["personal", "work"], undefined>, undefined>;
|
|
3724
3725
|
}, undefined>;
|
|
3725
3726
|
readonly facts: v.StrictObjectSchema<{
|
|
3726
3727
|
readonly included: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
3727
3728
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
3728
3729
|
readonly cut_by: v.NullableSchema<v.PicklistSchema<["limit", "bytes"], undefined>, undefined>;
|
|
3729
3730
|
readonly selection: v.LiteralSchema<"accepted, about them or a project they are a member of", undefined>;
|
|
3731
|
+
readonly scopes: v.ArraySchema<v.PicklistSchema<["personal", "work"], undefined>, undefined>;
|
|
3730
3732
|
}, undefined>;
|
|
3731
3733
|
readonly notes: v.StrictObjectSchema<{
|
|
3732
3734
|
readonly included: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
3733
3735
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
3734
3736
|
readonly cut_by: v.NullableSchema<v.PicklistSchema<["limit", "bytes"], undefined>, undefined>;
|
|
3735
3737
|
readonly selection: v.LiteralSchema<"written by you, about them", undefined>;
|
|
3738
|
+
readonly scopes: v.ArraySchema<v.PicklistSchema<["personal", "work"], undefined>, undefined>;
|
|
3736
3739
|
readonly withheld: v.OptionalSchema<v.LiteralSchema<"contacts.notes.list", undefined>, undefined>;
|
|
3737
3740
|
}, undefined>;
|
|
3738
3741
|
readonly meetings: v.StrictObjectSchema<{
|
|
@@ -4314,11 +4317,16 @@ export declare const ENTITIES: {
|
|
|
4314
4317
|
readonly sender_ref: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>, undefined>;
|
|
4315
4318
|
readonly found_by: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["title", "words", "meaning"], undefined>, undefined>, undefined>;
|
|
4316
4319
|
readonly offset_ms: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
4317
|
-
readonly scope: v.OptionalSchema<v.PicklistSchema<["transcript", "chat", "summary"], undefined>, undefined>;
|
|
4320
|
+
readonly scope: v.OptionalSchema<v.PicklistSchema<["title", "transcript", "chat", "summary"], undefined>, undefined>;
|
|
4318
4321
|
readonly cue_ref: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4319
4322
|
readonly language: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
4320
4323
|
readonly line: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
4321
4324
|
readonly lines_total: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
4325
|
+
readonly match: v.OptionalSchema<v.PicklistSchema<["corrected"], undefined>, undefined>;
|
|
4326
|
+
readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
4327
|
+
readonly from: v.StringSchema<undefined>;
|
|
4328
|
+
readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
4329
|
+
}, undefined>, undefined>, undefined>;
|
|
4322
4330
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
4323
4331
|
readonly review: v.OptionalSchema<v.PicklistSchema<["proposed", "confirmed"], undefined>, undefined>;
|
|
4324
4332
|
readonly source_record: v.OptionalSchema<v.StrictObjectSchema<{
|
package/dist/errors/reasons.js
CHANGED
|
@@ -59,6 +59,7 @@ const PROVIDER_API = [
|
|
|
59
59
|
const OTHERS = [
|
|
60
60
|
["query.time-limit", "timeout", "the search took longer than its time limit; the query itself is valid"],
|
|
61
61
|
["enrichment.owner-only", "permission_error", "only the owner turns enrichment on, not an agent"],
|
|
62
|
+
["search-harder.owner-only", "permission_error", "only the owner allows search all --harder, not an agent"],
|
|
62
63
|
["model.offline", "permission_error", "downloading a model needs the network; --offline was requested"],
|
|
63
64
|
["model.key-rejected", "invalid_response", "the model provider refused the API key (401 or 403)"],
|
|
64
65
|
["model.unreachable", "invalid_response", "the model provider could not be reached over the network"],
|
|
@@ -316,6 +317,7 @@ const OTHERS = [
|
|
|
316
317
|
validation("crm.write-unsupported", "the CRM does not take this write, or does not recognise a repeated one"),
|
|
317
318
|
validation("crm.unlisted-held", "a list of every id would mark most of a kind deleted; nothing was, until --rescan"),
|
|
318
319
|
validation("crm.narrowing-held", "the default scope mine would mark most of a kind's stored rows deleted; none is, until the owner sets the scope"),
|
|
320
|
+
validation("crm.unassigned-dropped", "the CRM does not let this sign-in count a user in unassigned as nobody's; that user's deals are not copied"),
|
|
319
321
|
validation("crm.not-reported", "the CRM did not list users or departments; what they would say is unknown, nothing withdrawn"),
|
|
320
322
|
validation("crm.reference-unknown", "a CRM row names a contact, company or user the store does not hold; that link was not made"),
|
|
321
323
|
validation("crm.pending-dropped", "relationships waited too long for an end that never came; they were dropped"),
|
|
@@ -395,6 +397,7 @@ const OTHERS = [
|
|
|
395
397
|
validation("output.unknown-field", "the answer has no field by that name"),
|
|
396
398
|
validation("name.taken", "the name is already used"),
|
|
397
399
|
validation("period.ambiguous", "the period can be read more than one way"),
|
|
400
|
+
["press.owner-hand-only", "permission_error", "this button decides something for the owner; only a hand presses it"],
|
|
398
401
|
validation("proposal.wrong-state", "the proposal is not in a state that allows this"),
|
|
399
402
|
validation("proposal.reason-required", "an agent deciding for the owner, or proposing a link, gives a reason"),
|
|
400
403
|
validation("decision.request-invalid", "a decision request needs its batch, message, owner and distinct known actions"),
|