@contractspec/module.ai-chat 1.57.0 → 1.59.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 (120) hide show
  1. package/dist/ai-chat.capability.d.ts +2 -0
  2. package/dist/ai-chat.capability.d.ts.map +1 -0
  3. package/dist/ai-chat.feature.d.ts +1 -6
  4. package/dist/ai-chat.feature.d.ts.map +1 -1
  5. package/dist/ai-chat.operations.d.ts +217 -223
  6. package/dist/ai-chat.operations.d.ts.map +1 -1
  7. package/dist/browser/context/index.js +415 -0
  8. package/dist/browser/core/index.js +336 -0
  9. package/dist/browser/index.js +2291 -0
  10. package/dist/browser/presentation/components/index.js +974 -0
  11. package/dist/browser/presentation/hooks/index.js +556 -0
  12. package/dist/browser/presentation/index.js +1520 -0
  13. package/dist/browser/providers/index.js +51 -0
  14. package/dist/context/chat.test.d.ts +2 -0
  15. package/dist/context/chat.test.d.ts.map +1 -0
  16. package/dist/context/context-builder.d.ts +37 -36
  17. package/dist/context/context-builder.d.ts.map +1 -1
  18. package/dist/context/file-operations.d.ts +64 -67
  19. package/dist/context/file-operations.d.ts.map +1 -1
  20. package/dist/context/index.d.ts +7 -4
  21. package/dist/context/index.d.ts.map +1 -0
  22. package/dist/context/index.js +409 -4
  23. package/dist/context/workspace-context.d.ts +84 -87
  24. package/dist/context/workspace-context.d.ts.map +1 -1
  25. package/dist/core/chat-service.d.ts +56 -60
  26. package/dist/core/chat-service.d.ts.map +1 -1
  27. package/dist/core/conversation-store.d.ts +60 -61
  28. package/dist/core/conversation-store.d.ts.map +1 -1
  29. package/dist/core/index.d.ts +7 -4
  30. package/dist/core/index.d.ts.map +1 -0
  31. package/dist/core/index.js +330 -3
  32. package/dist/core/message-types.d.ts +94 -97
  33. package/dist/core/message-types.d.ts.map +1 -1
  34. package/dist/docs/ai-chat.docblock.d.ts +2 -0
  35. package/dist/docs/ai-chat.docblock.d.ts.map +1 -0
  36. package/dist/docs/index.d.ts +7 -0
  37. package/dist/docs/index.d.ts.map +1 -0
  38. package/dist/events.d.ts +103 -109
  39. package/dist/events.d.ts.map +1 -1
  40. package/dist/index.d.ts +16 -21
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +2286 -23
  43. package/dist/node/context/index.js +410 -0
  44. package/dist/node/core/index.js +331 -0
  45. package/dist/node/index.js +2286 -0
  46. package/dist/node/presentation/components/index.js +969 -0
  47. package/dist/node/presentation/hooks/index.js +551 -0
  48. package/dist/node/presentation/index.js +1515 -0
  49. package/dist/node/providers/index.js +46 -0
  50. package/dist/presentation/components/ChatContainer.d.ts +7 -16
  51. package/dist/presentation/components/ChatContainer.d.ts.map +1 -1
  52. package/dist/presentation/components/ChatInput.d.ts +17 -30
  53. package/dist/presentation/components/ChatInput.d.ts.map +1 -1
  54. package/dist/presentation/components/ChatMessage.d.ts +9 -19
  55. package/dist/presentation/components/ChatMessage.d.ts.map +1 -1
  56. package/dist/presentation/components/CodePreview.d.ts +20 -35
  57. package/dist/presentation/components/CodePreview.d.ts.map +1 -1
  58. package/dist/presentation/components/ContextIndicator.d.ts +11 -21
  59. package/dist/presentation/components/ContextIndicator.d.ts.map +1 -1
  60. package/dist/presentation/components/ModelPicker.d.ts +21 -32
  61. package/dist/presentation/components/ModelPicker.d.ts.map +1 -1
  62. package/dist/presentation/components/index.d.ts +10 -7
  63. package/dist/presentation/components/index.d.ts.map +1 -0
  64. package/dist/presentation/components/index.js +968 -7
  65. package/dist/presentation/hooks/index.d.ts +6 -3
  66. package/dist/presentation/hooks/index.d.ts.map +1 -0
  67. package/dist/presentation/hooks/index.js +550 -3
  68. package/dist/presentation/hooks/use-chat.test.d.ts +2 -0
  69. package/dist/presentation/hooks/use-chat.test.d.ts.map +1 -0
  70. package/dist/presentation/hooks/useChat.d.ts +50 -54
  71. package/dist/presentation/hooks/useChat.d.ts.map +1 -1
  72. package/dist/presentation/hooks/useProviders.d.ts +21 -25
  73. package/dist/presentation/hooks/useProviders.d.ts.map +1 -1
  74. package/dist/presentation/index.d.ts +8 -11
  75. package/dist/presentation/index.d.ts.map +1 -0
  76. package/dist/presentation/index.js +1515 -12
  77. package/dist/providers/chat-utilities.d.ts +18 -7
  78. package/dist/providers/chat-utilities.d.ts.map +1 -1
  79. package/dist/providers/index.d.ts +8 -3
  80. package/dist/providers/index.d.ts.map +1 -0
  81. package/dist/providers/index.js +45 -3
  82. package/dist/schema.d.ts +195 -200
  83. package/dist/schema.d.ts.map +1 -1
  84. package/package.json +123 -34
  85. package/dist/ai-chat.feature.js +0 -102
  86. package/dist/ai-chat.feature.js.map +0 -1
  87. package/dist/ai-chat.operations.js +0 -172
  88. package/dist/ai-chat.operations.js.map +0 -1
  89. package/dist/context/context-builder.js +0 -148
  90. package/dist/context/context-builder.js.map +0 -1
  91. package/dist/context/file-operations.js +0 -175
  92. package/dist/context/file-operations.js.map +0 -1
  93. package/dist/context/workspace-context.js +0 -124
  94. package/dist/context/workspace-context.js.map +0 -1
  95. package/dist/core/chat-service.js +0 -227
  96. package/dist/core/chat-service.js.map +0 -1
  97. package/dist/core/conversation-store.js +0 -109
  98. package/dist/core/conversation-store.js.map +0 -1
  99. package/dist/events.js +0 -98
  100. package/dist/events.js.map +0 -1
  101. package/dist/presentation/components/ChatContainer.js +0 -63
  102. package/dist/presentation/components/ChatContainer.js.map +0 -1
  103. package/dist/presentation/components/ChatInput.js +0 -149
  104. package/dist/presentation/components/ChatInput.js.map +0 -1
  105. package/dist/presentation/components/ChatMessage.js +0 -136
  106. package/dist/presentation/components/ChatMessage.js.map +0 -1
  107. package/dist/presentation/components/CodePreview.js +0 -127
  108. package/dist/presentation/components/CodePreview.js.map +0 -1
  109. package/dist/presentation/components/ContextIndicator.js +0 -97
  110. package/dist/presentation/components/ContextIndicator.js.map +0 -1
  111. package/dist/presentation/components/ModelPicker.js +0 -202
  112. package/dist/presentation/components/ModelPicker.js.map +0 -1
  113. package/dist/presentation/hooks/useChat.js +0 -172
  114. package/dist/presentation/hooks/useChat.js.map +0 -1
  115. package/dist/presentation/hooks/useProviders.js +0 -41
  116. package/dist/presentation/hooks/useProviders.js.map +0 -1
  117. package/dist/providers/chat-utilities.js +0 -17
  118. package/dist/providers/chat-utilities.js.map +0 -1
  119. package/dist/schema.js +0 -100
  120. package/dist/schema.js.map +0 -1
