• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphty-org / graphty-element / 20514590651

26 Dec 2025 02:37AM UTC coverage: 70.559% (-0.3%) from 70.836%
20514590651

push

github

apowers313
ci: fix npm ci

9591 of 13363 branches covered (71.77%)

Branch coverage included in aggregate %.

25136 of 35854 relevant lines covered (70.11%)

6233.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/src/ai/input/TextInputAdapter.ts
1
/**
5✔
2
 * TextInputAdapter - Text input adapter for streaming text support.
3
 * @module ai/input/TextInputAdapter
4
 */
5

6
import type {InputAdapter, InputCallback} from "./types";
7

8
/**
9
 * Text input adapter that wraps text input with streaming support.
10
 * Useful for "as-you-type" suggestions or preview functionality.
11
 */
12
export class TextInputAdapter implements InputAdapter {
5✔
13
    readonly type = "text" as const;
13✔
14
    readonly isSupported = true;
13✔
15

16
    private _isActive = false;
13✔
17
    private callbacks: InputCallback[] = [];
13✔
18

19
    /**
20
     * Get whether text input is currently active.
21
     * @returns True if accepting input
22
     */
23
    get isActive(): boolean {
5✔
24
        return this._isActive;
4✔
25
    }
4✔
26

27
    /**
28
     * Start accepting text input.
29
     */
30
    start(): void {
5✔
31
        this._isActive = true;
7✔
32
    }
7✔
33

34
    /**
35
     * Stop accepting text input.
36
     */
37
    stop(): void {
5✔
38
        this._isActive = false;
3✔
39
    }
3✔
40

41
    /**
42
     * Register a callback for input events.
43
     * @param callback - Function called when input is received
44
     */
45
    onInput(callback: InputCallback): void {
5✔
46
        this.callbacks.push(callback);
10✔
47
    }
10✔
48

49
    /**
50
     * Submit final text input.
51
     * @param text - The complete input text
52
     */
53
    submitInput(text: string): void {
5✔
54
        if (!this._isActive) {
4✔
55
            return;
2✔
56
        }
2✔
57

58
        for (const callback of this.callbacks) {
4✔
59
            callback(text, true);
3✔
60
        }
3✔
61
    }
4✔
62

63
    /**
64
     * Submit interim (partial) text input.
65
     * @param text - The partial input text
66
     */
67
    submitInterim(text: string): void {
5✔
68
        if (!this._isActive) {
1!
69
            return;
×
70
        }
×
71

72
        for (const callback of this.callbacks) {
1✔
73
            callback(text, false);
1✔
74
        }
1✔
75
    }
1✔
76

77
    /**
78
     * Clean up resources and remove all callbacks.
79
     */
80
    dispose(): void {
5✔
81
        this.stop();
2✔
82
        this.callbacks = [];
2✔
83
    }
2✔
84
}
5✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc