@soederpop/luca 0.0.29 → 0.0.30

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 (46) hide show
  1. package/commands/try-all-challenges.ts +1 -1
  2. package/docs/TABLE-OF-CONTENTS.md +0 -3
  3. package/docs/tutorials/20-browser-esm.md +234 -0
  4. package/package.json +1 -1
  5. package/src/agi/container.server.ts +4 -0
  6. package/src/agi/features/assistant.ts +62 -1
  7. package/src/agi/features/browser-use.ts +623 -0
  8. package/src/bootstrap/generated.ts +236 -308
  9. package/src/cli/build-info.ts +2 -2
  10. package/src/clients/rest.ts +7 -7
  11. package/src/commands/chat.ts +22 -0
  12. package/src/commands/describe.ts +67 -2
  13. package/src/commands/prompt.ts +23 -3
  14. package/src/container.ts +411 -113
  15. package/src/helper.ts +189 -5
  16. package/src/introspection/generated.agi.ts +17148 -11148
  17. package/src/introspection/generated.node.ts +5179 -2200
  18. package/src/introspection/generated.web.ts +379 -291
  19. package/src/introspection/index.ts +7 -0
  20. package/src/introspection/scan.ts +224 -7
  21. package/src/node/container.ts +31 -10
  22. package/src/node/features/content-db.ts +7 -7
  23. package/src/node/features/disk-cache.ts +11 -11
  24. package/src/node/features/esbuild.ts +3 -3
  25. package/src/node/features/file-manager.ts +15 -15
  26. package/src/node/features/fs.ts +23 -22
  27. package/src/node/features/git.ts +10 -10
  28. package/src/node/features/ink.ts +13 -13
  29. package/src/node/features/ipc-socket.ts +8 -8
  30. package/src/node/features/networking.ts +3 -3
  31. package/src/node/features/os.ts +7 -7
  32. package/src/node/features/package-finder.ts +15 -15
  33. package/src/node/features/proc.ts +1 -1
  34. package/src/node/features/ui.ts +13 -13
  35. package/src/node/features/vm.ts +4 -4
  36. package/src/scaffolds/generated.ts +1 -1
  37. package/src/servers/express.ts +6 -6
  38. package/src/servers/mcp.ts +4 -4
  39. package/src/servers/socket.ts +6 -6
  40. package/docs/apis/features/node/window-manager.md +0 -445
  41. package/docs/examples/window-manager-layouts.md +0 -180
  42. package/docs/examples/window-manager.md +0 -125
  43. package/docs/window-manager-fix.md +0 -249
  44. package/scripts/test-window-manager-lifecycle.ts +0 -86
  45. package/scripts/test-window-manager.ts +0 -43
  46. package/src/node/features/window-manager.ts +0 -1603
@@ -78,12 +78,12 @@ export class FileManager<
78
78
  });
79
79
 
80
80
  /** Returns an array of all relative file paths indexed by the file manager. */
