@rikaidev/yomi 0.2.6 → 0.3.1

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 (54) hide show
  1. package/README.md +38 -11
  2. package/dist/auth/credential-store.js +0 -34
  3. package/dist/insight/graph.js +90 -0
  4. package/dist/insight/index.js +61 -0
  5. package/dist/insight/pending.js +92 -0
  6. package/dist/insight/relationships.js +125 -0
  7. package/dist/insight/rhythm.js +50 -0
  8. package/dist/line/auth/protocol/index.js +0 -2
  9. package/dist/line/auth/pwless/index.js +1 -1
  10. package/dist/line/client/index.js +1 -1
  11. package/dist/line/client/talk-service/chat-query.js +3 -3
  12. package/dist/line/client/talk-service/contact-query.js +1 -1
  13. package/dist/line/client/talk-service/requests.js +1 -1
  14. package/dist/line/core/e2ee/crypto/crypto-primitives.js +2 -15
  15. package/dist/line/core/e2ee/index.js +0 -1
  16. package/dist/line/core/e2ee/keys/decrypt.js +0 -1
  17. package/dist/line/core/e2ee/keys/group-key.js +0 -1
  18. package/dist/line/core/e2ee/keys/key-payload.js +1 -1
  19. package/dist/line/core/e2ee/keys/message-decrypt.js +1 -1
  20. package/dist/line/core/e2ee/keys/peer-key.js +1 -1
  21. package/dist/line/core/media-decrypt.js +1 -1
  22. package/dist/line/core/mention.js +1 -1
  23. package/dist/line/core/message-query-service.js +2 -2
  24. package/dist/line/core/session-state/persist.js +1 -1
  25. package/dist/line/core/thrift/binary/type-codec-dsl.js +1 -1
  26. package/dist/line/core/thrift/compact/type-codec-dsl.js +1 -43
  27. package/dist/line/core/thrift/fields/builders.js +1 -11
  28. package/dist/line/core/thrift/index.js +1 -6
  29. package/dist/line/core/thrift/primitives/varint.js +1 -1
  30. package/dist/line/core/thrift/types.js +0 -6
  31. package/dist/mcp/handlers/contacts.js +4 -16
  32. package/dist/mcp/handlers/conversations.js +5 -11
  33. package/dist/mcp/handlers/index.js +1 -0
  34. package/dist/mcp/handlers/insight.js +129 -0
  35. package/dist/mcp/handlers/login.js +3 -3
  36. package/dist/mcp/handlers/scope.js +5 -11
  37. package/dist/mcp/handlers/search.js +32 -10
  38. package/dist/mcp/handlers/send.js +16 -16
  39. package/dist/mcp/handlers/shared.js +21 -6
  40. package/dist/mcp/handlers/stickers.js +3 -12
  41. package/dist/mcp/media.js +2 -2
  42. package/dist/mcp/names.js +1 -1
  43. package/dist/mcp/server.js +11 -4
  44. package/dist/mcp/tools.js +17 -0
  45. package/dist/search/collector.js +1 -1
  46. package/dist/search/store.js +58 -14
  47. package/dist/util/data-dir.js +1 -1
  48. package/dist/version.js +1 -1
  49. package/package.json +5 -3
  50. package/dist/line/core/e2ee/types.js +0 -4
  51. package/dist/line/core/store.js +0 -8
  52. package/dist/line/core/thrift/binary/binary-reader.js +0 -151
  53. package/dist/line/core/thrift/compact/compact-reader.js +0 -180
  54. package/dist/line/core/thrift/compact/compact-writer.js +0 -161
