byterover-cli 2.5.2 → 2.6.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 (85) hide show
  1. package/.env.production +7 -0
  2. package/LICENSE +44 -0
  3. package/bin/dev.js +8 -1
  4. package/bin/run.js +8 -1
  5. package/dist/server/config/environment.d.ts +0 -19
  6. package/dist/server/config/environment.js +29 -38
  7. package/dist/server/constants.d.ts +0 -9
  8. package/dist/server/constants.js +0 -12
  9. package/dist/server/core/domain/errors/auth-error.d.ts +0 -6
  10. package/dist/server/core/domain/errors/auth-error.js +0 -12
  11. package/dist/server/core/domain/errors/task-error.d.ts +0 -3
  12. package/dist/server/core/domain/errors/task-error.js +0 -8
  13. package/dist/server/core/domain/errors/transport-error.d.ts +0 -31
  14. package/dist/server/core/domain/errors/transport-error.js +0 -50
  15. package/dist/server/infra/connectors/rules/rules-connector-config.d.ts +0 -4
  16. package/dist/server/infra/http/models-dev-client.d.ts +0 -4
  17. package/dist/server/infra/http/models-dev-client.js +0 -6
  18. package/dist/server/infra/http/openrouter-api-client.d.ts +0 -8
  19. package/dist/server/infra/http/openrouter-api-client.js +0 -13
  20. package/dist/server/infra/http/provider-model-fetcher-registry.d.ts +0 -5
  21. package/dist/server/infra/http/provider-model-fetcher-registry.js +0 -7
  22. package/dist/server/infra/provider/env-provider-detector.d.ts +0 -20
  23. package/dist/server/infra/provider/env-provider-detector.js +0 -27
  24. package/dist/server/infra/storage/file-provider-config-store.d.ts +0 -4
  25. package/dist/server/infra/storage/file-provider-config-store.js +0 -6
  26. package/dist/server/utils/file-content-reader.d.ts +2 -1
  27. package/dist/server/utils/file-helpers.d.ts +0 -24
  28. package/dist/server/utils/file-helpers.js +0 -81
  29. package/dist/server/utils/process-logger.d.ts +0 -13
  30. package/dist/server/utils/process-logger.js +1 -78
  31. package/node_modules/@campfirein/brv-transport-client/LICENSE +95 -0
  32. package/node_modules/@campfirein/brv-transport-client/README.md +3 -4
  33. package/node_modules/@campfirein/brv-transport-client/package.json +2 -2
  34. package/oclif.manifest.json +132 -132
  35. package/package.json +5 -3
  36. package/dist/server/core/domain/entities/bullet.d.ts +0 -51
  37. package/dist/server/core/domain/entities/bullet.js +0 -94
  38. package/dist/server/core/domain/entities/memory.d.ts +0 -55
  39. package/dist/server/core/domain/entities/memory.js +0 -90
  40. package/dist/server/core/domain/entities/playbook.d.ts +0 -80
  41. package/dist/server/core/domain/entities/playbook.js +0 -214
  42. package/dist/server/core/domain/entities/presigned-url.d.ts +0 -9
  43. package/dist/server/core/domain/entities/presigned-url.js +0 -18
  44. package/dist/server/core/domain/entities/presigned-urls-response.d.ts +0 -10
  45. package/dist/server/core/domain/entities/presigned-urls-response.js +0 -18
  46. package/dist/server/core/domain/entities/retrieve-result.d.ts +0 -35
  47. package/dist/server/core/domain/entities/retrieve-result.js +0 -35
  48. package/dist/server/core/domain/errors/headless-prompt-error.d.ts +0 -11
  49. package/dist/server/core/domain/errors/headless-prompt-error.js +0 -18
  50. package/dist/server/core/interfaces/services/i-legacy-rule-detector.d.ts +0 -56
  51. package/dist/server/core/interfaces/services/i-legacy-rule-detector.js +0 -1
  52. package/dist/server/core/interfaces/services/i-memory-retrieval-service.d.ts +0 -39
  53. package/dist/server/core/interfaces/services/i-memory-retrieval-service.js +0 -1
  54. package/dist/server/core/interfaces/services/i-memory-storage-service.d.ts +0 -53
  55. package/dist/server/core/interfaces/services/i-memory-storage-service.js +0 -1
  56. package/dist/server/core/interfaces/services/i-terminal.d.ts +0 -146
  57. package/dist/server/core/interfaces/services/i-terminal.js +0 -1
  58. package/dist/server/core/interfaces/services/i-workspace-detector-service.d.ts +0 -8
  59. package/dist/server/core/interfaces/services/i-workspace-detector-service.js +0 -1
  60. package/dist/server/core/interfaces/storage/i-onboarding-preference-store.d.ts +0 -20
  61. package/dist/server/core/interfaces/storage/i-onboarding-preference-store.js +0 -1
  62. package/dist/server/infra/connectors/rules/legacy-rule-detector.d.ts +0 -21
  63. package/dist/server/infra/connectors/rules/legacy-rule-detector.js +0 -106
  64. package/dist/server/infra/memory/http-memory-retrieval-service.d.ts +0 -18
  65. package/dist/server/infra/memory/http-memory-retrieval-service.js +0 -64
  66. package/dist/server/infra/memory/http-memory-storage-service.d.ts +0 -18
  67. package/dist/server/infra/memory/http-memory-storage-service.js +0 -72
  68. package/dist/server/infra/memory/memory-to-playbook-mapper.d.ts +0 -33
  69. package/dist/server/infra/memory/memory-to-playbook-mapper.js +0 -51
  70. package/dist/server/infra/storage/file-onboarding-preference-store.d.ts +0 -10
  71. package/dist/server/infra/storage/file-onboarding-preference-store.js +0 -45
  72. package/dist/server/infra/terminal/headless-terminal.d.ts +0 -91
  73. package/dist/server/infra/terminal/headless-terminal.js +0 -211
  74. package/dist/server/infra/workspace/workspace-detector-service.d.ts +0 -57
  75. package/dist/server/infra/workspace/workspace-detector-service.js +0 -165
  76. package/dist/server/utils/crash-log.d.ts +0 -14
  77. package/dist/server/utils/crash-log.js +0 -19
  78. package/dist/server/utils/emoji-helpers.d.ts +0 -38
  79. package/dist/server/utils/emoji-helpers.js +0 -42
  80. package/dist/server/utils/error-handler.d.ts +0 -51
  81. package/dist/server/utils/error-handler.js +0 -169
  82. package/dist/server/utils/oclif-error-helpers.d.ts +0 -40
  83. package/dist/server/utils/oclif-error-helpers.js +0 -46
  84. package/dist/server/utils/tool-display-formatter.d.ts +0 -53
  85. package/dist/server/utils/tool-display-formatter.js +0 -257