81
- get fileIds() {
81
+ get fileIds(): string[] {
82
82
  return Array.from(this.files.keys());
83
83
  }
84
84
 
85
85
  /** Returns an array of all file metadata objects indexed by the file manager. */
86
- get fileObjects() {
86
+ get fileObjects(): File[] {
87
87
  return Array.from(this.files.values());
88
88
  }
89
89
 
@@ -92,7 +92,7 @@ export class FileManager<
92
92
  * @param {string | string[]} patterns - The patterns to match against the file IDs
93
93
  * @returns {string[]} The file IDs that match the patterns
94
94
  */
95
- match(patterns: string | string[]) {
95
+ match(patterns: string | string[]): string[] {
96
96
  return micromatch(this.files.keys(), patterns);
97
97
  }
98
98
 
@@ -102,7 +102,7 @@ export class FileManager<
102
102
  * @param {string | string[]} patterns - The patterns to match against the file IDs
103
103
  * @returns {File[]} The file objects that match the patterns
104
104
  */
105
- matchFiles(patterns: string | string[]) {
105
+ matchFiles(patterns: string | string[]): (File | undefined)[] {
106
106
  const fileIds = this.match(Array.isArray(patterns) ? patterns : [patterns]);
107
107
  return fileIds.map((fileId) => this.files.get(fileId));
108
108
  }
@@ -110,7 +110,7 @@ export class FileManager<
110
110
  /**
111
111
  * Returns the directory IDs for all of the files in the project.
112
112
  */
113
- get directoryIds() {
113
+ get directoryIds(): string[] {
114
114
  return Array.from(
115
115
  new Set(
116
116
  this.files
@@ -122,7 +122,7 @@ export class FileManager<
122
122
  }
123
123
 
124
124
  /** Returns an array of unique file extensions found across all indexed files. */
125
- get uniqueExtensions() {
125
+ get uniqueExtensions(): string[] {
126
126
  return Array.from(
127
127
  new Set(
128
128
  this.files.values().map((file) => file.extension)
@@ -131,17 +131,17 @@ export class FileManager<
131
131
  }
132
132
 
133
133
  /** Whether the file manager has completed its initial scan. */
134
- get isStarted() {
134
+ get isStarted(): boolean {
135
135
  return !!this.state.get("started");
136
136
  }
137
137
 
138
138
  /** Whether the file manager is currently performing its initial scan. */
139
- get isStarting() {
139
+ get isStarting(): boolean {
140
140
  return !!this.state.get("starting");
141
141
  }
142
142
 
143
143
  /** Whether the file watcher is actively monitoring for changes. */
144
- get isWatching() {
144
+ get isWatching(): boolean {
145
145
  return !!this.state.get("watching");
146
146
  }
147
147
 
@@ -156,7 +156,7 @@ export class FileManager<
156
156
  * @param {string | string[]} [options.exclude] - The patterns to exclude from the scan
157
157
  * @returns {Promise<FileManager>} The file manager instance
158
158
  */
159
- async start(options: { exclude?: string | string[] } = {}) {
159
+ async start(options: { exclude?: string | string[] } = {}): Promise<this> {
160
160
  if (this.isStarted) {
161
161
  return this;
162
162
  }
@@ -302,7 +302,7 @@ export class FileManager<
302
302
  * @param {string | string[]} [options.exclude] - The patterns to exclude from the scan
303
303
  * @returns {Promise<FileManager>} The file manager instance
304
304
  */
305
- async scanFiles(options: { exclude?: string | string[] } = {}) {
305
+ async scanFiles(options: { exclude?: string | string[] } = {}): Promise<this> {
306
306
  const { cwd, git, fs } = this.container;
307
307
 
308
308
  const fileIds: string[] = [];
@@ -416,7 +416,7 @@ export class FileManager<
416
416
  * @param {string | string[]} [options.exclude] - The patterns to exclude from the watch
417
417
  * @returns {Promise<void>}
418
418
  */
419
- async watch(options: { paths?: string | string[]; exclude?: string | string[] } = {}) {
419
+ async watch(options: { paths?: string | string[]; exclude?: string | string[] } = {}): Promise<void> {
420
420
  const pathsToWatch = castArray(options.paths || this.directoryIds.map(id => this.container.paths.resolve(id)))
421
421
  .map(p => this.container.paths.resolve(p));
422
422
 
@@ -487,7 +487,7 @@ export class FileManager<
487
487
  this.watcher = watcher;
488
488
  }
489
489
 
490
- async stopWatching() {
490
+ async stopWatching(): Promise<void> {
491
491
  if (!this.isWatching) {
492
492
  return;
493
493
  }
@@ -500,7 +500,7 @@ export class FileManager<
500
500
  }
501
501
  }
502
502
 
503
- async updateFile(path: string) {
503
+ async updateFile(path: string): Promise<void> {
504
504
  const absolutePath = this.container.paths.resolve(path);
505
505
  const { name, ext, dir } = parse(absolutePath);
506
506
 
@@ -526,7 +526,7 @@ export class FileManager<
526
526
  }
527
527
  }
528
528
 
529
- async removeFile(path: string) {
529
+ async removeFile(path: string): Promise<void> {
530
530
  this.files.delete(path);
531
531
  }
532
532
  }
@@ -13,6 +13,7 @@ import {
13
13
  realpathSync,
14
14
 
15
15
  rmSync as nodeRmSync,
16
+ type Stats,
16
17
  } from "fs";
17
18
  import { join, resolve, dirname, relative } from "path";
18
19
  import { readFile, stat, lstat, realpath, unlink, mkdir, writeFile, appendFile, readdir, cp, rename, rm as nodeRm } from "fs/promises";
@@ -145,7 +146,7 @@ export class FS extends Feature {
145
146
  * console.log(config.version)
146
147
  * ```
147
148
  */
148
- readJson(path: string) {
149
+ readJson(path: string): any {
149
150
  return JSON.parse(this.readFile(path) as string)
150
151
  }
151
152
 
@@ -153,7 +154,7 @@ export class FS extends Feature {
153
154
  * Read and parse a JSON file synchronously
154
155
  * @alias readJson
155
156
  */
156
- readJsonSync(path: string) {
157
+ readJsonSync(path: string): any {
157
158
  return this.readJson(path)
158
159
  }
159
160
 
@@ -170,7 +171,7 @@ export class FS extends Feature {
170
171
  * console.log(config.version)
171
172
  * ```
172
173
  */
173
- async readJsonAsync(path: string) {
174
+ async readJsonAsync(path: string): Promise<any> {
174
175
  const content = await this.readFileAsync(path)
175
176
  return JSON.parse(content as string)
176
177
  }
@@ -188,7 +189,7 @@ export class FS extends Feature {
188
189
  * console.log(entries) // ['index.ts', 'utils.ts', 'components']
189
190
  * ```
190
191
  */
191
- readdirSync(path: string) {
192
+ readdirSync(path: string): string[] {
192
193
  return readdirSync(this.container.paths.resolve(path))
193
194
  }
194
195
 
@@ -205,7 +206,7 @@ export class FS extends Feature {
205
206
  * console.log(entries) // ['index.ts', 'utils.ts', 'components']
206
207
  * ```
207
208
  */
208
- async readdir(path: string) {
209
+ async readdir(path: string): Promise<string[]> {
209
210
  return await readdir(this.container.paths.resolve(path))
210
211
  }
211
212
 
@@ -226,7 +227,7 @@ export class FS extends Feature {
226
227
  * fs.writeFile('data.bin', Buffer.from([1, 2, 3, 4]))
227
228
  * ```
228
229
  */
229
- writeFile(path: string, content: Buffer | string) {
230
+ writeFile(path: string, content: Buffer | string): void {
230
231
  writeFileSync(this.container.paths.resolve(path), content)
231
232
  }
232
233
 
@@ -261,7 +262,7 @@ export class FS extends Feature {
261
262
  * fs.writeJson('config.json', { version: '1.0.0', debug: false })
262
263
  * ```
263
264
  */
264
- writeJson(path: string, data: any, indent: number = 2) {
265
+ writeJson(path: string, data: any, indent: number = 2): void {
265
266
  this.writeFile(path, JSON.stringify(data, null, indent) + '\n')
266
267
  }
267
268
 
@@ -294,7 +295,7 @@ export class FS extends Feature {
294
295
  * fs.appendFile('log.txt', 'New line\n')
295
296
  * ```
296
297
  */
297
- appendFile(path: string, content: Buffer | string) {
298
+ appendFile(path: string, content: Buffer | string): void {
298
299
  appendFileSync(this.container.paths.resolve(path), content)
299
300
  }
300
301
 
@@ -332,7 +333,7 @@ export class FS extends Feature {
332
333
  * fs.ensureFile('logs/app.log', '', false)
333
334
  * ```
334
335
  */
335
- ensureFile(path: string, content: string, overwrite = false) {
336
+ ensureFile(path: string, content: string, overwrite = false): string {
336
337
  path = this.container.paths.resolve(path);
337
338
 
338
339
  if (this.exists(path) && !overwrite) {
@@ -359,7 +360,7 @@ export class FS extends Feature {
359
360
  * await fs.ensureFileAsync('config/settings.json', '{}', true)
360
361
  * ```
361
362
  */
362
- async ensureFileAsync(path: string, content: string, overwrite = false) {
363
+ async ensureFileAsync(path: string, content: string, overwrite = false): Promise<string> {
363
364
  path = this.container.paths.resolve(path);
364
365
 
365
366
  if (this.exists(path) && !overwrite) {
@@ -384,7 +385,7 @@ export class FS extends Feature {
384
385
  * fs.ensureFolder('logs/debug')
385
386
  * ```
386
387
  */
387
- ensureFolder(path: string) {
388
+ ensureFolder(path: string): string {
388
389
  mkdirSync(this.container.paths.resolve(path), { recursive: true });
389
390
  return this.container.paths.resolve(path);
390
391
  }
@@ -401,7 +402,7 @@ export class FS extends Feature {
401
402
  * await fs.ensureFolderAsync('logs/debug')
402
403
  * ```
403
404
  */
404
- async ensureFolderAsync(path: string) {
405
+ async ensureFolderAsync(path: string): Promise<string> {
405
406
  const resolved = this.container.paths.resolve(path);
406
407
  await mkdir(resolved, { recursive: true });
407
408
  return resolved;
@@ -418,7 +419,7 @@ export class FS extends Feature {
418
419
  * fs.mkdirp('deep/nested/path')
419
420
  * ```
420
421
  */
421
- mkdirp(folder: string) {
422
+ mkdirp(folder: string): string {
422
423
  return this.ensureFolder(folder)
423
424
  }
424
425
 
@@ -479,7 +480,7 @@ export class FS extends Feature {
479
480
  * }
480
481
  * ```
481
482
  */
482
- async existsAsync(path: string) {
483
+ async existsAsync(path: string): Promise<boolean> {
483
484
  const filePath = this.container.paths.resolve(path);
484
485
  return stat(filePath).then(() => true).catch(() => false)
485
486
  }
@@ -519,7 +520,7 @@ export class FS extends Feature {
519
520
  * console.log(info.size, info.mtime)
520
521
  * ```
521
522
  */
522
- stat(path: string) {
523
+ stat(path: string): Stats {
523
524
  return statSync(this.container.paths.resolve(path))
524
525
  }
525
526
 
@@ -536,7 +537,7 @@ export class FS extends Feature {
536
537
  * console.log(info.size, info.mtime)
537
538
  * ```
538
539
  */
539
- async statAsync(path: string) {
540
+ async statAsync(path: string): Promise<Stats> {
540
541
  return stat(this.container.paths.resolve(path))
541
542
  }
542
543
 
@@ -631,7 +632,7 @@ export class FS extends Feature {
631
632
  * fs.rmSync('temp/cache.tmp')
632
633
  * ```
633
634
  */
634
- rmSync(path: string) {
635
+ rmSync(path: string): void {
635
636
  nodeRmSync(this.container.paths.resolve(path), { force: true })
636
637
  }
637
638
 
@@ -662,7 +663,7 @@ export class FS extends Feature {
662
663
  * fs.rmdirSync('temp/cache')
663
664
  * ```
664
665
  */
665
- rmdirSync(dirPath: string) {
666
+ rmdirSync(dirPath: string): void {
666
667
  nodeRmSync(this.container.paths.resolve(dirPath), { recursive: true, force: true })
667
668
  }
668
669
 
@@ -702,7 +703,7 @@ export class FS extends Feature {
702
703
  * fs.copy('src', 'backup/src')
703
704
  * ```
704
705
  */
705
- copy(src: string, dest: string, options: { overwrite?: boolean } = {}) {
706
+ copy(src: string, dest: string, options: { overwrite?: boolean } = {}): void {
706
707
  const { overwrite = true } = options
707
708
  const resolvedSrc = this.container.paths.resolve(src)
708
709
  const resolvedDest = this.container.paths.resolve(dest)
@@ -746,7 +747,7 @@ export class FS extends Feature {
746
747
  * fs.move('old-dir', 'new-dir')
747
748
  * ```
748
749
  */
749
- move(src: string, dest: string) {
750
+ move(src: string, dest: string): void {
750
751
  const resolvedSrc = this.container.paths.resolve(src)
751
752
  const resolvedDest = this.container.paths.resolve(dest)
752
753
  const destDir = dirname(resolvedDest)
@@ -819,7 +820,7 @@ export class FS extends Feature {
819
820
  * const relative = fs.walk('inbox', { relative: true }) // => { files: ['contact-1.json', ...] }
820
821
  * ```
821
822
  */
822
- walk(basePath: string, options: WalkOptions = {}) {
823
+ walk(basePath: string, options: WalkOptions = {}): { directories: string[], files: string[] } {
823
824
  const {
824
825
  directories = true,
825
826
  files = true,
@@ -898,7 +899,7 @@ export class FS extends Feature {
898
899
  * // files.files => ['contact-1.json', 'subfolder/file.txt', ...]
899
900
  * ```
900
901
  */
901
- async walkAsync(baseDir: string, options: WalkOptions = {}) {
902
+ async walkAsync(baseDir: string, options: WalkOptions = {}): Promise<{ directories: string[], files: string[] }> {
902
903
  const {
903
904
  directories = true,
904
905
  files = true,
@@ -98,7 +98,7 @@ export class Git extends Feature {
98
98
  * })
99
99
  * ```
100
100
  */
101
- async lsFiles(options: LsFilesOptions = {}) {
101
+ async lsFiles(options: LsFilesOptions = {}): Promise<string[]> {
102
102
  const {
103
103
  cached = false,
104
104
  deleted = false,
@@ -153,7 +153,7 @@ export class Git extends Feature {
153
153
  * }
154
154
  * ```
155
155
  */
156
- get branch() {
156
+ get branch(): string | null {
157
157
  if(!this.isRepo) { return null }
158
158
  return this.container.feature('proc').exec(`${this.gitPath} branch`).split("\n").filter(line => line.startsWith('*')).map(line => line.replace('*', '').trim()).pop()
159
159
  }
@@ -171,7 +171,7 @@ export class Git extends Feature {
171
171
  * }
172
172
  * ```
173
173
  */
174
- get sha() {
174
+ get sha(): string | null {
175
175
  if(!this.isRepo) { return null }
176
176
  return this.container.feature('proc').exec(`${this.gitPath} rev-parse HEAD`, { cwd: this.repoRoot })
177
177
  }
@@ -190,7 +190,7 @@ export class Git extends Feature {
190
190
  * }
191
191
  * ```
192
192
  */
193
- get isRepo() {
193
+ get isRepo(): boolean {
194
194
  return !!this.repoRoot
195
195
  }
196
196
 
@@ -208,7 +208,7 @@ export class Git extends Feature {
208
208
  * }
209
209
  * ```
210
210
  */
211
- get isRepoRoot() {
211
+ get isRepoRoot(): boolean {
212
212
  return this.repoRoot == this.container.cwd
213
213
  }
214
214
 
@@ -228,7 +228,7 @@ export class Git extends Feature {
228
228
  * }
229
229
  * ```
230
230
  */
231
- get repoRoot() {
231
+ get repoRoot(): string | null {
232
232
  if (this.state.has('repoRoot')) {
233
233
  return this.state.get('repoRoot')
234
234
  }
@@ -260,7 +260,7 @@ export class Git extends Feature {
260
260
  * }
261
261
  * ```
262
262
  */
263
- async getLatestChanges(numberOfChanges: number = 10) {
263
+ async getLatestChanges(numberOfChanges: number = 10): Promise<Array<{ title: string, message: string, author: string }>> {
264
264
  if (!this.isRepo) return []
265
265
 
266
266
  const separator = '---COMMIT---'
@@ -299,7 +299,7 @@ export class Git extends Feature {
299
299
  * }
300
300
  * ```
301
301
  */
302
- fileLog(...files: string[]) {
302
+ fileLog(...files: string[]): Array<{ sha: string, message: string }> {
303
303
  if (!this.isRepo || !files.length) return []
304
304
 
305
305
  const proc = this.container.feature('proc')
@@ -349,7 +349,7 @@ export class Git extends Feature {
349
349
  * const d = git.diff('src/index.ts', 'feature-branch', 'main')
350
350
  * ```
351
351
  */
352
- diff(file: string, compareTo: string, compareFrom?: string) {
352
+ diff(file: string, compareTo: string, compareFrom?: string): string {
353
353
  if (!this.isRepo) return ''
354
354
 
355
355
  const proc = this.container.feature('proc')
@@ -531,7 +531,7 @@ export class Git extends Feature {
531
531
  * const history = git.getChangeHistoryForFiles('src/node/features/*.ts')
532
532
  * ```
533
533
  */
534
- getChangeHistoryForFiles(...paths: string[]) {
534
+ getChangeHistoryForFiles(...paths: string[]): Array<{ sha: string, message: string, longMessage: string, filesMatched: string[] }> {
535
535
  if (!this.isRepo || !paths.length) return []
536
536
 
537
537
  const proc = this.container.feature('proc')
@@ -128,7 +128,7 @@ export class Ink extends Feature<InkState, InkOptions> {
128
128
  * Exposed so consumers don't need a separate react import.
129
129
  * Lazy-loaded — first access triggers the import.
130
130
  */
131
- get React() {
131
+ get React(): typeof import('react') {
132
132
  // return a promise the first time, but for ergonomics we also
133
133
  // expose a sync getter that throws if react hasn't loaded yet.
134
134
  if (this._reactModule) return this._reactModule
@@ -151,7 +151,7 @@ export class Ink extends Feature<InkState, InkOptions> {
151
151
  * const { Box, Text } = ink.components
152
152
  * ```
153
153
  */
154
- async loadModules() {
154
+ async loadModules(): Promise<this> {
155
155
  await Promise.all([this._getInk(), this._getReact()])
156
156
  return this
157
157
  }
@@ -163,7 +163,7 @@ export class Ink extends Feature<InkState, InkOptions> {
163
163
  * const { Box, Text, Static, Spacer } = ink.components
164
164
  * ```
165
165
  */
166
- get components() {
166
+ get components(): { Box: typeof import('ink').Box; Text: typeof import('ink').Text; Static: typeof import('ink').Static; Transform: typeof import('ink').Transform; Newline: typeof import('ink').Newline; Spacer: typeof import('ink').Spacer } {
167
167
  const ink = this._inkModule
168
168
  if (!ink) {
169
169
  throw new Error(
@@ -188,7 +188,7 @@ export class Ink extends Feature<InkState, InkOptions> {
188
188
  * const { useInput, useApp, useFocus } = ink.hooks
189
189
  * ```
190
190
  */
191
- get hooks() {
191
+ get hooks(): { useInput: typeof import('ink').useInput; useApp: typeof import('ink').useApp; useStdin: typeof import('ink').useStdin; useStdout: typeof import('ink').useStdout; useStderr: typeof import('ink').useStderr; useFocus: typeof import('ink').useFocus; useFocusManager: typeof import('ink').useFocusManager; useCursor: typeof import('ink').useCursor } {
192
192
  const ink = this._inkModule
193
193
  if (!ink) {
194
194
  throw new Error(
@@ -211,7 +211,7 @@ export class Ink extends Feature<InkState, InkOptions> {
211
211
  /**
212
212
  * The Ink measureElement utility.
213
213
  */
214
- get measureElement() {
214
+ get measureElement(): typeof import('ink').measureElement {
215
215
  const ink = this._inkModule
216
216
  if (!ink) {
217
217
  throw new Error('Ink not loaded yet.')
@@ -229,7 +229,7 @@ export class Ink extends Feature<InkState, InkOptions> {
229
229
  * @param options - Ink render options (stdout, stdin, debug, etc.)
230
230
  * @returns The Ink instance with rerender, unmount, waitUntilExit, clear
231
231
  */
232
- async render(node: any, options: Record<string, any> = {}) {
232
+ async render(node: any, options: Record<string, any> = {}): Promise<any> {
233
233
  const ink = await this._getInk()
234
234
  await this._getReact()
235
235
 
@@ -280,7 +280,7 @@ export class Ink extends Feature<InkState, InkOptions> {
280
280
  * ink.rerender(React.createElement(Text, null, 'Updated!'))
281
281
  * ```
282
282
  */
283
- rerender(node: any) {
283
+ rerender(node: any): void {
284
284
  if (!this._instance) {
285
285
  throw new Error('No mounted ink app. Call render() first.')
286
286
  }
@@ -304,7 +304,7 @@ export class Ink extends Feature<InkState, InkOptions> {
304
304
  * console.log(ink.isMounted) // false
305
305
  * ```
306
306
  */
307
- unmount() {
307
+ unmount(): void {
308
308
  if (this._instance) {
309
309
  this._instance.unmount()
310
310
  this.setState({ mounted: false })
@@ -351,7 +351,7 @@ export class Ink extends Feature<InkState, InkOptions> {
351
351
  * ink.clear()
352
352
  * ```
353
353
  */
354
- clear() {
354
+ clear(): void {
355
355
  if (this._instance) {
356
356
  this._instance.clear()
357
357
  }
@@ -367,7 +367,7 @@ export class Ink extends Feature<InkState, InkOptions> {
367
367
  /**
368
368
  * The raw ink render instance if you need low-level access.
369
369
  */
370
- get instance() {
370
+ get instance(): any | null {
371
371
  return this._instance
372
372
  }
373
373
 
@@ -387,7 +387,7 @@ export class Ink extends Feature<InkState, InkOptions> {
387
387
  * )
388
388
  * ```
389
389
  */
390
- registerBlock(name: string, component: Function) {
390
+ registerBlock(name: string, component: Function): this {
391
391
  this._blocks.set(name, component)
392
392
  return this
393
393
  }
@@ -407,7 +407,7 @@ export class Ink extends Feature<InkState, InkOptions> {
407
407
  * await ink.renderBlock('Greeting', { name: 'Jon' })
408
408
  * ```
409
409
  */
410
- async renderBlock(name: string, data?: Record<string, any>) {
410
+ async renderBlock(name: string, data?: Record<string, any>): Promise<void> {
411
411
  const component = this._blocks.get(name)
412
412
  if (!component) {
413
413
  throw new Error(`No block registered with name "${name}". Available: ${[...this._blocks.keys()].join(', ') || '(none)'}`)
@@ -450,7 +450,7 @@ export class Ink extends Feature<InkState, InkOptions> {
450
450
  * await renderAsync('AsyncChart', { url: 'https://api.example.com/data' })
451
451
  * ```
452
452
  */
453
- async renderBlockAsync(name: string, data?: Record<string, any>, options?: { timeout?: number }) {
453
+ async renderBlockAsync(name: string, data?: Record<string, any>, options?: { timeout?: number }): Promise<void> {
454
454
  const component = this._blocks.get(name)
455
455
  if (!component) {
456
456
  throw new Error(`No block registered with name "${name}". Available: ${[...this._blocks.keys()].join(', ') || '(none)'}`)
@@ -139,7 +139,7 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
139
139
  *
140
140
  * @returns True if the socket is configured as a client
141
141
  */
142
- get isClient() {
142
+ get isClient(): boolean {
143
143
  return this.state.get('mode') === 'client'
144
144
  }
145
145
 
@@ -148,14 +148,14 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
148
148
  *
149
149
  * @returns True if the socket is configured as a server
150
150
  */
151
- get isServer() {
151
+ get isServer(): boolean {
152
152
  return this.state.get('mode') === 'server'
153
153
  }
154
154
 
155
155
  /**
156
156
  * Returns the number of currently connected clients (server mode).
157
157
  */
158
- get clientCount() {
158
+ get clientCount(): number {
159
159
  return this.clients.size
160
160
  }
161
161
 
@@ -326,7 +326,7 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
326
326
  *
327
327
  * @returns The active Socket connection, or undefined if not connected
328
328
  */
329
- get connection() {
329
+ get connection(): Socket | undefined {
330
330
  return this._connection
331
331
  }
332
332
 
@@ -337,7 +337,7 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
337
337
  * @param exclude - Optional client ID to exclude from broadcast
338
338
  * @returns This instance for method chaining
339
339
  */
340
- broadcast(message: any, exclude?: string) {
340
+ broadcast(message: any, exclude?: string): this {
341
341
  const envelope = JSON.stringify({
342
342
  data: message,
343
343
  id: this.container.utils.uuid()
@@ -377,7 +377,7 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
377
377
  *
378
378
  * @param message - The message to send
379
379
  */
380
- async send(message: any) {
380
+ async send(message: any): Promise<void> {
381
381
  if(!this._connection) {
382
382
  throw new Error("No connection.")
383
383
  }
@@ -449,7 +449,7 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
449
449
  * @param data - The reply payload
450
450
  * @param clientId - Target client (server mode; for client mode, omit)
451
451
  */
452
- reply(requestId: string, data: any, clientId?: string) {
452
+ reply(requestId: string, data: any, clientId?: string): void {
453
453
  const envelope = JSON.stringify({
454
454
  id: this.container.utils.uuid(),
455
455
  data,
@@ -557,7 +557,7 @@ export class IpcSocket<T extends IpcState = IpcState> extends Feature<T> {
557
557
  /**
558
558
  * Disconnects the client and stops any reconnection attempts.
559
559
  */
560
- disconnect() {
560
+ disconnect(): void {
561
561
  this._reconnect.enabled = false
562
562
  if (this._reconnect.timer) {
563
563
  clearTimeout(this._reconnect.timer)
@@ -249,11 +249,11 @@ export class Networking extends Feature<NetworkingState, NetworkingOptions> {
249
249
  return this._binCache[name]
250
250
  }
251
251
 
252
- get proc() {
252
+ get proc(): ReturnType<typeof this.container.feature<'proc'>> {
253
253
  return this.container.feature('proc')
254
254
  }
255
255
 
256
- get os() {
256
+ get os(): ReturnType<typeof this.container.feature<'os'>> {
257
257
  return this.container.feature('os')
258
258
  }
259
259
 
@@ -630,7 +630,7 @@ export class Networking extends Feature<NetworkingState, NetworkingOptions> {
630
630
  /**
631
631
  * Optional nmap wrapper for users that already have nmap installed.
632
632
  */
633
- get nmap() {
633
+ get nmap(): { isAvailable: () => Promise<boolean>; scan: (target: string, args?: string[]) => Promise<{ hosts: NmapHost[]; raw: string }>; quickScan: (cidr: string) => Promise<{ hosts: NmapHost[]; raw: string }>; fullScan: (target: string) => Promise<{ hosts: NmapHost[]; raw: string }> } {
634
634
  return {
635
635
  isAvailable: async () => this.isNmapAvailable(),
636
636
  scan: async (target: string, args: string[] = []) => this.runNmapScan(target, args),
@@ -48,7 +48,7 @@ export class OS extends Feature {
48
48
  * console.log(`Running on ${arch} architecture`)
49
49
  * ```
50
50
  */
51
- get arch() {
51
+ get arch(): string {
52
52
  return os.arch()
53
53
  }
54
54
 
@@ -63,7 +63,7 @@ export class OS extends Feature {
63
63
  * console.log(`Temp directory: ${tempDir}`)
64
64
  * ```
65
65
  */
66
- get tmpdir() {
66
+ get tmpdir(): string {
67
67
  return os.tmpdir()
68
68
  }
69
69
 
@@ -78,7 +78,7 @@ export class OS extends Feature {
78
78
  * console.log(`User home: ${home}`)
79
79
  * ```
80
80
  */
81
- get homedir() {
81
+ get homedir(): string {
82
82
  return os.homedir()
83
83
  }
84
84
 
@@ -93,7 +93,7 @@ export class OS extends Feature {
93
93
  * console.log(`System has ${cores} CPU cores`)
94
94
  * ```
95
95
  */
96
- get cpuCount() {
96
+ get cpuCount(): number {
97
97
  return os.cpus().length
98
98
  }
99
99
 
@@ -108,7 +108,7 @@ export class OS extends Feature {
108
108
  * console.log(`Hostname: ${hostname}`)
109
109
  * ```
110
110
  */
111
- get hostname() {
111
+ get hostname(): string {
112
112
  return os.hostname()
113
113
  }
114
114
 
@@ -125,7 +125,7 @@ export class OS extends Feature {
125
125
  * }
126
126
  * ```
127
127
  */
128
- get platform() {
128
+ get platform(): string {
129
129
  return os.platform()
130
130
  }
131
131
 
@@ -142,7 +142,7 @@ export class OS extends Feature {
142
142
  * })
143
143
  * ```
144
144
  */
145
- get networkInterfaces() {
145
+ get networkInterfaces(): NodeJS.Dict<os.NetworkInterfaceInfo[]> {
146
146
  return os.networkInterfaces()
147
147
  }
148
148