@mobb.ai/cli 1.4.49 → 1.4.50
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/.env +10 -0
- package/LICENSE +21 -0
- package/README.md +210 -78
- package/bin/cli.mjs +2 -0
- package/dist/args/commands/upload_ai_blame.d.mts +164 -0
- package/dist/args/commands/upload_ai_blame.mjs +6614 -0
- package/dist/hash_search/index.d.mts +10 -0
- package/dist/hash_search/index.mjs +112 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +29052 -0
- package/package.json +160 -19
- package/src/features/codeium_intellij/proto/buf/validate/validate.proto +504 -0
- package/src/features/codeium_intellij/proto/exa/auto_cascade_common_pb/auto_cascade_common.proto +81 -0
- package/src/features/codeium_intellij/proto/exa/bug_checker_pb/bug_checker.proto +24 -0
- package/src/features/codeium_intellij/proto/exa/cascade_plugins_pb/cascade_plugins.proto +108 -0
- package/src/features/codeium_intellij/proto/exa/chat_client_server_pb/chat_client_server.proto +56 -0
- package/src/features/codeium_intellij/proto/exa/chat_pb/chat.proto +457 -0
- package/src/features/codeium_intellij/proto/exa/code_edit/code_edit_pb/code_edit.proto +191 -0
- package/src/features/codeium_intellij/proto/exa/codeium_common_pb/codeium_common.proto +3783 -0
- package/src/features/codeium_intellij/proto/exa/context_module_pb/context_module.proto +172 -0
- package/src/features/codeium_intellij/proto/exa/cortex_pb/cortex.proto +3604 -0
- package/src/features/codeium_intellij/proto/exa/diff_action_pb/diff_action.proto +73 -0
- package/src/features/codeium_intellij/proto/exa/extension_server_pb/extension_server.proto +565 -0
- package/src/features/codeium_intellij/proto/exa/index_pb/index.proto +474 -0
- package/src/features/codeium_intellij/proto/exa/knowledge_base_pb/knowledge_base.proto +149 -0
- package/src/features/codeium_intellij/proto/exa/language_server_pb/language_server.proto +2504 -0
- package/src/features/codeium_intellij/proto/exa/opensearch_clients_pb/opensearch_clients.proto +505 -0
- package/src/features/codeium_intellij/proto/exa/product_analytics_pb/product_analytics.proto +31 -0
- package/src/features/codeium_intellij/proto/exa/reactive_component_pb/reactive_component.proto +104 -0
- package/src/features/codeium_intellij/proto/exa/seat_management_pb/seat_management.proto +2349 -0
- package/src/post_install/binary.mjs +89 -0
- package/src/post_install/constants.mjs +2 -0
- package/src/post_install/cx_install.mjs +72 -0
- package/bin/mobbdev.js +0 -10
- package/lib/binary.js +0 -52
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
|
|
3
|
+
declare class HashSearchError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare function createIndex(originalText: string, windowSize?: number): Promise<Buffer>;
|
|
8
|
+
declare function searchIndex(searchText: string, index: Buffer): Promise<number[]>;
|
|
9
|
+
|
|
10
|
+
export { HashSearchError, createIndex, searchIndex };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/hash_search/index.ts
|
|
2
|
+
import { Buffer } from "buffer";
|
|
3
|
+
import { randomBytes } from "crypto";
|
|
4
|
+
import { blake3 } from "hash-wasm";
|
|
5
|
+
|
|
6
|
+
// src/hash_search/errors.ts
|
|
7
|
+
var HashSearchError = class _HashSearchError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "HashSearchError";
|
|
11
|
+
Object.setPrototypeOf(this, _HashSearchError.prototype);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/hash_search/index.ts
|
|
16
|
+
var MIN_WINDOW_SIZE = 8;
|
|
17
|
+
var DEFAULT_WINDOW_SIZE = 30;
|
|
18
|
+
async function createIndex(originalText, windowSize = DEFAULT_WINDOW_SIZE) {
|
|
19
|
+
if (!originalText || typeof originalText !== "string") {
|
|
20
|
+
throw new HashSearchError("Original text must be a non-empty string");
|
|
21
|
+
}
|
|
22
|
+
if (windowSize < MIN_WINDOW_SIZE) {
|
|
23
|
+
throw new HashSearchError(`Window size must be at least ${MIN_WINDOW_SIZE}`);
|
|
24
|
+
}
|
|
25
|
+
if (originalText.length < windowSize) {
|
|
26
|
+
throw new HashSearchError(
|
|
27
|
+
`Text length must be at least ${windowSize} characters (window size)`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const originalLength = originalText.length;
|
|
31
|
+
const paddingNeeded = (windowSize - originalLength % windowSize) % windowSize;
|
|
32
|
+
const paddedText = originalText + "\0".repeat(paddingNeeded);
|
|
33
|
+
const numChunks = paddedText.length - windowSize + 1;
|
|
34
|
+
const bufferSize = 12 + numChunks * 24;
|
|
35
|
+
const buffer = Buffer.alloc(bufferSize);
|
|
36
|
+
buffer.writeUInt8(114, 0);
|
|
37
|
+
buffer.writeUInt8(131, 1);
|
|
38
|
+
buffer.writeUInt8(0, 2);
|
|
39
|
+
buffer.writeUInt8(1, 3);
|
|
40
|
+
buffer.writeUInt32BE(originalLength, 4);
|
|
41
|
+
buffer.writeUInt32BE(windowSize, 8);
|
|
42
|
+
for (let i = 0; i < numChunks; i++) {
|
|
43
|
+
const chunk = paddedText.slice(i, i + windowSize);
|
|
44
|
+
const salt = randomBytes(8);
|
|
45
|
+
const dataToHash = Buffer.concat([salt, Buffer.from(chunk, "utf-8")]);
|
|
46
|
+
const hashHex = await blake3(dataToHash, 128);
|
|
47
|
+
const hash = Buffer.from(hashHex, "hex");
|
|
48
|
+
const offset = 12 + i * 24;
|
|
49
|
+
salt.copy(buffer, offset);
|
|
50
|
+
hash.copy(buffer, offset + 8);
|
|
51
|
+
}
|
|
52
|
+
return buffer;
|
|
53
|
+
}
|
|
54
|
+
async function searchIndex(searchText, index) {
|
|
55
|
+
if (!searchText || typeof searchText !== "string") {
|
|
56
|
+
throw new HashSearchError("Search text must be a non-empty string");
|
|
57
|
+
}
|
|
58
|
+
if (!Buffer.isBuffer(index)) {
|
|
59
|
+
throw new HashSearchError("Index must be a Buffer");
|
|
60
|
+
}
|
|
61
|
+
if (index.length < 12) {
|
|
62
|
+
throw new HashSearchError("Invalid index buffer: too small");
|
|
63
|
+
}
|
|
64
|
+
if ((index.length - 12) % 24 !== 0) {
|
|
65
|
+
throw new HashSearchError("Invalid index buffer: incorrect structure");
|
|
66
|
+
}
|
|
67
|
+
if (index.readUInt8(0) !== 114 || index.readUInt8(1) !== 131 || index.readUInt8(2) !== 0 || index.readUInt8(3) !== 1) {
|
|
68
|
+
throw new HashSearchError("Invalid magic number in index buffer");
|
|
69
|
+
}
|
|
70
|
+
const windowSize = index.readUInt32BE(8);
|
|
71
|
+
if (searchText.length < windowSize) {
|
|
72
|
+
throw new HashSearchError(
|
|
73
|
+
`Search text must be at least ${windowSize} characters (window size)`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const originalTextLength = index.readUInt32BE(4);
|
|
77
|
+
const searchLength = searchText.length;
|
|
78
|
+
const paddingNeeded = (windowSize - searchLength % windowSize) % windowSize;
|
|
79
|
+
const paddedSearch = searchText + "\0".repeat(paddingNeeded);
|
|
80
|
+
const numPositions = (index.length - 12) / 24;
|
|
81
|
+
const searchChunks = searchLength - windowSize + 1;
|
|
82
|
+
const results = [];
|
|
83
|
+
for (let startPos = 0; startPos <= numPositions - searchChunks; startPos++) {
|
|
84
|
+
let match = true;
|
|
85
|
+
for (let j = 0; j < searchChunks; j++) {
|
|
86
|
+
const searchChunk = paddedSearch.slice(j, j + windowSize);
|
|
87
|
+
const saltOffset = 12 + (startPos + j) * 24;
|
|
88
|
+
const salt = index.subarray(saltOffset, saltOffset + 8);
|
|
89
|
+
const dataToHash = Buffer.concat([
|
|
90
|
+
salt,
|
|
91
|
+
Buffer.from(searchChunk, "utf-8")
|
|
92
|
+
]);
|
|
93
|
+
const expectedHashHex = await blake3(dataToHash, 128);
|
|
94
|
+
const expectedHash = Buffer.from(expectedHashHex, "hex");
|
|
95
|
+
const hashOffset = saltOffset + 8;
|
|
96
|
+
const actualHash = index.subarray(hashOffset, hashOffset + 16);
|
|
97
|
+
if (!expectedHash.equals(actualHash)) {
|
|
98
|
+
match = false;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (match && startPos + searchLength <= originalTextLength) {
|
|
103
|
+
results.push(startPos);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
HashSearchError,
|
|
110
|
+
createIndex,
|
|
111
|
+
searchIndex
|
|
112
|
+
};
|
package/dist/index.d.mts
ADDED