@wirecat/cli-core 0.662.0 → 0.664.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 +213 -0
- 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/call-stats-command.d.ts +18 -0
- package/dist/cli/call-stats-command.js +52 -0
- package/dist/cli/chat-sending-command.d.ts +14 -0
- package/dist/cli/chat-sending-command.js +64 -0
- package/dist/cli/context.d.ts +7 -0
- package/dist/cli/context.js +12 -4
- package/dist/cli/contract-templates.js +2 -0
- package/dist/cli/envelope.d.ts +0 -5
- package/dist/cli/envelope.js +25 -0
- package/dist/cli/index.d.ts +4 -1
- package/dist/cli/index.js +4 -1
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +7 -5
- package/dist/cli/meeting-meaning-command.d.ts +47 -0
- package/dist/cli/meeting-meaning-command.js +136 -0
- package/dist/cli/meeting-preparation-answer.d.ts +6 -0
- package/dist/cli/meeting-preparation-command.js +5 -5
- package/dist/cli/meeting-preparation-projects.d.ts +6 -0
- package/dist/cli/meeting-preparation-read.d.ts +11 -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/meeting-tags-command.d.ts +18 -0
- package/dist/cli/meeting-tags-command.js +74 -0
- package/dist/cli/messenger/admin-statistics-command.js +2 -2
- package/dist/cli/messenger/conversation-answers.d.ts +1 -1
- package/dist/cli/messenger/conversation-answers.js +1 -0
- package/dist/cli/messenger/conversations-command.js +38 -12
- package/dist/cli/messenger/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/models-command.js +7 -0
- package/dist/cli/messenger/rankings-command.js +3 -3
- package/dist/cli/messenger/records-command.d.ts +4 -1
- package/dist/cli/messenger/records-command.js +6 -1
- package/dist/cli/messenger/tags-command.js +7 -2
- package/dist/cli/messenger/tasks-command.js +2 -2
- package/dist/cli/model-catalogue-command.js +2 -0
- package/dist/cli/paging.d.ts +10 -0
- package/dist/cli/paging.js +29 -0
- package/dist/cli/profile-token.d.ts +15 -1
- package/dist/cli/profile-token.js +103 -7
- package/dist/cli/program.js +2 -2
- package/dist/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/domain/links.d.ts +11 -0
- package/dist/domain/links.js +4 -0
- 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/chat-sending.d.ts +10 -0
- package/dist/entities/chat-sending.js +11 -0
- package/dist/entities/fields.d.ts +2 -2
- package/dist/entities/fields.js +2 -2
- package/dist/entities/index.d.ts +135 -2
- package/dist/entities/index.js +8 -3
- package/dist/entities/meeting-preparation.d.ts +6 -0
- package/dist/entities/meeting.d.ts +1 -1
- package/dist/entities/meeting.js +1 -1
- package/dist/errors/reasons.js +25 -2
- 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 +1 -1
- package/dist/mail/sync.js +1 -1
- package/dist/mcp/meeting-preparation.d.ts +6 -0
- 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/meetings/answers.d.ts +7 -0
- package/dist/meetings/answers.js +4 -0
- 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 +4 -0
- package/dist/meetings/index.js +4 -0
- package/dist/meetings/mcp/index.d.ts +6 -3
- package/dist/meetings/mcp/index.js +2 -4
- package/dist/meetings/mcp/search.d.ts +12 -1
- package/dist/meetings/mcp/search.js +3 -3
- package/dist/meetings/project-evidence-answer.d.ts +6 -0
- 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/tag-answers.d.ts +43 -0
- package/dist/meetings/tag-answers.js +41 -0
- 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/models/chat-sending.d.ts +24 -0
- package/dist/models/chat-sending.js +40 -0
- package/dist/moderation/rules.d.ts +2 -0
- package/dist/moderation/rules.js +16 -2
- package/dist/runs/events.d.ts +1 -1
- 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 +4 -0
- package/dist/search/question-plan.js +7 -0
- package/dist/search/service-query.d.ts +6 -1
- package/dist/search/service-query.js +9 -1
- package/dist/search/task-similarity.d.ts +1 -0
- package/dist/search/task-similarity.js +1 -1
- 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 +39 -9
- package/dist/services/embeddings.d.ts +4 -0
- package/dist/services/events-search.js +2 -1
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +3 -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/meeting-meaning.d.ts +47 -0
- package/dist/services/meeting-meaning.js +158 -0
- package/dist/services/meeting-tags.d.ts +27 -0
- package/dist/services/meeting-tags.js +81 -0
- package/dist/services/messages-combined.js +15 -4
- package/dist/services/messages-discovery.js +2 -2
- 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/tags.js +4 -2
- package/dist/services/task-stats.js +2 -2
- package/dist/services/tasks.js +2 -2
- package/dist/sftp/index.d.ts +1 -1
- package/dist/sftp/index.js +1 -1
- package/dist/sftp/session.d.ts +30 -4
- package/dist/sftp/session.js +195 -11
- package/dist/sftp/ssh2.d.ts +19 -4
- package/dist/sftp/ssh2.js +144 -17
- package/dist/speech/cloud.d.ts +47 -0
- package/dist/speech/cloud.js +73 -0
- package/dist/speech/decode.d.ts +36 -9
- package/dist/speech/decode.js +208 -61
- package/dist/speech/index.d.ts +2 -1
- package/dist/speech/index.js +2 -1
- package/dist/speech/openai.d.ts +4 -0
- package/dist/speech/openai.js +13 -12
- package/dist/sql/index.d.ts +1 -0
- package/dist/sql/index.js +1 -0
- package/dist/sql/reader.d.ts +95 -0
- package/dist/sql/reader.js +214 -0
- package/dist/store/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/drizzle/bun.js +4 -4
- package/dist/store/sqlite/drizzle/bun.js.map +1 -1
- package/dist/store/sqlite/drizzle/core.js +5 -5
- package/dist/store/sqlite/drizzle/core.js.map +1 -1
- package/dist/store/sqlite/drizzle/node.js +4 -4
- package/dist/store/sqlite/drizzle/node.js.map +1 -1
- package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js → shared-5XR7K42U.js} +58 -58
- package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js.map → shared-5XR7K42U.js.map} +1 -1
- package/dist/store/sqlite/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.d.ts +1 -1
- package/dist/store/sqlite/knowledge.js +27 -23
- package/dist/store/sqlite/labelled.d.ts +5 -0
- package/dist/store/sqlite/labelled.js +6 -0
- package/dist/store/sqlite/link-row.d.ts +1 -0
- package/dist/store/sqlite/link-row.js +2 -0
- package/dist/store/sqlite/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 +3 -1
- package/dist/store/sqlite/notes.js +25 -14
- 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 +18 -3
- package/parity.json +20 -1
- package/skills/link-conversations/SKILL.md +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { InvalidArgumentError } from "commander";
|
|
4
|
+
import { meetingTagChangeItem, meetingTaggingItem } from "../meetings/index.js";
|
|
5
|
+
import { outputFor } from "./context.js";
|
|
6
|
+
import { LOCAL_READ, LOCAL_WRITE, NO_EFFECTS } from "./effects.js";
|
|
7
|
+
import { itemOf, listOf, renderAnswer } from "./envelope.js";
|
|
8
|
+
import { queryTerms, termField, withQuery } from "./list-query.js";
|
|
9
|
+
const MEETING_TAG_QUERY = {
|
|
10
|
+
entity: "meeting_tagging",
|
|
11
|
+
backend: "native",
|
|
12
|
+
fields: [termField("tag", "kw", "tag:complaint")],
|
|
13
|
+
};
|
|
14
|
+
const positive = (value) => {
|
|
15
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
16
|
+
throw new InvalidArgumentError("expected a positive integer");
|
|
17
|
+
return Number(value);
|
|
18
|
+
};
|
|
19
|
+
const ids = (value, previous = []) => [...previous, positive(value)];
|
|
20
|
+
const targetOf = ({ meeting, matching }) => {
|
|
21
|
+
if ((meeting === undefined) === (matching === undefined))
|
|
22
|
+
throw new CliError("validation_error", "name the meetings: --meeting <id> (repeat for more) or --matching <query>");
|
|
23
|
+
return matching === undefined ? { meetings: meeting ?? [] } : { matching };
|
|
24
|
+
};
|
|
25
|
+
const groupOf = (program) => program.commands.find((command) => command.name() === "tags") ??
|
|
26
|
+
annotate(program.command("tags"), { effects: NO_EFFECTS }).description("your labels on stored meetings, kept in the local store and never sent");
|
|
27
|
+
/**
|
|
28
|
+
* `tags add|remove|list` for a host whose things to label are its meetings, such as pbx's phone calls. A host of
|
|
29
|
+
* chats mounts the messenger's `tags` instead. `--matching` takes `search meetings`'s query, so "search, then tag" is
|
|
30
|
+
* one command, and a rerun after new calls are transcribed marks only those.
|
|
31
|
+
*/
|
|
32
|
+
export const addMeetingTagsCommand = (program, deps) => {
|
|
33
|
+
const tags = groupOf(program);
|
|
34
|
+
const print = (body, command) => deps.output ? deps.output(body, command) : renderAnswer(command, outputFor(command), body);
|
|
35
|
+
for (const operation of ["add", "remove"])
|
|
36
|
+
annotate(tags.command(operation), {
|
|
37
|
+
effects: LOCAL_WRITE,
|
|
38
|
+
output: { entity: "meeting_tag_change" },
|
|
39
|
+
examples: deps.examples[operation],
|
|
40
|
+
})
|
|
41
|
+
.summary(operation === "add" ? "put tags on stored meetings" : "take tags off stored meetings")
|
|
42
|
+
.description(operation === "add"
|
|
43
|
+
? "put tags on stored meetings: by id, or every meeting where a search finds its words"
|
|
44
|
+
: "take tags off stored meetings: by id, or every meeting where a search finds its words")
|
|
45
|
+
.argument("<tag...>", "one or more tags: 1–32 letters a–z, digits and hyphens; upper case is lowered")
|
|
46
|
+
.option("--meeting <id>", "a meeting, by its store id; repeat for more", ids)
|
|
47
|
+
.option("--matching <query>", "every meeting where search meetings finds this query: words, phrases, OR, -word, from:, date>=30d")
|
|
48
|
+
.action(async (given, flags, command) => {
|
|
49
|
+
const target = targetOf(flags);
|
|
50
|
+
const done = await (await deps.read())[operation](target, given, deps.signal?.());
|
|
51
|
+
print(itemOf(meetingTagChangeItem(done)), command);
|
|
52
|
+
});
|
|
53
|
+
withQuery(annotate(tags.command("list"), { effects: LOCAL_READ, examples: deps.examples.list })
|
|
54
|
+
.summary("tagged meetings of this account, with their tags")
|
|
55
|
+
.description("the stored meetings of this account that carry a tag, each with all its tags"), MEETING_TAG_QUERY)
|
|
56
|
+
.option("--limit <n>", "meetings per page, 1–500 (default 100)", positive, 100)
|
|
57
|
+
.option("--page <n>", "page number", positive, 1)
|
|
58
|
+
.action(async (words, flags, command) => {
|
|
59
|
+
if (flags.limit > 500)
|
|
60
|
+
throw new CliError("validation_error", "--limit is at most 500");
|
|
61
|
+
const tag = queryTerms(words, MEETING_TAG_QUERY, "tags list").get("tag");
|
|
62
|
+
const found = await (await deps.read()).list({
|
|
63
|
+
...(tag === undefined ? {} : { tag }),
|
|
64
|
+
limit: flags.limit,
|
|
65
|
+
offset: (flags.page - 1) * flags.limit,
|
|
66
|
+
});
|
|
67
|
+
print(listOf("tags list", {
|
|
68
|
+
items: found.items.map(meetingTaggingItem),
|
|
69
|
+
limit: flags.limit,
|
|
70
|
+
page: flags.page,
|
|
71
|
+
has_more: found.hasMore,
|
|
72
|
+
}), command);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
@@ -32,7 +32,7 @@ export const adminStatisticsCommand = (messenger, report) => {
|
|
|
32
32
|
command.option("--saved <name|id>", "run a saved report of this kind; typed report options replace stored options");
|
|
33
33
|
command
|
|
34
34
|
.option("--timezone <zone>", "the IANA timezone for calendar date boundaries")
|
|
35
|
-
.option("--limit <n>", "report rows, 1–100;
|
|
35
|
+
.option("--limit <n>", "report rows, 1–100; the configured limit if not given", positiveCount("--limit"));
|
|
36
36
|
if (report !== "discussion")
|
|
37
37
|
command.option("--answerer <person>", "stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more", collect);
|
|
38
38
|
if (report !== "newcomers")
|
|
@@ -44,7 +44,7 @@ export const adminStatisticsCommand = (messenger, report) => {
|
|
|
44
44
|
const { answerer, ...options } = this.opts();
|
|
45
45
|
const found = await context.withServices((services) => services.adminStatistics.report(report, {
|
|
46
46
|
...options,
|
|
47
|
-
limit: options.limit ??
|
|
47
|
+
limit: options.limit ?? Math.min(context.settings.limit, 100),
|
|
48
48
|
...(answerer ? { answerers: answerer } : {}),
|
|
49
49
|
...(report === "newcomers" ? { chat: argument } : filters),
|
|
50
50
|
signal: environmentOf(this).commandSignal ?? environmentOf(this).signal,
|
|
@@ -11,7 +11,7 @@ export declare const readinessGaps: ({ meaning, model, readiness, refreshed, cov
|
|
|
11
11
|
missing: Missing[];
|
|
12
12
|
};
|
|
13
13
|
/** `search conversations` and `conversations related`, CLI and MCP alike. */
|
|
14
|
-
export declare const foundConversations: (command: string, found: Readiness & Pick<FoundConversations, "hits" | "accounts">, limit: number, messenger: Syncing, chat?: string, meta?: Partial<Meta>) => import("../envelope.js").ListBody<unknown>;
|
|
14
|
+
export declare const foundConversations: (command: string, found: Readiness & Pick<FoundConversations, "hits" | "accounts" | "words">, limit: number, messenger: Syncing, chat?: string, meta?: Partial<Meta>) => import("../envelope.js").ListBody<unknown>;
|
|
15
15
|
/** `conversations status`: each built chat with the model it was measured by; group chats never built are missing. */
|
|
16
16
|
export declare const readinessList: ({ model, chats, unbuiltGroups, }: {
|
|
17
17
|
model: string;
|
|
@@ -61,6 +61,7 @@ export const foundConversations = (command, found, limit, messenger, chat, meta
|
|
|
61
61
|
meta: {
|
|
62
62
|
...meta,
|
|
63
63
|
...(found.accounts ? { accounts: found.accounts.map((one) => `${one.provider}:${one.account}`) } : {}),
|
|
64
|
+
...(found.words ? { words: found.words } : {}),
|
|
64
65
|
},
|
|
65
66
|
});
|
|
66
67
|
/** `conversations status`: each built chat with the model it was measured by; group chats never built are missing. */
|
|
@@ -6,12 +6,16 @@ import { openAnalysis, providerIdentity } from "../../analysis/provider.js";
|
|
|
6
6
|
import { runAnalysis } from "../../analysis/runner.js";
|
|
7
7
|
import { DEFAULT_TEXT_MODEL } from "../../embeddings/models.js";
|
|
8
8
|
import { isLocal } from "../../embeddings/remote.js";
|
|
9
|
+
import { chatSendingAllowed, chatSendingAskRefusal } from "../../models/chat-sending.js";
|
|
9
10
|
import { renderMessages } from "../../render/messages.js";
|
|
11
|
+
import { typedCommand } from "../../runs/scope.js";
|
|
12
|
+
import { searchTimeLimit } from "../../search/lucene/types.js";
|
|
10
13
|
import { BATCH_SIZE, CONVERSATION_QUERY } from "../../services/conversations.js";
|
|
11
14
|
import { REFRESH_BOUNDS, } from "../../services/embeddings.js";
|
|
12
15
|
import { servicesFor, storedDeps } from "../../services/index.js";
|
|
13
16
|
import { dateWindow } from "../../services/moment.js";
|
|
14
17
|
import { analysisChoice } from "../analysis-choice.js";
|
|
18
|
+
import { environmentOf } from "../context.js";
|
|
15
19
|
import { destroysNothing, LOCAL_READ, LOCAL_WRITE, REMOTE_READ, REMOTE_WRITE, reachesOtherService, refuseUnderReadOnly, } from "../effects.js";
|
|
16
20
|
import { embeddingChoice, refuseRemoteQuery } from "../embedding-choice.js";
|
|
17
21
|
import { itemOf, listOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
@@ -36,7 +40,9 @@ const conversationBuildCommand = (messenger) => boundOptions(reachesOtherService
|
|
|
36
40
|
.description("find a chat's conversations in what the store holds, replacing the last build; without --chat, every " +
|
|
37
41
|
"chat that changed since its build and every group never built; never asks the messenger")
|
|
38
42
|
.option("--chat <chat>", messenger.chatArgument)
|
|
39
|
-
.option("--analyze", "link batches using the configured analysis provider; requires --chat
|
|
43
|
+
.option("--analyze", "link batches using the configured analysis provider; requires --chat. A model outside this computer follows " +
|
|
44
|
+
"the `models chats` setting: under ask, a yes is remembered for this chat and provider")
|
|
45
|
+
.option("--yes", "send this chat's text to the analysis model outside this computer, when `models chats` is ask")
|
|
40
46
|
.addOption(new Option("--analysis-provider <provider>", "analysis: agent, openai or anthropic"))
|
|
41
47
|
.option("--model <model>", "analysis model; overrides models.analysis.model")
|
|
42
48
|
.option("--base-url <url>", "analysis API endpoint; overrides models.analysis.base_url")
|
|
@@ -44,6 +50,7 @@ const conversationBuildCommand = (messenger) => boundOptions(reachesOtherService
|
|
|
44
50
|
.option("--max-tokens <n>", "analysis input/output reservation cap per run; default 100000", positiveCount("--max-tokens")), { chunks: false }).action(async function () {
|
|
45
51
|
const options = this.optsWithGlobals();
|
|
46
52
|
const { chat, maxChats } = options;
|
|
53
|
+
const { yes } = this.opts();
|
|
47
54
|
const context = messengerContext(this, messenger);
|
|
48
55
|
if (options.analyze) {
|
|
49
56
|
if (!chat)
|
|
@@ -51,8 +58,14 @@ const conversationBuildCommand = (messenger) => boundOptions(reachesOtherService
|
|
|
51
58
|
refuseLocalWrite(context, messenger.app.command, LINKS_KEY);
|
|
52
59
|
refuseLocalWrite(context, messenger.app.command, "conversations.links.rebuild");
|
|
53
60
|
const target = analysisChoice(options, messenger.app, context.settings, context.env, context.keyring);
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
const outside = !isLocal(target.baseUrl);
|
|
62
|
+
const host = new URL(target.baseUrl).host;
|
|
63
|
+
const tool = typedCommand(messenger.app.command, "");
|
|
64
|
+
if (outside)
|
|
65
|
+
refuseUnderReadOnly(this, `send chat text to ${host}`);
|
|
66
|
+
// A model on this computer keeps the text here: it needs no yes, as embeddings on this computer need none.
|
|
67
|
+
const needsYes = () => outside && !chatSendingAllowed(context.env, host, tool);
|
|
68
|
+
const asks = needsYes();
|
|
56
69
|
const controller = new AbortController();
|
|
57
70
|
context.track({ close: async () => controller.abort() });
|
|
58
71
|
const maxTokens = options.maxTokens ?? 100_000;
|
|
@@ -66,12 +79,12 @@ const conversationBuildCommand = (messenger) => boundOptions(reachesOtherService
|
|
|
66
79
|
const status = await services.conversations.batchStatus(chat, size);
|
|
67
80
|
const consents = analysisConsents(store, account);
|
|
68
81
|
const identity = providerIdentity(target);
|
|
69
|
-
if (status.messages && !(await consents.has(status.chat, identity))) {
|
|
82
|
+
if (asks && status.messages && !(await consents.has(status.chat, identity))) {
|
|
70
83
|
const what = `${status.messages} messages, ${status.characters} characters (about ${status.tokensEstimate} message tokens, plus prompt and batch context), go to ${target.model} at ${target.baseUrl}; this run reserves at most ${maxTokens} input/output tokens. Consent is remembered for this chat and provider until revoked`;
|
|
71
|
-
if (!
|
|
84
|
+
if (!yes) {
|
|
72
85
|
const answer = await askOwner(this, `${what}. Allow analysis? [y/N] `);
|
|
73
86
|
if (answer === null)
|
|
74
|
-
throw
|
|
87
|
+
throw chatSendingAskRefusal(what, tool);
|
|
75
88
|
if (!/^y(es)?$/i.test(answer.trim()))
|
|
76
89
|
throw new CliError("cancelled", "cancelled — nothing was sent");
|
|
77
90
|
}
|
|
@@ -80,7 +93,8 @@ const conversationBuildCommand = (messenger) => boundOptions(reachesOtherService
|
|
|
80
93
|
await services.conversations.build(chat);
|
|
81
94
|
const request = openAnalysis(target, controller.signal, context.env);
|
|
82
95
|
return runAnalysis(services.conversations, chat, async (...args) => {
|
|
83
|
-
|
|
96
|
+
// Read again per batch: a revoked consent or a stricter setting stops the run before the next send.
|
|
97
|
+
if (needsYes() && !(await consents.has(status.chat, identity)))
|
|
84
98
|
throw new CliError("permission_error", "analysis consent was revoked; no further batch was sent");
|
|
85
99
|
return request(...args);
|
|
86
100
|
}, {
|
|
@@ -291,10 +305,12 @@ export const conversationsCommand = (messenger) => {
|
|
|
291
305
|
.option("--chat <chat>", messenger.chatArgument))
|
|
292
306
|
.option("--threads <n>", "local: threads in all (default: min(8, cores))", positiveCount("--threads"))
|
|
293
307
|
.option("--concurrency <n>", "remote: requests at once (default: 4)", positiveCount("--concurrency"))
|
|
294
|
-
.option("--max-tokens <n>", "remote: stop before a run that could send more tokens than this", positiveCount("--max-tokens"))
|
|
308
|
+
.option("--max-tokens <n>", "remote: stop before a run that could send more tokens than this", positiveCount("--max-tokens"))
|
|
309
|
+
.option("--yes", "remote: send the chunks to the model outside this computer, when `models chats` is ask");
|
|
295
310
|
boundOptions(embed, { oneChatUnbounded: true });
|
|
296
311
|
embed.action(async function () {
|
|
297
312
|
const options = this.optsWithGlobals();
|
|
313
|
+
const { yes } = this.opts();
|
|
298
314
|
const context = messengerContext(this, messenger);
|
|
299
315
|
refuseLocalWrite(context, messenger.app.command, EMBED_KEY);
|
|
300
316
|
const model = choiceOf(options, messenger, context);
|
|
@@ -316,8 +332,14 @@ export const conversationsCommand = (messenger) => {
|
|
|
316
332
|
context.renderer.note(`${status.left} of ${status.chunks} chunks to embed with ${status.model}` +
|
|
317
333
|
(status.estimateSeconds === null ? "" : `, ${minutes(status.estimateSeconds)} on one session`));
|
|
318
334
|
if (typeof model !== "string" && status.left > 0 && !isLocal(model.remote.baseUrl)) {
|
|
319
|
-
|
|
320
|
-
|
|
335
|
+
const host = new URL(model.remote.baseUrl).host;
|
|
336
|
+
refuseUnderReadOnly(this, `send chat text to ${host}`);
|
|
337
|
+
const tool = typedCommand(messenger.app.command, "");
|
|
338
|
+
const allowed = chatSendingAllowed(context.env, host, tool);
|
|
339
|
+
await consent(this, status, model.remote.baseUrl, tool, {
|
|
340
|
+
yes: allowed || yes === true,
|
|
341
|
+
...(options.maxTokens === undefined ? {} : { maxTokens: options.maxTokens }),
|
|
342
|
+
});
|
|
321
343
|
}
|
|
322
344
|
return services.embeddings.embed(chat, {
|
|
323
345
|
model,
|
|
@@ -470,7 +492,7 @@ const choiceOf = (options, messenger, context, extra) => embeddingChoice(options
|
|
|
470
492
|
* The messages leave the machine: say where, how much and what it may cost, and wait for a yes — `--yes`
|
|
471
493
|
* in machine mode (E11). Every run asks again.
|
|
472
494
|
*/
|
|
473
|
-
const consent = async (command, status, baseUrl, { yes, maxTokens }) => {
|
|
495
|
+
const consent = async (command, status, baseUrl, tool, { yes, maxTokens }) => {
|
|
474
496
|
if (maxTokens !== undefined && status.tokensAtMost > maxTokens) {
|
|
475
497
|
throw new CliError("validation_error", `this run could send up to ${status.tokensAtMost} tokens, above --max-tokens ${maxTokens} — nothing was sent`);
|
|
476
498
|
}
|
|
@@ -483,7 +505,7 @@ const consent = async (command, status, baseUrl, { yes, maxTokens }) => {
|
|
|
483
505
|
return;
|
|
484
506
|
const answer = await askOwner(command, `${what}. Send them? [y/N] `);
|
|
485
507
|
if (answer === null)
|
|
486
|
-
throw
|
|
508
|
+
throw chatSendingAskRefusal(what, tool);
|
|
487
509
|
if (!/^y(es)?$/i.test(answer.trim()))
|
|
488
510
|
throw new CliError("cancelled", "cancelled — nothing was sent");
|
|
489
511
|
};
|
|
@@ -575,10 +597,12 @@ export const conversationsSearchCommand = (messenger) => syncOptions(boundOption
|
|
|
575
597
|
...(since === undefined ? {} : { sinceTime: since }),
|
|
576
598
|
...(options.timezone === undefined ? {} : { zone: options.timezone }),
|
|
577
599
|
});
|
|
600
|
+
const timeLimitMs = searchTimeLimit(environmentOf(this).deadline?.());
|
|
578
601
|
const { found, refreshed } = await context.withServices(async (services) => {
|
|
579
602
|
const syncing = syncRequest(this, context);
|
|
580
603
|
const found = await services.embeddings.search(query, {
|
|
581
604
|
...syncing,
|
|
605
|
+
...(timeLimitMs === undefined ? {} : { timeLimitMs }),
|
|
582
606
|
...(options.catchUp
|
|
583
607
|
? {
|
|
584
608
|
refresh: {
|
|
@@ -602,6 +626,8 @@ export const conversationsSearchCommand = (messenger) => syncOptions(boundOption
|
|
|
602
626
|
if (refreshed)
|
|
603
627
|
for (const note of leftNotes(refreshed, rootOf(this)))
|
|
604
628
|
context.renderer.note(note);
|
|
629
|
+
if (found.words === "out-of-time")
|
|
630
|
+
context.renderer.note("the word half ran out of time, so these are by meaning alone; --timeout gives it longer");
|
|
605
631
|
renderAnswer(this, context, foundConversations("search conversations", found, limit, messenger, chat, window.meta), () => found.hits.map((hit) => `${hitLine(hit)}\n`).join(""));
|
|
606
632
|
if (found.hits.length === 0 && context.format === "pretty")
|
|
607
633
|
context.renderer.note(found.meaning === "unavailable"
|
|
@@ -21,7 +21,7 @@ export const countersCommand = (messenger) => {
|
|
|
21
21
|
.option("--timezone <zone>", "IANA timezone for query dates")
|
|
22
22
|
.option("--selection <json>", "pinned counter-targets selection from counters show; conflicts with query and scope")
|
|
23
23
|
.option("--counters <names>", "distinct views,reactions,comments fields; all three by default")
|
|
24
|
-
.option("--limit <n>", "messages, 1–100;
|
|
24
|
+
.option("--limit <n>", "messages, 1–100; the configured limit if not given", positiveCount("--limit"));
|
|
25
25
|
if (operation === "refresh")
|
|
26
26
|
command;
|
|
27
27
|
if (operation === "show")
|
|
@@ -41,7 +41,7 @@ export const countersCommand = (messenger) => {
|
|
|
41
41
|
refuseLocalWrite(context, messenger.app.command, "stats.messages.counters.sync");
|
|
42
42
|
const query = {
|
|
43
43
|
...options,
|
|
44
|
-
limit: options.limit ??
|
|
44
|
+
limit: options.limit ?? Math.min(context.settings.limit, 100),
|
|
45
45
|
...(words.length ? { text: words.join(" ") } : {}),
|
|
46
46
|
signal: environmentOf(this).commandSignal ?? environmentOf(this).signal,
|
|
47
47
|
};
|
|
@@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands";
|
|
|
3
3
|
import { parseDuration } from "../../domain/duration.js";
|
|
4
4
|
import { refusedPlace } from "../../sends/upload.js";
|
|
5
5
|
import { FETCHING } from "../../services/archive.js";
|
|
6
|
-
import { archiveMedia, checkMediaArchive
|
|
6
|
+
import { archiveMedia, checkMediaArchive } from "../../services/media-archive.js";
|
|
7
|
+
import { momentOf } from "../../services/moment.js";
|
|
7
8
|
import { environmentOf, setExitCode } from "../context.js";
|
|
8
9
|
import { FETCH, LOCAL_READ } from "../effects.js";
|
|
9
10
|
import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
@@ -21,12 +22,12 @@ export const addMediaArchiveCommands = (archive, messenger) => {
|
|
|
21
22
|
.addHelpText("after", `\nMedia is saved only when you request a download; serve does not save these copies.\nTo disable an installed daily backup: ${messenger.app.command} <profile> attachments jobs stop <dir>.`)
|
|
22
23
|
.argument("<dir>", "archive directory; created if missing")
|
|
23
24
|
.option("--chat <chat>", `only this chat; repeat for more; ${messenger.chatArgument}`, (value, previous) => [...previous, value], [])
|
|
24
|
-
.option("--since-time <time>", "include messages from this ISO
|
|
25
|
+
.option("--since-time <time>", "include messages from this time: ISO 8601, a date, today, yesterday, or 2h, 7d ago")
|
|
25
26
|
.option("--pause <duration>", "pause between history pages", messenger.fetching?.pause ?? FETCHING.pause)
|
|
26
27
|
.action(async function (directory) {
|
|
27
28
|
const context = messengerContext(this, messenger);
|
|
28
29
|
const options = this.opts();
|
|
29
|
-
|
|
30
|
+
const sinceTime = options.sinceTime && new Date(momentOf(options.sinceTime, "--since-time")).toISOString();
|
|
30
31
|
const pauseMs = parseDuration(options.pause, "--pause");
|
|
31
32
|
if (context.settings.offline)
|
|
32
33
|
throw new CliError("validation_error", "archiving media needs online mode");
|
|
@@ -42,7 +43,7 @@ export const addMediaArchiveCommands = (archive, messenger) => {
|
|
|
42
43
|
const result = await context.withServices((services) => archiveMedia(services, {
|
|
43
44
|
directory,
|
|
44
45
|
chats: options.chat,
|
|
45
|
-
sinceTime:
|
|
46
|
+
...(sinceTime ? { sinceTime } : {}),
|
|
46
47
|
pauseMs,
|
|
47
48
|
signal,
|
|
48
49
|
pageSize: messenger.history === "store" ? 100 : (messenger.fetching ?? FETCHING).page,
|
|
@@ -17,7 +17,7 @@ export const addMediaArchiveMove = (attachments, messenger) => {
|
|
|
17
17
|
.description("move older images into another verified archive; remember their new locations")
|
|
18
18
|
.argument("<dir>", "source media archive directory")
|
|
19
19
|
.argument("<archive-dir>", "destination archive directory; created if needed")
|
|
20
|
-
.requiredOption("--before-time <time>", "move images whose message date is before this ISO
|
|
20
|
+
.requiredOption("--before-time <time>", "move images whose message date is before this time: ISO 8601, a date (its start), today, or 7d ago")
|
|
21
21
|
.option("--dry-run", "show counts and bytes without moving files or creating the destination")
|
|
22
22
|
.addHelpText("after", "\nCopies are verified at the destination before local image bytes are removed.\nSource manifests retain relocation records; checks follow them and downloads do not fetch them again.\nImages without a recorded message date are left in place and counted as undated.")
|
|
23
23
|
.action(async function (directory, archiveDirectory) {
|
|
@@ -5,7 +5,7 @@ import { annotate } from "@wirecat/cli-base/commands";
|
|
|
5
5
|
import { dailyArchiveTimer, manageDailyArchiveTimer, runArchiveTimerCommand, } from "../../background/daily-archive-timer.js";
|
|
6
6
|
import { thisMachine } from "../../background/system.js";
|
|
7
7
|
import { refusedPlace } from "../../sends/upload.js";
|
|
8
|
-
import {
|
|
8
|
+
import { momentOf } from "../../services/moment.js";
|
|
9
9
|
import { environmentOf } from "../context.js";
|
|
10
10
|
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "../effects.js";
|
|
11
11
|
import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
@@ -33,7 +33,7 @@ export const addMediaArchiveTimers = (attachments, messenger) => {
|
|
|
33
33
|
.option("--at <HH:mm>", "daily start time", "03:00")
|
|
34
34
|
.option("--timezone <zone>", "IANA time zone of the daily start time", "UTC")
|
|
35
35
|
.option("--chat <chat>", `only this chat; repeat for more; ${messenger.chatArgument}`, (value, previous) => [...previous, value], [])
|
|
36
|
-
.option("--since-time <time>", "include messages from this ISO
|
|
36
|
+
.option("--since-time <time>", "include messages from this time: ISO 8601, a date, today, yesterday, or 2h, 7d ago; fixed when installed");
|
|
37
37
|
command.action(async function (directory) {
|
|
38
38
|
const context = messengerContext(this, messenger);
|
|
39
39
|
const environment = environmentOf(this);
|
|
@@ -43,7 +43,8 @@ export const addMediaArchiveTimers = (attachments, messenger) => {
|
|
|
43
43
|
run: (args, env) => runArchiveTimerCommand(args, env, signal),
|
|
44
44
|
};
|
|
45
45
|
const options = this.opts();
|
|
46
|
-
|
|
46
|
+
// Fixed now: `2h` read again at every daily run would be a different start each night.
|
|
47
|
+
const sinceTime = options.sinceTime && new Date(momentOf(options.sinceTime, "--since-time")).toISOString();
|
|
47
48
|
if (action === "install" && refusedPlace(directory, messenger.app, context.env))
|
|
48
49
|
throw new CliError("validation_error", "the archive cannot write credential, application or message-store folders");
|
|
49
50
|
// Canonicalize existing destinations so a symlink alias addresses the same timer.
|
|
@@ -59,7 +60,7 @@ export const addMediaArchiveTimers = (attachments, messenger) => {
|
|
|
59
60
|
entry: system.entry,
|
|
60
61
|
env: context.env,
|
|
61
62
|
chats: options.chat,
|
|
62
|
-
sinceTime
|
|
63
|
+
sinceTime,
|
|
63
64
|
at: options.at,
|
|
64
65
|
timeZone: options.timezone,
|
|
65
66
|
});
|
|
@@ -28,13 +28,13 @@ export const metadataCommand = (messenger) => {
|
|
|
28
28
|
.description("fetch group and channel descriptions again and cache them")
|
|
29
29
|
.option("--chat <chat>", "stored group/channel; repeat for several", (value, previous) => [...previous, value], [])
|
|
30
30
|
.option("--only-missing", "only chats with no metadata yet; without --chat, every stored group/channel")
|
|
31
|
-
.option("--limit <n>", "process at most 1–500 chats", positiveCount("--limit")
|
|
31
|
+
.option("--limit <n>", "process at most 1–500 chats; the configured limit if not given", positiveCount("--limit"))
|
|
32
32
|
.action(async function () {
|
|
33
33
|
const context = messengerContext(this, messenger);
|
|
34
34
|
refuseLocalWrite(context, messenger.app.command, "metadata.sync");
|
|
35
35
|
const options = this.opts();
|
|
36
|
-
const limit =
|
|
37
|
-
if (
|
|
36
|
+
const limit = options.limit ?? Math.min(context.settings.limit, 500);
|
|
37
|
+
if (limit > 500)
|
|
38
38
|
throw new CliError("validation_error", "--limit takes 1–500");
|
|
39
39
|
if (options.chat.length === 0 && !options.onlyMissing)
|
|
40
40
|
throw new CliError("validation_error", "name a chat with --chat, or give --only-missing");
|
|
@@ -7,12 +7,14 @@ import { embeddingKeys } from "../../embeddings/keys.js";
|
|
|
7
7
|
import { DEFAULT_RERANK_MODEL, DEFAULT_TEXT_MODEL, RERANK_MODELS, textModels, } from "../../embeddings/models.js";
|
|
8
8
|
import { model as modelEntity } from "../../entities/model.js";
|
|
9
9
|
import { DEFAULT_IMAGE_MODEL, IMAGE_MODELS, imageModelsDirectory, isImageModelInstalled, } from "../../images/picture/models.js";
|
|
10
|
+
import { typedCommand } from "../../runs/scope.js";
|
|
10
11
|
import { downloadImageModel, downloadRerankModel, downloadTextModel } from "../../services/model-downloads.js";
|
|
11
12
|
import { addCustomTextModel, useTextModel } from "../../services/text-model-choice.js";
|
|
12
13
|
import { install, installedBytes, isInstalled, megabytes, modelPath, modelsDirectory, vadPath, } from "../../speech/install.js";
|
|
13
14
|
import { orderedModels, speechModel, VAD } from "../../speech/models.js";
|
|
14
15
|
import { choose } from "../../speech/transcribe.js";
|
|
15
16
|
import { readSecret } from "../../terminal/prompt.js";
|
|
17
|
+
import { chatSendingCommand } from "../chat-sending-command.js";
|
|
16
18
|
import { baseContext, environmentOf } from "../context.js";
|
|
17
19
|
import { FETCH, grantsAuthority, LOCAL_READ, LOCAL_WRITE, reachesOtherService } from "../effects.js";
|
|
18
20
|
import { itemOf, listOf, renderAnswer } from "../envelope.js";
|
|
@@ -143,6 +145,11 @@ export const modelsCommand = (messenger) => {
|
|
|
143
145
|
const tool = `${messenger.app.command} personal`;
|
|
144
146
|
const models = new Command("models").description("models that run on this machine");
|
|
145
147
|
models.addCommand(modelKeysCommand(messenger, tool));
|
|
148
|
+
models.addCommand(chatSendingCommand(messenger.app, {
|
|
149
|
+
env: (command) => baseContext(command, messenger.resolveSettings).env,
|
|
150
|
+
output: (answer, command) => renderAnswer(command, baseContext(command, messenger.resolveSettings), answer),
|
|
151
|
+
tool: () => typedCommand(messenger.app.command, ""),
|
|
152
|
+
}));
|
|
146
153
|
withQuery(annotate(models.command("list"), {
|
|
147
154
|
effects: LOCAL_READ,
|
|
148
155
|
examples: [`${tool} models list`, `${tool} models list kind:audio`],
|
|
@@ -90,24 +90,24 @@ export const rankingEvidenceCommand = (messenger, target) => annotate(new Comman
|
|
|
90
90
|
: "the exact native person id from the ranking row")
|
|
91
91
|
.requiredOption("--selection <json>", "the resolved ranking selection returned in drilldown", selectionOf)
|
|
92
92
|
.requiredOption("--component <name>", "the exposed ranking component")
|
|
93
|
-
.option("--limit <n>", "evidence rows, 1–100;
|
|
93
|
+
.option("--limit <n>", "evidence rows, 1–100; the configured limit if not given", positiveCount("--limit"))
|
|
94
94
|
.option("--cursor <cursor>", "continue the same component and stored-evidence fingerprint")
|
|
95
95
|
.action(async function (reference) {
|
|
96
96
|
const context = messengerContext(this, messenger);
|
|
97
97
|
const options = this.opts();
|
|
98
98
|
if (isRetentionSelection(options.selection))
|
|
99
99
|
assertRetentionEvidenceRead(context.settings.permissions);
|
|
100
|
+
const limit = options.limit ?? Math.min(context.settings.limit, 100);
|
|
100
101
|
const found = await context.withServices((services) => (isRetentionSelection(options.selection)
|
|
101
102
|
? services.retention
|
|
102
103
|
: isAdminSelection(options.selection)
|
|
103
104
|
? services.adminStatistics
|
|
104
105
|
: services.rankings).evidence(target, reference, options.selection, {
|
|
105
106
|
component: options.component,
|
|
106
|
-
limit
|
|
107
|
+
limit,
|
|
107
108
|
...(options.cursor ? { cursor: options.cursor } : {}),
|
|
108
109
|
signal: environmentOf(this).commandSignal ?? environmentOf(this).signal,
|
|
109
110
|
}));
|
|
110
|
-
const limit = options.limit ?? 20;
|
|
111
111
|
const body = evidenceAnswer(`stats ${target} evidence`, found, {
|
|
112
112
|
[target === "messages" ? "message" : "person"]: reference,
|
|
113
113
|
selection: JSON.stringify(options.selection),
|
|
@@ -6,7 +6,10 @@ export declare const mediaCommand: (messenger: Messenger) => Command;
|
|
|
6
6
|
export declare const stickersCommand: (messenger: Messenger) => Command;
|
|
7
7
|
/** `calls list` — the account's call history, newest first. */
|
|
8
8
|
export declare const callsCommand: (messenger: Messenger) => Command;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* `chats delete` and `chats clear` — for this account only; at the default level they ask first. No MCP server offers
|
|
11
|
+
* them: over MCP an ask level goes ahead, and a whole chat gone cannot be undone (owner ruling, 2026-11-14).
|
|
12
|
+
*/
|
|
10
13
|
export declare const chatDeletionCommands: (messenger: Messenger) => Command[];
|
|
11
14
|
/** `chats mute` and `unmute` — the owner's own notifications for one chat; nobody in it is told. */
|
|
12
15
|
export declare const muteCommands: (messenger: Messenger) => Command[];
|
|
@@ -90,11 +90,15 @@ export const callsCommand = (messenger) => {
|
|
|
90
90
|
});
|
|
91
91
|
return calls;
|
|
92
92
|
};
|
|
93
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* `chats delete` and `chats clear` — for this account only; at the default level they ask first. No MCP server offers
|
|
95
|
+
* them: over MCP an ask level goes ahead, and a whole chat gone cannot be undone (owner ruling, 2026-11-14).
|
|
96
|
+
*/
|
|
94
97
|
export const chatDeletionCommands = (messenger) => [
|
|
95
98
|
annotate(new Command("delete"), {
|
|
96
99
|
output: { entity: "chat_removal" },
|
|
97
100
|
effects: REMOTE_WRITE,
|
|
101
|
+
mcp: false,
|
|
98
102
|
examples: [`${messenger.app.command} personal chats delete "Book club"`],
|
|
99
103
|
})
|
|
100
104
|
.description("delete a chat from this account; the others in it keep it and its messages")
|
|
@@ -107,6 +111,7 @@ export const chatDeletionCommands = (messenger) => [
|
|
|
107
111
|
annotate(new Command("clear"), {
|
|
108
112
|
output: { entity: "chat_removal" },
|
|
109
113
|
effects: REMOTE_WRITE,
|
|
114
|
+
mcp: false,
|
|
110
115
|
examples: [`${messenger.app.command} personal chats clear "Book club"`],
|
|
111
116
|
})
|
|
112
117
|
.description("delete every message in a chat for this account; the others in it keep theirs")
|
|
@@ -39,7 +39,7 @@ export const tagsCommand = (messenger) => {
|
|
|
39
39
|
}))
|
|
40
40
|
.description("derive local group/channel tags from cached metadata using keyword rules")
|
|
41
41
|
.option("--chat <chat>", "a stored group/channel; repeat to select several", (value, previous) => [...previous, value], [])
|
|
42
|
-
.option("--limit <n>", "process at most 1–500 chats", positiveCount("--limit")
|
|
42
|
+
.option("--limit <n>", "process at most 1–500 chats; the configured limit if not given", positiveCount("--limit"))
|
|
43
43
|
.option("--sync-first", "read current descriptions from the messenger before classifying")
|
|
44
44
|
.option("--dry-run", "preview cached classification without changing the store")
|
|
45
45
|
.action(async function () {
|
|
@@ -47,7 +47,12 @@ export const tagsCommand = (messenger) => {
|
|
|
47
47
|
const { chat, limit, syncFirst, dryRun } = this.opts();
|
|
48
48
|
if (!dryRun)
|
|
49
49
|
refuseLocalWrite(context, messenger.app.command, "tags.rebuild");
|
|
50
|
-
const done = await context.withServices((services) => services.metadata.auto({
|
|
50
|
+
const done = await context.withServices((services) => services.metadata.auto({
|
|
51
|
+
chats: chat,
|
|
52
|
+
limit: limit ?? Math.min(context.settings.limit, 500),
|
|
53
|
+
refresh: syncFirst,
|
|
54
|
+
dryRun,
|
|
55
|
+
}));
|
|
51
56
|
renderAnswer(this, context, itemOf(snakeKeys(done)));
|
|
52
57
|
});
|
|
53
58
|
targetOptions(annotate(tags.command("add"), {
|
|
@@ -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) => {
|
|
@@ -13,6 +13,7 @@ import { DEFAULT_ORDER, orderedModels, speechModel } from "../speech/models.js";
|
|
|
13
13
|
import { readSecret } from "../terminal/prompt.js";
|
|
14
14
|
import { stepLines } from "../terminal/step-lines.js";
|
|
15
15
|
import { aiModelCommand } from "./ai-model-command.js";
|
|
16
|
+
import { chatSendingCommand } from "./chat-sending-command.js";
|
|
16
17
|
import { FETCH, grantsAuthority, LOCAL_READ, LOCAL_WRITE, NO_EFFECTS } from "./effects.js";
|
|
17
18
|
import { enrichmentConsentsCommand } from "./enrichment-consents-command.js";
|
|
18
19
|
import { itemOf, listOf } from "./envelope.js";
|
|
@@ -150,6 +151,7 @@ export const modelCatalogueCommand = (app, options) => {
|
|
|
150
151
|
models.addCommand(providerKeysCommand(app, options));
|
|
151
152
|
models.addCommand(aiModelCommand(app, options));
|
|
152
153
|
models.addCommand(localOnlyCommand(app, options));
|
|
154
|
+
models.addCommand(chatSendingCommand(app, options));
|
|
153
155
|
models.addCommand(pictureReadingCommand(app, options));
|
|
154
156
|
}
|
|
155
157
|
if (options.jsonOption)
|
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
|
+
};
|