@@ -1,5 +1,410 @@
1
- import { WorkspaceContext, createWorkspaceContext } from "./workspace-context.js";
2
- import { ContextBuilder, createContextBuilder } from "./context-builder.js";
3
- import { FileOperations, createNodeFileOperations } from "./file-operations.js";
1
+ // @bun
2
+ var __require = import.meta.require;
4
3
 
5
- export { ContextBuilder, FileOperations, WorkspaceContext, createContextBuilder, createNodeFileOperations, createWorkspaceContext };
4
+ // src/context/workspace-context.ts
5
+ class WorkspaceContext {
6
+ workspacePath;
7
+ allowWrites;
8
+ specs = [];
9
+ files = [];
10
+ initialized = false;
11
+ constructor(config) {
12
+ this.workspacePath = config.workspacePath;
13
+ this.allowWrites = config.allowWrites ?? false;
14
+ }
15
+ async initialize() {
16
+ if (this.initialized)
17
+ return;
18
+ this.initialized = true;
19
+ }
20
+ getSpecs() {
21
+ return this.specs;
22
+ }
23
+ getFiles() {
24
+ return this.files;
25
+ }
26
+ addSpecs(specs) {
27
+ this.specs.push(...specs);
28
+ }
29
+ addFiles(files) {
30
+ this.files.push(...files);
31
+ }
32
+ getSummary() {
33
+ const commands = this.specs.filter((s) => s.type === "command").length;
34
+ const queries = this.specs.filter((s) => s.type === "query").length;
35
+ const events = this.specs.filter((s) => s.type === "event").length;
36
+ const presentations = this.specs.filter((s) => s.type === "presentation").length;
37
+ const tsFiles = this.files.filter((f) => f.extension === ".ts").length;
38
+ const specFiles = this.files.filter((f) => f.isSpec).length;
39
+ return {
40
+ name: this.workspacePath.split("/").pop() ?? "workspace",
41
+ path: this.workspacePath,
42
+ specs: {
43
+ total: this.specs.length,
44
+ commands,
45
+ queries,
46
+ events,
47
+ presentations
48
+ },
49
+ files: {
50
+ total: this.files.length,
51
+ typescript: tsFiles,
52
+ specFiles
53
+ }
54
+ };
55
+ }
56
+ getContextSummary() {
57
+ const summary = this.getSummary();
58
+ const parts = [
59
+ `Workspace: ${summary.name}`,
60
+ `Path: ${summary.path}`,
61
+ "",
62
+ "### Specs",
63
+ `- Commands: ${summary.specs.commands}`,
64
+ `- Queries: ${summary.specs.queries}`,
65
+ `- Events: ${summary.specs.events}`,
66
+ `- Presentations: ${summary.specs.presentations}`
67
+ ];
68
+ if (this.specs.length > 0) {
69
+ parts.push("", "### Available Specs");
70
+ for (const spec of this.specs.slice(0, 20)) {
71
+ parts.push(`- ${spec.name} (${spec.type})`);
72
+ }
73
+ if (this.specs.length > 20) {
74
+ parts.push(`- ... and ${this.specs.length - 20} more`);
75
+ }
76
+ }
77
+ return parts.join(`
78
+ `);
79
+ }
80
+ findSpecs(query) {
81
+ const lowerQuery = query.toLowerCase();
82
+ return this.specs.filter((s) => s.name.toLowerCase().includes(lowerQuery) || s.description?.toLowerCase().includes(lowerQuery) || s.tags?.some((t) => t.toLowerCase().includes(lowerQuery)));
83
+ }
84
+ findFiles(query) {
85
+ const lowerQuery = query.toLowerCase();
86
+ return this.files.filter((f) => f.path.toLowerCase().includes(lowerQuery) || f.name.toLowerCase().includes(lowerQuery));
87
+ }
88
+ }
89
+ async function createWorkspaceContext(path, options) {
90
+ const context = new WorkspaceContext({
91
+ workspacePath: path,
92
+ ...options
93
+ });
94
+ await context.initialize();
95
+ return context;
96
+ }
97
+ // src/context/context-builder.ts
98
+ function estimateTokens(text) {
99
+ return Math.ceil(text.length / 4);
100
+ }
101
+ function scoreSpec(spec, query) {
102
+ if (!query)
103
+ return 0.5;
104
+ const lowerQuery = query.toLowerCase();
105
+ let score = 0;
106
+ if (spec.name.toLowerCase().includes(lowerQuery)) {
107
+ score += 0.4;
108
+ }
109
+ if (spec.description?.toLowerCase().includes(lowerQuery)) {
110
+ score += 0.3;
111
+ }
112
+ if (spec.tags?.some((t) => t.toLowerCase().includes(lowerQuery))) {
113
+ score += 0.2;
114
+ }
115
+ return Math.min(score, 1);
116
+ }
117
+ function scoreFile(file, query) {
118
+ if (!query)
119
+ return 0.5;
120
+ const lowerQuery = query.toLowerCase();
121
+ let score = 0;
122
+ if (file.path.toLowerCase().includes(lowerQuery)) {
123
+ score += 0.5;
124
+ }
125
+ if (file.name.toLowerCase().includes(lowerQuery)) {
126
+ score += 0.3;
127
+ }
128
+ if (file.isSpec) {
129
+ score += 0.2;
130
+ }
131
+ return Math.min(score, 1);
132
+ }
133
+
134
+ class ContextBuilder {
135
+ context;
136
+ constructor(context) {
137
+ this.context = context;
138
+ }
139
+ build(options = {}) {
140
+ const maxTokens = options.maxTokens ?? 4000;
141
+ const entries = [];
142
+ let totalTokens = 0;
143
+ if (options.includeSpecs?.length) {
144
+ for (const specName of options.includeSpecs) {
145
+ const spec = this.context.getSpecs().find((s) => s.name === specName);
146
+ if (spec) {
147
+ const entry = {
148
+ type: "spec",
149
+ path: spec.path,
150
+ summary: `${spec.type}: ${spec.name}${spec.description ? ` - ${spec.description}` : ""}`,
151
+ relevance: 1
152
+ };
153
+ entries.push(entry);
154
+ totalTokens += estimateTokens(entry.summary ?? "");
155
+ }
156
+ }
157
+ }
158
+ if (options.includeFiles?.length) {
159
+ for (const filePath of options.includeFiles) {
160
+ const file = this.context.getFiles().find((f) => f.path === filePath);
161
+ if (file) {
162
+ const entry = {
163
+ type: "file",
164
+ path: file.path,
165
+ summary: `File: ${file.relativePath}`,
166
+ relevance: 1
167
+ };
168
+ entries.push(entry);
169
+ totalTokens += estimateTokens(entry.summary ?? "");
170
+ }
171
+ }
172
+ }
173
+ if (options.query) {
174
+ const scoredSpecs = this.context.getSpecs().map((spec) => ({ spec, score: scoreSpec(spec, options.query) })).filter(({ score }) => score > 0.2).sort((a, b) => b.score - a.score);
175
+ for (const { spec, score } of scoredSpecs) {
176
+ if (totalTokens >= maxTokens)
177
+ break;
178
+ if (entries.some((e) => e.path === spec.path))
179
+ continue;
180
+ const entry = {
181
+ type: "spec",
182
+ path: spec.path,
183
+ summary: `${spec.type}: ${spec.name}${spec.description ? ` - ${spec.description}` : ""}`,
184
+ relevance: score
185
+ };
186
+ entries.push(entry);
187
+ totalTokens += estimateTokens(entry.summary ?? "");
188
+ }
189
+ }
190
+ if (options.query) {
191
+ const scoredFiles = this.context.getFiles().map((file) => ({ file, score: scoreFile(file, options.query) })).filter(({ score }) => score > 0.2).sort((a, b) => b.score - a.score);
192
+ for (const { file, score } of scoredFiles) {
193
+ if (totalTokens >= maxTokens)
194
+ break;
195
+ if (entries.some((e) => e.path === file.path))
196
+ continue;
197
+ const entry = {
198
+ type: "file",
199
+ path: file.path,
200
+ summary: `File: ${file.relativePath}`,
201
+ relevance: score
202
+ };
203
+ entries.push(entry);
204
+ totalTokens += estimateTokens(entry.summary ?? "");
205
+ }
206
+ }
207
+ const summary = this.buildSummary(entries);
208
+ return {
209
+ entries,
210
+ summary,
211
+ totalTokensEstimate: totalTokens + estimateTokens(summary)
212
+ };
213
+ }
214
+ buildSummary(entries) {
215
+ if (entries.length === 0) {
216
+ return this.context.getContextSummary();
217
+ }
218
+ const parts = [];
219
+ const workspaceSummary = this.context.getSummary();
220
+ parts.push(`Workspace: ${workspaceSummary.name}`);
221
+ parts.push("");
222
+ const specs = entries.filter((e) => e.type === "spec");
223
+ if (specs.length > 0) {
224
+ parts.push("### Relevant Specs");
225
+ for (const entry of specs) {
226
+ parts.push(`- ${entry.summary}`);
227
+ }
228
+ parts.push("");
229
+ }
230
+ const files = entries.filter((e) => e.type === "file");
231
+ if (files.length > 0) {
232
+ parts.push("### Relevant Files");
233
+ for (const entry of files) {
234
+ parts.push(`- ${entry.summary}`);
235
+ }
236
+ }
237
+ return parts.join(`
238
+ `);
239
+ }
240
+ }
241
+ function createContextBuilder(context) {
242
+ return new ContextBuilder(context);
243
+ }
244
+ // src/context/file-operations.ts
245
+ class FileOperations {
246
+ fs;
247
+ workspacePath;
248
+ allowWrites;
249
+ constructor(fs, workspacePath, allowWrites = false) {
250
+ this.fs = fs;
251
+ this.workspacePath = workspacePath;
252
+ this.allowWrites = allowWrites;
253
+ }
254
+ async read(relativePath) {
255
+ const fullPath = this.resolvePath(relativePath);
256
+ try {
257
+ const content = await this.fs.readFile(fullPath);
258
+ return { success: true, path: relativePath, content };
259
+ } catch (error) {
260
+ return {
261
+ success: false,
262
+ path: relativePath,
263
+ error: error instanceof Error ? error.message : String(error)
264
+ };
265
+ }
266
+ }
267
+ async write(relativePath, content) {
268
+ if (!this.allowWrites) {
269
+ return {
270
+ success: false,
271
+ path: relativePath,
272
+ error: "File writes are not enabled"
273
+ };
274
+ }
275
+ const fullPath = this.resolvePath(relativePath);
276
+ try {
277
+ await this.fs.writeFile(fullPath, content);
278
+ return { success: true, path: relativePath };
279
+ } catch (error) {
280
+ return {
281
+ success: false,
282
+ path: relativePath,
283
+ error: error instanceof Error ? error.message : String(error)
284
+ };
285
+ }
286
+ }
287
+ async execute(operations) {
288
+ const results = [];
289
+ for (const operation of operations) {
290
+ let result;
291
+ switch (operation.type) {
292
+ case "read": {
293
+ const readResult = await this.read(operation.path);
294
+ result = {
295
+ operation,
296
+ success: readResult.success,
297
+ content: readResult.content,
298
+ error: readResult.error
299
+ };
300
+ break;
301
+ }
302
+ case "write":
303
+ case "create": {
304
+ if (!operation.content) {
305
+ result = {
306
+ operation,
307
+ success: false,
308
+ error: "Content is required for write operations"
309
+ };
310
+ } else {
311
+ const writeResult = await this.write(operation.path, operation.content);
312
+ result = {
313
+ operation,
314
+ success: writeResult.success,
315
+ error: writeResult.error
316
+ };
317
+ }
318
+ break;
319
+ }
320
+ case "delete": {
321
+ if (!this.allowWrites) {
322
+ result = {
323
+ operation,
324
+ success: false,
325
+ error: "File writes are not enabled"
326
+ };
327
+ } else {
328
+ try {
329
+ await this.fs.deleteFile(this.resolvePath(operation.path));
330
+ result = { operation, success: true };
331
+ } catch (error) {
332
+ result = {
333
+ operation,
334
+ success: false,
335
+ error: error instanceof Error ? error.message : String(error)
336
+ };
337
+ }
338
+ }
339
+ break;
340
+ }
341
+ default:
342
+ result = {
343
+ operation,
344
+ success: false,
345
+ error: `Unknown operation type: ${operation.type}`
346
+ };
347
+ }
348
+ results.push(result);
349
+ }
350
+ return results;
351
+ }
352
+ resolvePath(relativePath) {
353
+ const normalized = relativePath.replace(/\.\./g, "").replace(/^\//, "");
354
+ return `${this.workspacePath}/${normalized}`;
355
+ }
356
+ }
357
+ function createNodeFileOperations(workspacePath, allowWrites = false) {
358
+ const fs = {
359
+ async readFile(path) {
360
+ const { readFile } = await import("fs/promises");
361
+ return readFile(path, "utf-8");
362
+ },
363
+ async writeFile(path, content) {
364
+ const { writeFile, mkdir } = await import("fs/promises");
365
+ const { dirname } = await import("path");
366
+ await mkdir(dirname(path), { recursive: true });
367
+ await writeFile(path, content, "utf-8");
368
+ },
369
+ async exists(path) {
370
+ const { access } = await import("fs/promises");
371
+ try {
372
+ await access(path);
373
+ return true;
374
+ } catch {
375
+ return false;
376
+ }
377
+ },
378
+ async deleteFile(path) {
379
+ const { unlink } = await import("fs/promises");
380
+ await unlink(path);
381
+ },
382
+ async listFiles(directory, options) {
383
+ const { readdir } = await import("fs/promises");
384
+ const { join } = await import("path");
385
+ const files = [];
386
+ const entries = await readdir(directory, { withFileTypes: true });
387
+ for (const entry of entries) {
388
+ const fullPath = join(directory, entry.name);
389
+ if (entry.isDirectory() && options?.recursive) {
390
+ const subFiles = await this.listFiles(fullPath, options);
391
+ files.push(...subFiles);
392
+ } else if (entry.isFile()) {
393
+ if (!options?.pattern || entry.name.match(new RegExp(options.pattern))) {
394
+ files.push(fullPath);
395
+ }
396
+ }
397
+ }
398
+ return files;
399
+ }
400
+ };
401
+ return new FileOperations(fs, workspacePath, allowWrites);
402
+ }
403
+ export {
404
+ createWorkspaceContext,
405
+ createNodeFileOperations,
406
+ createContextBuilder,
407
+ WorkspaceContext,
408
+ FileOperations,
409
+ ContextBuilder
410
+ };
@@ -1,4 +1,3 @@
1
- //#region src/context/workspace-context.d.ts
2
1
  /**
3
2
  * Workspace context management
4
3
  *
@@ -8,110 +7,108 @@
8
7
  /**
9
8
  * Spec information for context
10
9
  */
11
- interface SpecInfo {
12
- name: string;
13
- version: string;
14
- type: 'command' | 'query' | 'event' | 'presentation';
15
- path: string;
16
- description?: string;
17
- tags?: string[];
10
+ export interface SpecInfo {
11
+ name: string;
12
+ version: string;
13
+ type: 'command' | 'query' | 'event' | 'presentation';
14
+ path: string;
15
+ description?: string;
16
+ tags?: string[];
18
17
  }
19
18
  /**
20
19
  * File information for context
21
20
  */
22
- interface FileInfo {
23
- path: string;
24
- relativePath: string;
25
- name: string;
26
- extension: string;
27
- size: number;
28
- isSpec: boolean;
21
+ export interface FileInfo {
22
+ path: string;
23
+ relativePath: string;
24
+ name: string;
25
+ extension: string;
26
+ size: number;
27
+ isSpec: boolean;
29
28
  }
30
29
  /**
31
30
  * Workspace summary for context
32
31
  */
33
- interface WorkspaceSummary {
34
- name: string;
35
- path: string;
36
- specs: {
37
- total: number;
38
- commands: number;
39
- queries: number;
40
- events: number;
41
- presentations: number;
42
- };
43
- files: {
44
- total: number;
45
- typescript: number;
46
- specFiles: number;
47
- };
32
+ export interface WorkspaceSummary {
33
+ name: string;
34
+ path: string;
35
+ specs: {
36
+ total: number;
37
+ commands: number;
38
+ queries: number;
39
+ events: number;
40
+ presentations: number;
41
+ };
42
+ files: {
43
+ total: number;
44
+ typescript: number;
45
+ specFiles: number;
46
+ };
48
47
  }
49
48
  /**
50
49
  * Configuration for workspace context
51
50
  */
52
- interface WorkspaceContextConfig {
53
- /** Root path of the workspace */
54
- workspacePath: string;
55
- /** File patterns to include */
56
- includePatterns?: string[];
57
- /** File patterns to exclude */
58
- excludePatterns?: string[];
59
- /** Maximum file size to read (bytes) */
60
- maxFileSize?: number;
61
- /** Whether to enable file writes */
62
- allowWrites?: boolean;
51
+ export interface WorkspaceContextConfig {
52
+ /** Root path of the workspace */
53
+ workspacePath: string;
54
+ /** File patterns to include */
55
+ includePatterns?: string[];
56
+ /** File patterns to exclude */
57
+ excludePatterns?: string[];
58
+ /** Maximum file size to read (bytes) */
59
+ maxFileSize?: number;
60
+ /** Whether to enable file writes */
61
+ allowWrites?: boolean;
63
62
  }
64
63
  /**
65
64
  * Workspace context for AI chat
66
65
  */
67
- declare class WorkspaceContext {
68
- readonly workspacePath: string;
69
- readonly allowWrites: boolean;
70
- private specs;
71
- private files;
72
- private initialized;
73
- constructor(config: WorkspaceContextConfig);
74
- /**
75
- * Initialize the workspace context by scanning files
76
- */
77
- initialize(): Promise<void>;
78
- /**
79
- * Get all discovered specs
80
- */
81
- getSpecs(): SpecInfo[];
82
- /**
83
- * Get all discovered files
84
- */
85
- getFiles(): FileInfo[];
86
- /**
87
- * Add specs to the context
88
- */
89
- addSpecs(specs: SpecInfo[]): void;
90
- /**
91
- * Add files to the context
92
- */
93
- addFiles(files: FileInfo[]): void;
94
- /**
95
- * Get a summary of the workspace for context
96
- */
97
- getSummary(): WorkspaceSummary;
98
- /**
99
- * Get a context summary for LLM prompts
100
- */
101
- getContextSummary(): string;
102
- /**
103
- * Find specs matching a query
104
- */
105
- findSpecs(query: string): SpecInfo[];
106
- /**
107
- * Find files matching a query
108
- */
109
- findFiles(query: string): FileInfo[];
66
+ export declare class WorkspaceContext {
67
+ readonly workspacePath: string;
68
+ readonly allowWrites: boolean;
69
+ private specs;
70
+ private files;
71
+ private initialized;
72
+ constructor(config: WorkspaceContextConfig);
73
+ /**
74
+ * Initialize the workspace context by scanning files
75
+ */
76
+ initialize(): Promise<void>;
77
+ /**
78
+ * Get all discovered specs
79
+ */
80
+ getSpecs(): SpecInfo[];
81
+ /**
82
+ * Get all discovered files
83
+ */
84
+ getFiles(): FileInfo[];
85
+ /**
86
+ * Add specs to the context
87
+ */
88
+ addSpecs(specs: SpecInfo[]): void;
89
+ /**
90
+ * Add files to the context
91
+ */
92
+ addFiles(files: FileInfo[]): void;
93
+ /**
94
+ * Get a summary of the workspace for context
95
+ */
96
+ getSummary(): WorkspaceSummary;
97
+ /**
98
+ * Get a context summary for LLM prompts
99
+ */
100
+ getContextSummary(): string;
101
+ /**
102
+ * Find specs matching a query
103
+ */
104
+ findSpecs(query: string): SpecInfo[];
105
+ /**
106
+ * Find files matching a query
107
+ */
108
+ findFiles(query: string): FileInfo[];
110
109
  }
111
110
  /**
112
111
  * Create a workspace context from a path
113
112
  */
114
- declare function createWorkspaceContext(path: string, options?: Partial<WorkspaceContextConfig>): Promise<WorkspaceContext>;
115
- //#endregion
116
- export { FileInfo, SpecInfo, WorkspaceContext, WorkspaceContextConfig, WorkspaceSummary, createWorkspaceContext };
113
+ export declare function createWorkspaceContext(path: string, options?: Partial<WorkspaceContextConfig>): Promise<WorkspaceContext>;
117
114
  //# sourceMappingURL=workspace-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-context.d.ts","names":[],"sources":["../../src/context/workspace-context.ts"],"mappings":";;AAUA;;;;;;;;UAAiB,QAAA;EACf,IAAA;EACA,OAAA;EACA,IAAA;EACA,IAAA;EACA,WAAA;EACA,IAAA;AAAA;;;;UAMe,QAAA;EACf,IAAA;EACA,YAAA;EACA,IAAA;EACA,SAAA;EACA,IAAA;EACA,MAAA;AAAA;;;;UAMe,gBAAA;EACf,IAAA;EACA,IAAA;EACA,KAAA;IACE,KAAA;IACA,QAAA;IACA,OAAA;IACA,MAAA;IACA,aAAA;EAAA;EAEF,KAAA;IACE,KAAA;IACA,UAAA;IACA,SAAA;EAAA;AAAA;;;;UAOa,sBAAA;EAUf;EARA,aAAA;EAQW;EANX,eAAA;EAY2B;EAV3B,eAAA;EAkBoB;EAhBpB,WAAA;EAmCY;EAjCZ,WAAA;AAAA;;;;cAMW,gBAAA;EAAA,SACF,aAAA;EAAA,SACA,WAAA;EAAA,QAED,KAAA;EAAA,QACA,KAAA;EAAA,QACA,WAAA;cAEI,MAAA,EAAQ,sBAAA;EAFZ;;;EAUF,UAAA,CAAA,GAAc,OAAA;EAAd;;;EAWN,QAAA,CAAA,GAAY,QAAA;EAOZ;;;EAAA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