@@ -1,55 +0,0 @@
1
- /**
2
- * Parameters for creating a Memory instance.
3
- *
4
- * Note: score, parentIds, and childrenIds are optional.
5
- * These fields are present in primary memories (from the `memories` array)
6
- * but absent in related memories (from the `related_memories` array).
7
- */
8
- export type MemoryParams = {
9
- bulletId: string;
10
- childrenIds?: string[];
11
- content: string;
12
- id: string;
13
- metadataType: string;
14
- nodeKeys: string[];
15
- parentIds?: string[];
16
- score?: number;
17
- section: string;
18
- tags: string[];
19
- timestamp: string;
20
- title: string;
21
- };
22
- /**
23
- * Represents a memory retrieved from the ByteRover Memora service.
24
- * Memories are hierarchical knowledge fragments that can have parent and child relationships.
25
- *
26
- * Note: score, parentIds, and childrenIds are optional fields.
27
- * - Primary memories (from API `memories` array) have these fields
28
- * - Related memories (from API `related_memories` array) don't have these fields
29
- */
30
- export declare class Memory {
31
- readonly bulletId: string;
32
- readonly childrenIds?: readonly string[];
33
- readonly content: string;
34
- readonly id: string;
35
- readonly metadataType: string;
36
- readonly nodeKeys: readonly string[];
37
- readonly parentIds?: readonly string[];
38
- readonly score?: number;
39
- readonly section: string;
40
- readonly tags: readonly string[];
41
- readonly timestamp: string;
42
- readonly title: string;
43
- constructor(params: MemoryParams);
44
- /**
45
- * Creates a Memory instance from a JSON object.
46
- * @param json JSON object representing the Memory
47
- * @returns An instance of Memory
48
- */
49
- static fromJson(json: MemoryParams): Memory;
50
- /**
51
- * Converts the Memory instance to a JSON object.
52
- * @returns A JSON object representing the Memory
53
- */
54
- toJson(): MemoryParams;
55
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * Represents a memory retrieved from the ByteRover Memora service.
3
- * Memories are hierarchical knowledge fragments that can have parent and child relationships.
4
- *
5
- * Note: score, parentIds, and childrenIds are optional fields.
6
- * - Primary memories (from API `memories` array) have these fields
7
- * - Related memories (from API `related_memories` array) don't have these fields
8
- */
9
- export class Memory {
10
- bulletId;
11
- childrenIds;
12
- content;
13
- id;
14
- metadataType;
15
- nodeKeys;
16
- parentIds;
17
- score;
18
- section;
19
- tags;
20
- timestamp;
21
- title;
22
- constructor(params) {
23
- if (params.id.trim().length === 0) {
24
- throw new Error('Memory ID cannot be empty');
25
- }
26
- if (params.bulletId.trim().length === 0) {
27
- throw new Error('Memory bulletId cannot be empty');
28
- }
29
- if (params.title.trim().length === 0) {
30
- throw new Error('Memory title cannot be empty');
31
- }
32
- if (params.content.trim().length === 0) {
33
- throw new Error('Memory content cannot be empty');
34
- }
35
- if (params.section.trim().length === 0) {
36
- throw new Error('Memory section cannot be empty');
37
- }
38
- if (params.timestamp.trim().length === 0) {
39
- throw new Error('Memory timestamp cannot be empty');
40
- }
41
- if (params.metadataType.trim().length === 0) {
42
- throw new Error('Memory metadataType cannot be empty');
43
- }
44
- // Only validate score if it's provided (primary memories have score, related memories don't)
45
- if (params.score !== undefined && (params.score < 0 || params.score > 1)) {
46
- throw new Error('Memory score must be between 0.0 and 1.0');
47
- }
48
- this.id = params.id;
49
- this.bulletId = params.bulletId;
50
- this.title = params.title;
51
- this.content = params.content;
52
- this.score = params.score;
53
- this.section = params.section;
54
- this.metadataType = params.metadataType;
55
- this.timestamp = params.timestamp;
56
- // Defensive copy to prevent external mutation
57
- this.nodeKeys = [...params.nodeKeys];
58
- this.parentIds = params.parentIds ? [...params.parentIds] : undefined;
59
- this.childrenIds = params.childrenIds ? [...params.childrenIds] : undefined;
60
- this.tags = [...params.tags];
61
- }
62
- /**
63
- * Creates a Memory instance from a JSON object.
64
- * @param json JSON object representing the Memory
65
- * @returns An instance of Memory
66
- */
67
- static fromJson(json) {
68
- return new Memory(json);
69
- }
70
- /**
71
- * Converts the Memory instance to a JSON object.
72
- * @returns A JSON object representing the Memory
73
- */
74
- toJson() {
75
- return {
76
- bulletId: this.bulletId,
77
- ...(this.childrenIds !== undefined && { childrenIds: [...this.childrenIds] }),
78
- content: this.content,
79
- id: this.id,
80
- metadataType: this.metadataType,
81
- nodeKeys: [...this.nodeKeys],
82
- ...(this.parentIds !== undefined && { parentIds: [...this.parentIds] }),
83
- ...(this.score !== undefined && { score: this.score }),
84
- section: this.section,
85
- tags: [...this.tags],
86
- timestamp: this.timestamp,
87
- title: this.title,
88
- };
89
- }
90
- }
@@ -1,80 +0,0 @@
1
- import { Bullet, type BulletJson, type BulletMetadata } from './bullet.js';
2
- export interface PlaybookJson {
3
- bullets: Record<string, BulletJson>;
4
- nextId: number;
5
- sections: Record<string, string[]>;
6
- }
7
- export interface PlaybookStats {
8
- bullets: number;
9
- sections: number;
10
- tags: string[];
11
- }
12
- /**
13
- * The central knowledge repository that stores and manages bullets.
14
- * Playbooks are organized into sections.
15
- * Playbooks are used as temporary notes then will be pushed to byterover for usage.
16
- */
17
- export declare class Playbook {
18
- private readonly bullets;
19
- private nextId;
20
- private readonly sections;
21
- constructor(bullets?: Map<string, Bullet>, sections?: Map<string, string[]>, nextId?: number);
22
- /**
23
- * Adds a new bullet to the playbook
24
- */
25
- addBullet(section: string, content: string, bulletId?: string, metadata?: BulletMetadata): Bullet;
26
- /**
27
- * Adds a tag to a bullet
28
- */
29
- addTagToBullet(bulletId: string, tag: string): Bullet | undefined;
30
- /**
31
- * Converts playbook to markdown format for LLM prompts
32
- */
33
- asPrompt(): string;
34
- /**
35
- * Serializes to JSON string (pretty-printed)
36
- * @param includeContent If false, content field is omitted from bullets (for file-based storage)
37
- */
38
- dumps(includeContent?: boolean): string;
39
- /**
40
- * Retrieves a single bullet by ID
41
- */
42
- getBullet(bulletId: string): Bullet | undefined;
43
- /**
44
- * Returns all bullets as an array
45
- */
46
- getBullets(): Bullet[];
47
- /**
48
- * Returns bullets in a specific section
49
- */
50
- getBulletsInSection(section: string): Bullet[];
51
- /**
52
- * Returns the next bullet ID that will be generated
53
- */
54
- getNextId(): string;
55
- /**
56
- * Returns all section names
57
- */
58
- getSections(): string[];
59
- /**
60
- * Removes a bullet from the playbook
61
- */
62
- removeBullet(bulletId: string): void;
63
- /**
64
- * Removes a tag from a bullet
65
- */
66
- removeTagFromBullet(bulletId: string, tag: string): Bullet | undefined;
67
- /**
68
- * Returns playbook statistics
69
- */
70
- stats(): PlaybookStats;
71
- toJson(includeContent?: boolean): PlaybookJson;
72
- /**
73
- * Updates an existing bullet's content and/or metadata
74
- */
75
- updateBullet(bulletId: string, options: {
76
- content?: string;
77
- metadata?: BulletMetadata;
78
- }): Bullet | undefined;
79
- private _generateId;
80
- }
@@ -1,214 +0,0 @@
1
- import { Bullet } from './bullet.js';
2
- /**
3
- * The central knowledge repository that stores and manages bullets.
4
- * Playbooks are organized into sections.
5
- * Playbooks are used as temporary notes then will be pushed to byterover for usage.
6
- */
7
- export class Playbook {
8
- bullets;
9
- nextId;
10
- sections;
11
- constructor(bullets = new Map(), sections = new Map(), nextId = 1) {
12
- this.bullets = new Map(bullets);
13
- this.sections = new Map(sections);
14
- this.nextId = nextId;
15
- }
16
- // ===== CRUD Operations =====
17
- /**
18
- * Adds a new bullet to the playbook
19
- */
20
- addBullet(section, content, bulletId, metadata) {
21
- const id = bulletId ?? this._generateId(section);
22
- const now = new Date().toISOString();
23
- // Create metadata with defaults if not provided
24
- const bulletMetadata = metadata ?? {
25
- relatedFiles: [],
26
- tags: [],
27
- timestamp: now,
28
- };
29
- const bullet = new Bullet(id, section, content, bulletMetadata, undefined);
30
- // Add to bullets map
31
- this.bullets.set(id, bullet);
32
- // Add to sections map
33
- if (!this.sections.has(section)) {
34
- this.sections.set(section, []);
35
- }
36
- this.sections.get(section).push(id);
37
- return bullet;
38
- }
39
- /**
40
- * Adds a tag to a bullet
41
- */
42
- addTagToBullet(bulletId, tag) {
43
- const bullet = this.bullets.get(bulletId);
44
- if (!bullet)
45
- return undefined;
46
- // Check if tag already exists
47
- if (bullet.metadata.tags.includes(tag)) {
48
- return bullet;
49
- }
50
- const updatedMetadata = {
51
- ...bullet.metadata,
52
- tags: [...bullet.metadata.tags, tag],
53
- timestamp: new Date().toISOString(),
54
- };
55
- const updatedBullet = new Bullet(bullet.id, bullet.section, bullet.content, updatedMetadata, bullet.memoryId);
56
- this.bullets.set(bulletId, updatedBullet);
57
- return updatedBullet;
58
- }
59
- /**
60
- * Converts playbook to markdown format for LLM prompts
61
- */
62
- asPrompt() {
63
- const sections = this.getSections();
64
- if (sections.length === 0) {
65
- return '(Empty playbook)';
66
- }
67
- const lines = [];
68
- for (const section of sections) {
69
- lines.push(`## ${section}`);
70
- const bullets = this.getBulletsInSection(section);
71
- for (const bullet of bullets) {
72
- lines.push(bullet.toDisplayString());
73
- }
74
- lines.push(''); // Empty line between sections
75
- }
76
- return lines.join('\n').trim();
77
- }
78
- /**
79
- * Serializes to JSON string (pretty-printed)
80
- * @param includeContent If false, content field is omitted from bullets (for file-based storage)
81
- */
82
- dumps(includeContent = true) {
83
- return JSON.stringify(this.toJson(includeContent), null, 2);
84
- }
85
- /**
86
- * Retrieves a single bullet by ID
87
- */
88
- getBullet(bulletId) {
89
- return this.bullets.get(bulletId);
90
- }
91
- /**
92
- * Returns all bullets as an array
93
- */
94
- getBullets() {
95
- return [...this.bullets.values()];
96
- }
97
- /**
98
- * Returns bullets in a specific section
99
- */
100
- getBulletsInSection(section) {
101
- const bulletIds = this.sections.get(section) ?? [];
102
- return bulletIds.map((id) => this.bullets.get(id)).filter((b) => b !== undefined);
103
- }
104
- /**
105
- * Returns the next bullet ID that will be generated
106
- */
107
- getNextId() {
108
- // Use "temp" as prefix since we don't know the section yet
109
- return String(this.nextId).padStart(5, '0');
110
- }
111
- /**
112
- * Returns all section names
113
- */
114
- getSections() {
115
- return [...this.sections.keys()].sort();
116
- }
117
- /**
118
- * Removes a bullet from the playbook
119
- */
120
- removeBullet(bulletId) {
121
- const bullet = this.bullets.get(bulletId);
122
- if (!bullet)
123
- return;
124
- // Remove from bullets map
125
- this.bullets.delete(bulletId);
126
- // Remove from sections map
127
- const sectionBullets = this.sections.get(bullet.section);
128
- if (sectionBullets) {
129
- const index = sectionBullets.indexOf(bulletId);
130
- if (index !== -1) {
131
- sectionBullets.splice(index, 1);
132
- }
133
- // Clean up empty sections
134
- if (sectionBullets.length === 0) {
135
- this.sections.delete(bullet.section);
136
- }
137
- }
138
- }
139
- /**
140
- * Removes a tag from a bullet
141
- */
142
- removeTagFromBullet(bulletId, tag) {
143
- const bullet = this.bullets.get(bulletId);
144
- if (!bullet)
145
- return undefined;
146
- const updatedMetadata = {
147
- ...bullet.metadata,
148
- tags: bullet.metadata.tags.filter((t) => t !== tag),
149
- timestamp: new Date().toISOString(),
150
- };
151
- const updatedBullet = new Bullet(bullet.id, bullet.section, bullet.content, updatedMetadata, bullet.memoryId);
152
- this.bullets.set(bulletId, updatedBullet);
153
- return updatedBullet;
154
- }
155
- // ===== Presentation =====
156
- /**
157
- * Returns playbook statistics
158
- */
159
- stats() {
160
- const tagsSet = new Set();
161
- for (const bullet of this.bullets.values()) {
162
- for (const tag of bullet.metadata.tags) {
163
- tagsSet.add(tag);
164
- }
165
- }
166
- return {
167
- bullets: this.bullets.size,
168
- sections: this.sections.size,
169
- tags: [...tagsSet].sort(),
170
- };
171
- }
172
- toJson(includeContent = true) {
173
- const bulletsObj = {};
174
- for (const [id, bullet] of this.bullets) {
175
- bulletsObj[id] = bullet.toJson(includeContent);
176
- }
177
- const sectionsObj = {};
178
- for (const [section, bulletIds] of this.sections) {
179
- sectionsObj[section] = [...bulletIds];
180
- }
181
- return {
182
- bullets: bulletsObj,
183
- nextId: this.nextId,
184
- sections: sectionsObj,
185
- };
186
- }
187
- // ===== Serialization =====
188
- /**
189
- * Updates an existing bullet's content and/or metadata
190
- */
191
- updateBullet(bulletId, options) {
192
- const bullet = this.bullets.get(bulletId);
193
- if (!bullet)
194
- return undefined;
195
- const updatedMetadata = options.metadata ?? {
196
- ...bullet.metadata,
197
- timestamp: new Date().toISOString(),
198
- };
199
- const updatedBullet = new Bullet(bullet.id, bullet.section, options.content ?? bullet.content, updatedMetadata, bullet.memoryId);
200
- this.bullets.set(bulletId, updatedBullet);
201
- return updatedBullet;
202
- }
203
- // ===== Private Helpers =====
204
- _generateId(section) {
205
- // Convert section to prefix: "Common Errors" -> "common"
206
- const prefix = section
207
- .toLowerCase()
208
- .split(' ')[0]
209
- .replaceAll(/[^a-z0-9]/g, '');
210
- const id = `${prefix}-${String(this.nextId).padStart(5, '0')}`;
211
- this.nextId++;
212
- return id;
213
- }
214
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Represents a presigned URL for uploading files to cloud storage.
3
- * Contains the file name and the temporary upload URL with embedded credentials.
4
- */
5
- export declare class PresignedUrl {
6
- readonly fileName: string;
7
- readonly uploadUrl: string;
8
- constructor(fileName: string, uploadUrl: string);
9
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Represents a presigned URL for uploading files to cloud storage.
3
- * Contains the file name and the temporary upload URL with embedded credentials.
4
- */
5
- export class PresignedUrl {
6
- fileName;
7
- uploadUrl;
8
- constructor(fileName, uploadUrl) {
9
- if (fileName.trim().length === 0) {
10
- throw new Error('File name cannot be empty');
11
- }
12
- if (uploadUrl.trim().length === 0) {
13
- throw new Error('Upload URL cannot be empty');
14
- }
15
- this.fileName = fileName;
16
- this.uploadUrl = uploadUrl;
17
- }
18
- }
@@ -1,10 +0,0 @@
1
- import type { PresignedUrl } from './presigned-url.js';
2
- /**
3
- * Represents the response from requesting presigned URLs.
4
- * Contains both the presigned URLs for file upload and the request ID for confirmation.
5
- */
6
- export declare class PresignedUrlsResponse {
7
- readonly presignedUrls: ReadonlyArray<PresignedUrl>;
8
- readonly requestId: string;
9
- constructor(presignedUrls: PresignedUrl[], requestId: string);
10
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Represents the response from requesting presigned URLs.
3
- * Contains both the presigned URLs for file upload and the request ID for confirmation.
4
- */
5
- export class PresignedUrlsResponse {
6
- presignedUrls;
7
- requestId;
8
- constructor(presignedUrls, requestId) {
9
- if (presignedUrls.length === 0) {
10
- throw new Error('Presigned URLs array cannot be empty');
11
- }
12
- if (requestId.trim().length === 0) {
13
- throw new Error('Request ID cannot be empty');
14
- }
15
- this.presignedUrls = Object.freeze([...presignedUrls]);
16
- this.requestId = requestId;
17
- }
18
- }
@@ -1,35 +0,0 @@
1
- import { Memory, MemoryParams } from './memory.js';
2
- /**
3
- * Parameters for creating a RetrieveResult instance.
4
- */
5
- export type RetrieveResultParams = {
6
- memories: Memory[];
7
- relatedMemories: Memory[];
8
- };
9
- /**
10
- * JSON representation of a RetrieveResult.
11
- */
12
- export type RetrieveResultJson = {
13
- memories: MemoryParams[];
14
- relatedMemories: MemoryParams[];
15
- };
16
- /**
17
- * Represents the result of a memory retrieval operation from the ByteRover Memora service.
18
- * Contains both directly matching memories and related memories.
19
- */
20
- export declare class RetrieveResult {
21
- readonly memories: readonly Memory[];
22
- readonly relatedMemories: readonly Memory[];
23
- constructor(params: RetrieveResultParams);
24
- /**
25
- * Creates a RetrieveResult instance from a JSON object.
26
- * @param json JSON object representing the RetrieveResult
27
- * @returns An instance of RetrieveResult
28
- */
29
- static fromJson(json: RetrieveResultJson): RetrieveResult;
30
- /**
31
- * Converts the RetrieveResult instance to a JSON object.
32
- * @returns A JSON object representing the RetrieveResult
33
- */
34
- toJson(): RetrieveResultJson;
35
- }
@@ -1,35 +0,0 @@
1
- import { Memory } from './memory.js';
2
- /**
3
- * Represents the result of a memory retrieval operation from the ByteRover Memora service.
4
- * Contains both directly matching memories and related memories.
5
- */
6
- export class RetrieveResult {
7
- memories;
8
- relatedMemories;
9
- constructor(params) {
10
- // Defensive copy to prevent external mutation
11
- this.memories = [...params.memories];
12
- this.relatedMemories = [...params.relatedMemories];
13
- }
14
- /**
15
- * Creates a RetrieveResult instance from a JSON object.
16
- * @param json JSON object representing the RetrieveResult
17
- * @returns An instance of RetrieveResult
18
- */
19
- static fromJson(json) {
20
- return new RetrieveResult({
21
- memories: json.memories.map((m) => Memory.fromJson(m)),
22
- relatedMemories: json.relatedMemories.map((m) => Memory.fromJson(m)),
23
- });
24
- }
25
- /**
26
- * Converts the RetrieveResult instance to a JSON object.
27
- * @returns A JSON object representing the RetrieveResult
28
- */
29
- toJson() {
30
- return {
31
- memories: this.memories.map((m) => m.toJson()),
32
- relatedMemories: this.relatedMemories.map((m) => m.toJson()),
33
- };
34
- }
35
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Error thrown when headless mode encounters a prompt that cannot be handled.
3
- * Provides detailed information about what prompt was required and available choices.
4
- */
5
- export declare class HeadlessPromptError extends Error {
6
- readonly availableChoices?: string[];
7
- readonly code = "HEADLESS_PROMPT_REQUIRED";
8
- readonly promptMessage: string;
9
- readonly promptType: string;
10
- constructor(promptType: string, promptMessage: string, availableChoices?: string[]);
11
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Error thrown when headless mode encounters a prompt that cannot be handled.
3
- * Provides detailed information about what prompt was required and available choices.
4
- */
5
- export class HeadlessPromptError extends Error {
6
- availableChoices;
7
- code = 'HEADLESS_PROMPT_REQUIRED';
8
- promptMessage;
9
- promptType;
10
- constructor(promptType, promptMessage, availableChoices) {
11
- const choicesInfo = availableChoices?.length ? ` Available choices: ${availableChoices.join(', ')}` : '';
12
- super(`Headless mode cannot handle ${promptType} prompt: "${promptMessage}".${choicesInfo}`);
13
- this.name = 'HeadlessPromptError';
14
- this.promptType = promptType;
15
- this.promptMessage = promptMessage;
16
- this.availableChoices = availableChoices;
17
- }
18
- }
@@ -1,56 +0,0 @@
1
- import type { Agent } from '../../domain/entities/agent.js';
2
- /**
3
- * Represents a reliably detected legacy ByteRover rule section.
4
- */
5
- export type LegacyRuleMatch = {
6
- /**
7
- * Content of the detected section.
8
- */
9
- content: string;
10
- /**
11
- * Ending line number (1-indexed)
12
- */
13
- endLine: number;
14
- /**
15
- * Starting line number (1-indexed)
16
- */
17
- startLine: number;
18
- };
19
- /**
20
- * Represents an uncertain detection where the footer was found but start couldn't be reliably determined.
21
- */
22
- export type UncertainMatch = {
23
- /**
24
- * Line number where the footer tag was found (1-indexed).
25
- */
26
- footerLine: number;
27
- /**
28
- * Reason why the start couldn't be determined.
29
- */
30
- reason: string;
31
- };
32
- /**
33
- * Result of detecting legacy ByteRover rules in a file.
34
- */
35
- export type LegacyRuleDetectionResult = {
36
- /**
37
- * Reliably detected rule sections with known start and end positions.
38
- */
39
- reliableMatches: LegacyRuleMatch[];
40
- /**
41
- * Uncertain matches where only the footer was found.
42
- */
43
- uncertainMatches: UncertainMatch[];
44
- };
45
- /**
46
- * Service for detecting legacy ByteRover rules (without boundary markers) in instruction files.
47
- */
48
- export interface ILegacyRuleDetector {
49
- /**
50
- * Detects legacy ByteRover rule sections in file content.
51
- * @param content The file content to analyze.
52
- * @param agentName The agent name to look for in the footer tag.
53
- * @returns Detection result with reliable and uncertain matches.
54
- */
55
- detectLegacyRules: (content: string, agentName: Agent) => LegacyRuleDetectionResult;
56
- }