@wirecat/cli-memo 0.131.53 → 0.131.55
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/dist/author.d.ts +2 -0
- package/dist/author.d.ts.map +1 -1
- package/dist/author.js +3 -1
- package/dist/author.js.map +1 -1
- package/dist/bin/memo.js +2 -2
- package/dist/bundle/{auto-JV4T2URZ.js → auto-K7FXWNR2.js} +5 -5
- package/dist/bundle/{chunk-LBGZT3W4.js → chunk-ACSHPLHQ.js} +3 -3
- package/dist/bundle/{chunk-WXFNUZZU.js → chunk-BSA22I76.js} +2 -2
- package/dist/bundle/{chunk-CQPZUKTI.js → chunk-DIFRVXKQ.js} +1 -0
- package/dist/bundle/{chunk-WNQUOEUV.js → chunk-IR45YH4T.js} +1 -1
- package/dist/bundle/{chunk-D63QZQR7.js → chunk-LWWJW5V7.js} +2 -2
- package/dist/bundle/{chunk-LCP4TVBX.js → chunk-MMWIVZ7F.js} +1 -1
- package/dist/bundle/{chunk-I3TF3CDE.js → chunk-XD52BEML.js} +3 -3
- package/dist/bundle/{chunk-F3BUTC2N.js → chunk-YHHR7NQ3.js} +1 -1
- package/dist/bundle/{failure-XQ7TMBYM.js → failure-PFBL75CT.js} +3 -3
- package/dist/bundle/memo.js +5 -5
- package/dist/bundle/{program-LE3UATKG.js → program-W35YGVVL.js} +159 -60
- package/dist/bundle/{server-MU43SKL5.js → server-7VLGYAOI.js} +7 -7
- package/dist/bundle/{update-TO3RIYTH.js → update-WJ2N47FV.js} +4 -4
- package/dist/mcp/catalogue.js +1 -1
- package/dist/mcp/catalogue.js.map +1 -1
- package/dist/notes/command.d.ts.map +1 -1
- package/dist/notes/command.js +18 -2
- package/dist/notes/command.js.map +1 -1
- package/dist/schedule/mail-triage-input.d.ts +21 -5
- package/dist/schedule/mail-triage-input.d.ts.map +1 -1
- package/dist/schedule/mail-triage-input.js +111 -12
- package/dist/schedule/mail-triage-input.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
autoState,
|
|
7
7
|
lastAutoRun,
|
|
8
8
|
recordAutoRun
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XD52BEML.js";
|
|
10
10
|
import {
|
|
11
11
|
installer,
|
|
12
12
|
latest,
|
|
13
13
|
upgradeCommand
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ACSHPLHQ.js";
|
|
15
15
|
import {
|
|
16
16
|
mcpOwnerAllowed,
|
|
17
17
|
readOnlyAvailability,
|
|
18
18
|
refuseWritesUnderLock
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BSA22I76.js";
|
|
20
20
|
import {
|
|
21
21
|
answers,
|
|
22
22
|
atDetail,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
trackAnswers,
|
|
27
27
|
wholeList,
|
|
28
28
|
withStore
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LWWJW5V7.js";
|
|
30
30
|
import {
|
|
31
31
|
ATTACHMENT_CHARS,
|
|
32
32
|
DIALECTS,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
showMail,
|
|
57
57
|
unsetConfigKey,
|
|
58
58
|
updateConfig
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-YHHR7NQ3.js";
|
|
60
60
|
import "./chunk-QP3KNC5D.js";
|
|
61
61
|
import "./chunk-5UM2OEOR.js";
|
|
62
62
|
import "./chunk-JBQP2M7J.js";
|
|
@@ -64,8 +64,9 @@ import "./chunk-PHP3T567.js";
|
|
|
64
64
|
import {
|
|
65
65
|
errorObject,
|
|
66
66
|
recognisable
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-IR45YH4T.js";
|
|
68
68
|
import {
|
|
69
|
+
AGENT_INPUT_MAX_CHARS,
|
|
69
70
|
DISCOVERY_DESCRIPTIONS,
|
|
70
71
|
DOCTOR_DEEP_OPTION,
|
|
71
72
|
addContractInfo,
|
|
@@ -101,7 +102,7 @@ import {
|
|
|
101
102
|
tasksCommand,
|
|
102
103
|
tasksStatsCommand,
|
|
103
104
|
withSqliteSidecars
|
|
104
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-DIFRVXKQ.js";
|
|
105
106
|
import "./chunk-34GJQ4ZR.js";
|
|
106
107
|
import "./chunk-JB43Q2QL.js";
|
|
107
108
|
import {
|
|
@@ -334,7 +335,7 @@ import {
|
|
|
334
335
|
REASONS,
|
|
335
336
|
STORE_CLIENT,
|
|
336
337
|
VERSION
|
|
337
|
-
} from "./chunk-
|
|
338
|
+
} from "./chunk-MMWIVZ7F.js";
|
|
338
339
|
import "./chunk-IK6KH3RE.js";
|
|
339
340
|
import "./chunk-SW6C6WH5.js";
|
|
340
341
|
import "./chunk-D72URWJE.js";
|
|
@@ -433,8 +434,9 @@ var ownerSays = /* @__PURE__ */ __name(async (command, question) => {
|
|
|
433
434
|
if (!/^\s*y(es)?\s*$/i.test(answer))
|
|
434
435
|
throw new CliError("cancelled", "not done \u2014 the answer was no");
|
|
435
436
|
}, "ownerSays");
|
|
437
|
+
var isMcpRun = /* @__PURE__ */ __name((command, env) => environmentOf(command).agent !== void 0 || env.AI_AGENT === "memo-mcp", "isMcpRun");
|
|
436
438
|
var whoRuns = /* @__PURE__ */ __name(async (command, env, { asOwner = false, question }) => {
|
|
437
|
-
if (
|
|
439
|
+
if (isMcpRun(command, env)) {
|
|
438
440
|
if (asOwner)
|
|
439
441
|
throw new CliError("permission_error", "an agent cannot act as the owner; the owner runs this command");
|
|
440
442
|
return { bot: agentIn(env) ?? "memo-mcp" };
|
|
@@ -912,7 +914,7 @@ var reviewText = /* @__PURE__ */ __name((items, hasMore) => {
|
|
|
912
914
|
for (const item of items)
|
|
913
915
|
groups.set(sourceOf2(item), [...groups.get(sourceOf2(item)) ?? [], item]);
|
|
914
916
|
const pad = " ".repeat(width);
|
|
915
|
-
const
|
|
917
|
+
const lines2 = [...groups].flatMap(([source, group], at) => [
|
|
916
918
|
...at === 0 ? [] : [""],
|
|
917
919
|
source,
|
|
918
920
|
...group.flatMap((item) => {
|
|
@@ -931,7 +933,7 @@ var reviewText = /* @__PURE__ */ __name((items, hasMore) => {
|
|
|
931
933
|
return [head, ...why ? [`${pad} ${why}`] : [], ...parts];
|
|
932
934
|
})
|
|
933
935
|
]);
|
|
934
|
-
return [...
|
|
936
|
+
return [...lines2, `${items.length} shown${hasMore ? ", more with --page" : ""}`].join("\n");
|
|
935
937
|
}, "reviewText");
|
|
936
938
|
var decidedText = /* @__PURE__ */ __name(({ decided, refused }) => [
|
|
937
939
|
...decided.map((one2) => `${one2.status.padEnd(9)} ${one2.id}${one2.made.length ? ` \u2192 ${one2.made.join(" ")}` : ""}`),
|
|
@@ -1821,8 +1823,8 @@ var configCommand = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
1821
1823
|
const values = rows.map((row) => `${JSON.stringify(row.value)}${row.from === "default" ? " (default)" : ""}`);
|
|
1822
1824
|
const wide = /* @__PURE__ */ __name((texts) => texts.reduce((most, text3) => Math.max(most, text3.length), 0), "wide");
|
|
1823
1825
|
const [settingWidth, valueWidth] = [wide(rows.map((row) => row.setting)), wide(values)];
|
|
1824
|
-
const
|
|
1825
|
-
print(options.json, itemAnswer({ path: configPath(env), found: raw !== void 0, settings: rows }), [configPath(env), ...
|
|
1826
|
+
const lines2 = rows.map((row, at) => `${row.setting.padEnd(settingWidth)} ${values[at]?.padEnd(valueWidth)} ${row.description}`);
|
|
1827
|
+
print(options.json, itemAnswer({ path: configPath(env), found: raw !== void 0, settings: rows }), [configPath(env), ...lines2].join("\n"));
|
|
1826
1828
|
});
|
|
1827
1829
|
annotate(config.command("migrate"), { effects: LOCAL_WRITE }).description("write each setting the file lacks at its default, keeping yours").option("--json", "print JSON; --json=id,title keeps only those fields").action((options) => {
|
|
1828
1830
|
const added = migrateConfig(env);
|
|
@@ -4974,9 +4976,9 @@ var financeText = /* @__PURE__ */ __name((block) => block.length === 0 ? [] : [
|
|
|
4974
4976
|
"books (confirmed invoices and payments):",
|
|
4975
4977
|
...block.map((one2) => {
|
|
4976
4978
|
const refs = [...one2.invoices, ...one2.payments];
|
|
4977
|
-
const
|
|
4979
|
+
const shown2 = refs.slice(0, 6).join(" ") + (refs.length > 6 ? ` +${refs.length - 6}` : "");
|
|
4978
4980
|
const loose = one2.unallocated === moneyOf(0, one2.currency).amount ? "" : `, ${one2.unallocated} not matched`;
|
|
4979
|
-
return ` ${WHO[one2.direction]} ${one2.currency}: billed ${one2.billed}, paid ${one2.paid}, owed ${one2.owed}${loose} \xB7 ${
|
|
4981
|
+
return ` ${WHO[one2.direction]} ${one2.currency}: billed ${one2.billed}, paid ${one2.paid}, owed ${one2.owed}${loose} \xB7 ${shown2}`;
|
|
4980
4982
|
})
|
|
4981
4983
|
], "financeText");
|
|
4982
4984
|
|
|
@@ -5795,9 +5797,9 @@ var runChild = /* @__PURE__ */ __name((command, args, { env, signal, onStderr })
|
|
|
5795
5797
|
stdout += chunk;
|
|
5796
5798
|
});
|
|
5797
5799
|
child.stderr.setEncoding("utf8").on("data", (chunk) => {
|
|
5798
|
-
const
|
|
5799
|
-
pending2 =
|
|
5800
|
-
for (const line3 of
|
|
5800
|
+
const lines2 = (pending2 + chunk).split("\n");
|
|
5801
|
+
pending2 = lines2.pop() ?? "";
|
|
5802
|
+
for (const line3 of lines2)
|
|
5801
5803
|
if (line3)
|
|
5802
5804
|
onStderr?.(line3);
|
|
5803
5805
|
});
|
|
@@ -6871,12 +6873,12 @@ var messagesCommand = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
6871
6873
|
return;
|
|
6872
6874
|
}
|
|
6873
6875
|
const emails = await withStore(env, async (store) => {
|
|
6874
|
-
const
|
|
6876
|
+
const shown2 = await showMail(store, reference2, {
|
|
6875
6877
|
before: options.beforeN,
|
|
6876
6878
|
after: options.afterN,
|
|
6877
6879
|
full: options.full === true
|
|
6878
6880
|
});
|
|
6879
|
-
return Promise.all(
|
|
6881
|
+
return Promise.all(shown2.map(async (email) => ({
|
|
6880
6882
|
...email,
|
|
6881
6883
|
...options.trimmed ? { text: mailOwnText(email.text) } : {},
|
|
6882
6884
|
ref: email.locator,
|
|
@@ -6906,7 +6908,7 @@ var mcpCommandDefinition = /* @__PURE__ */ __name((program, streams, env, create
|
|
|
6906
6908
|
}).summary("serve this profile's commands to an AI agent").description("serve memo commands over MCP on stdio or authenticated HTTP, limited by saved permissions").option("--permission <key=level>", "tighten one saved permission for this server; repeat for more keys", (value, previous = []) => [...previous, value]).option("--http", "serve on 127.0.0.1 behind an HTTPS tunnel with an owner access-code login").option("--port <port>", `local HTTP port (default ${DEFAULT_PORT}); requires --http`).option("--public-url <url>", "tunnel's HTTPS address without /mcp, or a path of it such as https://<name>.ts.net/memo; requires --http").action(async (options) => {
|
|
6907
6909
|
if (!options.http && (options.port !== void 0 || options.publicUrl !== void 0))
|
|
6908
6910
|
throw new CliError("validation_error", "--port and --public-url require --http");
|
|
6909
|
-
const { createMemoServer } = await import("./server-
|
|
6911
|
+
const { createMemoServer } = await import("./server-7VLGYAOI.js");
|
|
6910
6912
|
const build = /* @__PURE__ */ __name(() => createMemoServer(env, createProgram2, options.permission), "build");
|
|
6911
6913
|
if (options.http) {
|
|
6912
6914
|
const { httpLockFile, mcpUrlOf, portOf, publicUrlOf, serveOverHttp } = await import("./mcp-I72UY3QP.js");
|
|
@@ -6977,7 +6979,7 @@ var mcpCommandDefinition = /* @__PURE__ */ __name((program, streams, env, create
|
|
|
6977
6979
|
argv: ["mcp", "serve", "--http"],
|
|
6978
6980
|
version: APP.version
|
|
6979
6981
|
}), "target"),
|
|
6980
|
-
answer: /* @__PURE__ */ __name((self, item,
|
|
6982
|
+
answer: /* @__PURE__ */ __name((self, item, lines2) => out.print(self.opts().json, itemAnswer(item), lines2.join("\n")), "answer")
|
|
6981
6983
|
});
|
|
6982
6984
|
for (const command of server.commands)
|
|
6983
6985
|
command.option("--json", "print JSON");
|
|
@@ -7097,46 +7099,46 @@ var prepareStoredMeeting = /* @__PURE__ */ __name(async (store, env, source, ser
|
|
|
7097
7099
|
|
|
7098
7100
|
// dist/meetings/preparation-text.js
|
|
7099
7101
|
var preparationText = /* @__PURE__ */ __name((item) => {
|
|
7100
|
-
const
|
|
7102
|
+
const lines2 = [
|
|
7101
7103
|
`${item.series?.title ?? item.upcoming.meeting_id} \u2014 stored meeting preparation`,
|
|
7102
7104
|
"Next meeting: unverified; no provider calendar was read.",
|
|
7103
7105
|
`History: ${item.history_window.after} to ${item.history_window.before} (exclusive)`,
|
|
7104
7106
|
`Archive completeness: ${item.coverage.archive_completeness}`
|
|
7105
7107
|
];
|
|
7106
7108
|
for (const entry of [...item.meetings, ...item.related.items]) {
|
|
7107
|
-
|
|
7109
|
+
lines2.push("", `${entry.ref} ${entry.meeting.started_at ?? "undated"} ${entry.meeting.title ?? "untitled"}`);
|
|
7108
7110
|
for (const cue of entry.evidence.items)
|
|
7109
|
-
|
|
7111
|
+
lines2.push(` ${cue.ref} ${cue.speaker_name ?? "unknown speaker"}: ${cue.text}`);
|
|
7110
7112
|
if (entry.evidence.coverage.has_more)
|
|
7111
|
-
|
|
7113
|
+
lines2.push(" More transcript evidence available; use --json for references.");
|
|
7112
7114
|
}
|
|
7113
7115
|
if (!item.meetings.length)
|
|
7114
|
-
|
|
7116
|
+
lines2.push("No stored occurrences found in this series and history window.");
|
|
7115
7117
|
for (const fact of item.knowledge?.items ?? [])
|
|
7116
|
-
|
|
7118
|
+
lines2.push(`Fact ${fact.ref}: ${fact.statement}`);
|
|
7117
7119
|
for (const note of item.notes?.items ?? [])
|
|
7118
|
-
|
|
7120
|
+
lines2.push(`Note ${note.ref}: ${note.text}`);
|
|
7119
7121
|
if (item.project_evidence)
|
|
7120
|
-
|
|
7122
|
+
lines2.push(`Project word evidence: ${item.project_evidence.project}; use --json to inspect candidates.`);
|
|
7121
7123
|
if (item.communications) {
|
|
7122
|
-
|
|
7124
|
+
lines2.push("", `Communications: literal words \u201C${item.communications.coverage.query}\u201D`);
|
|
7123
7125
|
for (const source of item.communications.coverage.sources) {
|
|
7124
|
-
|
|
7126
|
+
lines2.push(` ${source.selection_id}: ${source.state}; index ${source.index}; completeness ${source.completeness}`);
|
|
7125
7127
|
if (source.has_more)
|
|
7126
|
-
|
|
7128
|
+
lines2.push(" More matches available; use --json for the source cursor.");
|
|
7127
7129
|
if (source.restart_required)
|
|
7128
|
-
|
|
7130
|
+
lines2.push(" Some matches were omitted; restart with a larger output budget.");
|
|
7129
7131
|
}
|
|
7130
7132
|
for (const excerpt2 of item.communications.items)
|
|
7131
|
-
|
|
7133
|
+
lines2.push(`${excerpt2.ref} ${excerpt2.at}: ${excerpt2.text}`);
|
|
7132
7134
|
} else
|
|
7133
|
-
|
|
7135
|
+
lines2.push("Communications: not queried; select --context-source and --context-query to include them.");
|
|
7134
7136
|
if (item.coverage.history_has_more)
|
|
7135
|
-
|
|
7137
|
+
lines2.push("More series history available; raise --meetings.");
|
|
7136
7138
|
if (item.coverage.output_limited)
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
return
|
|
7139
|
+
lines2.push("Output limited; raise --bytes to include more evidence.");
|
|
7140
|
+
lines2.push("Use --json for linked people, projects, facts, notes, tasks and full coverage.");
|
|
7141
|
+
return lines2.join("\n");
|
|
7140
7142
|
}, "preparationText");
|
|
7141
7143
|
|
|
7142
7144
|
// dist/meetings/preparation-command.js
|
|
@@ -7427,6 +7429,18 @@ var NOTES_LIST_QUERY = {
|
|
|
7427
7429
|
termField("text", "txt", "text:budget")
|
|
7428
7430
|
]
|
|
7429
7431
|
};
|
|
7432
|
+
var refuseOverMcp = /* @__PURE__ */ __name((options, mcp2) => {
|
|
7433
|
+
if (!mcp2)
|
|
7434
|
+
return;
|
|
7435
|
+
if (options.textFile !== void 0)
|
|
7436
|
+
throw new CliError("permission_error", "over MCP a note's text is given as text, never read from a file", {
|
|
7437
|
+
param: "text_file"
|
|
7438
|
+
});
|
|
7439
|
+
if (options.export !== void 0)
|
|
7440
|
+
throw new CliError("permission_error", "over MCP a note is not written as a file; the owner exports it", {
|
|
7441
|
+
param: "export"
|
|
7442
|
+
});
|
|
7443
|
+
}, "refuseOverMcp");
|
|
7430
7444
|
var textOf = /* @__PURE__ */ __name((options, given) => {
|
|
7431
7445
|
const sources = [given, options.text, options.textFile].filter((value) => value !== void 0);
|
|
7432
7446
|
if (sources.length !== 1)
|
|
@@ -7518,7 +7532,8 @@ var notesCommandDefinition = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
7518
7532
|
output: { entity: "note" },
|
|
7519
7533
|
literal_after_dashes: true
|
|
7520
7534
|
}).description("write a note of your own about messages, people, projects or other notes").argument("[text]", "the note; or --text, or --text-file").option("--text <text>", "the note").option("--text-file <path>", "read the note from a file; - reads stdin").option("--title <title>", "a title").option("--subject <ref>", "what it is about: <messenger>:<name or id>, msg:, chat:, person:, organization:, project:, task:, note:, document:, meeting:; repeat for more", collect).option("--meeting <id>", "also about this meeting, by its store id, with --account");
|
|
7521
|
-
writeOptions(noteAdd, `the account of --meeting: ${MEETING_WRITE_HELP}`).option("--export [dir]", "also write it as a file \u2014 to this folder, or notes.export.dir").option("--format <format>", `the file's format: ${DIALECTS.join(", ")}`, formatOf).option("--json", "print JSON; --json=id,title keeps only those fields").action(async (given, options) => {
|
|
7535
|
+
writeOptions(noteAdd, `the account of --meeting: ${MEETING_WRITE_HELP}`).option("--export [dir]", "also write it as a file \u2014 to this folder, or notes.export.dir").option("--format <format>", `the file's format: ${DIALECTS.join(", ")}`, formatOf).option("--json", "print JSON; --json=id,title keeps only those fields").action(async (given, options, command) => {
|
|
7536
|
+
refuseOverMcp(options, isMcpRun(command, env));
|
|
7522
7537
|
const body = textOf(options, given);
|
|
7523
7538
|
const value = writeAccountOf(options, (text3) => streams.diagnostic(text3));
|
|
7524
7539
|
if (options.meeting === void 0 && value !== void 0)
|
|
@@ -7539,7 +7554,8 @@ var notesCommandDefinition = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
7539
7554
|
});
|
|
7540
7555
|
print(options.json, itemAnswer(answer), answer.ref);
|
|
7541
7556
|
});
|
|
7542
|
-
annotate(notes2.command("edit"), { effects: LOCAL_WRITE, output: { entity: "note" }, literal_after_dashes: true }).description("change a note you wrote here; a file's note is edited in its file").argument("<id>", "note:<id>").requiredOption("--revision <n>", "its current revision, so an edit made meanwhile is not lost", positive).option("--text <text>", "the new text").option("--text-file <path>", "read the new text from a file; - reads stdin").option("--export [dir]", "also rewrite its file \u2014 in this folder, or notes.export.dir").option("--format <format>", `the file's format: ${DIALECTS.join(", ")}`, formatOf).option("--json", "print JSON; --json=id,title keeps only those fields").action(async (id, options) => {
|
|
7557
|
+
annotate(notes2.command("edit"), { effects: LOCAL_WRITE, output: { entity: "note" }, literal_after_dashes: true }).description("change a note you wrote here; a file's note is edited in its file").argument("<id>", "note:<id>").requiredOption("--revision <n>", "its current revision, so an edit made meanwhile is not lost", positive).option("--text <text>", "the new text").option("--text-file <path>", "read the new text from a file; - reads stdin").option("--export [dir]", "also rewrite its file \u2014 in this folder, or notes.export.dir").option("--format <format>", `the file's format: ${DIALECTS.join(", ")}`, formatOf).option("--json", "print JSON; --json=id,title keeps only those fields").action(async (id, options, command) => {
|
|
7558
|
+
refuseOverMcp(options, isMcpRun(command, env));
|
|
7543
7559
|
const body = textOf(options);
|
|
7544
7560
|
const answer = await withNotes(async (store) => {
|
|
7545
7561
|
await refuseBareNumber(store, id, ["note"]);
|
|
@@ -8403,22 +8419,22 @@ var reviewCommand = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
8403
8419
|
});
|
|
8404
8420
|
json6(annotate(review.command("show"), { effects: LOCAL_READ })).description("one proposal with its titles, signals and the text around each piece of evidence").argument("<id>", "the proposal's id, as review lists it: 17070, fact:512, memory:88, link:17, payment:4, close:Q-15").option("--brief", "only references and their titles, without excerpts or nearby text").option("--before-n <n>", "messages or document paragraphs before the evidence, at most 5", whole, 2).option("--after-n <n>", "messages or document paragraphs after the evidence, at most 5", whole, 2).option("--compact", "one line, as review prints it").action(async (id, given) => {
|
|
8405
8421
|
const body = await withStore(env, async (store) => {
|
|
8406
|
-
const
|
|
8422
|
+
const shown2 = await showReview(store, env, id);
|
|
8407
8423
|
const window = {
|
|
8408
8424
|
brief: given.brief === true,
|
|
8409
8425
|
before: Math.min(given.beforeN, 5),
|
|
8410
8426
|
after: Math.min(given.afterN, 5)
|
|
8411
8427
|
};
|
|
8412
|
-
const evidence = await Promise.all(
|
|
8428
|
+
const evidence = await Promise.all(shown2.evidence.map(async (one2) => {
|
|
8413
8429
|
const sender = window.brief ? null : await senderOf(store, one2.ref);
|
|
8414
8430
|
return {
|
|
8415
|
-
...window.brief ? {} : await evidenceContext(store, one2.ref, null,
|
|
8431
|
+
...window.brief ? {} : await evidenceContext(store, one2.ref, null, shown2.reason ?? "", window),
|
|
8416
8432
|
...one2,
|
|
8417
8433
|
...sender === null ? {} : { sender },
|
|
8418
8434
|
untrusted: EVIDENCE_UNTRUSTED
|
|
8419
8435
|
};
|
|
8420
8436
|
}));
|
|
8421
|
-
return itemAnswer({ ...
|
|
8437
|
+
return itemAnswer({ ...shown2, evidence });
|
|
8422
8438
|
});
|
|
8423
8439
|
print(given.json, body, void 0, given.compact);
|
|
8424
8440
|
});
|
|
@@ -8668,6 +8684,7 @@ var syncCommand = /* @__PURE__ */ __name((program, streams, env, signal) => {
|
|
|
8668
8684
|
|
|
8669
8685
|
// dist/schedule/mail-triage-input.js
|
|
8670
8686
|
var SKILL = "mail-triage";
|
|
8687
|
+
var INPUT_BUDGET = AGENT_INPUT_MAX_CHARS - 1e3;
|
|
8671
8688
|
var FIELDS = [
|
|
8672
8689
|
"ref",
|
|
8673
8690
|
"chat_id",
|
|
@@ -8679,37 +8696,119 @@ var FIELDS = [
|
|
|
8679
8696
|
"email.new_sender",
|
|
8680
8697
|
"email.sender_identities",
|
|
8681
8698
|
"email.bulk",
|
|
8682
|
-
"email.excerpt_only"
|
|
8699
|
+
"email.excerpt_only",
|
|
8700
|
+
"email.cursor",
|
|
8701
|
+
"email.findings_key"
|
|
8683
8702
|
].join(",");
|
|
8684
8703
|
var stepArg = /* @__PURE__ */ __name((review, step, arg) => review.next?.find((one2) => one2.step === step)?.args?.[arg], "stepArg");
|
|
8685
|
-
var
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
const cursor
|
|
8704
|
+
var shown = /* @__PURE__ */ __name((item) => {
|
|
8705
|
+
if (!item.email)
|
|
8706
|
+
return JSON.stringify(item);
|
|
8707
|
+
const { cursor: _cursor, findings_key: _key, ...email } = item.email;
|
|
8708
|
+
return JSON.stringify({ ...item, email });
|
|
8709
|
+
}, "shown");
|
|
8710
|
+
var cutsOf = /* @__PURE__ */ __name((items) => {
|
|
8711
|
+
const cuts = /* @__PURE__ */ new Map();
|
|
8712
|
+
for (const item of items) {
|
|
8713
|
+
const cursor = item.email?.cursor;
|
|
8714
|
+
if (!cursor)
|
|
8715
|
+
return void 0;
|
|
8716
|
+
const cut2 = cuts.get(cursor) ?? { cursor, key: item.email?.findings_key, items: [] };
|
|
8717
|
+
cut2.items.push(item);
|
|
8718
|
+
cuts.set(cursor, cut2);
|
|
8719
|
+
}
|
|
8720
|
+
return [...cuts.values()].sort((a, b) => Number.parseInt(a.cursor, 10) - Number.parseInt(b.cursor, 10));
|
|
8721
|
+
}, "cutsOf");
|
|
8722
|
+
var lines = /* @__PURE__ */ __name((source, review, { key, cursor, items, waiting: waiting2 }) => {
|
|
8689
8723
|
const left = (review.missing ?? []).map((one2) => one2.why).filter(Boolean);
|
|
8690
8724
|
return [
|
|
8691
8725
|
`## ${source}`,
|
|
8692
8726
|
...key ? [`key: ${key}`] : [],
|
|
8693
8727
|
`cursor: ${cursor ?? "none"}`,
|
|
8694
|
-
`more mail waits past the cursor: ${review.meta?.complete === false}`,
|
|
8728
|
+
waiting2 > 0 ? `more mail waits past the cursor: true \u2014 ${waiting2} emails did not fit this input; the next run reads them, do not review this mailbox again now` : `more mail waits past the cursor: ${review.meta?.complete === false}`,
|
|
8695
8729
|
...left.length ? [`left out: ${left.join("; ")}`] : [],
|
|
8730
|
+
...items.some((item) => item.text_cut) ? [
|
|
8731
|
+
"text_cut: only the start of that email's text fits here; read it whole with `memo messages show '<ref>' --trimmed --json` before you stage a finding from it"
|
|
8732
|
+
] : [],
|
|
8696
8733
|
items.length ? "emails, one JSON per line:" : "no emails; acknowledge the cursor.",
|
|
8697
|
-
...items.map(
|
|
8734
|
+
...items.map(shown)
|
|
8698
8735
|
].join("\n");
|
|
8736
|
+
}, "lines");
|
|
8737
|
+
var LEAST_TEXT = 300;
|
|
8738
|
+
var startOf = /* @__PURE__ */ __name((text3, length) => {
|
|
8739
|
+
const end = /[\uD800-\uDBFF]/.test(text3.charAt(length - 1)) ? length - 1 : length;
|
|
8740
|
+
return text3.slice(0, Math.max(0, end));
|
|
8741
|
+
}, "startOf");
|
|
8742
|
+
var shortened = /* @__PURE__ */ __name((items, room, least, block) => {
|
|
8743
|
+
const longest = items.reduce((most, item) => Math.max(most, item.text?.length ?? 0), 0);
|
|
8744
|
+
const cut2 = /* @__PURE__ */ __name((share2) => items.map((item) => (item.text?.length ?? 0) <= share2 ? item : { ...item, text: startOf(item.text ?? "", share2), text_cut: true }), "cut");
|
|
8745
|
+
let share = longest;
|
|
8746
|
+
for (let over = block(cut2(share)).length - room; over > 0; over = block(cut2(share)).length - room) {
|
|
8747
|
+
if (share === 0)
|
|
8748
|
+
return void 0;
|
|
8749
|
+
share = Math.max(0, share - Math.ceil(over / items.length));
|
|
8750
|
+
}
|
|
8751
|
+
return share < Math.min(least, longest) ? void 0 : cut2(share);
|
|
8752
|
+
}, "shortened");
|
|
8753
|
+
var mailboxBlock = /* @__PURE__ */ __name((source, review, room = Number.POSITIVE_INFINITY, alone = false) => {
|
|
8754
|
+
const items = review.items ?? [];
|
|
8755
|
+
const key = stepArg(review, "mail-findings.add", "key");
|
|
8756
|
+
const cursor = stepArg(review, "mail-messages.acknowledge", "cursor");
|
|
8757
|
+
const whole2 = lines(source, review, { key, cursor, items, waiting: 0 });
|
|
8758
|
+
if (whole2.length <= room)
|
|
8759
|
+
return whole2;
|
|
8760
|
+
const cuts = cutsOf(items) ?? [];
|
|
8761
|
+
let fit;
|
|
8762
|
+
for (let end = 1; end < cuts.length; end++) {
|
|
8763
|
+
const kept = new Set(cuts.slice(0, end).flatMap((cut2) => cut2.items));
|
|
8764
|
+
const at = cuts[end - 1];
|
|
8765
|
+
const block = lines(source, review, {
|
|
8766
|
+
key: at?.key,
|
|
8767
|
+
cursor: at?.cursor,
|
|
8768
|
+
items: items.filter((item) => kept.has(item)),
|
|
8769
|
+
waiting: items.length - kept.size
|
|
8770
|
+
});
|
|
8771
|
+
if (block.length > room)
|
|
8772
|
+
break;
|
|
8773
|
+
fit = block;
|
|
8774
|
+
}
|
|
8775
|
+
if (fit)
|
|
8776
|
+
return fit;
|
|
8777
|
+
const [first] = cuts;
|
|
8778
|
+
if (first) {
|
|
8779
|
+
const block = /* @__PURE__ */ __name((group2) => lines(source, review, {
|
|
8780
|
+
key: first.key,
|
|
8781
|
+
cursor: first.cursor,
|
|
8782
|
+
items: group2,
|
|
8783
|
+
waiting: items.length - group2.length
|
|
8784
|
+
}), "block");
|
|
8785
|
+
const group = shortened(first.items, room, alone ? 0 : LEAST_TEXT, block);
|
|
8786
|
+
if (group)
|
|
8787
|
+
return block(group);
|
|
8788
|
+
}
|
|
8789
|
+
return `## ${source}
|
|
8790
|
+
no room in this input: do not acknowledge this mailbox and do not review it now; the next run reads it.`;
|
|
8699
8791
|
}, "mailboxBlock");
|
|
8700
|
-
var PREAMBLE = "Your first reads are below, already done: the mail-triage skill and each mailbox's review. Do not run `memo skill show` or `memo mail review`. Start at step 2 of the skill. Stage each mailbox's findings in ONE `memo mail findings add` call, all mailboxes in the same turn, without `--dry-run`. Then acknowledge each mailbox's cursor (also a mailbox with nothing to stage), then write the report.";
|
|
8792
|
+
var PREAMBLE = "Your first reads are below, already done: the mail-triage skill and each mailbox's review. Do not run `memo skill show` or `memo mail review`. Start at step 2 of the skill. Stage each mailbox's findings in ONE `memo mail findings add` call, all mailboxes in the same turn, without `--dry-run`. Then acknowledge each mailbox's cursor (also a mailbox with nothing to stage) except one marked \"do not acknowledge\", then write the report.";
|
|
8701
8793
|
var mailTriageInput = /* @__PURE__ */ __name((mailboxes) => async (schedule, run) => {
|
|
8702
8794
|
const holder = schedule.onNewMail;
|
|
8703
8795
|
if (!holder)
|
|
8704
8796
|
return void 0;
|
|
8705
8797
|
const skill2 = await run(["skill", "show", SKILL]);
|
|
8706
|
-
const
|
|
8798
|
+
const parts = [PREAMBLE, "# The skill", skill2.trim(), "# The review"];
|
|
8799
|
+
const separator = "\n\n";
|
|
8800
|
+
let used = parts.join(separator).length + separator.length * 2;
|
|
8801
|
+
let alone = true;
|
|
8707
8802
|
for (const address of await mailboxes()) {
|
|
8708
8803
|
const source = `email:${address}`;
|
|
8709
8804
|
const review = JSON.parse(await run(["mail", "review", "--holder", holder, "--source", source, `--json=${FIELDS}`]));
|
|
8710
|
-
|
|
8805
|
+
const block = mailboxBlock(source, review, INPUT_BUDGET - used - separator.length, alone);
|
|
8806
|
+
parts.push(block);
|
|
8807
|
+
used += block.length + separator.length;
|
|
8808
|
+
if (block.includes("\nemails, one JSON per line:"))
|
|
8809
|
+
alone = false;
|
|
8711
8810
|
}
|
|
8712
|
-
return [
|
|
8811
|
+
return [...parts, ""].join(separator);
|
|
8713
8812
|
}, "mailTriageInput");
|
|
8714
8813
|
|
|
8715
8814
|
// dist/schedule/command.js
|
|
@@ -9266,9 +9365,9 @@ var tagsCommand = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
9266
9365
|
}) : { items: [], hasMore: false };
|
|
9267
9366
|
const knowledge = owned.items;
|
|
9268
9367
|
answer.hasMore ||= owned.hasMore;
|
|
9269
|
-
const
|
|
9368
|
+
const lines2 = answer.items.map((row) => `${row.tag} ${row.type} ${row.locator ?? (row.type === "contact" ? `${row.provider}:${row.personId ?? ""}` : reference(row, row.chatId ?? ""))}`);
|
|
9270
9369
|
if (answer.hasMore)
|
|
9271
|
-
|
|
9370
|
+
lines2.push("More labels match; raise --limit to see them.");
|
|
9272
9371
|
answer.hasMore ||= knowledge.length > options.limit;
|
|
9273
9372
|
print(options.json, listAnswer("tags list", {
|
|
9274
9373
|
items: [
|
|
@@ -9279,7 +9378,7 @@ var tagsCommand = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
9279
9378
|
has_more: answer.hasMore,
|
|
9280
9379
|
meta: { accounts: keys.map(accountName) }
|
|
9281
9380
|
}), [
|
|
9282
|
-
...
|
|
9381
|
+
...lines2,
|
|
9283
9382
|
...knowledge.slice(0, options.limit).map((item) => `${item.labels.map(({ tag: tag2, origin }) => origin === "file" ? `${tag2} (file)` : tag2).join(", ")} ${item.target.type} ${item.target.type === "message" ? item.target.locator : `${item.target.type}:${item.target.id}`}`)
|
|
9284
9383
|
].join("\n") || "No source tags.");
|
|
9285
9384
|
});
|
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
memoLevels,
|
|
7
7
|
readOnly,
|
|
8
8
|
refuseUnknownPermissions
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BSA22I76.js";
|
|
10
10
|
import {
|
|
11
11
|
itemAnswer
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-LWWJW5V7.js";
|
|
13
|
+
import "./chunk-YHHR7NQ3.js";
|
|
14
14
|
import "./chunk-QP3KNC5D.js";
|
|
15
15
|
import "./chunk-3MWNNJII.js";
|
|
16
16
|
import {
|
|
17
17
|
errorObject,
|
|
18
18
|
mcpFailure,
|
|
19
19
|
throwParseFailures
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-IR45YH4T.js";
|
|
21
|
+
import "./chunk-DIFRVXKQ.js";
|
|
22
22
|
import "./chunk-34GJQ4ZR.js";
|
|
23
23
|
import "./chunk-O7CBAY6J.js";
|
|
24
24
|
import "./chunk-JB43Q2QL.js";
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
APP,
|
|
91
91
|
STORE_CLIENT,
|
|
92
92
|
VERSION
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-MMWIVZ7F.js";
|
|
94
94
|
import "./chunk-IK6KH3RE.js";
|
|
95
95
|
import "./chunk-SW6C6WH5.js";
|
|
96
96
|
import "./chunk-D72URWJE.js";
|
|
@@ -144,7 +144,7 @@ var commandCatalogue = /* @__PURE__ */ __name((env, createProgram) => {
|
|
|
144
144
|
const tools = toolsFromCommands(commands, {
|
|
145
145
|
stdin,
|
|
146
146
|
exclude: MCP_EXCLUSIONS.map(({ path }) => path),
|
|
147
|
-
omit: ["as_owner", "compact", "debug", "from_app", "json", "jsonl", "no_input", "record"]
|
|
147
|
+
omit: ["as_owner", "compact", "debug", "from_app", "json", "jsonl", "no_input", "record", "text_file", "export"]
|
|
148
148
|
});
|
|
149
149
|
for (const tool of tools)
|
|
150
150
|
if (stdin(tool.path)) {
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
runUpdate,
|
|
8
8
|
updateNotice,
|
|
9
9
|
upgradeCommand
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-ACSHPLHQ.js";
|
|
11
|
+
import "./chunk-YHHR7NQ3.js";
|
|
12
12
|
import "./chunk-QP3KNC5D.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-DIFRVXKQ.js";
|
|
14
14
|
import "./chunk-34GJQ4ZR.js";
|
|
15
15
|
import "./chunk-JB43Q2QL.js";
|
|
16
16
|
import "./chunk-DDD3CXHR.js";
|
|
@@ -47,7 +47,7 @@ import "./chunk-VPCNLTME.js";
|
|
|
47
47
|
import "./chunk-26QKDK5P.js";
|
|
48
48
|
import "./chunk-OSPAMIIY.js";
|
|
49
49
|
import "./chunk-RSBROHX4.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-MMWIVZ7F.js";
|
|
51
51
|
import "./chunk-IK6KH3RE.js";
|
|
52
52
|
import "./chunk-SW6C6WH5.js";
|
|
53
53
|
import "./chunk-D72URWJE.js";
|
package/dist/mcp/catalogue.js
CHANGED
|
@@ -38,7 +38,7 @@ export const commandCatalogue = (env, createProgram) => {
|
|
|
38
38
|
const tools = toolsFromCommands(commands, {
|
|
39
39
|
stdin,
|
|
40
40
|
exclude: MCP_EXCLUSIONS.map(({ path }) => path),
|
|
41
|
-
omit: ["as_owner", "compact", "debug", "from_app", "json", "jsonl", "no_input", "record"],
|
|
41
|
+
omit: ["as_owner", "compact", "debug", "from_app", "json", "jsonl", "no_input", "record", "text_file", "export"],
|
|
42
42
|
});
|
|
43
43
|
for (const tool of tools)
|
|
44
44
|
if (stdin(tool.path)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../../src/mcp/catalogue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,cAAc,EAAgB,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACzF,OAAO,EAAqB,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAG9G,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAI/D,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,EAAE,IAAI,EAAE,CA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,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE;YAC9E,KAAK;YACL,SAAS;YACT,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,CAAC,UAAU,CAAC,EAAE;YAChF,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;YACpB,KAAK;SACN,CAAC,CACH;KACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/notes/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAM1D,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/notes/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAM1D,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,WAAW,CAAA;AAwE9D,QAAA,MAAM,sBAAsB,YAAa,OAAO,WAAW,OAAO,OAAO,MAAM,CAAC,UAAU,KAAG,IAyO5F,CAAA;AAOD,eAAO,MAAM,YAAY,YAAa,UAAU,CAAC,OAAO,sBAAsB,CAAC,SAY9E,CAAA"}
|
package/dist/notes/command.js
CHANGED
|
@@ -6,6 +6,7 @@ import { contextEvidenceFingerprint } from "@wirecat/cli-core/services";
|
|
|
6
6
|
import { InvalidArgumentError } from "commander";
|
|
7
7
|
import { answers, itemAnswer, listAnswer, withStore } from "../answer.js";
|
|
8
8
|
import { APP } from "../app.js";
|
|
9
|
+
import { isMcpRun } from "../author.js";
|
|
9
10
|
import { loadConfig } from "../config.js";
|
|
10
11
|
import { SHELL_OVERRIDES } from "../contract-overrides.js";
|
|
11
12
|
import { collect, positive } from "../options.js";
|
|
@@ -37,6 +38,19 @@ const NOTES_LIST_QUERY = {
|
|
|
37
38
|
termField("text", "txt", "text:budget"),
|
|
38
39
|
],
|
|
39
40
|
};
|
|
41
|
+
/** Over MCP `-` would read the server's own stdin, a path a file of this computer, and `--export` write anywhere. */
|
|
42
|
+
const refuseOverMcp = (options, mcp) => {
|
|
43
|
+
if (!mcp)
|
|
44
|
+
return;
|
|
45
|
+
if (options.textFile !== undefined)
|
|
46
|
+
throw new CliError("permission_error", "over MCP a note's text is given as text, never read from a file", {
|
|
47
|
+
param: "text_file",
|
|
48
|
+
});
|
|
49
|
+
if (options.export !== undefined)
|
|
50
|
+
throw new CliError("permission_error", "over MCP a note is not written as a file; the owner exports it", {
|
|
51
|
+
param: "export",
|
|
52
|
+
});
|
|
53
|
+
};
|
|
40
54
|
const textOf = (options, given) => {
|
|
41
55
|
const sources = [given, options.text, options.textFile].filter((value) => value !== undefined);
|
|
42
56
|
if (sources.length !== 1)
|
|
@@ -155,7 +169,8 @@ const notesCommandDefinition = (program, streams, env) => {
|
|
|
155
169
|
.option("--export [dir]", "also write it as a file — to this folder, or notes.export.dir")
|
|
156
170
|
.option("--format <format>", `the file's format: ${DIALECTS.join(", ")}`, formatOf)
|
|
157
171
|
.option("--json", "print JSON; --json=id,title keeps only those fields")
|
|
158
|
-
.action(async (given, options) => {
|
|
172
|
+
.action(async (given, options, command) => {
|
|
173
|
+
refuseOverMcp(options, isMcpRun(command, env));
|
|
159
174
|
const body = textOf(options, given);
|
|
160
175
|
const value = writeAccountOf(options, (text) => streams.diagnostic(text));
|
|
161
176
|
if (options.meeting === undefined && value !== undefined)
|
|
@@ -185,7 +200,8 @@ const notesCommandDefinition = (program, streams, env) => {
|
|
|
185
200
|
.option("--export [dir]", "also rewrite its file — in this folder, or notes.export.dir")
|
|
186
201
|
.option("--format <format>", `the file's format: ${DIALECTS.join(", ")}`, formatOf)
|
|
187
202
|
.option("--json", "print JSON; --json=id,title keeps only those fields")
|
|
188
|
-
.action(async (id, options) => {
|
|
203
|
+
.action(async (id, options, command) => {
|
|
204
|
+
refuseOverMcp(options, isMcpRun(command, env));
|
|
189
205
|
const body = textOf(options);
|
|
190
206
|
const answer = await withNotes(async (store) => {
|
|
191
207
|
await refuseBareNumber(store, id, ["note"]);
|