@@ -1,180 +0,0 @@
1
- /**
2
- * Thrift Compact Reader
3
- *
4
- * Reads Thrift protocol messages in compact binary format.
5
- *
6
- * @class TCompactReader
7
- */
8
- import { THRIFT_TYPE } from '../types.js';
9
- import { getCompactTypeCodecDefinition } from './type-codec-dsl.js';
10
- /**
11
- *
12
- */
13
- export class TCompactReader {
14
- buffer;
15
- offset = 0;
16
- lastFieldId = 0;
17
- readHandlers;
18
- constructor(buffer) {
19
- this.buffer = buffer;
20
- this.readHandlers = {
21
- readBoolValue: () => this.readByte() !== 0,
22
- readByteValue: () => this.readByte(),
23
- readI16Value: () => this.readZigzag32(),
24
- readI32Value: () => this.readZigzag32(),
25
- readI64Value: () => this.readZigzag64(),
26
- readStringValue: () => this.readString(),
27
- };
28
- }
29
- /**
30
- * Read message header
31
- *
32
- * @returns {{name: string, type: number, seqId: number}} Message header
33
- */
34
- readMessageBegin() {
35
- const protocolId = this.readVarint32();
36
- if ((protocolId & 0xff000000) !== 0x82010000) {
37
- throw new Error('Invalid compact protocol');
38
- }
39
- const type = (protocolId >> 4) & 0x0f;
40
- const name = this.readString();
41
- const seqId = this.readVarint32();
42
- return { name, type, seqId };
43
- }
44
- /**
45
- * Read message end
46
- */
47
- readMessageEnd() {
48
- // No-op
49
- }
50
- /**
51
- * Read field begin
52
- *
53
- * @returns {{type: number, id: number}} Field header
54
- */
55
- readFieldBegin() {
56
- const header = this.readByte();
57
- if ((header & 0x0f) === THRIFT_TYPE.STOP) {
58
- return { type: THRIFT_TYPE.STOP, id: 0 };
59
- }
60
- const delta = (header >> 4) & 0x0f;
61
- const type = header & 0x0f;
62
- if (delta > 0) {
63
- this.lastFieldId += delta;
64
- }
65
- else {
66
- this.lastFieldId = this.readVarint32();
67
- }
68
- return { type, id: this.lastFieldId };
69
- }
70
- /**
71
- * Read field end
72
- */
73
- readFieldEnd() {
74
- // No-op
75
- }
76
- /**
77
- * Read byte
78
- *
79
- * @returns {number} Byte value
80
- */
81
- readByte() {
82
- return this.buffer[this.offset++];
83
- }
84
- /**
85
- * Read varint32
86
- *
87
- * @returns {number} Integer value
88
- */
89
- readVarint32() {
90
- let result = 0;
91
- let shift = 0;
92
- while (true) {
93
- const b = this.readByte();
94
- result |= (b & 0x7f) << shift;
95
- if ((b & 0x80) === 0) {
96
- break;
97
- }
98
- shift += 7;
99
- }
100
- return result;
101
- }
102
- /**
103
- * Read zigzag32
104
- *
105
- * @returns {number} Integer value
106
- */
107
- readZigzag32() {
108
- const n = this.readVarint32();
109
- return (n >>> 1) ^ -(n & 1);
110
- }
111
- /**
112
- * Read zigzag64
113
- *
114
- * @returns {number} Integer value
115
- */
116
- readZigzag64() {
117
- const n = this.readVarint64();
118
- return (n >>> 1) ^ -(n & 1);
119
- }
120
- /**
121
- * Read varint64
122
- *
123
- * @returns {number} Integer value
124
- */
125
- readVarint64() {
126
- let result = 0n;
127
- let shift = 0;
128
- while (true) {
129
- const b = this.readByte();
130
- result |= BigInt(b & 0x7f) << BigInt(shift);
131
- if ((b & 0x80) === 0) {
132
- break;
133
- }
134
- shift += 7;
135
- }
136
- return Number(result);
137
- }
138
- /**
139
- * Read string
140
- *
141
- * @returns {string} String value
142
- */
143
- readString() {
144
- const len = this.readVarint32();
145
- const bytes = this.buffer.slice(this.offset, this.offset + len);
146
- this.offset += len;
147
- return new TextDecoder().decode(bytes);
148
- }
149
- /**
150
- * Read value
151
- *
152
- * @param {number} type - Value type
153
- * @returns {unknown} Value
154
- */
155
- readValue(type) {
156
- const definition = getCompactTypeCodecDefinition(type);
157
- if (!definition) {
158
- throw new Error(`Unsupported type: ${type}`);
159
- }
160
- return this.readHandlers[definition.readHandler]();
161
- }
162
- /**
163
- * Read struct
164
- *
165
- * @returns {ThriftField[]} Fields
166
- */
167
- readStruct() {
168
- const fields = [];
169
- while (true) {
170
- const { type, id } = this.readFieldBegin();
171
- if (type === THRIFT_TYPE.STOP) {
172
- break;
173
- }
174
- const value = this.readValue(type);
175
- fields.push({ id, type: type, value });
176
- this.readFieldEnd();
177
- }
178
- return fields;
179
- }
180
- }
@@ -1,161 +0,0 @@
1
- /**
2
- * Thrift Compact Writer
3
- *
4
- * Writes Thrift protocol messages in compact binary format.
5
- *
6
- * @class TCompactWriter
7
- */
8
- import { THRIFT_TYPE } from '../types.js';
9
- import { getCompactTypeCodecDefinition } from './type-codec-dsl.js';
10
- /**
11
- *
12
- */
13
- export class TCompactWriter {
14
- buffer = [];
15
- lastFieldId = 0;
16
- writeHandlers;
17
- constructor() {
18
- this.writeHandlers = {
19
- writeBoolValue: (value) => this.writeByte(value ? 1 : 0),
20
- writeByteValue: (value) => this.writeByte(value),
21
- writeI16Value: (value) => this.writeZigzag32(value),
22
- writeI32Value: (value) => this.writeZigzag32(value),
23
- writeI64Value: (value) => this.writeZigzag64(Number(value)),
24
- writeStringValue: (value) => this.writeString(value),
25
- };
26
- }
27
- /**
28
- * Write message header
29
- *
30
- * @param {string} name - Method name
31
- * @param {number} seqId - Sequence ID
32
- * @param {Function} fieldsBuilder - Function to write fields
33
- */
34
- writeMessage(name, seqId, fieldsBuilder) {
35
- this.buffer = [];
36
- this.lastFieldId = 0;
37
- // Protocol version + type
38
- this.writeVarint32(0x820100 | 1);
39
- this.writeString(name);
40
- this.writeVarint32(seqId);
41
- fieldsBuilder();
42
- this.writeByte(THRIFT_TYPE.STOP);
43
- }
44
- /**
45
- * Write field header
46
- *
47
- * @param {number} id - Field ID
48
- * @param {number} type - Field type
49
- */
50
- writeFieldBegin(id, type) {
51
- const delta = id - this.lastFieldId;
52
- if (delta > 0 && delta <= 15) {
53
- this.writeByte((delta << 4) | type);
54
- }
55
- else {
56
- this.writeByte(type);
57
- this.writeVarint32(id);
58
- }
59
- this.lastFieldId = id;
60
- }
61
- /**
62
- * Write field stop
63
- */
64
- writeFieldStop() {
65
- this.writeByte(THRIFT_TYPE.STOP);
66
- }
67
- /**
68
- * Write byte
69
- *
70
- * @param {number} b - Byte value
71
- */
72
- writeByte(b) {
73
- this.buffer.push(b & 0xff);
74
- }
75
- /**
76
- * Write varint32
77
- *
78
- * @param {number} n - Integer value
79
- */
80
- writeVarint32(n) {
81
- while (n > 0x7f) {
82
- this.buffer.push((n & 0x7f) | 0x80);
83
- n >>= 7;
84
- }
85
- this.buffer.push(n);
86
- }
87
- /**
88
- * Write varint64
89
- *
90
- * @param {number} n - Integer value
91
- */
92
- writeVarint64(n) {
93
- while (n > 0x7f) {
94
- this.buffer.push((n & 0x7f) | 0x80);
95
- n >>= 7;
96
- }
97
- this.buffer.push(n);
98
- }
99
- /**
100
- * Write zigzag encoded 32-bit integer
101
- *
102
- * @param {number} n - Integer value
103
- */
104
- writeZigzag32(n) {
105
- this.writeVarint32((n << 1) ^ (n >> 31));
106
- }
107
- /**
108
- * Write zigzag encoded 64-bit integer
109
- *
110
- * @param {number} n - Integer value
111
- */
112
- writeZigzag64(n) {
113
- this.writeVarint64((n << 1) ^ (n >> 63));
114
- }
115
- /**
116
- * Write string
117
- *
118
- * @param {string} s - String value
119
- */
120
- writeString(s) {
121
- const bytes = new TextEncoder().encode(s);
122
- this.writeVarint32(bytes.length);
123
- for (const b of bytes) {
124
- this.buffer.push(b);
125
- }
126
- }
127
- /**
128
- * Write list
129
- *
130
- * @param {number} elemType - Element type
131
- * @param {unknown[]} arr - Array of elements
132
- */
133
- writeList(elemType, arr) {
134
- this.writeByte(elemType);
135
- this.writeVarint32(arr.length);
136
- for (const item of arr) {
137
- this.writeValue(elemType, item);
138
- }
139
- }
140
- /**
141
- * Write value
142
- *
143
- * @param {number} type - Value type
144
- * @param {unknown} value - Value
145
- */
146
- writeValue(type, value) {
147
- const definition = getCompactTypeCodecDefinition(type);
148
- if (!definition) {
149
- throw new Error(`Unsupported type: ${type}`);
150
- }
151
- this.writeHandlers[definition.writeHandler](value);
152
- }
153
- /**
154
- * Get buffer
155
- *
156
- * @returns {Uint8Array} Buffer
157
- */
158
- getBuffer() {
159
- return new Uint8Array(this.buffer);
160
- }
161
- }