@leemour/max-cli 0.4.0 → 0.5.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.
Files changed (100) hide show
  1. package/dist/bin/max.js +0 -0
  2. package/dist/cache/store.d.ts +14 -8
  3. package/dist/cache/store.d.ts.map +1 -1
  4. package/dist/cache/store.js +29 -5
  5. package/dist/cache/store.js.map +1 -1
  6. package/dist/client.d.ts +37 -3
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +164 -27
  9. package/dist/client.js.map +1 -1
  10. package/dist/commands/chats.d.ts.map +1 -1
  11. package/dist/commands/chats.js +20 -0
  12. package/dist/commands/chats.js.map +1 -1
  13. package/dist/commands/config.d.ts.map +1 -1
  14. package/dist/commands/config.js +27 -0
  15. package/dist/commands/config.js.map +1 -1
  16. package/dist/commands/contacts.d.ts.map +1 -1
  17. package/dist/commands/contacts.js +18 -0
  18. package/dist/commands/contacts.js.map +1 -1
  19. package/dist/commands/context.d.ts.map +1 -1
  20. package/dist/commands/context.js +1 -0
  21. package/dist/commands/context.js.map +1 -1
  22. package/dist/commands/messages.d.ts.map +1 -1
  23. package/dist/commands/messages.js +49 -2
  24. package/dist/commands/messages.js.map +1 -1
  25. package/dist/config.d.ts +45 -12
  26. package/dist/config.d.ts.map +1 -1
  27. package/dist/config.js +82 -16
  28. package/dist/config.js.map +1 -1
  29. package/dist/domain/map.js +6 -1
  30. package/dist/domain/map.js.map +1 -1
  31. package/dist/domain/models.d.ts +22 -1
  32. package/dist/domain/models.d.ts.map +1 -1
  33. package/dist/domain/models.js.map +1 -1
  34. package/dist/download.d.ts +15 -0
  35. package/dist/download.d.ts.map +1 -0
  36. package/dist/download.js +60 -0
  37. package/dist/download.js.map +1 -0
  38. package/dist/generated/client.generated.d.ts +4 -0
  39. package/dist/generated/client.generated.d.ts.map +1 -1
  40. package/dist/generated/client.generated.js +4 -0
  41. package/dist/generated/client.generated.js.map +1 -1
  42. package/dist/generated/opcodes.generated.d.ts +2 -0
  43. package/dist/generated/opcodes.generated.d.ts.map +1 -1
  44. package/dist/generated/opcodes.generated.js +2 -0
  45. package/dist/generated/opcodes.generated.js.map +1 -1
  46. package/dist/generated/operations.generated.d.ts +13 -0
  47. package/dist/generated/operations.generated.d.ts.map +1 -1
  48. package/dist/generated/operations.generated.js +3 -0
  49. package/dist/generated/operations.generated.js.map +1 -1
  50. package/dist/runs/recording.d.ts.map +1 -1
  51. package/dist/runs/recording.js +7 -0
  52. package/dist/runs/recording.js.map +1 -1
  53. package/dist/runs/run.d.ts +2 -0
  54. package/dist/runs/run.d.ts.map +1 -1
  55. package/dist/runs/run.js +1 -0
  56. package/dist/runs/run.js.map +1 -1
  57. package/dist/session/handshake.d.ts +1 -1
  58. package/dist/spec/index.d.ts.map +1 -1
  59. package/dist/spec/index.js +3 -0
  60. package/dist/spec/index.js.map +1 -1
  61. package/dist/spec/operations/attachments.d.ts +15 -0
  62. package/dist/spec/operations/attachments.d.ts.map +1 -0
  63. package/dist/spec/operations/attachments.js +38 -0
  64. package/dist/spec/operations/attachments.js.map +1 -0
  65. package/dist/testing/mock-max.d.ts +8 -3
  66. package/dist/testing/mock-max.d.ts.map +1 -1
  67. package/dist/testing/mock-max.js +4 -0
  68. package/dist/testing/mock-max.js.map +1 -1
  69. package/dist/testing/sandbox.js +2 -0
  70. package/dist/testing/sandbox.js.map +1 -1
  71. package/dist/testing/unscripted.d.ts +2 -0
  72. package/dist/testing/unscripted.d.ts.map +1 -0
  73. package/dist/testing/unscripted.js +18 -0
  74. package/dist/testing/unscripted.js.map +1 -0
  75. package/dist/version.d.ts +1 -1
  76. package/dist/version.js +1 -1
  77. package/package.json +27 -22
  78. package/skills/max-cli/SKILL.md +11 -3
  79. package/dist/commands/login.d.ts +0 -15
  80. package/dist/commands/login.d.ts.map +0 -1
  81. package/dist/commands/login.js +0 -43
  82. package/dist/commands/login.js.map +0 -1
  83. package/dist/commands/logout.d.ts +0 -10
  84. package/dist/commands/logout.d.ts.map +0 -1
  85. package/dist/commands/logout.js +0 -22
  86. package/dist/commands/logout.js.map +0 -1
  87. package/dist/commands/me.d.ts +0 -3
  88. package/dist/commands/me.d.ts.map +0 -1
  89. package/dist/commands/me.js +0 -18
  90. package/dist/commands/me.js.map +0 -1
  91. package/dist/commands/send.d.ts +0 -10
  92. package/dist/commands/send.d.ts.map +0 -1
  93. package/dist/commands/send.js +0 -30
  94. package/dist/commands/send.js.map +0 -1
  95. package/dist/protocol/session.d.ts +0 -54
  96. package/dist/protocol/session.d.ts.map +0 -1
  97. package/dist/protocol/session.js +0 -57
  98. package/dist/protocol/session.js.map +0 -1
  99. package/dist/spec/operations/auth.d.ts +0 -42
  100. package/dist/spec/operations/auth.d.ts.map +0 -1
