@leemour/cli-messaging 0.85.0 → 0.87.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/dist/cli/index.d.ts +5 -3
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/messenger/account-command.d.ts +0 -3
- package/dist/cli/messenger/account-command.d.ts.map +1 -1
- package/dist/cli/messenger/account-command.js +20 -2
- package/dist/cli/messenger/account-command.js.map +1 -1
- package/dist/cli/messenger/account-sessions-command.d.ts.map +1 -1
- package/dist/cli/messenger/account-sessions-command.js +15 -1
- package/dist/cli/messenger/account-sessions-command.js.map +1 -1
- package/dist/cli/messenger/admin-contacts-command.d.ts +8 -0
- package/dist/cli/messenger/admin-contacts-command.d.ts.map +1 -0
- package/dist/cli/messenger/admin-contacts-command.js +60 -0
- package/dist/cli/messenger/admin-contacts-command.js.map +1 -0
- package/dist/cli/messenger/after.d.ts +2 -0
- package/dist/cli/messenger/after.d.ts.map +1 -1
- package/dist/cli/messenger/after.js +22 -2
- package/dist/cli/messenger/after.js.map +1 -1
- package/dist/cli/messenger/archive-commands.d.ts.map +1 -1
- package/dist/cli/messenger/archive-commands.js +6 -5
- package/dist/cli/messenger/archive-commands.js.map +1 -1
- package/dist/cli/messenger/backfill-command.d.ts +1 -1
- package/dist/cli/messenger/backfill-command.d.ts.map +1 -1
- package/dist/cli/messenger/backfill-command.js +29 -19
- package/dist/cli/messenger/backfill-command.js.map +1 -1
- package/dist/cli/messenger/backfill-jobs.d.ts +3 -2
- package/dist/cli/messenger/backfill-jobs.d.ts.map +1 -1
- package/dist/cli/messenger/backfill-jobs.js.map +1 -1
- package/dist/cli/messenger/chats-command.d.ts +0 -3
- package/dist/cli/messenger/chats-command.d.ts.map +1 -1
- package/dist/cli/messenger/chats-command.js +14 -28
- package/dist/cli/messenger/chats-command.js.map +1 -1
- package/dist/cli/messenger/contacts-command.d.ts.map +1 -1
- package/dist/cli/messenger/contacts-command.js +3 -0
- package/dist/cli/messenger/contacts-command.js.map +1 -1
- package/dist/cli/messenger/context.d.ts +1 -1
- package/dist/cli/messenger/context.d.ts.map +1 -1
- package/dist/cli/messenger/download-command.js +6 -6
- package/dist/cli/messenger/download-command.js.map +1 -1
- package/dist/cli/messenger/hearing-command.d.ts +0 -2
- package/dist/cli/messenger/hearing-command.d.ts.map +1 -1
- package/dist/cli/messenger/hearing-command.js +0 -8
- package/dist/cli/messenger/hearing-command.js.map +1 -1
- package/dist/cli/messenger/inbox.d.ts +1 -8
- package/dist/cli/messenger/inbox.d.ts.map +1 -1
- package/dist/cli/messenger/inbox.js +8 -28
- package/dist/cli/messenger/inbox.js.map +1 -1
- package/dist/cli/messenger/messages-command.d.ts.map +1 -1
- package/dist/cli/messenger/messages-command.js +23 -18
- package/dist/cli/messenger/messages-command.js.map +1 -1
- package/dist/cli/messenger/messages-edit-command.js +2 -2
- package/dist/cli/messenger/messages-edit-command.js.map +1 -1
- package/dist/cli/messenger/messages-scheduled-command.d.ts.map +1 -1
- package/dist/cli/messenger/messages-scheduled-command.js +2 -1
- package/dist/cli/messenger/messages-scheduled-command.js.map +1 -1
- package/dist/cli/messenger/models-command.d.ts.map +1 -1
- package/dist/cli/messenger/models-command.js +2 -1
- package/dist/cli/messenger/models-command.js.map +1 -1
- package/dist/cli/messenger/port.d.ts +30 -2
- package/dist/cli/messenger/port.d.ts.map +1 -1
- package/dist/cli/messenger/port.js.map +1 -1
- package/dist/cli/messenger/review.d.ts +1 -5
- package/dist/cli/messenger/review.d.ts.map +1 -1
- package/dist/cli/messenger/review.js +12 -23
- package/dist/cli/messenger/review.js.map +1 -1
- package/dist/cli/messenger/server-command.d.ts.map +1 -1
- package/dist/cli/messenger/server-command.js +2 -1
- package/dist/cli/messenger/server-command.js.map +1 -1
- package/dist/cli/paging.d.ts +11 -0
- package/dist/cli/paging.d.ts.map +1 -1
- package/dist/cli/paging.js +11 -0
- package/dist/cli/paging.js.map +1 -1
- package/dist/cli/settings.d.ts.map +1 -1
- package/dist/cli/settings.js +3 -3
- package/dist/cli/settings.js.map +1 -1
- package/dist/domain/models.d.ts +5 -0
- package/dist/domain/models.d.ts.map +1 -1
- package/dist/domain/models.js.map +1 -1
- package/dist/mcp/server.d.ts +4 -3
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/account.d.ts.map +1 -1
- package/dist/mcp/tools/account.js +1 -1
- package/dist/mcp/tools/account.js.map +1 -1
- package/dist/mcp/tools/chats.d.ts.map +1 -1
- package/dist/mcp/tools/chats.js +2 -2
- package/dist/mcp/tools/chats.js.map +1 -1
- package/dist/mcp/tools/contacts-write.d.ts +5 -0
- package/dist/mcp/tools/contacts-write.d.ts.map +1 -0
- package/dist/mcp/tools/contacts-write.js +55 -0
- package/dist/mcp/tools/contacts-write.js.map +1 -0
- package/dist/mcp/tools/inbox.d.ts.map +1 -1
- package/dist/mcp/tools/inbox.js +2 -3
- package/dist/mcp/tools/inbox.js.map +1 -1
- package/dist/mcp/tools/messages.d.ts.map +1 -1
- package/dist/mcp/tools/messages.js +1 -2
- package/dist/mcp/tools/messages.js.map +1 -1
- package/dist/mcp/tools/review.d.ts.map +1 -1
- package/dist/mcp/tools/review.js +3 -4
- package/dist/mcp/tools/review.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +2 -0
- package/dist/mcp/tools.js.map +1 -1
- package/dist/resolve.d.ts +1 -0
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +5 -5
- package/dist/resolve.js.map +1 -1
- package/dist/services/account.d.ts +17 -0
- package/dist/services/account.d.ts.map +1 -0
- package/dist/services/account.js +33 -0
- package/dist/services/account.js.map +1 -0
- package/dist/services/archive.d.ts +6 -3
- package/dist/services/archive.d.ts.map +1 -1
- package/dist/services/archive.js +10 -8
- package/dist/services/archive.js.map +1 -1
- package/dist/services/chats.d.ts +4 -1
- package/dist/services/chats.d.ts.map +1 -1
- package/dist/services/chats.js +15 -0
- package/dist/services/chats.js.map +1 -1
- package/dist/services/inbox.d.ts +4 -0
- package/dist/services/inbox.d.ts.map +1 -1
- package/dist/services/inbox.js +4 -0
- package/dist/services/inbox.js.map +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/messages.d.ts.map +1 -1
- package/dist/services/messages.js +4 -1
- package/dist/services/messages.js.map +1 -1
- package/dist/services/moment.d.ts +8 -0
- package/dist/services/moment.d.ts.map +1 -0
- package/dist/services/moment.js +24 -0
- package/dist/services/moment.js.map +1 -0
- package/dist/services/people.d.ts +24 -1
- package/dist/services/people.d.ts.map +1 -1
- package/dist/services/people.js +95 -42
- package/dist/services/people.js.map +1 -1
- package/dist/speech/hearing.d.ts +2 -0
- package/dist/speech/hearing.d.ts.map +1 -1
- package/dist/speech/hearing.js +8 -0
- package/dist/speech/hearing.js.map +1 -1
- package/package.json +1 -1
- package/parity.json +195 -73
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { guardedClose, guardedCreatePoll, guardedVote } from "../sends/polls.js";
|
|
2
2
|
export { INBOX_CHATS, newIn, REVIEW_CHATS, reviewIn, unanswered, unreadIn } from "../services/inbox.js";
|
|
3
|
+
export { momentOf } from "../services/moment.js";
|
|
4
|
+
export { maskedAccount } from "../services/people.js";
|
|
3
5
|
export { type AppIdentity, envName } from "./app.js";
|
|
4
6
|
export { CONTRACT, commandsCommand } from "./commands-command.js";
|
|
5
7
|
export { configCommand } from "./config-command.js";
|
|
6
8
|
export { type BaseContext, type BaseEnvironment, baseContext, environmentOf, outputFor, provide, } from "./context.js";
|
|
7
9
|
export { type Closeable, withDeadline } from "./deadline.js";
|
|
8
10
|
export { isCliFailure, isCommanderFailure } from "./failures.js";
|
|
9
|
-
export { accountCommand
|
|
11
|
+
export { accountCommand } from "./messenger/account-command.js";
|
|
10
12
|
export { accountFileFor, rememberAccount } from "./messenger/accounts.js";
|
|
11
13
|
export { storeCommand } from "./messenger/archive-commands.js";
|
|
12
14
|
export { chatsCommand } from "./messenger/chats-command.js";
|
|
@@ -16,7 +18,7 @@ export { contactsCommand } from "./messenger/contacts-command.js";
|
|
|
16
18
|
export { type ConnectOptions, type Fetching, type Messenger, type MessengerContext, messengerContext, } from "./messenger/context.js";
|
|
17
19
|
export { doctorCommand } from "./messenger/doctor-command.js";
|
|
18
20
|
export { recipientsCommand, sendsCommand } from "./messenger/guard-commands.js";
|
|
19
|
-
export { inboxCommand
|
|
21
|
+
export { inboxCommand } from "./messenger/inbox.js";
|
|
20
22
|
export { type McpEnvironment, mcpCommand, serverEntry } from "./messenger/mcp-command.js";
|
|
21
23
|
export { messagesCommand, sendCommand } from "./messenger/messages-command.js";
|
|
22
24
|
export { deleteCommand } from "./messenger/messages-delete-command.js";
|
|
@@ -32,7 +34,7 @@ export { serveCommand, servingProfiles } from "./messenger/serve-command.js";
|
|
|
32
34
|
export { type ServerSystem, serverCommand } from "./messenger/server-command.js";
|
|
33
35
|
export { topicsCommand } from "./messenger/topics-command.js";
|
|
34
36
|
export { watchCommand } from "./messenger/watch-command.js";
|
|
35
|
-
export { renderPage, window, withPaging } from "./paging.js";
|
|
37
|
+
export { listed, renderList, renderPage, window, withPaging } from "./paging.js";
|
|
36
38
|
export { asFirstWord, commandWords, DEFAULT_PROFILE, liftProfile, refuseCommandName, rootOf, usableProfileName, } from "./profile.js";
|
|
37
39
|
export { createProgram, type ProgramDefinition, type ProgramOptions, type RunOptions, run } from "./program.js";
|
|
38
40
|
export { runsCommand } from "./runs/command.js";
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,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,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,QAAQ,EACR,cAAc,EACd,UAAU,GACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,KAAK,WAAW,EAChB,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,GACT,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,WAAW,EAChB,aAAa,EACb,KAAK,EACL,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,WAAW,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { guardedClose, guardedCreatePoll, guardedVote } from "../sends/polls.js";
|
|
2
2
|
export { INBOX_CHATS, newIn, REVIEW_CHATS, reviewIn, unanswered, unreadIn } from "../services/inbox.js";
|
|
3
|
+
export { momentOf } from "../services/moment.js";
|
|
4
|
+
export { maskedAccount } from "../services/people.js";
|
|
3
5
|
export { envName } from "./app.js";
|
|
4
6
|
export { CONTRACT, commandsCommand } from "./commands-command.js";
|
|
5
7
|
export { configCommand } from "./config-command.js";
|
|
6
8
|
export { baseContext, environmentOf, outputFor, provide, } from "./context.js";
|
|
7
9
|
export { withDeadline } from "./deadline.js";
|
|
8
10
|
export { isCliFailure, isCommanderFailure } from "./failures.js";
|
|
9
|
-
export { accountCommand
|
|
11
|
+
export { accountCommand } from "./messenger/account-command.js";
|
|
10
12
|
export { accountFileFor, rememberAccount } from "./messenger/accounts.js";
|
|
11
13
|
export { storeCommand } from "./messenger/archive-commands.js";
|
|
12
14
|
export { chatsCommand } from "./messenger/chats-command.js";
|
|
@@ -16,7 +18,7 @@ export { contactsCommand } from "./messenger/contacts-command.js";
|
|
|
16
18
|
export { messengerContext, } from "./messenger/context.js";
|
|
17
19
|
export { doctorCommand } from "./messenger/doctor-command.js";
|
|
18
20
|
export { recipientsCommand, sendsCommand } from "./messenger/guard-commands.js";
|
|
19
|
-
export { inboxCommand
|
|
21
|
+
export { inboxCommand } from "./messenger/inbox.js";
|
|
20
22
|
export { mcpCommand, serverEntry } from "./messenger/mcp-command.js";
|
|
21
23
|
export { messagesCommand, sendCommand } from "./messenger/messages-command.js";
|
|
22
24
|
export { deleteCommand } from "./messenger/messages-delete-command.js";
|
|
@@ -31,7 +33,7 @@ export { serveCommand, servingProfiles } from "./messenger/serve-command.js";
|
|
|
31
33
|
export { serverCommand } from "./messenger/server-command.js";
|
|
32
34
|
export { topicsCommand } from "./messenger/topics-command.js";
|
|
33
35
|
export { watchCommand } from "./messenger/watch-command.js";
|
|
34
|
-
export { renderPage, window, withPaging } from "./paging.js";
|
|
36
|
+
export { listed, renderList, renderPage, window, withPaging } from "./paging.js";
|
|
35
37
|
export { asFirstWord, commandWords, DEFAULT_PROFILE, liftProfile, refuseCommandName, rootOf, usableProfileName, } from "./profile.js";
|
|
36
38
|
export { createProgram, run } from "./program.js";
|
|
37
39
|
export { runsCommand } from "./runs/command.js";
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACvG,OAAO,EAAoB,OAAO,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,a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AAY,EACZ,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,iBAAiB,GAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAgE,GAAG,EAAE,MAAM,cAAc,CAAA;AAC/G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAIL,gBAAgB,EAEhB,WAAW,GAEZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,OAAO,EAGP,QAAQ,EACR,cAAc,EACd,UAAU,GACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,GACT,MAAM,eAAe,CAAA;AACtB,OAAO,EAGL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EAER,aAAa,EACb,KAAK,EAKL,WAAW,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import type { Account } from "../../domain/models.js";
|
|
3
2
|
import { type Messenger } from "./context.js";
|
|
4
|
-
/** The phone cut to its last four digits: enough to tell two accounts apart. */
|
|
5
|
-
export declare const maskedAccount: (account: Account) => Account;
|
|
6
3
|
export declare const accountCommand: (messenger: Messenger) => Command;
|
|
7
4
|
//# sourceMappingURL=account-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/account-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/account-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAA;AAE/D,eAAO,MAAM,cAAc,cAAe,SAAS,KAAG,OA2CJ,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { annotate } from "@leemour/cli-core/commands";
|
|
1
2
|
import { Command } from "commander";
|
|
3
|
+
import { readUpload } from "../../sends/upload.js";
|
|
4
|
+
import { maskedAccount } from "../../services/people.js";
|
|
2
5
|
import { accountSessionsCommand } from "./account-sessions-command.js";
|
|
3
6
|
import { messengerContext } from "./context.js";
|
|
4
|
-
/** The phone cut to its last four digits: enough to tell two accounts apart. */
|
|
5
|
-
export const maskedAccount = (account) => account.phone ? { ...account, phone: `***${account.phone.replace(/\D/g, "").slice(-4)}` } : account;
|
|
6
7
|
export const accountCommand = (messenger) => new Command("account")
|
|
7
8
|
.description("the logged-in account")
|
|
8
9
|
.addCommand(new Command("show")
|
|
@@ -13,6 +14,23 @@ export const accountCommand = (messenger) => new Command("account")
|
|
|
13
14
|
const context = messengerContext(this, messenger);
|
|
14
15
|
const account = await context.withMessenger((connection) => connection.me());
|
|
15
16
|
context.renderer.result(whole ? account : maskedAccount(account));
|
|
17
|
+
}))
|
|
18
|
+
.addCommand(annotate(new Command("update"), { mutates: true })
|
|
19
|
+
.description("change the name, the description or the photo everyone sees on your profile")
|
|
20
|
+
.option("--first-name <name>", "your first name")
|
|
21
|
+
.option("--last-name <name>", "your last name")
|
|
22
|
+
.option("--description <text>", "about you")
|
|
23
|
+
.option("--photo <file>", "a new profile photo — an image file")
|
|
24
|
+
.action(async function () {
|
|
25
|
+
const context = messengerContext(this, messenger);
|
|
26
|
+
const { firstName, lastName, description, photo } = this.opts();
|
|
27
|
+
const upload = photo === undefined ? undefined : await readUpload("photo", photo, { app: messenger.app, env: context.env });
|
|
28
|
+
context.renderer.result(await context.withServices((services) => services.account.update({
|
|
29
|
+
...(firstName === undefined ? {} : { firstName }),
|
|
30
|
+
...(lastName === undefined ? {} : { lastName }),
|
|
31
|
+
...(description === undefined ? {} : { description }),
|
|
32
|
+
...(upload === undefined ? {} : { photo: upload }),
|
|
33
|
+
})));
|
|
16
34
|
}))
|
|
17
35
|
.addCommand(accountSessionsCommand(messenger));
|
|
18
36
|
//# sourceMappingURL=account-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-command.js","sourceRoot":"","sources":["../../../src/cli/messenger/account-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"account-command.js","sourceRoot":"","sources":["../../../src/cli/messenger/account-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAoB,EAAW,EAAE,CAC9D,IAAI,OAAO,CAAC,SAAS,CAAC;KACnB,WAAW,CAAC,uBAAuB,CAAC;KACpC,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,+EAA+E,CAAC;KAC5F,MAAM,CAAC,cAAc,EAAE,8BAA8B,CAAC;KACtD,MAAM,CAAC,KAAK;IACX,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAA2B,CAAC,SAAS,KAAK,IAAI,CAAA;IACrE,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IACjD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAA;IAC5E,O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AC/C,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;QACrD,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;KACnD,CAAC,CACH,CACF,CAAA;AACH,CAAC,CAAC,CACL;KACA,UAAU,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-sessions-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/account-sessions-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account-sessions-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/account-sessions-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAA;AAG/D,iGAAiG;AACjG,eAAO,MAAM,sBAAsB,cAAe,SAAS,KAAG,OAgC7D,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { CliError } from "@leemour/cli-core";
|
|
2
|
+
import { annotate } from "@leemour/cli-core/commands";
|
|
1
3
|
import { Command } from "commander";
|
|
4
|
+
import { listed } from "../paging.js";
|
|
2
5
|
import { messengerContext } from "./context.js";
|
|
3
6
|
import { capability } from "./port.js";
|
|
4
7
|
/** `account sessions …` — where else the account is logged in, not this tool's own `session`. */
|
|
@@ -13,8 +16,19 @@ export const accountSessionsCommand = (messenger) => {
|
|
|
13
16
|
if (context.format === "jsonl")
|
|
14
17
|
context.renderer.stream(found);
|
|
15
18
|
else
|
|
16
|
-
context.renderer.result(context.format === "pretty" ? found :
|
|
19
|
+
context.renderer.result(context.format === "pretty" ? found : listed(found));
|
|
17
20
|
});
|
|
21
|
+
// No MCP tool, at any permission level: it logs the owner out of the phone.
|
|
22
|
+
sessions.addCommand(annotate(new Command("end"), { mutates: true })
|
|
23
|
+
.description("log out every other device, your phone included; this one stays")
|
|
24
|
+
.option("--others", "every session but this one")
|
|
25
|
+
.action(async function () {
|
|
26
|
+
if (this.opts().others !== true) {
|
|
27
|
+
throw new CliError("validation_error", "only every other session can be ended at once — add --others");
|
|
28
|
+
}
|
|
29
|
+
const context = messengerContext(this, messenger);
|
|
30
|
+
context.renderer.result(await context.withServices((services) => services.account.endOtherSessions()));
|
|
31
|
+
}));
|
|
18
32
|
return sessions;
|
|
19
33
|
};
|
|
20
34
|
//# sourceMappingURL=account-sessions-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-sessions-command.js","sourceRoot":"","sources":["../../../src/cli/messenger/account-sessions-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,iGAAiG;AACjG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAoB,EAAW,EAAE;IACtE,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAClD,gDAAgD,SAAS,CAAC,GAAG,CAAC,OAAO,4CAA4C,CAClH,CAAA;IAED,QAAQ;SACL,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,kEAAkE,CAAC;SAC/E,MAAM,CAAC,KAAK;QACX,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QACjD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE,CACpD,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,6BAA6B,CAAC,EAAE,CACjE,CAAA;QACD,IAAI,OAAO,CAAC,MAAM,K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CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACnF,CAAC,CAAC,CAAA;IAEJ,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,CACjB,QAAQ,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SAC5C,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,UAAU,EAAE,4BAA4B,CAAC;SAChD,MAAM,CAAC,KAAK;QACX,IAAI,IAAI,CAAC,IAAI,EAAwB,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE,8DAA8D,CAAC,CAAA;QACxG,CAAC;QACD,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAA;IACxG,CAAC,CAAC,CACL,CAAA;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { PhoneBookEntry } from "../../domain/models.js";
|
|
3
|
+
import { type Messenger } from "./context.js";
|
|
4
|
+
/** The address book's writes, in max-cli's words. */
|
|
5
|
+
export declare const contactWriteCommands: (messenger: Messenger) => Command[];
|
|
6
|
+
/** ⚠ A bad line is named by its number, never by what is on it. */
|
|
7
|
+
export declare const phoneBook: (text: string) => PhoneBookEntry[];
|
|
8
|
+
//# sourceMappingURL=admin-contacts-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-contacts-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/admin-contacts-command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAA;AAI/D,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,cAAe,SAAS,KAAG,OAAO,EAiDlE,CAAA;AAED,mEAAmE;AACnE,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,cAAc,EAUnD,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { CliError } from "@leemour/cli-core";
|
|
3
|
+
import { annotate } from "@leemour/cli-core/commands";
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { phoneOf } from "../../services/index.js";
|
|
6
|
+
import { messengerContext } from "./context.js";
|
|
7
|
+
const PERSON = "person id — `contacts lookup` finds one — or part of a known name";
|
|
8
|
+
/** The address book's writes, in max-cli's words. */
|
|
9
|
+
export const contactWriteCommands = (messenger) => {
|
|
10
|
+
const simple = [
|
|
11
|
+
["add", "add a person to your contacts — `contacts list` still shows only people you have a dialog with"],
|
|
12
|
+
["remove", "remove a person from your contacts; the chat stays, a name you gave them may not"],
|
|
13
|
+
["block", "stop a person from writing to you — they need not be a contact"],
|
|
14
|
+
["unblock", "let a blocked person write to you again"],
|
|
15
|
+
].map(([name, description]) => annotate(new Command(name), { mutates: true })
|
|
16
|
+
.description(description)
|
|
17
|
+
.argument("<person>", PERSON)
|
|
18
|
+
.action(async function (person) {
|
|
19
|
+
const context = messengerContext(this, messenger);
|
|
20
|
+
context.renderer.result(await context.withServices((services) => services.people[name](person)));
|
|
21
|
+
}));
|
|
22
|
+
const rename = annotate(new Command("rename"), { mutates: true })
|
|
23
|
+
.description("give a person a name of your own — they do not see it")
|
|
24
|
+
.argument("<person>", PERSON)
|
|
25
|
+
.argument("<first-name>", "the name you want to see for them")
|
|
26
|
+
.argument("[last-name]")
|
|
27
|
+
.action(async function (person, firstName, lastName) {
|
|
28
|
+
const context = messengerContext(this, messenger);
|
|
29
|
+
context.renderer.result(await context.withServices((services) => services.people.rename(person, firstName, lastName)));
|
|
30
|
+
});
|
|
31
|
+
/** A file rather than argv: these are phone numbers, and argv is read by `ps` and kept by the shell. */
|
|
32
|
+
const importing = annotate(new Command("import"), { mutates: true })
|
|
33
|
+
.description("upload phone numbers and add the people the messenger has under them")
|
|
34
|
+
.argument("<file>", "one person per line: number, then a comma, a tab or a semicolon, then the name")
|
|
35
|
+
.action(async function (file) {
|
|
36
|
+
const context = messengerContext(this, messenger);
|
|
37
|
+
const entries = phoneBook(await readFile(file, "utf8").catch((error) => {
|
|
38
|
+
throw new CliError("not_found", `cannot read ${file}: ${error.code ?? error.message}`);
|
|
39
|
+
}));
|
|
40
|
+
const imported = await context.withServices((services) => services.people.import(entries));
|
|
41
|
+
context.renderer.result(imported);
|
|
42
|
+
context.renderer.success(`${imported.sent} sent, ${imported.recognised.length} recognised`);
|
|
43
|
+
});
|
|
44
|
+
return [...simple, rename, importing];
|
|
45
|
+
};
|
|
46
|
+
/** ⚠ A bad line is named by its number, never by what is on it. */
|
|
47
|
+
export const phoneBook = (text) => text.split(/\r?\n/).flatMap((line, index) => {
|
|
48
|
+
if (line.trim() === "")
|
|
49
|
+
return [];
|
|
50
|
+
const match = /^\s*([^,\t;]+?)\s*[,\t;]\s*(.*\S)\s*$/.exec(line);
|
|
51
|
+
if (!match?.[1] || !match[2])
|
|
52
|
+
throw new CliError("validation_error", `line ${index + 1} is not "number, name"`);
|
|
53
|
+
try {
|
|
54
|
+
return [{ phone: phoneOf(match[1]), name: match[2] }];
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new CliError("validation_error", `line ${index + 1}: the number is not a phone number with a country code`);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=admin-contacts-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-contacts-command.js","sourceRoot":"","sources":["../../../src/cli/messenger/admin-contacts-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/D,MAAM,MAAM,GAAG,mEAAmE,CAAA;AAElF,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAoB,EAAa,EAAE;IACtE,MAAM,MAAM,GACV;QACE,CAAC,KAAK,EAAE,gGAAgG,CAAC;QACzG,CAAC,QAAQ,EAAE,kFAAkF,CAAC;QAC9F,CAAC,OAAO,EAAE,gEAAgE,CAAC;QAC3E,CAAC,SAAS,EAAE,yCAAyC,CAAC;KAEzD,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,CAC5B,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SAC3C,WAAW,CAAC,WAAW,CAAC;SACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;SAC5B,MAAM,CAAC,KAAK,WAA0B,MAAc;QACnD,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CACrB,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAmB,EAAE,CAAC,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,EAAE,QAAQ,KAAK,GAAG,CAAC,wDAAwD,CAAC,CAAA;IACnH,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -2,4 +2,6 @@ import type { After } from "./port.js";
|
|
|
2
2
|
/** Ids are opaque to us — digits in Telegram and MAX, anything in another messenger — so only a moment's shape is a time. */
|
|
3
3
|
export declare const afterOf: (reference: string, flag?: string) => After;
|
|
4
4
|
export declare const oneDirection: (before: string | undefined, after: string | undefined) => void;
|
|
5
|
+
/** A list reads one way from one place: at most one of `--before-id`, `--after-id`, `--after-time`. */
|
|
6
|
+
export declare const listStart: (beforeId?: string, afterId?: string, afterTime?: string) => After | undefined;
|
|
5
7
|
//# sourceMappingURL=after.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"after.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/after.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEtC,6HAA6H;AAC7H,eAAO,MAAM,OAAO,cAAe,MAAM,oBAAqB,KAU7D,CAAA;
|
|
1
|
+
{"version":3,"file":"after.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/after.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEtC,6HAA6H;AAC7H,eAAO,MAAM,OAAO,cAAe,MAAM,oBAAqB,KAU7D,CAAA;AAID,eAAO,MAAM,YAAY,WAAY,MAAM,GAAG,SAAS,SAAS,MAAM,GAAG,SAAS,KAAG,IAIpF,CAAA;AAED,uGAAuG;AACvG,eAAO,MAAM,SAAS,cAAe,MAAM,YAAY,MAAM,cAAc,MAAM,KAAG,KAAK,GAAG,SAc3F,CAAA"}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
import { CliError } from "@leemour/cli-core";
|
|
2
|
-
import { isMoment, momentOf } from "
|
|
2
|
+
import { isMoment, momentOf } from "../../services/moment.js";
|
|
3
3
|
/** Ids are opaque to us — digits in Telegram and MAX, anything in another messenger — so only a moment's shape is a time. */
|
|
4
4
|
export const afterOf = (reference, flag = "--after") => {
|
|
5
5
|
const wanted = reference.trim();
|
|
6
6
|
if (isMoment(wanted))
|
|
7
7
|
return { time: momentOf(wanted, flag) };
|
|
8
|
-
if (
|
|
8
|
+
if (!isId(wanted)) {
|
|
9
9
|
throw new CliError("validation_error", `${flag} takes a message id, an ISO 8601 time or 30m, 2h, 1d ago — not "${wanted}"`);
|
|
10
10
|
}
|
|
11
11
|
return { id: wanted };
|
|
12
12
|
};
|
|
13
|
+
const isId = (value) => value !== "" && !/[\s\p{Cc}]/u.test(value);
|
|
13
14
|
export const oneDirection = (before, after) => {
|
|
14
15
|
if (before !== undefined && after !== undefined) {
|
|
15
16
|
throw new CliError("validation_error", "--before and --after are two directions; give one of them");
|
|
16
17
|
}
|
|
17
18
|
};
|
|
19
|
+
/** A list reads one way from one place: at most one of `--before-id`, `--after-id`, `--after-time`. */
|
|
20
|
+
export const listStart = (beforeId, afterId, afterTime) => {
|
|
21
|
+
const given = [
|
|
22
|
+
beforeId === undefined ? undefined : "--before-id",
|
|
23
|
+
afterId === undefined ? undefined : "--after-id",
|
|
24
|
+
afterTime === undefined ? undefined : "--after-time",
|
|
25
|
+
].filter((flag) => flag !== undefined);
|
|
26
|
+
if (given.length > 1) {
|
|
27
|
+
throw new CliError("validation_error", `${given.join(" and ")} are two starting points; give one of them`);
|
|
28
|
+
}
|
|
29
|
+
if (afterTime !== undefined)
|
|
30
|
+
return { time: momentOf(afterTime, "--after-time") };
|
|
31
|
+
if (afterId === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const id = afterId.trim();
|
|
34
|
+
if (!isId(id))
|
|
35
|
+
throw new CliError("validation_error", `--after-id takes a message id — not "${afterId}"`);
|
|
36
|
+
return { id };
|
|
37
|
+
};
|
|
18
38
|
//# sourceMappingURL=after.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"after.js","sourceRoot":"","sources":["../../../src/cli/messenger/after.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"after.js","sourceRoot":"","sources":["../../../src/cli/messenger/after.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAG7D,6HAA6H;AAC7H,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAE,IAAI,GAAG,SAAS,EAAS,EAAE;IACpE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,CAAA;IAC/B,IAAI,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAA;IAC7D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,QAAQ,CAChB,kBAAkB,EAClB,GAAG,IAAI,mEAAmE,MAAM,GAAG,CACpF,CAAA;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAE,KAAyB,EAAQ,EAAE;IAC1F,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAChD,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE,2DAA2D,CAAC,CAAA;IACrG,CAAC;AACH,CAAC,CAAA;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAiB,EAAE,OAAgB,EAAE,SAAkB,EAAqB,EAAE;IACtG,MAAM,KAAK,GAAG;QACZ,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;QAClD,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY;QAChD,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc;KACrD,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;IACtC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAA;IAC5G,CAAC;IACD,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,CAAA;IACjF,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC3C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IACzB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE,wCAAwC,OAAO,GAAG,CAAC,CAAA;IACzG,OAAO,EAAE,EAAE,EAAE,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/archive-commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"archive-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/archive-commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAA;AAG/D,oHAAoH;AACpH,eAAO,MAAM,YAAY,cAAe,SAAS,KAAG,OASnD,CAAA"}
|
|
@@ -4,9 +4,10 @@ import { CliError } from "@leemour/cli-core";
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { toMarkdown } from "../../render/markdown.js";
|
|
6
6
|
import { renderMessages } from "../../render/messages.js";
|
|
7
|
+
import { momentOf } from "../../services/moment.js";
|
|
8
|
+
import { renderList } from "../paging.js";
|
|
7
9
|
import { fetchCommand, jobsCommand } from "./backfill-command.js";
|
|
8
10
|
import { messengerContext } from "./context.js";
|
|
9
|
-
import { momentOf } from "./inbox.js";
|
|
10
11
|
import { storeMaintenanceCommands } from "./store-maintenance-command.js";
|
|
11
12
|
/** `store`: the local store of messages — what it holds, filling it, reading it out, and looking after the file. */
|
|
12
13
|
export const storeCommand = (messenger) => {
|
|
@@ -30,7 +31,7 @@ const statusCommand = (messenger) => new Command("status")
|
|
|
30
31
|
.action(async function (chat) {
|
|
31
32
|
const context = messengerContext(this, messenger);
|
|
32
33
|
const rows = await context.withServices((services) => services.archive.status(chat));
|
|
33
|
-
context.renderer.
|
|
34
|
+
renderList(context.renderer, context.format, rows);
|
|
34
35
|
if (rows.length === 0)
|
|
35
36
|
context.renderer.note("the store holds no messages for this profile yet");
|
|
36
37
|
});
|
|
@@ -42,14 +43,14 @@ const exportCommand = (messenger) => new Command("export")
|
|
|
42
43
|
.description("a chat's stored messages as JSON lines, oldest first; never asks the messenger")
|
|
43
44
|
.argument("<chat>", messenger.chatArgument)
|
|
44
45
|
.option("--format <format>", "jsonl (the default): one message per line; markdown: a transcript with a heading per day, replies and forwards quoted")
|
|
45
|
-
.option("--since <time>", "only from this ISO 8601 time, or 30m / 2h / 1d ago, on")
|
|
46
|
+
.option("--since-time <time>", "only from this ISO 8601 time, or 30m / 2h / 1d ago, on")
|
|
46
47
|
.option("--output <file>", "write JSON lines, or the transcript, to this new file, readable only by you")
|
|
47
48
|
.action(async function (chat) {
|
|
48
|
-
const { format, since, output } = this.opts();
|
|
49
|
+
const { format, sinceTime: since, output } = this.opts();
|
|
49
50
|
if (format !== undefined && format !== "markdown" && format !== "jsonl") {
|
|
50
51
|
throw new CliError("validation_error", `--format is jsonl or markdown, not "${format}"`);
|
|
51
52
|
}
|
|
52
|
-
const from = since === undefined ? undefined : new Date(momentOf(since)).toISOString();
|
|
53
|
+
const from = since === undefined ? undefined : new Date(momentOf(since, "--since-time")).toISOString();
|
|
53
54
|
const context = messengerContext(this, messenger);
|
|
54
55
|
const { title, messages } = await context.withServices((services) => services.archive.export(chat, from === undefined ? {} : { since: from }));
|
|
55
56
|
if (output !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive-commands.js","sourceRoot":"","sources":["../../../src/cli/messenger/archive-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"archive-commands.js","sourceRoot":"","sources":["../../../src/cli/messenger/archive-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC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,CAAC,CAAA;SAC1F,IAAI,MAAM,KAAK,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO;QACvD,KAAK,MAAM,OAAO,IAAI,QAAQ;YAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;SAC1E,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;;QAE9E,OAAO,CAAC,OAAO,CAAC,IAAI,CAClB,cAAc,CAAC,QAAQ,EAAE;YACvB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM;YAClC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY;YAC3C,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM;SAC7B,CAAC,CACH,CAAA;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,WAAW,CAAC,CAAA;AACtD,CAAC,CAAC,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { Command } from "commander";
|
|
|
2
2
|
import { type Messenger } from "./context.js";
|
|
3
3
|
/**
|
|
4
4
|
* A chat's history into the store, newest to oldest, **resumable**: after every page the stretch it
|
|
5
|
-
* covered is recorded, so a stop — Ctrl-C, `--timeout`, `--
|
|
5
|
+
* covered is recorded, so a stop — Ctrl-C, `--timeout`, `--limit`, `--since-time`, `--last`, a long FloodWait — loses
|
|
6
6
|
* nothing, and the next run jumps over what is already held. Needs numeric message ids, which order
|
|
7
7
|
* the chat.
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backfill-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/backfill-command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"backfill-command.d.ts","sourceRoot":"","sources":["../../../src/cli/messenger/backfill-command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmBnC,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,cAAc,CAAA;AAGtF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,cAAe,SAAS,KAAG,OA8GnD,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,WAAW,cAAe,SAAS,KAAG,OA4ClD,CAAA"}
|
|
@@ -4,17 +4,18 @@ import { join } from "node:path";
|
|
|
4
4
|
import { CliError } from "@leemour/cli-core";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { FETCHING } from "../../services/archive.js";
|
|
7
|
+
import { momentOf } from "../../services/moment.js";
|
|
7
8
|
import { envName } from "../app.js";
|
|
8
9
|
import { environmentOf } from "../context.js";
|
|
9
10
|
import { isCliFailure } from "../failures.js";
|
|
11
|
+
import { renderList } from "../paging.js";
|
|
10
12
|
import { parseDuration } from "../settings.js";
|
|
11
13
|
import { jobsDir, listJobs, readJob, saveJob, spawnDetached, stateOf, updateJob, } from "./backfill-jobs.js";
|
|
12
14
|
import { messengerContext } from "./context.js";
|
|
13
|
-
import { momentOf } from "./inbox.js";
|
|
14
15
|
import { stopOnSignal } from "./patience.js";
|
|
15
16
|
/**
|
|
16
17
|
* A chat's history into the store, newest to oldest, **resumable**: after every page the stretch it
|
|
17
|
-
* covered is recorded, so a stop — Ctrl-C, `--timeout`, `--
|
|
18
|
+
* covered is recorded, so a stop — Ctrl-C, `--timeout`, `--limit`, `--since-time`, `--last`, a long FloodWait — loses
|
|
18
19
|
* nothing, and the next run jumps over what is already held. Needs numeric message ids, which order
|
|
19
20
|
* the chat.
|
|
20
21
|
*/
|
|
@@ -23,30 +24,33 @@ export const fetchCommand = (messenger) => {
|
|
|
23
24
|
return new Command("fetch")
|
|
24
25
|
.description("fetch a chat's history into the local store, newest first; run it again to continue")
|
|
25
26
|
.argument("<chat>", messenger.chatArgument)
|
|
26
|
-
.option("--
|
|
27
|
+
.option("--limit <n>", `at most this many messages in this run; ${fetching.maxPages * fetching.page} if not given`, wholeNumber)
|
|
28
|
+
.option("--page-size <n>", `how many messages one request asks for; ${fetching.page} if not given`, wholeNumber)
|
|
27
29
|
.option("--pause <duration>", fetching.jitter
|
|
28
30
|
? "the least pause between pages, to stay under the provider's limits; each is up to twice that"
|
|
29
31
|
: "pause between pages, to stay under the provider's limits", fetching.pause)
|
|
30
|
-
.option("--since <time>", "stop once it reaches messages older than this: ISO 8601, or 2h / 1d ago")
|
|
32
|
+
.option("--since-time <time>", "stop once it reaches messages older than this: ISO 8601, or 2h / 1d ago")
|
|
31
33
|
.option("--last <n>", "stop once the newest n messages are held", wholeNumber)
|
|
32
34
|
.option("--background", "run as a job that outlives this command; `store jobs show` follows it")
|
|
33
35
|
.option("--estimate", "only estimate how many messages, requests and minutes a full fetch would still take — from the store, no request")
|
|
34
36
|
.action(async function (chat) {
|
|
35
|
-
const {
|
|
37
|
+
const { pause, sinceTime: since, last, background, estimate, ...sizes } = this.opts();
|
|
36
38
|
if (since !== undefined && last !== undefined) {
|
|
37
|
-
throw new CliError("validation_error", "give --since or --last, not both: how far back the fetch goes");
|
|
39
|
+
throw new CliError("validation_error", "give --since-time or --last, not both: how far back the fetch goes");
|
|
38
40
|
}
|
|
41
|
+
const pageSize = sizes.pageSize ?? fetching.page;
|
|
42
|
+
const limit = sizes.limit ?? fetching.maxPages * fetching.page;
|
|
39
43
|
const pauseMs = parseDuration(pause, "--pause");
|
|
40
|
-
const sinceMs = since === undefined ? undefined : momentOf(since);
|
|
44
|
+
const sinceMs = since === undefined ? undefined : momentOf(since, "--since-time");
|
|
41
45
|
const context = messengerContext(this, messenger);
|
|
42
46
|
if (estimate) {
|
|
43
47
|
if (since !== undefined || last !== undefined) {
|
|
44
|
-
throw new CliError("validation_error", "--estimate prices a full fetch; --since and --last do not narrow it");
|
|
48
|
+
throw new CliError("validation_error", "--estimate prices a full fetch; --since-time and --last do not narrow it");
|
|
45
49
|
}
|
|
46
|
-
const answer = await context.withServices((services) => services.archive.estimate(chat, {
|
|
50
|
+
const answer = await context.withServices((services) => services.archive.estimate(chat, { limit, pageSize, pauseMs }));
|
|
47
51
|
context.renderer.result(answer);
|
|
48
52
|
if (answer.missing === null) {
|
|
49
|
-
context.renderer.note(`nothing held of this chat to measure by — \`${messenger.app.command} store fetch ${chat} --
|
|
53
|
+
context.renderer.note(`nothing held of this chat to measure by — \`${messenger.app.command} store fetch ${chat} --limit ${pageSize}\` gives the estimate something to go on`);
|
|
50
54
|
}
|
|
51
55
|
else if (answer.missing > 0)
|
|
52
56
|
context.renderer.note("an estimate: provider waits (FloodWait) come on top");
|
|
@@ -55,7 +59,8 @@ export const fetchCommand = (messenger) => {
|
|
|
55
59
|
if (background) {
|
|
56
60
|
startJob(this, context, messenger, {
|
|
57
61
|
chat,
|
|
58
|
-
|
|
62
|
+
limit,
|
|
63
|
+
pageSize,
|
|
59
64
|
pause,
|
|
60
65
|
...(last === undefined ? {} : { last }),
|
|
61
66
|
...(sinceMs === undefined ? {} : { since: new Date(sinceMs).toISOString() }),
|
|
@@ -67,7 +72,8 @@ export const fetchCommand = (messenger) => {
|
|
|
67
72
|
const stop = stopOnSignal(this);
|
|
68
73
|
try {
|
|
69
74
|
const result = await context.withServices((services) => services.archive.fetch(chat, {
|
|
70
|
-
|
|
75
|
+
limit,
|
|
76
|
+
pageSize,
|
|
71
77
|
pauseMs,
|
|
72
78
|
...(sinceMs === undefined ? {} : { sinceMs }),
|
|
73
79
|
...(last === undefined ? {} : { last }),
|
|
@@ -104,7 +110,7 @@ export const jobsCommand = (messenger) => {
|
|
|
104
110
|
.action(function () {
|
|
105
111
|
const context = messengerContext(this, messenger);
|
|
106
112
|
const jobs = listJobs(jobsDir(messenger.app, context.env)).filter((job) => job.profile === context.profile);
|
|
107
|
-
context.renderer.
|
|
113
|
+
renderList(context.renderer, context.format, jobs.map(brief));
|
|
108
114
|
if (jobs.length === 0)
|
|
109
115
|
context.renderer.note("no background fetch jobs for this profile");
|
|
110
116
|
});
|
|
@@ -145,7 +151,8 @@ const brief = (job) => ({
|
|
|
145
151
|
startedAt: job.startedAt,
|
|
146
152
|
...(job.finishedAt ? { finishedAt: job.finishedAt } : {}),
|
|
147
153
|
fetched: Number(job.result?.fetched ?? job.progress?.fetched ?? 0),
|
|
148
|
-
...(job.
|
|
154
|
+
...(job.limit === undefined ? {} : { limit: job.limit }),
|
|
155
|
+
...(job.pageSize === undefined ? {} : { pageSize: job.pageSize }),
|
|
149
156
|
...(job.last === undefined ? {} : { last: job.last }),
|
|
150
157
|
...(job.result ? { complete: job.result.complete === true } : {}),
|
|
151
158
|
...(job.error ? { error: job.error } : {}),
|
|
@@ -158,7 +165,7 @@ const findJob = (messenger, context, id) => {
|
|
|
158
165
|
}
|
|
159
166
|
return job;
|
|
160
167
|
};
|
|
161
|
-
const startJob = (command, context, messenger, { chat,
|
|
168
|
+
const startJob = (command, context, messenger, { chat, limit, pageSize, pause, since, last, }) => {
|
|
162
169
|
const { app } = messenger;
|
|
163
170
|
const dir = jobsDir(app, context.env);
|
|
164
171
|
const running = listJobs(dir).find((job) => job.profile === context.profile && job.chat === chat && stateOf(job) === "running");
|
|
@@ -174,11 +181,13 @@ const startJob = (command, context, messenger, { chat, maxPages, pause, since, l
|
|
|
174
181
|
"store",
|
|
175
182
|
"fetch",
|
|
176
183
|
chat,
|
|
177
|
-
"--
|
|
178
|
-
String(
|
|
184
|
+
"--limit",
|
|
185
|
+
String(limit),
|
|
186
|
+
"--page-size",
|
|
187
|
+
String(pageSize),
|
|
179
188
|
"--pause",
|
|
180
189
|
pause,
|
|
181
|
-
...(since === undefined ? [] : ["--since", since]),
|
|
190
|
+
...(since === undefined ? [] : ["--since-time", since]),
|
|
182
191
|
...(last === undefined ? [] : ["--last", String(last)]),
|
|
183
192
|
"--json",
|
|
184
193
|
...(timeout ? ["--timeout", timeout] : []),
|
|
@@ -192,7 +201,8 @@ const startJob = (command, context, messenger, { chat, maxPages, pause, since, l
|
|
|
192
201
|
profile: context.profile,
|
|
193
202
|
pid: 0,
|
|
194
203
|
startedAt: now.toISOString(),
|
|
195
|
-
|
|
204
|
+
limit,
|
|
205
|
+
pageSize,
|
|
196
206
|
...(last === undefined ? {} : { last }),
|
|
197
207
|
log,
|
|
198
208
|
};
|