repoburg 1.3.11 → 1.3.13
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/backend/dist/packages/tokenpatch/index.d.ts +5 -1
- package/backend/dist/packages/tokenpatch/index.js +42 -24
- package/backend/dist/packages/tokenpatch/index.js.map +1 -1
- package/backend/dist/packages/tokenpatch/patcher.js +62 -20
- package/backend/dist/packages/tokenpatch/patcher.js.map +1 -1
- package/backend/dist/packages/tokenpatch/strategies/tiktoken-tokenizer.d.ts +6 -0
- package/backend/dist/packages/tokenpatch/strategies/tiktoken-tokenizer.js +28 -0
- package/backend/dist/packages/tokenpatch/strategies/tiktoken-tokenizer.js.map +1 -0
- package/backend/dist/packages/tokenpatch/strategies/tree-sitter-tokenizer.d.ts +9 -0
- package/backend/dist/packages/tokenpatch/strategies/tree-sitter-tokenizer.js +36 -0
- package/backend/dist/packages/tokenpatch/strategies/tree-sitter-tokenizer.js.map +1 -0
- package/backend/dist/packages/tokenpatch/tokenizer.interface.d.ts +4 -0
- package/backend/dist/packages/tokenpatch/tokenizer.interface.js +3 -0
- package/backend/dist/packages/tokenpatch/tokenizer.interface.js.map +1 -0
- package/backend/dist/packages/tokenpatch/tokens.d.ts +0 -2
- package/backend/dist/packages/tokenpatch/tokens.js +4 -23
- package/backend/dist/packages/tokenpatch/tokens.js.map +1 -1
- package/backend/dist/packages/tokenpatch/types.d.ts +2 -2
- package/backend/dist/src/llm-orchestration/action-handlers/patch.handler.js +130 -51
- package/backend/dist/src/llm-orchestration/action-handlers/patch.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/parser/parsing.constants.d.ts +2 -0
- package/backend/dist/src/llm-orchestration/parser/parsing.constants.js +3 -1
- package/backend/dist/src/llm-orchestration/parser/parsing.constants.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/experimental_eta_master-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/experimental_eta_master-agent.js +44 -55
- package/backend/dist/src/seeding/data/system-prompts/experimental_eta_master-agent.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/backend/packages/tokenpatch/index.spec.ts +55 -37
- package/backend/packages/tokenpatch/index.ts +61 -31
- package/backend/packages/tokenpatch/patcher.ts +119 -30
- package/backend/packages/tokenpatch/strategies/tiktoken-tokenizer.ts +35 -0
- package/backend/packages/tokenpatch/strategies/tree-sitter-tokenizer.ts +37 -0
- package/backend/packages/tokenpatch/tokenizer.interface.ts +5 -0
- package/backend/packages/tokenpatch/tokens.ts +10 -28
- package/backend/packages/tokenpatch/types.ts +4 -4
- package/package.json +2 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Token } from '../types';
|
|
2
|
+
import { TokenizerStrategy } from '../tokenizer.interface';
|
|
3
|
+
import type { Tree, Node, Parser } from 'web-tree-sitter';
|
|
4
|
+
|
|
5
|
+
export class TreeSitterTokenizer implements TokenizerStrategy {
|
|
6
|
+
constructor(private parser: Parser) {}
|
|
7
|
+
|
|
8
|
+
tokenize(content: string): Token[] {
|
|
9
|
+
const tree = this.parser.parse(content);
|
|
10
|
+
return this.collectTokens(tree, content);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private collectTokens(tree: Tree, code: string): Token[] {
|
|
14
|
+
const tokens: Token[] = [];
|
|
15
|
+
|
|
16
|
+
function visit(node: Node) {
|
|
17
|
+
if (node.childCount === 0) {
|
|
18
|
+
tokens.push({
|
|
19
|
+
text: code.slice(node.startIndex, node.endIndex),
|
|
20
|
+
type: node.type,
|
|
21
|
+
startIndex: node.startIndex,
|
|
22
|
+
endIndex: node.endIndex,
|
|
23
|
+
startPosition: node.startPosition,
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// By iterating over all children (not just named), we include punctuation
|
|
28
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
29
|
+
const child = node.child(i);
|
|
30
|
+
if (child) visit(child);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
visit(tree.rootNode);
|
|
35
|
+
return tokens;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,33 +1,15 @@
|
|
|
1
|
-
import type { Tree, Node } from 'web-tree-sitter';
|
|
2
1
|
import type { Token } from './types';
|
|
3
2
|
|
|
4
|
-
export function collectTokens(tree: Tree, code: string): Token[] {
|
|
5
|
-
const tokens: Token[] = [];
|
|
6
|
-
|
|
7
|
-
function visit(node: Node) {
|
|
8
|
-
if (node.childCount === 0) {
|
|
9
|
-
tokens.push({
|
|
10
|
-
text: code.slice(node.startIndex, node.endIndex),
|
|
11
|
-
type: node.type,
|
|
12
|
-
startIndex: node.startIndex,
|
|
13
|
-
endIndex: node.endIndex,
|
|
14
|
-
startPosition: node.startPosition,
|
|
15
|
-
});
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
// By iterating over all children (not just named), we include punctuation
|
|
19
|
-
// which is critical for anchor-based matching.
|
|
20
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
21
|
-
const child = node.child(i);
|
|
22
|
-
if (child) visit(child);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
visit(tree.rootNode);
|
|
27
|
-
return tokens;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
3
|
export function tokensEqual(a: Token, b: Token): boolean {
|
|
4
|
+
// If using Tiktoken (BPE), we relax the comparison to ignore whitespace differences
|
|
5
|
+
// and newlines by trimming and stripping them. This helps when the patch might
|
|
6
|
+
// have slightly different indentation or spacing than the source.
|
|
7
|
+
if (a.type === 'bpe' || b.type === 'bpe') {
|
|
8
|
+
return (
|
|
9
|
+
a.text.replace(/\r?\n/g, '').trim() ===
|
|
10
|
+
b.text.replace(/\r?\n/g, '').trim()
|
|
11
|
+
);
|
|
12
|
+
}
|
|
31
13
|
return a.text === b.text;
|
|
32
14
|
}
|
|
33
15
|
|
|
@@ -47,4 +29,4 @@ export function findAllSequences(haystack: Token[], needle: Token[]): number[] {
|
|
|
47
29
|
indices.push(i);
|
|
48
30
|
}
|
|
49
31
|
return indices;
|
|
50
|
-
}
|
|
32
|
+
}
|
|
@@ -2,8 +2,8 @@ import type { Point } from 'web-tree-sitter';
|
|
|
2
2
|
|
|
3
3
|
export interface Token {
|
|
4
4
|
text: string;
|
|
5
|
-
type
|
|
6
|
-
startIndex: number; // byte offsets
|
|
5
|
+
type?: string;
|
|
6
|
+
startIndex: number; // byte offsets
|
|
7
7
|
endIndex: number;
|
|
8
|
-
startPosition
|
|
9
|
-
}
|
|
8
|
+
startPosition?: Point;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repoburg",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "A local AI-powered software developer assistant that runs on your own machine.",
|
|
5
5
|
"author": "Celal Ertug",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"gpt-tokenizer": "^3.0.1",
|
|
70
70
|
"http-proxy-middleware": "^3.0.0",
|
|
71
71
|
"jose": "^5.6.3",
|
|
72
|
+
"js-tiktoken": "^1.0.21",
|
|
72
73
|
"libphonenumber-js": "^1.12.10",
|
|
73
74
|
"mermaid": "^11.10.1",
|
|
74
75
|
"open": "^10.1.2",
|