@wirecat/cli-core 0.678.0 → 0.680.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 +69 -0
- package/dist/background/budget.d.ts +9 -0
- package/dist/background/budget.js +16 -0
- package/dist/calendar/cli/answers.d.ts +2 -0
- package/dist/calendar/cli/answers.js +7 -1
- package/dist/calendar/cli/index.js +3 -0
- package/dist/cli/documents/sync.d.ts +1 -1
- package/dist/cli/help/first-screen.d.ts +2 -10
- package/dist/cli/help/first-screen.js +2 -54
- package/dist/cli/setup-command.js +28 -10
- package/dist/cli/skill-refresh.js +4 -3
- package/dist/crm/index.d.ts +1 -0
- package/dist/crm/index.js +1 -0
- package/dist/documents/scope.d.ts +3 -3
- package/dist/documents/scope.js +8 -4
- package/dist/entities/business-context.js +4 -0
- package/dist/entities/recorded-meeting.d.ts +1 -0
- package/dist/entities/recorded-meeting.js +2 -0
- package/dist/mcp/app-server.js +4 -5
- package/dist/mcp/bot/server.js +4 -5
- package/dist/mcp/server.js +5 -6
- package/dist/ports/wirecat-tools.d.ts +12 -0
- package/dist/ports/wirecat-tools.js +81 -0
- package/dist/sends/upload.d.ts +4 -1
- package/dist/sends/upload.js +22 -8
- package/dist/services/communications.d.ts +35 -0
- package/dist/services/communications.js +52 -2
- package/dist/services/documents/plan.js +25 -6
- package/dist/services/documents/ports.d.ts +2 -0
- package/dist/services/documents/sync.js +3 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +1 -0
- package/dist/services/notes-search.d.ts +8 -0
- package/dist/services/notes-search.js +29 -1
- package/dist/services/person-meetings.d.ts +2 -0
- package/dist/services/person-meetings.js +16 -1
- package/dist/skills/validate.d.ts +2 -0
- package/dist/skills/validate.js +28 -5
- package/dist/store/sqlite/agent-links.js +2 -2
- package/dist/store/sqlite/event-search.d.ts +2 -0
- package/dist/store/sqlite/event-search.js +10 -0
- package/dist/store/sqlite/note-search.d.ts +2 -0
- package/dist/store/sqlite/note-search.js +10 -0
- package/dist/store/sqlite/person-match-scan.d.ts +5 -0
- package/dist/store/sqlite/person-match-scan.js +15 -8
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,75 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
|
|
|
5
5
|
minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
|
|
6
6
|
shape of this file.
|
|
7
7
|
|
|
8
|
+
## 0.680.0 — 16.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`embedNotes`, `embedEvents` and `embedMail` take `deadline` and `signal`.** They stop between batches at the
|
|
13
|
+
deadline less its margin, or on a cancel, and answer `stopped` and, for notes and events, `remaining`: the chunks
|
|
14
|
+
still without a vector. Enrichment before the embed gets the same limit. Calendar `sync --embed` passes its run's
|
|
15
|
+
deadline and signal, so a sync that ends late no longer runs into `command.timed-out` while it embeds. See
|
|
16
|
+
[Walks over several syncs](docs/dev/DOCUMENTS.md#walks-over-several-syncs).
|
|
17
|
+
- **`RunBudget.first()`**: whether a call's first request goes past a `deadline` stop.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **A documents sync no longer overruns its deadline after a slow first listing.** The first-request exception held
|
|
22
|
+
for the walk's first listing and again for the first file read, so a 4 s run could list for 1.9 s, read for 3 s
|
|
23
|
+
and end at 4.9 s. Now only one request per call goes past the margin, only before any other, sized by the CLI's
|
|
24
|
+
`requestMs` plus 0.5 s to answer, and timed by the budget's clock rather than a sync's fixed `now`.
|
|
25
|
+
- **`setup apply --dry-run` never opens the keyring.** 0.679.0 still read it when the answers reached a secret input
|
|
26
|
+
and left it empty, so the shared deny contract (`cli-contract`, WC-PERM-23) could still fail. A dry run now takes
|
|
27
|
+
each secret as kept: it never reports an unanswered secret as missing, so an edit that leaves the password alone can
|
|
28
|
+
continue, and it still refuses a secret answer of the wrong shape. `apply` checks the secret and keeps the saved
|
|
29
|
+
one when none is answered.
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
|
|
33
|
+
- **A file to send is refused under `/proc`, `/sys` and `/dev`**, through any link and even with `--allow-any-file`:
|
|
34
|
+
`--file /proc/self/environ` sent the process's environment, which can hold a tool's token. `refusedPlace` refuses
|
|
35
|
+
those paths too, and `readUpload` still takes only a regular file.
|
|
36
|
+
- **`refusedPlace` covers every WireCat tool's folders.** It takes them from `WIRECAT_TOOLS`, which now names each
|
|
37
|
+
tool's `appName` and `envPrefix`, plus amo-cli and beeline-cli. zoom-cli's folders were missed: they
|
|
38
|
+
were listed under the name `zm`, not `zoom-cli`.
|
|
39
|
+
|
|
40
|
+
## 0.679.0 — 16.11.2026
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- **The first screen and first run list `notion`**, the Notion tool (`@wirecat/notion-cli`), under "Works with" and
|
|
45
|
+
among the tools first run offers to install.
|
|
46
|
+
- **`personHistory(store, "person:<id>")`** gives what happened with one person lately, across every source in scope,
|
|
47
|
+
newest first: their one-to-one messages, mail, calendar events and recorded meetings and calls, the same reads a
|
|
48
|
+
deal's and an organization's context make. `limit` (10 by default) ends a page and `next` is the `until` of the
|
|
49
|
+
older one; `since`, `until`, `accounts` and `deniedKinds` narrow it, and `coverage` says what was read.
|
|
50
|
+
- **A touch of a deal's context, and of a person's history, carries what was said**: a message's `text`, and on a
|
|
51
|
+
recorded call its `call` (direction, the employee, the other side's number), `duration_ms` and the start of its
|
|
52
|
+
transcript as `text`. A calendar event a call was held for carries them too.
|
|
53
|
+
- **A recorded meeting in a person's context has `snippet`**, the start of its transcript on one line, beside
|
|
54
|
+
`has_transcript`.
|
|
55
|
+
|
|
56
|
+
### Changed — may break callers
|
|
57
|
+
|
|
58
|
+
- **A saved `exclude` query that matches a page with sub-pages, or a folder, drops the whole branch.** The sub-pages
|
|
59
|
+
stayed in the documents and were listed at the top of the catalog with no parent; the next sync now removes them,
|
|
60
|
+
and the sync no longer lists what is below an excluded folder. A file that also sits under a parent the query keeps
|
|
61
|
+
stays. A selected folder the query matches drops only its own row, as before. Once the folder stops matching, the
|
|
62
|
+
next sync brings the whole branch back. See [Bind a provider](docs/dev/DOCUMENTS.md#bind-a-provider).
|
|
63
|
+
- **`inScope` and `within` take `folders: Record<string, M>`**, the type of the files they check, instead of
|
|
64
|
+
`Record<string, SourceFile>`; `within` is generic and takes an optional `cut` after `seen`.
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- **A documents sync with a deadline shorter than its margin moves on.** The run's budget stops 5 s or more before
|
|
69
|
+
the deadline, and it was asked before the first folder listing and the first file read, so `sync --timeout 3s`
|
|
70
|
+
said "sync again" forever with nothing done. Each call now makes its first listing and its first read while one
|
|
71
|
+
request still fits before the deadline itself, as it already did for the entry bound. See
|
|
72
|
+
[Walks over several syncs](docs/dev/DOCUMENTS.md#walks-over-several-syncs).
|
|
73
|
+
- **`setup apply --dry-run` opens the keyring only when the answers reach a secret.** It read every secret's saved
|
|
74
|
+
state up front, so a dry run of the first step touched the keyring, and the shared deny contract (`cli-contract`,
|
|
75
|
+
WC-PERM-23) failed amo's `contracts:check` once 0.678.0 let an empty dry run through.
|
|
76
|
+
|
|
8
77
|
## 0.678.0 — 16.11.2026
|
|
9
78
|
|
|
10
79
|
### Added
|
|
@@ -14,6 +14,11 @@ export interface Deadline {
|
|
|
14
14
|
export interface RunBudget {
|
|
15
15
|
/** One more request: `null` when it may go, otherwise why not. Once it says no it keeps saying no. */
|
|
16
16
|
take(): BudgetStop | null;
|
|
17
|
+
/**
|
|
18
|
+
* After `take()` said "deadline": whether the call's first request goes anyway. Only while nothing has gone yet,
|
|
19
|
+
* once, and when one request still ends before the deadline itself with time left to answer.
|
|
20
|
+
*/
|
|
21
|
+
first?(): boolean;
|
|
17
22
|
readonly used: number;
|
|
18
23
|
/** `null`: no request limit, only the deadline. */
|
|
19
24
|
readonly limit: number | null;
|
|
@@ -23,6 +28,10 @@ export declare const DEADLINE_MARGIN_MS = 5000;
|
|
|
23
28
|
export declare const DEADLINE_MARGIN_SHARE = 0.15;
|
|
24
29
|
/** How long one request to a provider is expected to take when the CLI does not say (`AppIdentity.requestMs`). */
|
|
25
30
|
export declare const DEFAULT_REQUEST_MS = 2000;
|
|
31
|
+
/** Kept after a request for the answer, the catalog import and the state save. */
|
|
32
|
+
export declare const ANSWER_RESERVE_MS = 500;
|
|
33
|
+
/** Whether one more request still ends before the deadline itself, with time left to answer. */
|
|
34
|
+
export declare const oneMoreFits: (deadline: Deadline | undefined, at: number, requestMs?: number) => boolean;
|
|
26
35
|
export declare const deadlineMargin: (deadline: Deadline) => number;
|
|
27
36
|
/** The requests that fit before the margin: `(deadline − margin) / requestMs`, at least one; none without a deadline. */
|
|
28
37
|
export declare const requestsFor: (deadline: Deadline | undefined, requestMs?: number) => number | null;
|
|
@@ -2,6 +2,10 @@ export const DEADLINE_MARGIN_MS = 5_000;
|
|
|
2
2
|
export const DEADLINE_MARGIN_SHARE = 0.15;
|
|
3
3
|
/** How long one request to a provider is expected to take when the CLI does not say (`AppIdentity.requestMs`). */
|
|
4
4
|
export const DEFAULT_REQUEST_MS = 2_000;
|
|
5
|
+
/** Kept after a request for the answer, the catalog import and the state save. */
|
|
6
|
+
export const ANSWER_RESERVE_MS = 500;
|
|
7
|
+
/** Whether one more request still ends before the deadline itself, with time left to answer. */
|
|
8
|
+
export const oneMoreFits = (deadline, at, requestMs = DEFAULT_REQUEST_MS) => deadline !== undefined && at + requestMs + ANSWER_RESERVE_MS < deadline.endsAt;
|
|
5
9
|
export const deadlineMargin = (deadline) => Math.max(DEADLINE_MARGIN_MS, deadline.ms * DEADLINE_MARGIN_SHARE);
|
|
6
10
|
/** The requests that fit before the margin: `(deadline − margin) / requestMs`, at least one; none without a deadline. */
|
|
7
11
|
export const requestsFor = (deadline, requestMs = DEFAULT_REQUEST_MS) => deadline === undefined ? null : Math.max(1, Math.floor((deadline.ms - deadlineMargin(deadline)) / requestMs));
|
|
@@ -14,6 +18,7 @@ export const runBudget = ({ requests, deadline, requestMs, signal, now = Date.no
|
|
|
14
18
|
const limit = fits === null ? (requests ?? null) : Math.min(fits, requests ?? fits);
|
|
15
19
|
const margin = deadline ? deadlineMargin(deadline) : 0;
|
|
16
20
|
let used = 0;
|
|
21
|
+
let granted = false;
|
|
17
22
|
let stopped = null;
|
|
18
23
|
let last;
|
|
19
24
|
// A request may page inside the source, so the gap between two asks is the honest measure of one.
|
|
@@ -37,6 +42,17 @@ export const runBudget = ({ requests, deadline, requestMs, signal, now = Date.no
|
|
|
37
42
|
last = at;
|
|
38
43
|
return null;
|
|
39
44
|
},
|
|
45
|
+
first() {
|
|
46
|
+
if (granted || used > 0 || stopped !== "deadline")
|
|
47
|
+
return false;
|
|
48
|
+
const at = now();
|
|
49
|
+
if (!oneMoreFits(deadline, at, Math.max(requestMs ?? DEFAULT_REQUEST_MS, slowest)))
|
|
50
|
+
return false;
|
|
51
|
+
granted = true;
|
|
52
|
+
used += 1;
|
|
53
|
+
last = at;
|
|
54
|
+
return true;
|
|
55
|
+
},
|
|
40
56
|
get used() {
|
|
41
57
|
return used;
|
|
42
58
|
},
|
|
@@ -100,6 +100,8 @@ export declare const calendarSync: v.StrictObjectSchema<{
|
|
|
100
100
|
readonly model: v.StringSchema<undefined>;
|
|
101
101
|
readonly embedded: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
102
102
|
readonly left: v.BooleanSchema<undefined>;
|
|
103
|
+
readonly stopped: v.OptionalSchema<v.PicklistSchema<["deadline", "cancelled"], undefined>, undefined>;
|
|
104
|
+
readonly remaining: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
103
105
|
}, undefined>, undefined>;
|
|
104
106
|
/**
|
|
105
107
|
* Each feed's events as read, and how many it could not take (`syncWithFeeds`); `unchanged` when the feed answered
|
|
@@ -71,7 +71,13 @@ export const calendarSync = v.strictObject({
|
|
|
71
71
|
}),
|
|
72
72
|
hint: v.optional(text),
|
|
73
73
|
/** What `sync --embed` embedded: `embedEvents`' answer. */
|
|
74
|
-
embeddings: v.optional(v.strictObject({
|
|
74
|
+
embeddings: v.optional(v.strictObject({
|
|
75
|
+
model: text,
|
|
76
|
+
embedded: count,
|
|
77
|
+
left: v.boolean(),
|
|
78
|
+
stopped: v.optional(v.picklist(["deadline", "cancelled"])),
|
|
79
|
+
remaining: v.optional(count),
|
|
80
|
+
})),
|
|
75
81
|
/**
|
|
76
82
|
* Each feed's events as read, and how many it could not take (`syncWithFeeds`); `unchanged` when the feed answered
|
|
77
83
|
* 304 and the counts are those of the read before.
|
|
@@ -191,6 +191,7 @@ const addCalendarCommandsDefinition = (program, options) => {
|
|
|
191
191
|
if (command.optsWithGlobals().full)
|
|
192
192
|
throw new CliError("validation_error", "sync starts over with --rescan; --full only widens output");
|
|
193
193
|
const { signal } = environmentOf(command);
|
|
194
|
+
const deadline = environmentOf(command).deadline?.();
|
|
194
195
|
await within(command, async (run) => {
|
|
195
196
|
if (opts.embed && !run.messages)
|
|
196
197
|
throw new CliError("configuration_error", "this tool cannot embed events");
|
|
@@ -206,6 +207,8 @@ const addCalendarCommandsDefinition = (program, options) => {
|
|
|
206
207
|
const embeddings = opts.embed && !report.stopped && run.messages
|
|
207
208
|
? await embedEvents(run.messages, {
|
|
208
209
|
maxChunks: EMBED_MAX,
|
|
210
|
+
...(deadline ? { deadline } : {}),
|
|
211
|
+
...(signal ? { signal } : {}),
|
|
209
212
|
...(run.env ? { env: run.env } : {}),
|
|
210
213
|
command: options.app.command,
|
|
211
214
|
})
|
|
@@ -9,7 +9,7 @@ export interface DocumentSyncArgs {
|
|
|
9
9
|
embed?: boolean;
|
|
10
10
|
/** Sized to the run's deadline; pass it to `syncDocuments` so a sync stops in time and says how to go on. */
|
|
11
11
|
budget?: RunBudget;
|
|
12
|
-
/** The run's hard limit; pass it to `syncDocuments
|
|
12
|
+
/** The run's hard limit; pass it to `syncDocuments`, and to `embedNotes` for `--embed`, so both end before it. */
|
|
13
13
|
deadline?: Deadline;
|
|
14
14
|
}
|
|
15
15
|
export interface DocumentSyncAnswer {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import { WIRECAT_TOOLS } from "../../ports/wirecat-tools.js";
|
|
2
3
|
export interface FirstScreenLine {
|
|
3
4
|
/** The command without the tool's name or the profile: `review --since 1d`. */
|
|
4
5
|
command: string;
|
|
@@ -15,15 +16,7 @@ export interface FirstScreen {
|
|
|
15
16
|
/** The first command to run. Unset, `<tool> personal setup` when the tool has `setup`. */
|
|
16
17
|
start?: string;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
command: string;
|
|
20
|
-
/** The npm package `setup` installs it from. */
|
|
21
|
-
package: string;
|
|
22
|
-
shown?: string;
|
|
23
|
-
does: string;
|
|
24
|
-
}
|
|
25
|
-
/** Every WireCat tool, as "Works with" names it; a tool's own entry is left out of its screen. */
|
|
26
|
-
export declare const WIRECAT_TOOLS: readonly Tool[];
|
|
19
|
+
export { WIRECAT_TOOLS };
|
|
27
20
|
/**
|
|
28
21
|
* The screen `<tool> --help` and a bare `<tool>` show: what the tool is for, what it does that a client would not,
|
|
29
22
|
* the other tools, and where the full list, the scenarios and the options are. It never lists every command.
|
|
@@ -36,4 +29,3 @@ export declare const firstScreen: (program: Command, screen?: FirstScreen) => st
|
|
|
36
29
|
* `createProgram` calls it for tg, max and wa.
|
|
37
30
|
*/
|
|
38
31
|
export declare const installHelp: (program: Command, screen?: FirstScreen) => Command;
|
|
39
|
-
export {};
|
|
@@ -2,63 +2,11 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
2
2
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
3
|
import { Command, Help, Option } from "commander";
|
|
4
4
|
import wrapAnsi from "wrap-ansi";
|
|
5
|
+
import { WIRECAT_TOOLS } from "../../ports/wirecat-tools.js";
|
|
5
6
|
import { NO_EFFECTS } from "../effects.js";
|
|
6
7
|
import { commandAt } from "../steps.js";
|
|
7
8
|
import { EXAMPLE_PROFILE, installCommandHelp } from "./command-help.js";
|
|
8
|
-
|
|
9
|
-
export const WIRECAT_TOOLS = [
|
|
10
|
-
{
|
|
11
|
-
command: "tg",
|
|
12
|
-
package: "@wirecat/tg-cli",
|
|
13
|
-
does: "Telegram in the same local store: search, review and tasks offline",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
command: "max",
|
|
17
|
-
package: "@wirecat/max-cli",
|
|
18
|
-
does: "MAX in the same local store: search, review and tasks offline",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
command: "wa",
|
|
22
|
-
package: "@wirecat/whatsapp-cli",
|
|
23
|
-
does: "WhatsApp in the same local store: search, review and tasks offline",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
command: "zm",
|
|
27
|
-
package: "@wirecat/zoom-cli",
|
|
28
|
-
does: "Zoom meetings: transcripts and summaries, searchable with your other WireCat data",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
command: "drive",
|
|
32
|
-
package: "@wirecat/drive-cli",
|
|
33
|
-
does: "Google Drive and Docs as local text, searchable with your other WireCat data",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
command: "gcal",
|
|
37
|
-
package: "@wirecat/gcal-cli",
|
|
38
|
-
does: "Google Calendar events, searchable with your other WireCat data",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
command: "memo",
|
|
42
|
-
package: "@wirecat/cli-memo",
|
|
43
|
-
shown: "memo context <person>",
|
|
44
|
-
does: "one person across messengers, mail, notes and meetings",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
command: "mail",
|
|
48
|
-
package: "@wirecat/mail-cli",
|
|
49
|
-
does: "IMAP mail in the same local store: search your mailbox offline, next to your other WireCat data",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
command: "b24",
|
|
53
|
-
package: "@wirecat/bitrix24-cli",
|
|
54
|
-
does: "Bitrix24 CRM: deals, leads and pipelines, searchable with your other WireCat data",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
command: "pbx",
|
|
58
|
-
package: "@wirecat/asterisk-cli",
|
|
59
|
-
does: "Asterisk PBX calls and recordings, searchable with your other WireCat data",
|
|
60
|
-
},
|
|
61
|
-
];
|
|
9
|
+
export { WIRECAT_TOOLS };
|
|
62
10
|
const WIDTH = 100;
|
|
63
11
|
const widest = (texts) => texts.reduce((most, text) => Math.max(most, text.length), 0);
|
|
64
12
|
const block = (title, rows, column) => rows.length === 0 ? [] : ["", `${title}:`, ...rows.map(([left, right]) => ` ${left.padEnd(column)}${right}`)];
|
|
@@ -45,10 +45,21 @@ export const setupCommand = (setup) => {
|
|
|
45
45
|
warn,
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
-
const currentOf = (command, context) => {
|
|
48
|
+
const currentOf = (command, context, { dryRun = false } = {}) => {
|
|
49
49
|
const { settings, renderer } = context;
|
|
50
50
|
const current = {};
|
|
51
|
-
|
|
51
|
+
let store;
|
|
52
|
+
// Read only when the path reaches the secret: a dry run of the first step must not open the keyring (WC-PERM-23).
|
|
53
|
+
const keptOf = (secret) => {
|
|
54
|
+
try {
|
|
55
|
+
store ??= storeFor(command, renderer.warn);
|
|
56
|
+
return readKept(store, settings.profile, secret) ? { set: true } : undefined;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// A keyring that cannot be read says nothing about the secret; the flow asks for it again.
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
52
63
|
for (const field of allFields(document)) {
|
|
53
64
|
if (field.setting !== undefined) {
|
|
54
65
|
const value = fromFile(settings, field.setting, undefined).value;
|
|
@@ -56,15 +67,22 @@ export const setupCommand = (setup) => {
|
|
|
56
67
|
current[field.setting] = value;
|
|
57
68
|
}
|
|
58
69
|
const secret = secretOf(field);
|
|
59
|
-
if (secret === undefined || current
|
|
70
|
+
if (secret === undefined || secret in current)
|
|
71
|
+
continue;
|
|
72
|
+
// Only `apply` checks a secret, and it keeps the saved one when none is answered: a dry run takes it as kept, so
|
|
73
|
+
// an edit that leaves the password alone can continue, and the keyring stays shut (WC-PERM-23).
|
|
74
|
+
if (dryRun) {
|
|
75
|
+
current[secret] = { set: true };
|
|
60
76
|
continue;
|
|
61
|
-
try {
|
|
62
|
-
if (readKept(store, settings.profile, secret))
|
|
63
|
-
current[secret] = { set: true };
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
// A keyring that cannot be read says nothing about the secret; the flow asks for it again.
|
|
67
77
|
}
|
|
78
|
+
let read;
|
|
79
|
+
Object.defineProperty(current, secret, {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: () => {
|
|
82
|
+
read ??= { value: keptOf(secret) };
|
|
83
|
+
return read.value;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
68
86
|
}
|
|
69
87
|
return current;
|
|
70
88
|
};
|
|
@@ -113,7 +131,7 @@ export const setupCommand = (setup) => {
|
|
|
113
131
|
const context = contextFor(command, true, dryRun);
|
|
114
132
|
const { settings, env } = context;
|
|
115
133
|
const profile = settings.profile;
|
|
116
|
-
const path = walk(setup, answers, { current: currentOf(command, context) });
|
|
134
|
+
const path = walk(setup, answers, { current: currentOf(command, context, { dryRun }) });
|
|
117
135
|
const reached = path.stopped === "run" || path.stopped === "done";
|
|
118
136
|
const told = {
|
|
119
137
|
profile,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { lstatSync, readFileSync
|
|
1
|
+
import { lstatSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
2
3
|
import { isMovedRun, loadConfigFile, saveConfigFile } from "@wirecat/cli-base";
|
|
3
|
-
import { hermesCopyPath, installSkill, skillStatus, skillVersion,
|
|
4
|
+
import { hermesCopyPath, installSkill, skillStatus, skillVersion, writeSkillFolder, } from "@wirecat/cli-base/skill";
|
|
4
5
|
import { isNewer } from "@wirecat/cli-base/update";
|
|
5
6
|
import * as v from "valibot";
|
|
6
7
|
import { envName } from "../ports/app.js";
|
|
@@ -38,7 +39,7 @@ const refreshHermesCopy = (app, skill, env) => {
|
|
|
38
39
|
const installed = skillVersion(readFileSync(path, "utf8"));
|
|
39
40
|
if (installed === undefined || !isNewer(app.version, installed))
|
|
40
41
|
return false;
|
|
41
|
-
|
|
42
|
+
writeSkillFolder(app, skill, dirname(path));
|
|
42
43
|
return true;
|
|
43
44
|
};
|
|
44
45
|
/**
|
package/dist/crm/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type { CrmCallContext, CrmChanges, CrmCondition, CrmGap, CrmIdPage, CrmLi
|
|
|
5
5
|
export { type CrmCursor, type CrmSyncIssue, type CrmSyncOptions, type CrmSyncReport, type CrmSyncResult, crmGapsOf, crmStatus, cursorName, parseCrmCursor, syncCrm, } from "./sync.js";
|
|
6
6
|
/** An adapter's readers of a CRM's raw JSON: `crmValues.text(raw.name)`, `crmValues.time(raw.created_at)`. */
|
|
7
7
|
export * as crmValues from "./values.js";
|
|
8
|
+
export { type CrmViewing, crmViewerOf } from "./viewer.js";
|
|
8
9
|
export { type CrmRows, type CrmWindow, crmWindowOf, walk } from "./walk.js";
|
|
9
10
|
export { CRM_ASSIGN_OTHERS_KEY, CRM_VERBS, CRM_WRITE_DEFAULTS, CRM_WRITE_KEYS, type CrmDraft, type CrmDrafts, type CrmFields, type CrmOrganizationFields, type CrmPersonFields, type CrmVerb, type CrmWriteCapabilities, type CrmWriteFields, type CrmWriteOptions, type CrmWriter, crmAlsoChecks, } from "./writer.js";
|
|
10
11
|
export { type CrmFieldsInput, type CrmRecordInput, type CrmRecordKind, type CrmRecordWritten, type CrmWriteContext, type CrmWrites, type CrmWritten, closeCrmItem, createCrmItem, createCrmRecord, crmCustomValues, fieldNamed, fieldPairsOf, foldFieldName, moveCrmItem, type NamedField, optionOf, removeCrmItem, unknownField, updateCrmItem, updateCrmRecord, } from "./writes.js";
|
package/dist/crm/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { conditionsOf, customConditions, customNames, filterableFields, selected
|
|
|
4
4
|
export { crmGapsOf, crmStatus, cursorName, parseCrmCursor, syncCrm, } from "./sync.js";
|
|
5
5
|
/** An adapter's readers of a CRM's raw JSON: `crmValues.text(raw.name)`, `crmValues.time(raw.created_at)`. */
|
|
6
6
|
export * as crmValues from "./values.js";
|
|
7
|
+
export { crmViewerOf } from "./viewer.js";
|
|
7
8
|
export { crmWindowOf, walk } from "./walk.js";
|
|
8
9
|
export { CRM_ASSIGN_OTHERS_KEY, CRM_VERBS, CRM_WRITE_DEFAULTS, CRM_WRITE_KEYS, crmAlsoChecks, } from "./writer.js";
|
|
9
10
|
export { closeCrmItem, createCrmItem, createCrmRecord, crmCustomValues, fieldNamed, fieldPairsOf, foldFieldName, moveCrmItem, optionOf, removeCrmItem, unknownField, updateCrmItem, updateCrmRecord, } from "./writes.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SourceFile } from "./model.js";
|
|
2
|
-
export declare const within: (file:
|
|
2
|
+
export declare const within: <F extends SourceFile>(file: F, roots: string[], folders: Record<string, F>, seen?: Set<string>, cut?: (folder: F) => boolean) => boolean;
|
|
3
3
|
/**
|
|
4
4
|
* A saved query beside the selected folders: `include` adds the files it finds wherever they sit, `exclude` keeps the
|
|
5
|
-
* files it matches out even inside a selected folder.
|
|
5
|
+
* files it matches out even inside a selected folder, and everything below a folder or page it matches.
|
|
6
6
|
*/
|
|
7
7
|
export interface SourceQuery<M extends SourceFile = SourceFile> {
|
|
8
8
|
/** Part of the sync's scope: a changed query or mode plans the sync again from the start. */
|
|
@@ -12,4 +12,4 @@ export interface SourceQuery<M extends SourceFile = SourceFile> {
|
|
|
12
12
|
/** Every file the query finds, read on each sync: a file shared by another owner may never reach the change feed. */
|
|
13
13
|
list?(): Promise<M[]>;
|
|
14
14
|
}
|
|
15
|
-
export declare const inScope: <M extends SourceFile>(file: M, roots: string[], folders: Record<string,
|
|
15
|
+
export declare const inScope: <M extends SourceFile>(file: M, roots: string[], folders: Record<string, M>, matched?: ReadonlySet<string>, query?: SourceQuery<M>) => boolean;
|
package/dist/documents/scope.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
-
export const within = (file, roots, folders, seen = new Set()) => {
|
|
2
|
+
export const within = (file, roots, folders, seen = new Set(), cut) => {
|
|
3
3
|
if (file.trashed)
|
|
4
4
|
return false;
|
|
5
5
|
if (roots.includes(file.id))
|
|
@@ -9,13 +9,17 @@ export const within = (file, roots, folders, seen = new Set()) => {
|
|
|
9
9
|
const next = new Set([...seen, file.id]);
|
|
10
10
|
return file.parents.some((id) => {
|
|
11
11
|
const folder = folders[id];
|
|
12
|
-
|
|
12
|
+
if (!folder)
|
|
13
|
+
return roots.includes(id);
|
|
14
|
+
// A selected folder is never cut: the owner chose it, so an exclude that matches it drops only its own row.
|
|
15
|
+
return (roots.includes(id) || !cut?.(folder)) && within(folder, roots, folders, next, cut);
|
|
13
16
|
});
|
|
14
17
|
};
|
|
15
18
|
export const inScope = (file, roots, folders, matched = new Set(), query) => {
|
|
16
19
|
if (file.trashed)
|
|
17
20
|
return false;
|
|
18
|
-
|
|
21
|
+
const excluded = query?.mode === "exclude" ? query.matches : undefined;
|
|
22
|
+
if (excluded?.(file))
|
|
19
23
|
return false;
|
|
20
|
-
return matched.has(file.id) || within(file, roots, folders);
|
|
24
|
+
return matched.has(file.id) || within(file, roots, folders, new Set(), excluded);
|
|
21
25
|
};
|
|
@@ -4,6 +4,7 @@ import { DEAL_KINDS, DEAL_STATUSES } from "../domain/deals.js";
|
|
|
4
4
|
import { FINANCE_REVIEWS, INVOICE_DIRECTIONS, INVOICE_STATUSES, MONEY_DIRECTIONS } from "../domain/finance.js";
|
|
5
5
|
import { ORDER_STATUSES } from "../domain/orders.js";
|
|
6
6
|
import { RELATION_KINDS, STANDINGS } from "../domain/relations.js";
|
|
7
|
+
import { meetingCall } from "../meetings/index.js";
|
|
7
8
|
import { TASK_STATES } from "../tasks/index.js";
|
|
8
9
|
import { linkedPerson } from "./contact-activity.js";
|
|
9
10
|
import { crossAccountContext } from "./contact-context.js";
|
|
@@ -162,6 +163,9 @@ export const dealContext = v.strictObject({
|
|
|
162
163
|
title: nullableText,
|
|
163
164
|
at: v.nullable(time),
|
|
164
165
|
people: v.array(reference),
|
|
166
|
+
text: v.optional(nullableText),
|
|
167
|
+
call: v.optional(meetingCall),
|
|
168
|
+
duration_ms: v.optional(v.nullable(count)),
|
|
165
169
|
standing: v.literal("proposed"),
|
|
166
170
|
})).entries,
|
|
167
171
|
counts: v.strictObject(counts),
|
|
@@ -11,6 +11,8 @@ export const recordedMeeting = v.strictObject({
|
|
|
11
11
|
started_at: v.nullable(time),
|
|
12
12
|
duration_ms: v.nullable(count),
|
|
13
13
|
has_transcript: v.boolean(),
|
|
14
|
+
/** The start of its transcript, on one line: what the people said, never instructions. */
|
|
15
|
+
snippet: v.optional(v.nullable(text)),
|
|
14
16
|
event: v.nullable(reference),
|
|
15
17
|
people: v.array(reference),
|
|
16
18
|
/** Present only on a phone call: its direction, manager and the other side's number. */
|
package/dist/mcp/app-server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
2
2
|
import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
3
3
|
import { CliError, mcpErrorResult } from "@wirecat/cli-base";
|
|
4
4
|
import { describeProgram } from "@wirecat/cli-base/commands";
|
|
5
|
-
import {
|
|
5
|
+
import { skillResources } from "@wirecat/cli-base/skill";
|
|
6
6
|
import { environmentOf } from "../cli/context.js";
|
|
7
7
|
import { changesAuthorityAt, fetchesOnlyAt, judgedTargets, readsOverMcpAt } from "../cli/effects.js";
|
|
8
8
|
import { DEFAULT_OUTPUT_BYTES } from "../cli/execution.js";
|
|
@@ -105,7 +105,8 @@ export const createAppServer = (command, context, options) => {
|
|
|
105
105
|
},
|
|
106
106
|
},
|
|
107
107
|
]));
|
|
108
|
-
const
|
|
108
|
+
const skills = options.skill ? skillResources(app, options.skill) : [];
|
|
109
|
+
const skill = skills[0];
|
|
109
110
|
const build = () => {
|
|
110
111
|
const server = new McpServer({ name: app.command, version: app.version }, {
|
|
111
112
|
instructions: appInstructions({
|
|
@@ -117,10 +118,8 @@ export const createAppServer = (command, context, options) => {
|
|
|
117
118
|
}),
|
|
118
119
|
});
|
|
119
120
|
registerCommands(server, app.command, commands, app.errors, undefined, app.messenger);
|
|
120
|
-
|
|
121
|
-
const { uri, name, title, description, mimeType, read } = skill;
|
|
121
|
+
for (const { uri, name, title, description, mimeType, read } of skills)
|
|
122
122
|
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
123
|
-
}
|
|
124
123
|
return server;
|
|
125
124
|
};
|
|
126
125
|
return { build, offered: Object.keys(commands) };
|
package/dist/mcp/bot/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
3
3
|
import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
4
4
|
import { mcpErrorResult } from "@wirecat/cli-base";
|
|
5
5
|
import { flatten } from "@wirecat/cli-base/commands";
|
|
6
|
-
import {
|
|
6
|
+
import { skillResources } from "@wirecat/cli-base/skill";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
import { changesMessenger } from "../../cli/effects.js";
|
|
9
9
|
import { itemOf } from "../../cli/envelope.js";
|
|
@@ -50,7 +50,8 @@ export const createBotServer = (options) => {
|
|
|
50
50
|
const writes = tools
|
|
51
51
|
.filter((tool) => tool.writes && tool.availability?.().available !== false)
|
|
52
52
|
.map((tool) => tool.command);
|
|
53
|
-
const
|
|
53
|
+
const skills = options.skill ? skillResources(bot.app, options.skill) : [];
|
|
54
|
+
const skill = skills[0];
|
|
54
55
|
// One at a time: the commands share the journal, the registry and the local copy.
|
|
55
56
|
let queue = Promise.resolve();
|
|
56
57
|
const invoke = (path, input, caller) => {
|
|
@@ -78,10 +79,8 @@ export const createBotServer = (options) => {
|
|
|
78
79
|
...(skill ? { skill: skill.instruction } : {}),
|
|
79
80
|
}),
|
|
80
81
|
});
|
|
81
|
-
|
|
82
|
-
const { uri, name, title, description, mimeType, read } = skill;
|
|
82
|
+
for (const { uri, name, title, description, mimeType, read } of skills)
|
|
83
83
|
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
84
|
-
}
|
|
85
84
|
const commands = Object.fromEntries(tools.map((tool) => [
|
|
86
85
|
tool.command,
|
|
87
86
|
{
|
package/dist/mcp/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
3
3
|
import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
4
4
|
import { CliError, errorObjectOf, mcpErrorResult } from "@wirecat/cli-base";
|
|
5
5
|
import { describeProgram } from "@wirecat/cli-base/commands";
|
|
6
|
-
import {
|
|
6
|
+
import { skillResources } from "@wirecat/cli-base/skill";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
import { findCommand } from "../cli/command-contract.js";
|
|
9
9
|
import { environmentOf } from "../cli/context.js";
|
|
@@ -182,7 +182,8 @@ export const createServer = (command, context, messenger, sessionOptions) => {
|
|
|
182
182
|
...(messenger.diagnose ? { [messenger.provider]: await messenger.diagnose(command, context) } : {}),
|
|
183
183
|
}),
|
|
184
184
|
});
|
|
185
|
-
const
|
|
185
|
+
const skills = messenger.skill ? skillResources(app, messenger.skill) : [];
|
|
186
|
+
const skill = skills[0];
|
|
186
187
|
const log = agentLog(() => openStore({ env: context.env, command: app.command, version: app.version }));
|
|
187
188
|
const audit = async (call, caller) => {
|
|
188
189
|
if (!recalledAccount(app, provider, settings.profile, context.env))
|
|
@@ -370,10 +371,8 @@ export const createServer = (command, context, messenger, sessionOptions) => {
|
|
|
370
371
|
});
|
|
371
372
|
},
|
|
372
373
|
});
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
server.registerResource(resource, uri, { title, description, mimeType }, read);
|
|
376
|
-
}
|
|
374
|
+
for (const { uri, name, title, description, mimeType, read } of skills)
|
|
375
|
+
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
377
376
|
return server;
|
|
378
377
|
};
|
|
379
378
|
return { session, embedders, build, log, offered: [...commands.map((one) => one.command), ...pictured] };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface WireCatTool {
|
|
2
|
+
command: string;
|
|
3
|
+
/** Its `AppIdentity.appName` and `envPrefix`: where its folders are, which no other tool may send. */
|
|
4
|
+
appName: string;
|
|
5
|
+
envPrefix: string;
|
|
6
|
+
/** The npm package `setup` installs it from. */
|
|
7
|
+
package: string;
|
|
8
|
+
shown?: string;
|
|
9
|
+
does: string;
|
|
10
|
+
}
|
|
11
|
+
/** Every WireCat tool, as "Works with" names it; a tool's own entry is left out of its screen. */
|
|
12
|
+
export declare const WIRECAT_TOOLS: readonly WireCatTool[];
|