@@ -1,54 +0,0 @@
1
- import type { Connection } from "./connection.js";
2
- import type { Payload } from "./frame.js";
3
- export declare const Opcode: {
4
- readonly SESSION_INIT: 6;
5
- readonly PROFILE: 16;
6
- readonly LOGIN: 19;
7
- readonly LOGOUT: 20;
8
- /**
9
- * Contact details by id. **Sources disagree about its neighbour**: opcode 36 is `CONTACT_LIST` in
10
- * tsmax and PyMax, and `GET_BLOCKED` in the protocol documentation. We use 32, which both call the
11
- * same thing, and stay away from 36 until somebody has watched what it returns.
12
- */
13
- readonly CONTACT_INFO: 32;
14
- readonly CHAT_HISTORY: 49;
15
- readonly CHATS_LIST: 53;
16
- readonly MSG_SEND: 64;
17
- };
18
- /**
19
- * What we claim to be. **We imitate MAX's own web client rather than announcing ourselves**
20
- * (REQUIREMENTS §34), so none of these values names this tool.
21
- *
22
- * Shape and field names from `max-api-docs/protocol/auth.md`, cross-checked against tsmax's
23
- * `createWebAgent`. The device identity is not here: it is generated once per profile and stored,
24
- * because a client that presents a new device on every command is not imitating anything.
25
- */
26
- export declare const WEB_USER_AGENT: {
27
- readonly deviceType: "WEB";
28
- readonly pushDeviceType: "WEBPUSH";
29
- readonly locale: "ru";
30
- readonly deviceLocale: "ru";
31
- readonly osVersion: "Linux";
32
- readonly deviceName: "Chrome";
33
- readonly headerUserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36";
34
- readonly appVersion: "26.5.5";
35
- readonly screen: "1080x1920 1.0x";
36
- readonly timezone: "Europe/Madrid";
37
- };
38
- export interface SessionOptions {
39
- token: string;
40
- deviceId: string;
41
- /** How many chats LOGIN should return with the profile. */
42
- chatsCount?: number;
43
- }
44
- /**
45
- * INIT then LOGIN, in that order, before anything else will be answered
46
- * (`max-api-docs/protocol/auth.md`).
47
- *
48
- * **`interactive` is false.** The web client sends true because a person is looking at it; we are
49
- * a script reading, and whether that flag moves presence or read state is not settled (`RES-5`).
50
- * Claiming a human is present when none is, is the kind of small lie that turns into a
51
- * side effect nobody can trace.
52
- */
53
- export declare const startSession: (connection: Connection, { token, deviceId, chatsCount }: SessionOptions) => Promise<Payload>;
54
- //# sourceMappingURL=session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/protocol/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,eAAO,MAAM,MAAM;;;;;IAKjB;;;;OAIG;;;;;CAKK,CAAA;AAEV;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAYjB,CAAA;AAEV,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,UAAU,EACtB,iCAAsC,cAAc,KACnD,OAAO,CAAC,OAAO,CAYjB,CAAA"}
@@ -1,57 +0,0 @@
1
- export const Opcode = {
2
- SESSION_INIT: 6,
3
- PROFILE: 16,
4
- LOGIN: 19,
5
- LOGOUT: 20,
6
- /**
7
- * Contact details by id. **Sources disagree about its neighbour**: opcode 36 is `CONTACT_LIST` in
8
- * tsmax and PyMax, and `GET_BLOCKED` in the protocol documentation. We use 32, which both call the
9
- * same thing, and stay away from 36 until somebody has watched what it returns.
10
- */
11
- CONTACT_INFO: 32,
12
- CHAT_HISTORY: 49,
13
- CHATS_LIST: 53,
14
- MSG_SEND: 64,
15
- };
16
- /**
17
- * What we claim to be. **We imitate MAX's own web client rather than announcing ourselves**
18
- * (REQUIREMENTS §34), so none of these values names this tool.
19
- *
20
- * Shape and field names from `max-api-docs/protocol/auth.md`, cross-checked against tsmax's
21
- * `createWebAgent`. The device identity is not here: it is generated once per profile and stored,
22
- * because a client that presents a new device on every command is not imitating anything.
23
- */
24
- export const WEB_USER_AGENT = {
25
- deviceType: "WEB",
26
- pushDeviceType: "WEBPUSH",
27
- locale: "ru",
28
- deviceLocale: "ru",
29
- osVersion: "Linux",
30
- deviceName: "Chrome",
31
- headerUserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36",
32
- appVersion: "26.5.5",
33
- screen: "1080x1920 1.0x",
34
- timezone: "Europe/Madrid",
35
- };
36
- /**
37
- * INIT then LOGIN, in that order, before anything else will be answered
38
- * (`max-api-docs/protocol/auth.md`).
39
- *
40
- * **`interactive` is false.** The web client sends true because a person is looking at it; we are
41
- * a script reading, and whether that flag moves presence or read state is not settled (`RES-5`).
42
- * Claiming a human is present when none is, is the kind of small lie that turns into a
43
- * side effect nobody can trace.
44
- */
45
- export const startSession = async (connection, { token, deviceId, chatsCount = 40 }) => {
46
- await connection.invoke(Opcode.SESSION_INIT, { userAgent: WEB_USER_AGENT, deviceId });
47
- return await connection.invoke(Opcode.LOGIN, {
48
- token,
49
- interactive: false,
50
- chatsCount,
51
- chatsSync: 0,
52
- contactsSync: 0,
53
- presenceSync: 0,
54
- draftsSync: 0,
55
- });
56
- };
57
- //# sourceMappingURL=session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/protocol/session.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV;;;;OAIG;IACH,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,EAAE;IAChB,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,EAAE;CACJ,CAAA;AAEV;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,SAAS;IACzB,MAAM,EAAE,IAAI;IACZ,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,QAAQ;IACpB,eAAe,EACb,uGAAuG;IACzG,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,eAAe;CACjB,CAAA;AASV;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,UAAsB,EACtB,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,GAAG,EAAE,EAAkB,EAClC,EAAE;IACpB,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAA;IAErF,OAAO,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAC3C,KAAK;QACL,WAAW,EAAE,KAAK;QAClB,UAAU;QACV,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;KACd,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -1,42 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const sessionInit: import("../define.js").Operation<v.StrictObjectSchema<{
3
- readonly userAgent: v.StrictObjectSchema<{
4
- readonly deviceType: v.LiteralSchema<"WEB", undefined>;
5
- readonly pushDeviceType: v.LiteralSchema<"WEBPUSH", undefined>;
6
- readonly locale: v.StringSchema<undefined>;
7
- readonly deviceLocale: v.StringSchema<undefined>;
8
- readonly osVersion: v.StringSchema<undefined>;
9
- readonly deviceName: v.StringSchema<undefined>;
10
- readonly headerUserAgent: v.StringSchema<undefined>;
11
- readonly appVersion: v.StringSchema<undefined>;
12
- readonly screen: v.StringSchema<undefined>;
13
- readonly timezone: v.StringSchema<undefined>;
14
- }, undefined>;
15
- readonly deviceId: v.StringSchema<undefined>;
16
- }, undefined>, v.LooseObjectSchema<{}, undefined>>;
17
- export declare const sessionLogin: import("../define.js").Operation<v.StrictObjectSchema<{
18
- readonly token: v.StringSchema<undefined>;
19
- /**
20
- * False, always. The web client sends true because a person is looking at it; we are a script
21
- * reading, and claiming a human is present is the small lie that becomes a side effect nobody
22
- * can trace (`RES-5`).
23
- */
24
- readonly interactive: v.LiteralSchema<false, undefined>;
25
- readonly chatsCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>;
26
- readonly chatsSync: v.NumberSchema<undefined>;
27
- readonly contactsSync: v.NumberSchema<undefined>;
28
- readonly presenceSync: v.NumberSchema<undefined>;
29
- readonly draftsSync: v.NumberSchema<undefined>;
30
- }, undefined>, v.LooseObjectSchema<{
31
- readonly profile: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
32
- readonly chats: v.OptionalSchema<v.ArraySchema<v.LooseObjectSchema<{}, undefined>, undefined>, undefined>;
33
- readonly contacts: v.OptionalSchema<v.ArraySchema<v.LooseObjectSchema<{}, undefined>, undefined>, undefined>;
34
- readonly messages: v.OptionalSchema<v.ArraySchema<v.LooseObjectSchema<{}, undefined>, undefined>, undefined>;
35
- readonly presence: v.OptionalSchema<v.UnknownSchema, undefined>;
36
- readonly time: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
37
- readonly chatMarker: v.OptionalSchema<v.UnknownSchema, undefined>;
38
- readonly config: v.OptionalSchema<v.UnknownSchema, undefined>;
39
- readonly videoChatHistory: v.OptionalSchema<v.UnknownSchema, undefined>;
40
- }, undefined>>;
41
- export declare const logout: import("../define.js").Reservation;
42
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/spec/operations/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAsB5B,eAAO,MAAM,WAAW;;;;;;;;;;;;;;kDAYtB,CAAA;AAEF,eAAO,MAAM,YAAY;;IAOrB;;;;OAIG;;;;;;;;;;;;;;;;;cA2BL,CAAA;AAEF,eAAO,MAAM,MAAM,oCAOjB,CAAA"}