thatgfsj-code 0.2.1
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/.patches/0001-fix-repl-replace-readline-with-inquirer-input-for-ke.patch +279 -0
- package/.patches/0002-fix-repl-stream-AI-output-directly-to-stdout-so-term.patch +564 -0
- package/.patches/0003-fix-session-break-the-hallucination-loop-in-assistan.patch +194 -0
- package/.patches/0004-chore-release-bump-version-to-0.2.1.patch +24 -0
- package/LICENSE +21 -0
- package/README.md +100 -0
- package/ROADMAP.md +107 -0
- package/dist/agent/core.d.ts +56 -0
- package/dist/agent/core.d.ts.map +1 -0
- package/dist/agent/core.js +142 -0
- package/dist/agent/core.js.map +1 -0
- package/dist/agent/index.d.ts +8 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +8 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/intent.d.ts +36 -0
- package/dist/agent/intent.d.ts.map +1 -0
- package/dist/agent/intent.js +146 -0
- package/dist/agent/intent.js.map +1 -0
- package/dist/agent/streaming.d.ts +50 -0
- package/dist/agent/streaming.d.ts.map +1 -0
- package/dist/agent/streaming.js +110 -0
- package/dist/agent/streaming.js.map +1 -0
- package/dist/core/ai-engine.d.ts +59 -0
- package/dist/core/ai-engine.d.ts.map +1 -0
- package/dist/core/ai-engine.js +378 -0
- package/dist/core/ai-engine.js.map +1 -0
- package/dist/core/cli.d.ts +21 -0
- package/dist/core/cli.d.ts.map +1 -0
- package/dist/core/cli.js +143 -0
- package/dist/core/cli.js.map +1 -0
- package/dist/core/config.d.ts +38 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +129 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/context-compactor.d.ts +54 -0
- package/dist/core/context-compactor.d.ts.map +1 -0
- package/dist/core/context-compactor.js +197 -0
- package/dist/core/context-compactor.js.map +1 -0
- package/dist/core/hooks.d.ts +75 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +146 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/permissions.d.ts +52 -0
- package/dist/core/permissions.d.ts.map +1 -0
- package/dist/core/permissions.js +237 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/session.d.ts +54 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +147 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +175 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/state.d.ts +60 -0
- package/dist/core/state.d.ts.map +1 -0
- package/dist/core/state.js +106 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/subagent.d.ts +68 -0
- package/dist/core/subagent.d.ts.map +1 -0
- package/dist/core/subagent.js +142 -0
- package/dist/core/subagent.js.map +1 -0
- package/dist/core/system-prompt.d.ts +40 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +138 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/tool-registry.d.ts +53 -0
- package/dist/core/tool-registry.d.ts.map +1 -0
- package/dist/core/tool-registry.js +138 -0
- package/dist/core/tool-registry.js.map +1 -0
- package/dist/core/types.d.ts +206 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +127 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +481 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +83 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +267 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/repl/index.d.ts +8 -0
- package/dist/repl/index.d.ts.map +1 -0
- package/dist/repl/index.js +8 -0
- package/dist/repl/index.js.map +1 -0
- package/dist/repl/input.d.ts +61 -0
- package/dist/repl/input.d.ts.map +1 -0
- package/dist/repl/input.js +127 -0
- package/dist/repl/input.js.map +1 -0
- package/dist/repl/loop.d.ts +53 -0
- package/dist/repl/loop.d.ts.map +1 -0
- package/dist/repl/loop.js +241 -0
- package/dist/repl/loop.js.map +1 -0
- package/dist/repl/output.d.ts +105 -0
- package/dist/repl/output.d.ts.map +1 -0
- package/dist/repl/output.js +197 -0
- package/dist/repl/output.js.map +1 -0
- package/dist/repl/welcome.d.ts +68 -0
- package/dist/repl/welcome.d.ts.map +1 -0
- package/dist/repl/welcome.js +249 -0
- package/dist/repl/welcome.js.map +1 -0
- package/dist/tools/file.d.ts +46 -0
- package/dist/tools/file.d.ts.map +1 -0
- package/dist/tools/file.js +100 -0
- package/dist/tools/file.js.map +1 -0
- package/dist/tools/git.d.ts +52 -0
- package/dist/tools/git.d.ts.map +1 -0
- package/dist/tools/git.js +112 -0
- package/dist/tools/git.js.map +1 -0
- package/dist/tools/index.d.ts +22 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +43 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/search.d.ts +36 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +223 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/shell.d.ts +57 -0
- package/dist/tools/shell.d.ts.map +1 -0
- package/dist/tools/shell.js +153 -0
- package/dist/tools/shell.js.map +1 -0
- package/dist/utils/diff-preview.d.ts +42 -0
- package/dist/utils/diff-preview.d.ts.map +1 -0
- package/dist/utils/diff-preview.js +174 -0
- package/dist/utils/diff-preview.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/memory.d.ts +81 -0
- package/dist/utils/memory.d.ts.map +1 -0
- package/dist/utils/memory.js +186 -0
- package/dist/utils/memory.js.map +1 -0
- package/dist/utils/project-context.d.ts +62 -0
- package/dist/utils/project-context.d.ts.map +1 -0
- package/dist/utils/project-context.js +197 -0
- package/dist/utils/project-context.js.map +1 -0
- package/docs/API_KEY_GUIDE.md +236 -0
- package/docs/FAQ.md +182 -0
- package/install.bat +63 -0
- package/install.ps1 +238 -0
- package/install.sh +113 -0
- package/package.json +36 -0
- package/src/agent/core.ts +179 -0
- package/src/agent/index.ts +8 -0
- package/src/agent/intent.ts +181 -0
- package/src/agent/streaming.ts +132 -0
- package/src/core/ai-engine.ts +437 -0
- package/src/core/cli.ts +171 -0
- package/src/core/config.ts +147 -0
- package/src/core/context-compactor.ts +245 -0
- package/src/core/hooks.ts +196 -0
- package/src/core/permissions.ts +308 -0
- package/src/core/session.ts +165 -0
- package/src/core/skills.ts +208 -0
- package/src/core/state.ts +120 -0
- package/src/core/subagent.ts +195 -0
- package/src/core/system-prompt.ts +163 -0
- package/src/core/tool-registry.ts +157 -0
- package/src/core/types.ts +280 -0
- package/src/index.ts +544 -0
- package/src/mcp/client.ts +330 -0
- package/src/repl/index.ts +8 -0
- package/src/repl/input.ts +139 -0
- package/src/repl/loop.ts +280 -0
- package/src/repl/output.ts +222 -0
- package/src/repl/welcome.ts +296 -0
- package/src/tools/file.ts +117 -0
- package/src/tools/git.ts +132 -0
- package/src/tools/index.ts +48 -0
- package/src/tools/search.ts +263 -0
- package/src/tools/shell.ts +181 -0
- package/src/utils/diff-preview.ts +202 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/memory.ts +223 -0
- package/src/utils/project-context.ts +207 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
From e51c23c167f946a6db211b0ea0a344502c6c7427 Mon Sep 17 00:00:00 2001
|
|
2
|
+
From: Thatgfsj <thatgfsj@users.noreply.github.com>
|
|
3
|
+
Date: Mon, 6 Jul 2026 02:33:34 +0800
|
|
4
|
+
Subject: [PATCH 1/4] fix(repl): replace readline with @inquirer/input for
|
|
5
|
+
keypad arrow key support
|
|
6
|
+
|
|
7
|
+
Node readline.createInterface does not emit keypress events for the
|
|
8
|
+
numeric keypad's arrow keys on Windows terminals, so users could not
|
|
9
|
+
move the cursor with the arrows or edit within the input line.
|
|
10
|
+
|
|
11
|
+
REPLInput now wraps @inquirer/input with prefill='editable', which uses
|
|
12
|
+
raw mode and standard keypress events for both keypad and main-cluster
|
|
13
|
+
arrow keys, plus Home/End/Ctrl+A/Ctrl+E for in-line editing.
|
|
14
|
+
---
|
|
15
|
+
src/repl/input.ts | 209 +++++++++++++++++++++-------------------------
|
|
16
|
+
1 file changed, 94 insertions(+), 115 deletions(-)
|
|
17
|
+
|
|
18
|
+
diff --git a/src/repl/input.ts b/src/repl/input.ts
|
|
19
|
+
index a30a92a..9fac346 100644
|
|
20
|
+
--- a/src/repl/input.ts
|
|
21
|
+
+++ b/src/repl/input.ts
|
|
22
|
+
@@ -1,160 +1,139 @@
|
|
23
|
+
/**
|
|
24
|
+
* REPL Input Handler
|
|
25
|
+
- * Handles multiline input, history, and Ctrl+C
|
|
26
|
+
+ *
|
|
27
|
+
+ * 基于 @inquirer/input 实现,支持:
|
|
28
|
+
+ * - 方向键(含数字小键盘方向键)行内移动 / 跳转词首尾
|
|
29
|
+
+ * - Home / End / Backspace / Delete 行内编辑
|
|
30
|
+
+ * - Ctrl+A / Ctrl+E 跳到行首/行尾(emacs 风格)
|
|
31
|
+
+ * - Ctrl+C 中断当前输入(不清空整个会话),连续按两次空输入退出
|
|
32
|
+
+ * - 命令历史:本地维护 history 数组,通过 default 预填上一条
|
|
33
|
+
+ *
|
|
34
|
+
+ * 不再使用 Node 内置 readline 的 rl.question()——它在 Windows 终端下
|
|
35
|
+
+ * 对小键盘方向键的 ANSI 转义序列不友好,会导致光标无法移动 (Bug #1)。
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
-import readline from 'readline';
|
|
39
|
+
+import input from '@inquirer/input';
|
|
40
|
+
import chalk from 'chalk';
|
|
41
|
+
|
|
42
|
+
+const MAX_HISTORY = 200;
|
|
43
|
+
+
|
|
44
|
+
+export type PromptResult =
|
|
45
|
+
+ | { kind: 'value'; value: string } // 用户正常输入并提交(Enter)
|
|
46
|
+
+ | { kind: 'cancelled' }; // Ctrl+C 中断当前输入
|
|
47
|
+
+
|
|
48
|
+
export class REPLInput {
|
|
49
|
+
- private rl: readline.Interface;
|
|
50
|
+
private history: string[] = [];
|
|
51
|
+
- private historyIndex: number = -1;
|
|
52
|
+
- private currentInput: string = '';
|
|
53
|
+
- private multilineMode: boolean = false;
|
|
54
|
+
- private multilineBuffer: string[] = [];
|
|
55
|
+
-
|
|
56
|
+
- constructor() {
|
|
57
|
+
- this.rl = readline.createInterface({
|
|
58
|
+
- input: process.stdin,
|
|
59
|
+
- output: process.stdout,
|
|
60
|
+
- completer: this.completer.bind(this),
|
|
61
|
+
- historySize: 100,
|
|
62
|
+
- tabSize: 4
|
|
63
|
+
- });
|
|
64
|
+
+ private historyIndex: number = -1; // -1 表示"未在历史中浏览"
|
|
65
|
+
+ private currentDraft: string = ''; // 离开历史时保留用户原始草稿
|
|
66
|
+
+ private defaultPrefix: string = chalk.green('\n> ');
|
|
67
|
+
+ private consecutiveCancels: number = 0; // 连续空输入 + Ctrl+C 计数,达到阈值退出
|
|
68
|
+
|
|
69
|
+
- // Handle Ctrl+C
|
|
70
|
+
- this.rl.on('SIGINT', () => {
|
|
71
|
+
- if (this.currentInput.length > 0 || this.multilineBuffer.length > 0) {
|
|
72
|
+
- // Clear current input
|
|
73
|
+
- this.currentInput = '';
|
|
74
|
+
- this.multilineBuffer = [];
|
|
75
|
+
- this.multilineMode = false;
|
|
76
|
+
- process.stdout.write('\n');
|
|
77
|
+
- this.rl.prompt();
|
|
78
|
+
- } else {
|
|
79
|
+
- // Exit REPL
|
|
80
|
+
- process.stdout.write(chalk.gray('\n\n👋 Exiting...\n'));
|
|
81
|
+
- process.exit(0);
|
|
82
|
+
+ /**
|
|
83
|
+
+ * Ask the user for input. Returns either a value or 'cancelled'.
|
|
84
|
+
+ * Loop decides what to do with cancellation (usually: continue session,
|
|
85
|
+
+ * unless user has cancelled an already-empty input twice in a row).
|
|
86
|
+
+ */
|
|
87
|
+
+ async prompt(prefix?: string, abortSignal?: AbortSignal): Promise<PromptResult> {
|
|
88
|
+
+ const prefill = this.computePrefill();
|
|
89
|
+
+ const previousDraft = prefill.kind === 'history' ? prefill.value : '';
|
|
90
|
+
+
|
|
91
|
+
+ // 用 abortSignal 绑到 inquirer:外面 Ctrl+C / 主进程事件可以取消
|
|
92
|
+
+ const value = await input({
|
|
93
|
+
+ message: prefix ?? this.defaultPrefix,
|
|
94
|
+
+ prefill: 'editable', // 关键:启用方向键 + 行内编辑,包括小键盘
|
|
95
|
+
+ default: previousDraft, // 历史预填
|
|
96
|
+
+ // Ctrl+C 由 @inquirer/input 抛出一个 symbol-like 错误,我们捕获为 cancelled
|
|
97
|
+
+ validate: () => true,
|
|
98
|
+
+ }, abortSignal ? { signal: abortSignal } : undefined).catch((err: any) => {
|
|
99
|
+
+ // 区分真实错误与用户取消;inquirer 用 ExitPromptError (name: 'ExitPromptError')
|
|
100
|
+
+ if (err && (err.name === 'ExitPromptError' || err.message?.includes('User force closed'))) {
|
|
101
|
+
+ return null;
|
|
102
|
+
}
|
|
103
|
+
+ throw err;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
- // Track history navigation
|
|
107
|
+
- this.rl.on('line', (line) => {
|
|
108
|
+
- if (line.trim()) {
|
|
109
|
+
- this.history.push(line);
|
|
110
|
+
- if (this.history.length > 100) {
|
|
111
|
+
- this.history.shift();
|
|
112
|
+
- }
|
|
113
|
+
+ if (value === null || value === undefined) {
|
|
114
|
+
+ this.consecutiveCancels++;
|
|
115
|
+
+ return { kind: 'cancelled' };
|
|
116
|
+
+ }
|
|
117
|
+
+
|
|
118
|
+
+ const trimmed = value.trim();
|
|
119
|
+
+ if (trimmed.length > 0) {
|
|
120
|
+
+ // 避免把连续重复的内容都压入历史
|
|
121
|
+
+ if (this.history[this.history.length - 1] !== trimmed) {
|
|
122
|
+
+ this.history.push(trimmed);
|
|
123
|
+
+ if (this.history.length > MAX_HISTORY) this.history.shift();
|
|
124
|
+
}
|
|
125
|
+
- this.historyIndex = this.history.length;
|
|
126
|
+
- });
|
|
127
|
+
- }
|
|
128
|
+
+ }
|
|
129
|
+
|
|
130
|
+
- /**
|
|
131
|
+
- * Prompt for input
|
|
132
|
+
- */
|
|
133
|
+
- async prompt(prefix: string = chalk.green('\n> ')): Promise<string> {
|
|
134
|
+
- return new Promise((resolve) => {
|
|
135
|
+
- this.rl.question(prefix, (answer) => {
|
|
136
|
+
- resolve(answer);
|
|
137
|
+
- });
|
|
138
|
+
- });
|
|
139
|
+
+ this.consecutiveCancels = 0;
|
|
140
|
+
+ return { kind: 'value', value: trimmed };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
- * Set prompt prefix
|
|
145
|
+
+ * Should we ask the loop to exit? Two consecutive Ctrl+C on empty input => exit.
|
|
146
|
+
*/
|
|
147
|
+
- setPrompt(prefix: string): void {
|
|
148
|
+
- this.rl.setPrompt(prefix);
|
|
149
|
+
+ shouldExitOnCancel(): boolean {
|
|
150
|
+
+ return this.consecutiveCancels >= 2;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
- * Close the interface
|
|
155
|
+
+ * Reset consecutive-cancel counter when the loop has decided to keep running.
|
|
156
|
+
*/
|
|
157
|
+
- close(): void {
|
|
158
|
+
- this.rl.close();
|
|
159
|
+
+ resetCancelCounter(): void {
|
|
160
|
+
+ this.consecutiveCancels = 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
- * Pause input
|
|
165
|
+
+ * Decide what to prefill. Two modes:
|
|
166
|
+
+ * - 'history': when user is navigating up/down with arrows
|
|
167
|
+
+ * - 'draft': when user has cleared the input — preserve their draft
|
|
168
|
+
*/
|
|
169
|
+
- pause(): void {
|
|
170
|
+
- this.rl.pause();
|
|
171
|
+
+ private computePrefill(): { kind: 'history' | 'draft' | 'none'; value: string } {
|
|
172
|
+
+ if (this.historyIndex >= 0 && this.historyIndex < this.history.length) {
|
|
173
|
+
+ return { kind: 'history', value: this.history[this.historyIndex] };
|
|
174
|
+
+ }
|
|
175
|
+
+ if (this.currentDraft) return { kind: 'draft', value: this.currentDraft };
|
|
176
|
+
+ return { kind: 'none', value: '' };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
- * Resume input
|
|
181
|
+
+ * Save the user's in-progress draft so ↑↓ preserves their unsent typing.
|
|
182
|
+
*/
|
|
183
|
+
- resume(): void {
|
|
184
|
+
- this.rl.resume();
|
|
185
|
+
+ saveDraft(text: string): void {
|
|
186
|
+
+ this.currentDraft = text;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
- * Get previous command from history (for key handler)
|
|
191
|
+
+ * Navigate up in history (called from a global key listener, if needed).
|
|
192
|
+
*/
|
|
193
|
+
- getPreviousHistory(): string | null {
|
|
194
|
+
- if (this.history.length === 0) return null;
|
|
195
|
+
-
|
|
196
|
+
- if (this.historyIndex > 0) {
|
|
197
|
+
- this.historyIndex--;
|
|
198
|
+
- }
|
|
199
|
+
- return this.history[this.historyIndex] || null;
|
|
200
|
+
+ historyUp(): string {
|
|
201
|
+
+ if (this.history.length === 0) return this.currentDraft;
|
|
202
|
+
+ if (this.historyIndex < 0) this.historyIndex = this.history.length;
|
|
203
|
+
+ if (this.historyIndex > 0) this.historyIndex--;
|
|
204
|
+
+ return this.history[this.historyIndex] ?? '';
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
- * Get next command from history (for key handler)
|
|
209
|
+
+ * Navigate down in history.
|
|
210
|
+
*/
|
|
211
|
+
- getNextHistory(): string | null {
|
|
212
|
+
- if (this.historyIndex < this.history.length - 1) {
|
|
213
|
+
- this.historyIndex++;
|
|
214
|
+
- return this.history[this.historyIndex];
|
|
215
|
+
+ historyDown(): string {
|
|
216
|
+
+ if (this.history.length === 0) return this.currentDraft;
|
|
217
|
+
+ if (this.historyIndex >= this.history.length) return this.currentDraft;
|
|
218
|
+
+ this.historyIndex++;
|
|
219
|
+
+ if (this.historyIndex >= this.history.length) {
|
|
220
|
+
+ this.historyIndex = this.history.length;
|
|
221
|
+
+ return this.currentDraft;
|
|
222
|
+
}
|
|
223
|
+
- this.historyIndex = this.history.length;
|
|
224
|
+
- return '';
|
|
225
|
+
+ return this.history[this.historyIndex] ?? '';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
- /**
|
|
229
|
+
- * Reset history navigation
|
|
230
|
+
- */
|
|
231
|
+
- resetHistoryNavigation(): void {
|
|
232
|
+
- this.historyIndex = this.history.length;
|
|
233
|
+
+ getHistory(): readonly string[] {
|
|
234
|
+
+ return this.history;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
- /**
|
|
238
|
+
- * Simple completer for commands
|
|
239
|
+
- */
|
|
240
|
+
- private completer(line: string): [string[], string] {
|
|
241
|
+
- const commands = [
|
|
242
|
+
- 'exit', 'quit', 'clear', 'context',
|
|
243
|
+
- 'help', 'tools', 'models', 'providers',
|
|
244
|
+
- 'history', 'git', 'file', 'shell'
|
|
245
|
+
- ];
|
|
246
|
+
-
|
|
247
|
+
- const hits = commands.filter(c => c.startsWith(line.toLowerCase()));
|
|
248
|
+
- return [hits.length ? hits : [], line];
|
|
249
|
+
- }
|
|
250
|
+
-
|
|
251
|
+
- /**
|
|
252
|
+
- * Handle multiline input detection
|
|
253
|
+
- */
|
|
254
|
+
- isMultilineComplete(input: string): boolean {
|
|
255
|
+
- // Check for explicit multiline trigger
|
|
256
|
+
- if (input.endsWith('\\')) {
|
|
257
|
+
- return false;
|
|
258
|
+
- }
|
|
259
|
+
-
|
|
260
|
+
- // Check bracket balance
|
|
261
|
+
- const openBrackets = (input.match(/\{/g) || []).length;
|
|
262
|
+
- const closeBrackets = (input.match(/\}/g) || []).length;
|
|
263
|
+
- const openParens = (input.match(/\(/g) || []).length;
|
|
264
|
+
- const closeParens = (input.match(/\)/g) || []).length;
|
|
265
|
+
- const openBrackets2 = (input.match(/\[/g) || []).length;
|
|
266
|
+
- const closeBrackets2 = (input.match(/\]/g) || []).length;
|
|
267
|
+
-
|
|
268
|
+
- // Balanced if all counts match
|
|
269
|
+
- return openBrackets === closeBrackets &&
|
|
270
|
+
- openParens === closeParens &&
|
|
271
|
+
- openBrackets2 === closeBrackets2;
|
|
272
|
+
+ clearHistory(): void {
|
|
273
|
+
+ this.history = [];
|
|
274
|
+
+ this.historyIndex = -1;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
--
|
|
278
|
+
2.45.2.windows.1
|
|
279
|
+
|