@wirecat/cli-memo 0.131.74 → 0.131.75
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/bin/memo.js +2 -2
- package/dist/bundle/{app-server-2LQJZC7Z.js → app-server-TRRARE66.js} +6 -6
- package/dist/bundle/{auto-OCCPDCFY.js → auto-AQAKW55Z.js} +12 -12
- package/dist/bundle/{chunk-6Q3JHCU7.js → chunk-2QND7VJS.js} +3 -3
- package/dist/bundle/{chunk-3BEJUJEL.js → chunk-346PWQJF.js} +2 -2
- package/dist/bundle/{chunk-WM7MVKGU.js → chunk-4XI7S3PO.js} +2 -2
- package/dist/bundle/{chunk-GPXHGG67.js → chunk-5CTOWPOL.js} +1 -1
- package/dist/bundle/{chunk-P6FPRA3P.js → chunk-5RLCKP5E.js} +1 -1
- package/dist/bundle/{chunk-AHAW3TOS.js → chunk-6VMIMAZ2.js} +1 -1
- package/dist/bundle/{chunk-HEYIBJ5I.js → chunk-7Y4HUYI3.js} +17 -5
- package/dist/bundle/{chunk-VRL5WRRQ.js → chunk-AOHT5FNX.js} +3 -3
- package/dist/bundle/{chunk-WBCY7WHV.js → chunk-EWRHTZD3.js} +2 -2
- package/dist/bundle/{chunk-BNJ2XK7D.js → chunk-FGMFJUHR.js} +53 -10
- package/dist/bundle/{chunk-EML43XLJ.js → chunk-GFVSZY4J.js} +25 -1
- package/dist/bundle/{chunk-GWNLLQBD.js → chunk-OWUEEVF6.js} +1 -1
- package/dist/bundle/{chunk-WFXRR2JT.js → chunk-RZS24U4N.js} +2 -2
- package/dist/bundle/{chunk-3OVYPDT6.js → chunk-VFKCZJFT.js} +3 -3
- package/dist/bundle/{chunk-QCR5WJ7R.js → chunk-W64FO6DD.js} +6 -6
- package/dist/bundle/{chunk-BR4DCOA5.js → chunk-WKLF7CAM.js} +5 -5
- package/dist/bundle/{chunk-OOKMABOJ.js → chunk-ZISVFVQU.js} +2 -0
- package/dist/bundle/{chunk-CWWUZK2U.js → chunk-ZP2XI5DR.js} +3 -3
- package/dist/bundle/{entry-7EYT2OA3.js → entry-TBOYUMWB.js} +1 -1
- package/dist/bundle/{failure-YQJ43YFG.js → failure-EKMEAYZH.js} +10 -10
- package/dist/bundle/{first-run-C7L7IACA.js → first-run-HQ4GA4EF.js} +1 -1
- package/dist/bundle/{mcp-UCDMODSA.js → mcp-DEY765VA.js} +4 -4
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{program-RHPSSKFA.js → program-OGDARQTX.js} +2930 -2445
- package/dist/bundle/{server-3TQJ47Q6.js → server-3UX245DY.js} +6 -6
- package/dist/bundle/{server-SHHKLBS2.js → server-6G5XF3V5.js} +4 -4
- package/dist/bundle/{server-FX7RKPL4.js → server-ADPO4V4B.js} +15 -15
- package/dist/bundle/{store-K45RFKGF.js → store-GSZAXU3A.js} +1 -1
- package/dist/bundle/{store-maintenance-command-EOTKQ3E5.js → store-maintenance-command-QMTALGSQ.js} +4 -4
- package/dist/bundle/{update-PW77Y4DM.js → update-HDJ23IV5.js} +11 -11
- package/dist/digest/backfill.d.ts +1 -1
- package/dist/digest/backfill.d.ts.map +1 -1
- package/dist/digest/backfill.js +71 -42
- package/dist/digest/backfill.js.map +1 -1
- package/dist/digest/brief.d.ts +14 -3
- package/dist/digest/brief.d.ts.map +1 -1
- package/dist/digest/brief.js +84 -34
- package/dist/digest/brief.js.map +1 -1
- package/dist/digest/command.d.ts +3 -0
- package/dist/digest/command.d.ts.map +1 -1
- package/dist/digest/command.js +23 -0
- package/dist/digest/command.js.map +1 -1
- package/dist/digest/digest-commands.d.ts +6 -0
- package/dist/digest/digest-commands.d.ts.map +1 -0
- package/dist/digest/digest-commands.js +241 -0
- package/dist/digest/digest-commands.js.map +1 -0
- package/dist/digest/digest.d.ts +5 -2
- package/dist/digest/digest.d.ts.map +1 -1
- package/dist/digest/digest.js +29 -8
- package/dist/digest/digest.js.map +1 -1
- package/dist/digest/digests.d.ts +72 -0
- package/dist/digest/digests.d.ts.map +1 -0
- package/dist/digest/digests.js +122 -0
- package/dist/digest/digests.js.map +1 -0
- package/dist/digest/tasks.d.ts +7 -4
- package/dist/digest/tasks.d.ts.map +1 -1
- package/dist/digest/tasks.js +13 -5
- package/dist/digest/tasks.js.map +1 -1
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +15 -1
- package/dist/examples.js.map +1 -1
- package/dist/people/command.d.ts +0 -1
- package/dist/people/command.d.ts.map +1 -1
- package/dist/people/command.js +114 -12
- package/dist/people/command.js.map +1 -1
- package/dist/program.d.ts +4 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +9 -5
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +24 -0
- package/dist/reasons.js.map +1 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +13 -1
- package/dist/rows.js.map +1 -1
- package/dist/schedule/command.d.ts +8 -0
- package/dist/schedule/command.d.ts.map +1 -1
- package/dist/schedule/command.js +4 -2
- package/dist/schedule/command.js.map +1 -1
- package/dist/search/people.d.ts +2 -0
- package/dist/search/people.d.ts.map +1 -1
- package/dist/search/people.js +11 -4
- package/dist/search/people.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/digest/brief.js
CHANGED
|
@@ -4,27 +4,78 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { CliError } from "@wirecat/cli-base";
|
|
6
6
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
7
|
-
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "@wirecat/cli-core/cli";
|
|
7
|
+
import { grantsAuthority, isCalendar, LOCAL_READ, LOCAL_WRITE, readSchedule, slotsOf, } from "@wirecat/cli-core/cli";
|
|
8
8
|
import { storePath } from "@wirecat/cli-core/store";
|
|
9
9
|
import { Command, Option } from "commander";
|
|
10
10
|
import { itemAnswer, withStore } from "../answer.js";
|
|
11
11
|
import { authorOf } from "../author.js";
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { agendaFlags, briefAddress, digestScheduleFile, isDigest, MORNING_DIGEST, readDefinition, runningDigest, windowStart, } from "./digests.js";
|
|
13
|
+
/** A digest's brief address; the brief is kept in the templates table, beside the templates, with history and undo. */
|
|
14
|
+
const addressOf = (env, name) => {
|
|
15
|
+
const digest = name ?? MORNING_DIGEST;
|
|
16
|
+
if (digest !== MORNING_DIGEST && !isDigest(env, digest))
|
|
17
|
+
throw new CliError("not_found", `no digest ${digest} — \`memo digest list\` names them`, {
|
|
18
|
+
reason: "digest.not-found",
|
|
19
|
+
});
|
|
20
|
+
return briefAddress(digest);
|
|
21
|
+
};
|
|
14
22
|
/** The brief goes into every scheduled run's prompt, so its size is its cost. */
|
|
15
23
|
export const BRIEF_LIMIT = 4000;
|
|
16
|
-
/**
|
|
17
|
-
export const readBrief = async (env) => {
|
|
24
|
+
/** A digest's brief, or undefined; a machine with no store yet has none, and reading it creates no store. */
|
|
25
|
+
export const readBrief = async (env, name = MORNING_DIGEST) => {
|
|
18
26
|
if (!existsSync(storePath(env)))
|
|
19
27
|
return undefined;
|
|
20
|
-
return withStore(env, async (store) => store.templates.get(
|
|
28
|
+
return withStore(env, async (store) => store.templates.get(briefAddress(name))?.body);
|
|
29
|
+
};
|
|
30
|
+
/** Checks a brief the owner gives and saves it; the body it replaces stays in the history. */
|
|
31
|
+
export const checkedBrief = (given, kept = "") => {
|
|
32
|
+
const body = given.trim();
|
|
33
|
+
if (!body)
|
|
34
|
+
throw new CliError("validation_error", `the brief is empty; memo digest brief reset removes it${kept}`, {
|
|
35
|
+
reason: "brief.empty",
|
|
36
|
+
});
|
|
37
|
+
if (body.length > BRIEF_LIMIT)
|
|
38
|
+
throw new CliError("validation_error", `the brief is ${body.length} characters; the limit is ${BRIEF_LIMIT}, because every run reads ` +
|
|
39
|
+
`it and pays for it. Nothing was saved${kept}`, { reason: "brief.too-long", chars: body.length, limit: BRIEF_LIMIT });
|
|
40
|
+
return body;
|
|
21
41
|
};
|
|
22
42
|
/** The morning-digest skill with the owner's brief after it, as the last word (NEED-2457). */
|
|
23
|
-
export const withBrief = (skill, brief) =>
|
|
24
|
-
? skill
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
export const withBrief = (skill, brief, digest) => {
|
|
44
|
+
const shown = digest === undefined ? skill : `${skill}\n\n${digest}`;
|
|
45
|
+
return brief === undefined
|
|
46
|
+
? shown
|
|
47
|
+
: `${shown}\n\n## The owner's brief\n\n` +
|
|
48
|
+
"The owner wrote this himself: it adds to everything above, and where it contradicts a rule of this skill, " +
|
|
49
|
+
`the brief wins.\n\n${brief.trim()}`;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* What `skill show morning-digest` adds for the digest a scheduled run belongs to (`MEMO_SCHEDULED`): its window and
|
|
53
|
+
* sources when it is a named digest, and its brief. The morning digest made before names existed gets its brief alone.
|
|
54
|
+
*/
|
|
55
|
+
export const digestAddendum = async (env, now = Date.now()) => {
|
|
56
|
+
const name = runningDigest(env);
|
|
57
|
+
const brief = await readBrief(env, name);
|
|
58
|
+
const definition = readDefinition(env, name);
|
|
59
|
+
const file = digestScheduleFile(env, name);
|
|
60
|
+
if (!existsSync(file))
|
|
61
|
+
return { brief, digest: undefined };
|
|
62
|
+
const { when } = readSchedule(file);
|
|
63
|
+
const slots = isCalendar(when) ? slotsOf(when) : [];
|
|
64
|
+
// The skill's own `--since-time 1d` is already right for a morning digest that runs once a day.
|
|
65
|
+
if (!definition && !(slots.length > 1 || slots.some((slot) => slot.on)))
|
|
66
|
+
return { brief, digest: undefined };
|
|
67
|
+
const sources = definition?.sources ?? [];
|
|
68
|
+
const flags = agendaFlags(windowStart(when, now), sources);
|
|
69
|
+
return {
|
|
70
|
+
brief,
|
|
71
|
+
digest: `## This digest: ${definition?.title ?? "Morning digest"}\n\n` +
|
|
72
|
+
"Unless your input has a `backfill:` line, the agenda call is " +
|
|
73
|
+
`\`memo review agenda --compact ${flags}\`: this digest reads from its previous time` +
|
|
74
|
+
(sources.length ? `, and only ${sources.join(", ")}; leave everything else out of the report too.` : ".") +
|
|
75
|
+
" Where this skill says `--since-time 1d`, give that call the same `--since-time` instead. " +
|
|
76
|
+
`Keep \`"kind": "morning-digest"\` in the report: it names the report's shape, not the digest.`,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
28
79
|
const systemEditor = (path, env) => {
|
|
29
80
|
const editor = env.VISUAL?.trim() || env.EDITOR?.trim();
|
|
30
81
|
if (!editor)
|
|
@@ -36,14 +87,14 @@ const systemEditor = (path, env) => {
|
|
|
36
87
|
if (ran.status !== 0)
|
|
37
88
|
throw new CliError("validation_error", `the editor exited with ${ran.status ?? ran.signal}; nothing was saved`);
|
|
38
89
|
};
|
|
39
|
-
const refuseAgent = (env) => {
|
|
90
|
+
export const refuseAgent = (env) => {
|
|
40
91
|
// The brief may override the digest skill's rules, so an agent writing it could steer every later run.
|
|
41
92
|
if (authorOf(env) !== "owner")
|
|
42
93
|
throw new CliError("permission_error", "only the owner changes the digest brief, not an agent", {
|
|
43
94
|
reason: "brief.owner-only",
|
|
44
95
|
});
|
|
45
96
|
};
|
|
46
|
-
const historyOf = (store) => store.templates.history(
|
|
97
|
+
const historyOf = (store, address) => store.templates.history(address).map((entry) => ({
|
|
47
98
|
saved_at: new Date(entry.savedAt).toISOString(),
|
|
48
99
|
saved_by: entry.savedBy,
|
|
49
100
|
replaced_at: new Date(entry.replacedAt).toISOString(),
|
|
@@ -58,36 +109,40 @@ export const briefCommand = (digest, print, env, editor = systemEditor) => {
|
|
|
58
109
|
`stays read only, with memo as its only tool and the schedule's cost cap. At most ${BRIEF_LIMIT} characters`);
|
|
59
110
|
digest.addCommand(brief);
|
|
60
111
|
annotate(brief.command("show"), { effects: LOCAL_READ })
|
|
61
|
-
.summary("the brief
|
|
112
|
+
.summary("the brief a digest follows, and the bodies your changes replaced")
|
|
113
|
+
.argument("[digest]", `the digest's name, as \`memo digest list\` shows it; ${MORNING_DIGEST} when left out`)
|
|
62
114
|
.option("--json", "print JSON")
|
|
63
|
-
.action(async (given) => {
|
|
115
|
+
.action(async (name, given) => {
|
|
116
|
+
const address = addressOf(env, name);
|
|
64
117
|
const item = existsSync(storePath(env))
|
|
65
118
|
? await withStore(env, async (store) => {
|
|
66
|
-
const row = store.templates.get(
|
|
119
|
+
const row = store.templates.get(address);
|
|
67
120
|
return {
|
|
68
121
|
body: row?.body ?? null,
|
|
69
122
|
chars: row?.body.length ?? 0,
|
|
70
123
|
limit: BRIEF_LIMIT,
|
|
71
124
|
updated_at: row ? new Date(row.updatedAt).toISOString() : null,
|
|
72
125
|
updated_by: row?.updatedBy ?? null,
|
|
73
|
-
history: historyOf(store),
|
|
126
|
+
history: historyOf(store, address),
|
|
74
127
|
};
|
|
75
128
|
})
|
|
76
129
|
: { body: null, chars: 0, limit: BRIEF_LIMIT, updated_at: null, updated_by: null, history: [] };
|
|
77
|
-
print(given.json, itemAnswer(item), item.body ?? "No brief: the
|
|
130
|
+
print(given.json, itemAnswer(item), item.body ?? "No brief: the digest follows its skill alone. `memo digest brief edit` writes one.");
|
|
78
131
|
});
|
|
79
132
|
grantsAuthority(annotate(brief.command("edit"), { effects: LOCAL_WRITE }))
|
|
80
133
|
.summary("write the brief in $EDITOR or from --file; only you, never an agent")
|
|
81
134
|
.description(`write the brief in $EDITOR, or from --file; at most ${BRIEF_LIMIT} characters. The body it replaces is kept, ` +
|
|
82
135
|
"and --undo puts it back. Only you change it, never an agent or a read-only run")
|
|
136
|
+
.argument("[digest]", `the digest's name, as \`memo digest list\` shows it; ${MORNING_DIGEST} when left out`)
|
|
83
137
|
.option("--file <file>", "take the brief from this file instead of opening an editor; - reads stdin")
|
|
84
138
|
.addOption(new Option("--undo", "put back the body your last change replaced").conflicts("file"))
|
|
85
139
|
.option("--json", "print JSON")
|
|
86
|
-
.action(async (given) => {
|
|
140
|
+
.action(async (name, given) => {
|
|
87
141
|
refuseAgent(env);
|
|
142
|
+
const address = addressOf(env, name);
|
|
88
143
|
const { current, previous } = await withStore(env, async (store) => ({
|
|
89
|
-
current: store.templates.get(
|
|
90
|
-
previous: store.templates.history(
|
|
144
|
+
current: store.templates.get(address)?.body,
|
|
145
|
+
previous: store.templates.history(address, 1)[0]?.body,
|
|
91
146
|
}));
|
|
92
147
|
let draft;
|
|
93
148
|
let body;
|
|
@@ -108,35 +163,30 @@ export const briefCommand = (digest, print, env, editor = systemEditor) => {
|
|
|
108
163
|
body = readFileSync(draft, "utf8");
|
|
109
164
|
}
|
|
110
165
|
const kept = draft ? `. Your text is in ${draft}; fix it and run again with --file ${draft}` : "";
|
|
111
|
-
body = body
|
|
112
|
-
if (!body)
|
|
113
|
-
throw new CliError("validation_error", `the brief is empty; memo digest brief reset removes it${kept}`, {
|
|
114
|
-
reason: "brief.empty",
|
|
115
|
-
});
|
|
116
|
-
if (body.length > BRIEF_LIMIT)
|
|
117
|
-
throw new CliError("validation_error", `the brief is ${body.length} characters; the limit is ${BRIEF_LIMIT}, because every morning run reads ` +
|
|
118
|
-
`it and pays for it. Nothing was saved${kept}`, { reason: "brief.too-long", chars: body.length, limit: BRIEF_LIMIT });
|
|
166
|
+
body = checkedBrief(body, kept);
|
|
119
167
|
if (draft)
|
|
120
168
|
rmSync(join(draft, ".."), { recursive: true, force: true });
|
|
121
169
|
if (body === current) {
|
|
122
170
|
print(given.json, itemAnswer({ changed: false, chars: body.length }), "The brief is unchanged; nothing saved.");
|
|
123
171
|
return;
|
|
124
172
|
}
|
|
125
|
-
const saved = await withStore(env, async (store) => store.templates.save(
|
|
173
|
+
const saved = await withStore(env, async (store) => store.templates.save(address, body, "memo"));
|
|
126
174
|
print(given.json, itemAnswer({
|
|
127
175
|
changed: true,
|
|
128
176
|
chars: body.length,
|
|
129
177
|
limit: BRIEF_LIMIT,
|
|
130
178
|
updated_at: new Date(saved.updatedAt).toISOString(),
|
|
131
|
-
}), `Saved the brief (${body.length} of ${BRIEF_LIMIT} characters); the next
|
|
179
|
+
}), `Saved the brief (${body.length} of ${BRIEF_LIMIT} characters); the digest's next run follows it.`);
|
|
132
180
|
});
|
|
133
181
|
grantsAuthority(annotate(brief.command("reset"), { effects: LOCAL_WRITE }))
|
|
134
182
|
.summary("remove the brief; edit --undo brings it back")
|
|
135
|
-
.description("remove the brief, so the
|
|
183
|
+
.description("remove the brief, so the digest follows its skill alone; edit --undo brings it back")
|
|
184
|
+
.argument("[digest]", `the digest's name, as \`memo digest list\` shows it; ${MORNING_DIGEST} when left out`)
|
|
136
185
|
.option("--json", "print JSON")
|
|
137
|
-
.action(async (given) => {
|
|
186
|
+
.action(async (name, given) => {
|
|
138
187
|
refuseAgent(env);
|
|
139
|
-
const
|
|
188
|
+
const address = addressOf(env, name);
|
|
189
|
+
const changed = await withStore(env, async (store) => store.templates.reset(address));
|
|
140
190
|
print(given.json, itemAnswer({ changed }), changed ? "Removed the brief; memo digest brief edit --undo brings it back." : "There was no brief.");
|
|
141
191
|
});
|
|
142
192
|
};
|
package/dist/digest/brief.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brief.js","sourceRoot":"","sources":["../../src/digest/brief.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"brief.js","sourceRoot":"","sources":["../../src/digest/brief.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB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C,MAAM,OAAO,WAAW,iDAAiD,CACnG,CAAA;IACH,CAAC,CAAC,CAAA;IAEJ,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;SACxE,OAAO,CAAC,8CAA8C,CAAC;SACvD,WAAW,CAAC,qFAAqF,CAAC;SAClG,QAAQ,CAAC,UAAU,EAAE,wDAAwD,cAAc,gBAAgB,CAAC;SAC5G,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC9B,MAAM,CAAC,KAAK,EAAE,IAAwB,EAAE,KAAyB,EAAE,EAAE;QACpE,WAAW,CAAC,GAAG,CAAC,CAAA;QAChB,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACpC,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;QACrF,KAAK,CACH,KAAK,CAAC,IAAI,EACV,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,EACvB,OAAO,CAAC,CAAC,CAAC,kEAAkE,CAAC,CAAC,CAAC,qBAAqB,CACrG,CAAA;IACH,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
|
package/dist/digest/command.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type Streams } from "@wirecat/cli-base";
|
|
2
2
|
import type { Body } from "@wirecat/cli-core/cli";
|
|
3
3
|
import type { Command } from "commander";
|
|
4
|
+
import { type DigestSource } from "./digests.js";
|
|
5
|
+
/** `--source telegram,mail`, repeatable: what the agenda reads; each one a part it can leave out. */
|
|
6
|
+
export declare const sourcesOf: (value: string, before?: DigestSource[]) => DigestSource[];
|
|
4
7
|
export declare const sinceOf: (value: string, now?: number) => number;
|
|
5
8
|
/** A past moment, as an ISO time or a date (its local midnight); it must not be in the future. */
|
|
6
9
|
export declare const beforeOf: (value: string, now?: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/digest/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/digest/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,EAAkB,KAAK,YAAY,EAA4B,MAAM,cAAc,CAAA;AAyB1F,qGAAqG;AACrG,eAAO,MAAM,SAAS,UAAW,MAAM,WAAU,YAAY,EAAE,KAAQ,YAAY,EAWlF,CAAA;AAED,eAAO,MAAM,OAAO,UAAW,MAAM,mBAAqB,MAOzD,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,QAAQ,UAAW,MAAM,mBAAqB,MAW1D,CAAA;AAED,KAAK,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;AAE5D,8GAA8G;AAC9G,eAAO,MAAM,mBAAmB,WAAY,OAAO,SAAS,KAAK,WAAW,OAAO,OAAO,MAAM,CAAC,UAAU,KAAG,IA8D7G,CAAA"}
|
package/dist/digest/command.js
CHANGED
|
@@ -2,14 +2,34 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
2
2
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
3
|
import { LOCAL_READ, parseDuration } from "@wirecat/cli-core/cli";
|
|
4
4
|
import { itemAnswer, withStore } from "../answer.js";
|
|
5
|
+
import { APP } from "../app.js";
|
|
5
6
|
import { positive } from "../options.js";
|
|
6
7
|
import { gatherDigest, WATCH_TAG } from "./digest.js";
|
|
8
|
+
import { DIGEST_SOURCES, isDigest, readDefinition } from "./digests.js";
|
|
7
9
|
import { digestText, fitDigest } from "./text.js";
|
|
8
10
|
/** Roughly 10k tokens of mixed Russian and English: Cyrillic takes two bytes a letter and fewer letters a token. */
|
|
9
11
|
const COMPACT_BYTES = 40_000;
|
|
10
12
|
const FULL_BYTES = 80_000;
|
|
11
13
|
/** An owed reply older than this is left to `tasks agenda` and `mail review`, which read further back. */
|
|
12
14
|
const OWED_WITHIN = 7 * 86_400_000;
|
|
15
|
+
/** A digest's run keeps to the digest's sources even when its agent leaves out `--source`; other schedules do not. */
|
|
16
|
+
const scheduledSources = (env) => {
|
|
17
|
+
const scheduled = env[`${APP.envPrefix}_SCHEDULED`];
|
|
18
|
+
return scheduled && isDigest(env, scheduled) ? (readDefinition(env, scheduled)?.sources ?? []) : [];
|
|
19
|
+
};
|
|
20
|
+
/** `--source telegram,mail`, repeatable: what the agenda reads; each one a part it can leave out. */
|
|
21
|
+
export const sourcesOf = (value, before = []) => {
|
|
22
|
+
const words = value
|
|
23
|
+
.split(",")
|
|
24
|
+
.map((word) => word.trim().toLowerCase())
|
|
25
|
+
.filter(Boolean);
|
|
26
|
+
const unknown = words.filter((word) => !DIGEST_SOURCES.includes(word));
|
|
27
|
+
if (unknown.length)
|
|
28
|
+
throw new CliError("validation_error", `--source takes ${DIGEST_SOURCES.join(", ")}; not ${unknown.join(", ")}`, {
|
|
29
|
+
param: "source",
|
|
30
|
+
});
|
|
31
|
+
return [...new Set([...before, ...words])];
|
|
32
|
+
};
|
|
13
33
|
export const sinceOf = (value, now = Date.now()) => {
|
|
14
34
|
const since = /^\d{4}-\d{2}-\d{2}/.test(value) ? Date.parse(value) : now - parseDuration(value, "--since-time");
|
|
15
35
|
if (Number.isNaN(since))
|
|
@@ -52,6 +72,8 @@ export const reviewAgendaCommand = (review, print, streams, env) => {
|
|
|
52
72
|
.option("--since-time <time>", "how far back: hours or days (12h, 7d) or a start date (2026-11-01)", "1d")
|
|
53
73
|
.option("--before-time <time>", "build it as of this past ISO time or date, for a past day's digest: --since-time counts back from it, and " +
|
|
54
74
|
"what came later is left out; a chat or thread answered since reads as answered")
|
|
75
|
+
.option("--source <accounts>", `only these, comma-separated or repeated: ${DIGEST_SOURCES.join(", ")}; watched items, projects and proposals stay. ` +
|
|
76
|
+
"A digest's run reads the digest's own sources without it", sourcesOf)
|
|
55
77
|
.option("--limit <n>", "items per section before the size budget", positive, 25)
|
|
56
78
|
.option("--max-output-bytes <bytes>", "the text answer's size budget in bytes; 40000 with --compact, else 80000", positive)
|
|
57
79
|
.option("--compact", "one line per item, shorter excerpts, the smaller budget: for an agent")
|
|
@@ -70,6 +92,7 @@ export const reviewAgendaCommand = (review, print, streams, env) => {
|
|
|
70
92
|
limit: given.limit,
|
|
71
93
|
excerpt: given.compact ? 100 : 200,
|
|
72
94
|
owedWithin: OWED_WITHIN,
|
|
95
|
+
sources: given.source ?? scheduledSources(env),
|
|
73
96
|
}));
|
|
74
97
|
const digest = fitDigest(gathered, given.maxOutputBytes ?? (given.compact ? COMPACT_BYTES : FULL_BYTES));
|
|
75
98
|
// Not `print` for the text: its compact renderer would draw the answer generically, without the sections.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/digest/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,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AAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;YACzC,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;YAClC,UAAU,EAAE,WAAW;YACvB,OAAO,EAAE,KAAK,CAAC,MAAM,IAAI,gBAAgB,CAAC,GAAG,CAAC;SAC/C,CAAC,CACH,CAAA;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;QACxG,0GAA0G;QAC1G,IAAI,KAAK,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;;YAC1C,OAAO,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Body } from "@wirecat/cli-core/cli";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
type Print = (json: boolean | undefined, body: Body, text?: string) => void;
|
|
4
|
+
export declare const digestCommands: (digest: Command, print: Print, env: NodeJS.ProcessEnv) => void;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=digest-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest-commands.d.ts","sourceRoot":"","sources":["../../src/digest/digest-commands.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,IAAI,EAmBV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAyBxC,KAAK,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;AAoF3E,eAAO,MAAM,cAAc,WAAY,OAAO,SAAS,KAAK,OAAO,MAAM,CAAC,UAAU,KAAG,IAqPtF,CAAA"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { CliError } from "@wirecat/cli-base";
|
|
3
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
4
|
+
import { thisMachine } from "@wirecat/cli-core/background";
|
|
5
|
+
import { agentSchedule, calendarOf, environmentOf, grantsAuthority, LOCAL_READ, LOCAL_WRITE, parseRoute, pauseSchedule, queryTerms, removeSchedule, routeText, runScheduleNow, scheduleName, slotsOfAt, termField, withQuery, writeSchedule, } from "@wirecat/cli-core/cli";
|
|
6
|
+
import { itemAnswer, wholeList, withStore } from "../answer.js";
|
|
7
|
+
import { APP } from "../app.js";
|
|
8
|
+
import { fromAppOption, whoRuns } from "../author.js";
|
|
9
|
+
import { scheduleLimits } from "../config.js";
|
|
10
|
+
import { agentInputOf, MAIL_CLI } from "../schedule/command.js";
|
|
11
|
+
import { checkedBrief, readBrief, refuseAgent } from "./brief.js";
|
|
12
|
+
import { sourcesOf } from "./command.js";
|
|
13
|
+
import { briefAddress, DIGEST_PROMPT, DIGEST_SOURCES, digestNames, digestOf, digestScheduleFile, dropDefinition, MORNING_DIGEST, readDefinition, runCapOf, viewOf, writeDefinition, } from "./digests.js";
|
|
14
|
+
/** `--source all` and `--deliver-to none`: an edit's way to clear what an earlier one set. */
|
|
15
|
+
const ALL = "all";
|
|
16
|
+
const NONE = "none";
|
|
17
|
+
const usdOf = (flag, least) => (value) => {
|
|
18
|
+
const usd = Number(value);
|
|
19
|
+
if (!Number.isFinite(usd) || usd < 0 || (least === "above zero" && usd === 0))
|
|
20
|
+
throw new CliError("validation_error", `${flag} takes US dollars, ${least === "zero" ? "0 or more" : "more than 0"}; not "${value}"`, {
|
|
21
|
+
param: flag,
|
|
22
|
+
});
|
|
23
|
+
return usd;
|
|
24
|
+
};
|
|
25
|
+
const routeOf = (route, routes = []) => route === NONE ? [] : [...routes, routeText(parseRoute(route))];
|
|
26
|
+
const sourceOption = (value, before = []) => value.trim().toLowerCase() === ALL ? ALL : sourcesOf(value, before === ALL ? [] : before);
|
|
27
|
+
/** The options `add` and `edit` share; an edit replaces what each given option says and keeps the rest. */
|
|
28
|
+
const withDigestOptions = (command) => fromAppOption(command
|
|
29
|
+
.option("--title <title>", "the name the digest is shown under")
|
|
30
|
+
.option("--at <HH:MM>", "when it runs: HH:MM every day, or 'mon,fri 09:00' on those days; repeat it for more times, as 08:30 and 18:00", (at, all = []) => [...all, at])
|
|
31
|
+
.option("--source <accounts>", `what it reads, comma-separated or repeated: ${DIGEST_SOURCES.join(", ")}; ${ALL} (the default) reads everything`, sourceOption)
|
|
32
|
+
.option("--deliver-to <route>", `where each run is sent: telegram-bot:<profile>/<chat> or email:<profile>/<address>; repeat it for more, ${NONE} for nowhere`, routeOf)
|
|
33
|
+
.option("--text <text>", "your brief: what to collect, what to skip, how much; at most 4000 characters")
|
|
34
|
+
.option("--max-cost <usd>", "stop a run that costs more than this, in US dollars", usdOf("--max-cost", "above zero"))
|
|
35
|
+
.option("--max-cost-per-day <usd>", "start no run for the rest of the day once its runs cost this much, in US dollars; 0 for no cap", usdOf("--max-cost-per-day", "zero"))
|
|
36
|
+
.option("--json", "print JSON"));
|
|
37
|
+
/** The harness, model and per-run cap an existing schedule's argv was made with, so an edit keeps them. */
|
|
38
|
+
const kept = (schedule) => {
|
|
39
|
+
const { argv } = schedule;
|
|
40
|
+
const model = argv.indexOf("--model");
|
|
41
|
+
const cap = runCapOf(argv);
|
|
42
|
+
return {
|
|
43
|
+
harness: argv[1] === "exec" ? "codex" : "claude",
|
|
44
|
+
...(model < 0 ? { model: "" } : { model: argv[model + 1] ?? "" }),
|
|
45
|
+
...(cap === null ? {} : { maxCost: cap }),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export const digestCommands = (digest, print, env) => {
|
|
49
|
+
const siteOf = (command) => ({
|
|
50
|
+
app: APP,
|
|
51
|
+
system: environmentOf(command).system ?? thisMachine(),
|
|
52
|
+
env,
|
|
53
|
+
profile: "",
|
|
54
|
+
agentRuns: [MAIL_CLI],
|
|
55
|
+
limits: scheduleLimits(env),
|
|
56
|
+
});
|
|
57
|
+
// Each of these spends the owner's money, sets his timers or sends to his chats: he does it, never an agent.
|
|
58
|
+
const owner = async (command, question) => {
|
|
59
|
+
refuseAgent(env);
|
|
60
|
+
if ((await whoRuns(command, env, { question })) !== "owner")
|
|
61
|
+
throw new CliError("permission_error", "a digest spends your money and writes to your chats; you change or run it at a terminal or in WireCat Desktop", { reason: "digest.owner-only" });
|
|
62
|
+
};
|
|
63
|
+
const shown = async (name) => viewOf(env, name, { brief: (await readBrief(env, name)) ?? null, limits: scheduleLimits(env) });
|
|
64
|
+
const say = async (json, name, line) => print(json, itemAnswer(await shown(name)), line);
|
|
65
|
+
const saveBrief = async (name, text) => {
|
|
66
|
+
if (text === undefined)
|
|
67
|
+
return;
|
|
68
|
+
const body = checkedBrief(text);
|
|
69
|
+
await withStore(env, async (store) => store.templates.save(briefAddress(name), body, "memo"));
|
|
70
|
+
};
|
|
71
|
+
const listQuery = {
|
|
72
|
+
entity: "digest",
|
|
73
|
+
backend: "native",
|
|
74
|
+
fields: [termField("name", "kw", "name:weekly")],
|
|
75
|
+
};
|
|
76
|
+
withQuery(annotate(digest.command("list"), { effects: LOCAL_READ }).summary("your digests: when each runs, what it reads, where it goes, last and next run"), listQuery)
|
|
77
|
+
.option("--json", "print JSON")
|
|
78
|
+
.action(async (words, given) => {
|
|
79
|
+
const wanted = queryTerms(words, listQuery, "digest list").get("name");
|
|
80
|
+
const names = digestNames(env).filter((name) => wanted === undefined || name === wanted);
|
|
81
|
+
const items = await Promise.all(names.map(shown));
|
|
82
|
+
print(given.json, wholeList("digest list", items), items.length === 0
|
|
83
|
+
? "No digests. `memo digest add <name> --title … --at 08:30` makes one."
|
|
84
|
+
: items
|
|
85
|
+
.map((one) => [
|
|
86
|
+
one.name,
|
|
87
|
+
one.title,
|
|
88
|
+
one.times.length
|
|
89
|
+
? `${one.weekdays.length ? one.weekdays.join(",") : "daily"} ${one.times.join(", ")}`
|
|
90
|
+
: "no set time",
|
|
91
|
+
one.scheduled ? "on" : "paused",
|
|
92
|
+
one.sources.length ? `reads ${one.sources.join(", ")}` : "reads everything",
|
|
93
|
+
one.routes.length ? `to ${one.routes.join(", ")}` : "sent nowhere",
|
|
94
|
+
one.last ? `last ${one.last.at.slice(0, 16).replace("T", " ")} ${one.last.ok ? "ok" : "failed"}` : "",
|
|
95
|
+
]
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.join(" "))
|
|
98
|
+
.join("\n"));
|
|
99
|
+
});
|
|
100
|
+
withDigestOptions(grantsAuthority(annotate(digest.command("add"), { effects: LOCAL_WRITE }))
|
|
101
|
+
.summary("make a digest: its times, sources, routes and brief, on its timer")
|
|
102
|
+
.description("make a digest: an agent that runs memo's morning-digest skill at the given times, reading from its previous " +
|
|
103
|
+
"time (a weekly one reads the week) and only the sources given, and sends what it writes along the routes " +
|
|
104
|
+
"given. It runs read only. Each run is a paid model call; only you make one")
|
|
105
|
+
.argument("<name>", "lowercase letters, digits and dashes")
|
|
106
|
+
.option("--paused", "make it without putting it on its timer; `memo digest resume` does")).action(async (name, given, command) => {
|
|
107
|
+
const digestName = scheduleName(name);
|
|
108
|
+
if (existsSync(digestScheduleFile(env, digestName)))
|
|
109
|
+
throw new CliError("validation_error", `${digestName} already exists; \`memo digest edit ${digestName}\` changes it`, {
|
|
110
|
+
reason: "digest.exists",
|
|
111
|
+
});
|
|
112
|
+
if (!given.at?.length)
|
|
113
|
+
throw new CliError("validation_error", "say when: --at HH:MM, or --at 'mon 09:00'; repeat it for more times", {
|
|
114
|
+
param: "at",
|
|
115
|
+
});
|
|
116
|
+
const when = calendarOf(given.at.flatMap(slotsOfAt));
|
|
117
|
+
if (given.text !== undefined)
|
|
118
|
+
checkedBrief(given.text);
|
|
119
|
+
await owner(command, `make the digest ${digestName}, a paid model call at each of its times?`);
|
|
120
|
+
const site = siteOf(command);
|
|
121
|
+
const schedule = agentSchedule(site, {
|
|
122
|
+
name: digestName,
|
|
123
|
+
harness: "claude",
|
|
124
|
+
prompt: DIGEST_PROMPT,
|
|
125
|
+
when,
|
|
126
|
+
...(given.maxCost ? { maxCost: given.maxCost } : {}),
|
|
127
|
+
...(given.maxCostPerDay === undefined ? {} : { maxCostPerDay: given.maxCostPerDay }),
|
|
128
|
+
...(given.deliverTo?.length ? { to: given.deliverTo } : {}),
|
|
129
|
+
...(given.paused ? { paused: true } : {}),
|
|
130
|
+
});
|
|
131
|
+
writeDefinition(env, {
|
|
132
|
+
name: digestName,
|
|
133
|
+
title: given.title?.trim() || digestName,
|
|
134
|
+
sources: given.source === ALL || given.source === undefined ? [] : given.source,
|
|
135
|
+
createdAt: new Date().toISOString(),
|
|
136
|
+
});
|
|
137
|
+
await writeSchedule(site, schedule);
|
|
138
|
+
await saveBrief(digestName, given.text);
|
|
139
|
+
await say(given.json, digestName, `Added ${digestName}${given.paused ? ", paused" : ""}.`);
|
|
140
|
+
});
|
|
141
|
+
withDigestOptions(grantsAuthority(annotate(digest.command("edit"), { effects: LOCAL_WRITE }))
|
|
142
|
+
.summary("change a digest; each option given replaces what it says, the rest stays")
|
|
143
|
+
.description(`change a digest: each option given replaces what it set before (--at all its times, --source all its sources, ` +
|
|
144
|
+
`--deliver-to all its routes), and the rest stays as it was. --source ${ALL} reads everything again, ` +
|
|
145
|
+
`--deliver-to ${NONE} sends nowhere. A paused digest stays paused. Only you change one`)
|
|
146
|
+
.argument("<name>", "the digest's name, as `memo digest list` shows it")).action(async (name, given, command) => {
|
|
147
|
+
const { schedule } = digestOf(env, name);
|
|
148
|
+
if (!schedule.argv.includes(DIGEST_PROMPT))
|
|
149
|
+
throw new CliError("validation_error", `${name} runs a prompt of its own, made with \`memo schedule agent\`; an edit here would replace it — change it there`, { reason: "digest.own-prompt" });
|
|
150
|
+
const when = given.at?.length ? calendarOf(given.at.flatMap(slotsOfAt)) : schedule.when;
|
|
151
|
+
if (given.text !== undefined)
|
|
152
|
+
checkedBrief(given.text);
|
|
153
|
+
await owner(command, `change the digest ${name}?`);
|
|
154
|
+
const site = siteOf(command);
|
|
155
|
+
const previous = kept(schedule);
|
|
156
|
+
const maxCost = given.maxCost ?? previous.maxCost;
|
|
157
|
+
const to = given.deliverTo ?? schedule.to ?? [];
|
|
158
|
+
const maxCostPerDay = given.maxCostPerDay ?? schedule.maxCostPerDay;
|
|
159
|
+
const rebuilt = agentSchedule(site, {
|
|
160
|
+
name,
|
|
161
|
+
harness: previous.harness,
|
|
162
|
+
prompt: DIGEST_PROMPT,
|
|
163
|
+
when,
|
|
164
|
+
...(previous.model === undefined ? {} : { model: previous.model }),
|
|
165
|
+
...(maxCost ? { maxCost } : {}),
|
|
166
|
+
...(maxCostPerDay === undefined ? {} : { maxCostPerDay }),
|
|
167
|
+
...(schedule.notify ? { notify: schedule.notify } : {}),
|
|
168
|
+
...(to.length ? { to } : {}),
|
|
169
|
+
...(schedule.paused ? { paused: true } : {}),
|
|
170
|
+
});
|
|
171
|
+
const definition = readDefinition(env, name);
|
|
172
|
+
if (given.title !== undefined || given.source !== undefined || definition) {
|
|
173
|
+
writeDefinition(env, {
|
|
174
|
+
name,
|
|
175
|
+
title: given.title?.trim() || definition?.title || (name === MORNING_DIGEST ? "Morning digest" : name),
|
|
176
|
+
sources: given.source === ALL ? [] : (given.source ?? definition?.sources ?? []),
|
|
177
|
+
createdAt: definition?.createdAt || schedule.createdAt,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
await writeSchedule(site, { ...rebuilt, createdAt: schedule.createdAt });
|
|
181
|
+
await saveBrief(name, given.text);
|
|
182
|
+
await say(given.json, name, `Changed ${name}.`);
|
|
183
|
+
});
|
|
184
|
+
fromAppOption(annotate(digest.command("run"), { effects: LOCAL_WRITE }))
|
|
185
|
+
.summary("build a digest now and send it along its routes, or only some, or none")
|
|
186
|
+
.description("build a digest now, as its timer would, paused or not, and keep the run with its others; it is sent along " +
|
|
187
|
+
"its routes, only along those --deliver-to names (each one of its own), or with --no-notify nowhere. A paid " +
|
|
188
|
+
"model call: the day's cost cap holds, and only you run it")
|
|
189
|
+
.argument("<name>", "the digest's name, as `memo digest list` shows it")
|
|
190
|
+
.option("--no-notify", "keep it here: send it nowhere")
|
|
191
|
+
.option("--deliver-to <route>", "send it only along this one of the digest's routes; repeat it for more", (route, routes = []) => [...routes, routeText(parseRoute(route))])
|
|
192
|
+
.option("--json", "print JSON")
|
|
193
|
+
.action(async (name, given, command) => {
|
|
194
|
+
const { file } = digestOf(env, name);
|
|
195
|
+
if (!given.notify && given.deliverTo)
|
|
196
|
+
throw new CliError("validation_error", "--no-notify sends nothing; leave out --deliver-to, or --no-notify", {
|
|
197
|
+
param: "deliver-to",
|
|
198
|
+
});
|
|
199
|
+
await owner(command, `run the digest ${name} now, a paid model call?`);
|
|
200
|
+
const routes = given.notify ? given.deliverTo : [];
|
|
201
|
+
const last = await runScheduleNow(command, siteOf(command), file, {
|
|
202
|
+
agentInput: agentInputOf(env),
|
|
203
|
+
...(routes ? { routes } : {}),
|
|
204
|
+
});
|
|
205
|
+
if (!("exitCode" in last)) {
|
|
206
|
+
print(given.json, itemAnswer({ name, skipped: true, ...last.skipped }), `${name}: skipped — ${last.skipped.why}`);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (last.exitCode !== 0)
|
|
210
|
+
process.exitCode = 1;
|
|
211
|
+
print(given.json, itemAnswer({ name, ...last }), `${name}: ${last.exitCode === 0 ? "built" : `failed (exit ${last.exitCode})`} — ${last.output}`);
|
|
212
|
+
});
|
|
213
|
+
for (const [verb, paused] of [
|
|
214
|
+
["pause", true],
|
|
215
|
+
["resume", false],
|
|
216
|
+
])
|
|
217
|
+
fromAppOption(grantsAuthority(annotate(digest.command(verb), { effects: LOCAL_WRITE })))
|
|
218
|
+
.summary(paused
|
|
219
|
+
? "take a digest off its timer; it stays, and run still builds it"
|
|
220
|
+
: "put a paused digest back on its timer")
|
|
221
|
+
.argument("<name>", "the digest's name, as `memo digest list` shows it")
|
|
222
|
+
.option("--json", "print JSON")
|
|
223
|
+
.action(async (name, given, command) => {
|
|
224
|
+
digestOf(env, name);
|
|
225
|
+
await owner(command, `${verb} the digest ${name}?`);
|
|
226
|
+
await pauseSchedule(siteOf(command), name, paused);
|
|
227
|
+
await say(given.json, name, paused ? `Paused ${name}.` : `Resumed ${name}.`);
|
|
228
|
+
});
|
|
229
|
+
fromAppOption(grantsAuthority(annotate(digest.command("remove"), { effects: LOCAL_WRITE })))
|
|
230
|
+
.summary("remove a digest and its timer; its past runs, brief and templates stay")
|
|
231
|
+
.argument("<name>", "the digest's name, as `memo digest list` shows it")
|
|
232
|
+
.option("--json", "print JSON")
|
|
233
|
+
.action(async (name, given, command) => {
|
|
234
|
+
digestOf(env, name);
|
|
235
|
+
await owner(command, `remove the digest ${name}?`);
|
|
236
|
+
await removeSchedule(siteOf(command), name);
|
|
237
|
+
dropDefinition(env, name);
|
|
238
|
+
print(given.json, itemAnswer({ name, removed: true }), `Removed ${name}; its past runs stay.`);
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=digest-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest-commands.js","sourceRoot":"","sources":["../../src/digest/digest-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAqB,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EAE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