micro-models-agent 0.54.1 → 0.55.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/README.md +358 -358
- package/dist/certification/certifications.json +493 -493
- package/dist/main.js +489 -82
- package/dist/modules/browser/bridge-server.mjs +202 -202
- package/dist/skills/builtin/git.md +36 -36
- package/dist/skills/builtin/typescript.md +35 -35
- package/package.json +1 -1
- package/dist/cli/commands.js +0 -447
- package/dist/cli/completer.js +0 -167
- package/dist/cli/index.js +0 -2
- package/dist/cli/main.js +0 -153
- package/dist/cli/plugin-commands.js +0 -36
- package/dist/cli/repl-commands.js +0 -761
- package/dist/cli/repl.js +0 -702
- package/dist/cli/run-result.js +0 -33
- package/dist/cli/security-commands.js +0 -164
- package/dist/cli/setup.js +0 -237
- package/dist/config/config.js +0 -276
- package/dist/config/defaults.js +0 -141
- package/dist/config/domains.js +0 -179
- package/dist/config/experts.js +0 -15
- package/dist/config/index.js +0 -4
- package/dist/config/security.js +0 -213
- package/dist/config/types.js +0 -1
- package/dist/core/agent-moe.js +0 -102
- package/dist/core/agent.js +0 -1018
- package/dist/core/bootstrap.js +0 -481
- package/dist/core/crash-handler.js +0 -51
- package/dist/core/environment.js +0 -199
- package/dist/core/index.js +0 -2
- package/dist/core/prompt-builder.js +0 -76
- package/dist/core/session-logger.js +0 -251
- package/dist/core/types.js +0 -1
- package/dist/core/version.js +0 -26
- package/dist/core/workspace.js +0 -76
- package/dist/i18n/en.json +0 -679
- package/dist/i18n/index.js +0 -46
- package/dist/i18n/ru.json +0 -679
- package/dist/index.js +0 -22
- package/dist/llm/image-utils.js +0 -143
- package/dist/llm/index.js +0 -4
- package/dist/llm/model-loader.js +0 -78
- package/dist/llm/openai-compat.js +0 -497
- package/dist/llm/orchestrator.js +0 -200
- package/dist/llm/provider.js +0 -10
- package/dist/llm/response.js +0 -39
- package/dist/llm/token-counter.js +0 -39
- package/dist/llm/types.js +0 -1
- package/dist/logger/app-logger.js +0 -189
- package/dist/logger/file-log.js +0 -151
- package/dist/logger/index.js +0 -1
- package/dist/migration/backup.js +0 -45
- package/dist/migration/detect.js +0 -50
- package/dist/migration/index.js +0 -2
- package/dist/modules/artifacts/store.js +0 -61
- package/dist/modules/browser/actions.js +0 -76
- package/dist/modules/browser/bridge-client.js +0 -199
- package/dist/modules/browser/bridge-path.js +0 -10
- package/dist/modules/browser/cookie-store.js +0 -24
- package/dist/modules/browser/driver.js +0 -136
- package/dist/modules/browser/index.js +0 -7
- package/dist/modules/browser/module.js +0 -29
- package/dist/modules/browser/session.js +0 -342
- package/dist/modules/browser/snapshot.js +0 -148
- package/dist/modules/browser/types.js +0 -12
- package/dist/modules/certification/cli.js +0 -213
- package/dist/modules/certification/fact-checker.js +0 -82
- package/dist/modules/certification/loader.js +0 -106
- package/dist/modules/certification/manifest.js +0 -58
- package/dist/modules/certification/runner.js +0 -245
- package/dist/modules/certification/scenarios.js +0 -407
- package/dist/modules/certification/types.js +0 -1
- package/dist/modules/context/chunk-query.js +0 -100
- package/dist/modules/context/fact-extractor.js +0 -168
- package/dist/modules/context/history.js +0 -15
- package/dist/modules/context/index.js +0 -1
- package/dist/modules/context/manager.js +0 -440
- package/dist/modules/execution/audit-runners.js +0 -206
- package/dist/modules/execution/auditor.js +0 -218
- package/dist/modules/execution/execution-plugin.js +0 -431
- package/dist/modules/execution/index.js +0 -8
- package/dist/modules/execution/module.js +0 -625
- package/dist/modules/execution/moe-executor.js +0 -304
- package/dist/modules/execution/plan-coverage.js +0 -68
- package/dist/modules/execution/plan-persister.js +0 -46
- package/dist/modules/execution/plan-store.js +0 -196
- package/dist/modules/execution/plan-tool.js +0 -677
- package/dist/modules/execution/plan-validator.js +0 -153
- package/dist/modules/execution/planner.js +0 -94
- package/dist/modules/execution/stuck-detector.js +0 -746
- package/dist/modules/execution/tracker.js +0 -69
- package/dist/modules/execution/types.js +0 -1
- package/dist/modules/execution/verifier.js +0 -235
- package/dist/modules/execution/windows-commands.js +0 -41
- package/dist/modules/hallucination/confidence.js +0 -66
- package/dist/modules/hallucination/consistency.js +0 -26
- package/dist/modules/hallucination/detector.js +0 -47
- package/dist/modules/hallucination/factual.js +0 -169
- package/dist/modules/hallucination/index.js +0 -5
- package/dist/modules/hallucination/js-identifiers.js +0 -262
- package/dist/modules/hallucination/llm-judge.js +0 -101
- package/dist/modules/index.js +0 -5
- package/dist/modules/indexer/cache.js +0 -40
- package/dist/modules/indexer/index.js +0 -3
- package/dist/modules/indexer/module.js +0 -246
- package/dist/modules/indexer/project-profile.js +0 -183
- package/dist/modules/indexer/walker.js +0 -101
- package/dist/modules/lsp/check-tool.js +0 -58
- package/dist/modules/lsp/client.js +0 -389
- package/dist/modules/lsp/command.js +0 -60
- package/dist/modules/lsp/config.js +0 -135
- package/dist/modules/lsp/index.js +0 -3
- package/dist/modules/lsp/module.js +0 -260
- package/dist/modules/lsp/probe.js +0 -86
- package/dist/modules/lsp/project-root.js +0 -32
- package/dist/modules/lsp/startup-check.js +0 -144
- package/dist/modules/lsp/types.js +0 -1
- package/dist/modules/mcp/client.js +0 -399
- package/dist/modules/mcp/index.js +0 -3
- package/dist/modules/mcp/module.js +0 -142
- package/dist/modules/mcp/registry.js +0 -15
- package/dist/modules/memory/index.js +0 -1
- package/dist/modules/memory/module.js +0 -96
- package/dist/modules/memory/search.js +0 -42
- package/dist/modules/memory/store.js +0 -69
- package/dist/modules/pipelines/engine.js +0 -60
- package/dist/modules/pipelines/index.js +0 -3
- package/dist/modules/pipelines/parser.js +0 -56
- package/dist/modules/pipelines/template.js +0 -14
- package/dist/modules/plugins/builtin/lint-on-write.js +0 -334
- package/dist/modules/plugins/builtin/notify.js +0 -9
- package/dist/modules/plugins/index.js +0 -1
- package/dist/modules/plugins/loader.js +0 -70
- package/dist/modules/plugins/manager.js +0 -261
- package/dist/modules/plugins/types.js +0 -1
- package/dist/modules/pricing/index.js +0 -61
- package/dist/modules/pricing/prices.js +0 -129
- package/dist/modules/processes/detect.js +0 -34
- package/dist/modules/processes/index.js +0 -2
- package/dist/modules/processes/registry.js +0 -327
- package/dist/modules/processes/runner.js +0 -23
- package/dist/modules/providers/create.js +0 -22
- package/dist/modules/providers/fallback.js +0 -79
- package/dist/modules/providers/health.js +0 -46
- package/dist/modules/providers/index.js +0 -5
- package/dist/modules/providers/manager.js +0 -161
- package/dist/modules/providers/presets.js +0 -128
- package/dist/modules/providers/registry.js +0 -22
- package/dist/modules/providers/types.js +0 -1
- package/dist/modules/registry.js +0 -48
- package/dist/modules/security/audit-log.js +0 -136
- package/dist/modules/security/audit-notifier.js +0 -292
- package/dist/modules/security/command-validator.js +0 -219
- package/dist/modules/security/content-scanner.js +0 -53
- package/dist/modules/security/data-sanitizer.js +0 -89
- package/dist/modules/security/encryption.js +0 -242
- package/dist/modules/security/index.js +0 -14
- package/dist/modules/security/network-validator.js +0 -88
- package/dist/modules/security/path-validator.js +0 -203
- package/dist/modules/security/rate-limiter.js +0 -119
- package/dist/modules/security/security-policies.js +0 -531
- package/dist/modules/security/session-encryption.js +0 -210
- package/dist/modules/security/session-isolation.js +0 -95
- package/dist/modules/session/index.js +0 -3
- package/dist/modules/session/manager.js +0 -172
- package/dist/modules/session/module.js +0 -24
- package/dist/modules/session/store.js +0 -222
- package/dist/modules/session/types.js +0 -1
- package/dist/modules/skills/index.js +0 -2
- package/dist/modules/skills/loader.js +0 -72
- package/dist/modules/skills/matcher.js +0 -27
- package/dist/modules/skills/module.js +0 -129
- package/dist/modules/types.js +0 -1
- package/dist/modules/updater/checker.js +0 -96
- package/dist/modules/updater/index.js +0 -2
- package/dist/modules/updater/module.js +0 -116
- package/dist/modules/user-profile/compressor.js +0 -16
- package/dist/modules/user-profile/index.js +0 -1
- package/dist/modules/user-profile/profile.js +0 -68
- package/dist/tools/approve.js +0 -33
- package/dist/tools/attach-image.js +0 -101
- package/dist/tools/bash.js +0 -519
- package/dist/tools/browser.js +0 -115
- package/dist/tools/chunk-query.js +0 -100
- package/dist/tools/create-dir.js +0 -56
- package/dist/tools/delete-file.js +0 -63
- package/dist/tools/download-file.js +0 -117
- package/dist/tools/edit-file.js +0 -80
- package/dist/tools/enable-tools.js +0 -59
- package/dist/tools/executor.js +0 -154
- package/dist/tools/file-info.js +0 -47
- package/dist/tools/filter-tools.js +0 -17
- package/dist/tools/glob-tool.js +0 -27
- package/dist/tools/grep-tool.js +0 -125
- package/dist/tools/hidden-tools-block.js +0 -37
- package/dist/tools/index.js +0 -78
- package/dist/tools/list-dir.js +0 -49
- package/dist/tools/load-skill.js +0 -43
- package/dist/tools/mcp-call.js +0 -69
- package/dist/tools/move-file.js +0 -86
- package/dist/tools/path-utils.js +0 -101
- package/dist/tools/pipeline-run.js +0 -145
- package/dist/tools/preview.js +0 -2
- package/dist/tools/process-kill.js +0 -40
- package/dist/tools/process-list.js +0 -37
- package/dist/tools/process-log.js +0 -54
- package/dist/tools/question.js +0 -141
- package/dist/tools/read-file.js +0 -179
- package/dist/tools/recall.js +0 -118
- package/dist/tools/registry.js +0 -47
- package/dist/tools/remember.js +0 -68
- package/dist/tools/scope-check.js +0 -32
- package/dist/tools/search-history.js +0 -85
- package/dist/tools/subagent.js +0 -196
- package/dist/tools/types.js +0 -1
- package/dist/tools/user-input.js +0 -123
- package/dist/tools/web-browse.js +0 -87
- package/dist/tools/web-fetch.js +0 -119
- package/dist/tools/web-search.js +0 -105
- package/dist/tools/write-file.js +0 -82
- package/dist/ui/box.js +0 -77
- package/dist/ui/colors.js +0 -4
- package/dist/ui/diff.js +0 -178
- package/dist/ui/index.js +0 -6
- package/dist/ui/line-editor.js +0 -822
- package/dist/ui/line-math.js +0 -73
- package/dist/ui/md-formatter.js +0 -212
- package/dist/ui/output.js +0 -13
- package/dist/ui/plan-view.js +0 -103
- package/dist/ui/renderer.js +0 -259
- package/dist/ui/spinner.js +0 -70
- package/dist/ui/table.js +0 -144
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
import { getMessageText } from "../../llm/provider";
|
|
2
|
-
import { FactExtractor } from "./fact-extractor";
|
|
3
|
-
const COMPACTION_INTERVAL = 15;
|
|
4
|
-
const KEEP_LAST_N = 6;
|
|
5
|
-
function summarizeArgs(args) {
|
|
6
|
-
if (!args)
|
|
7
|
-
return "";
|
|
8
|
-
if (typeof args === "string")
|
|
9
|
-
return args.slice(0, 80);
|
|
10
|
-
try {
|
|
11
|
-
const keys = Object.keys(args);
|
|
12
|
-
return keys.slice(0, 3).join(", ");
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return String(args).slice(0, 80);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function truncate(s, max) {
|
|
19
|
-
if (s.length <= max)
|
|
20
|
-
return s;
|
|
21
|
-
return s.slice(0, max - 3) + "...";
|
|
22
|
-
}
|
|
23
|
-
function looksLikeErrorPaste(text) {
|
|
24
|
-
// Error markers.
|
|
25
|
-
if (/(?:^|\s)ERROR|Error:|error TS\d+|Transform failed|\[plugin:|SyntaxError|Cannot find|Uncaught|exception/i.test(text)) {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
// Structural signals of pasted compiler/runtime output: source frames
|
|
29
|
-
// ("270| }_s(...)"), path:line:col references, and stack-trace lines.
|
|
30
|
-
if (/(?:^|\n)\s*\d+\s*\|/.test(text))
|
|
31
|
-
return true;
|
|
32
|
-
if (/[\w./\\-]+\.[a-z]{1,6}:\d+:\d+/.test(text))
|
|
33
|
-
return true;
|
|
34
|
-
if (/(?:^|\n)\s*at\s+\S+/.test(text))
|
|
35
|
-
return true;
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
export function extractTriedAndFailed(messages) {
|
|
39
|
-
const failures = new Map();
|
|
40
|
-
for (const msg of messages) {
|
|
41
|
-
if (msg.role === "tool" && msg.name && msg.success === false) {
|
|
42
|
-
const key = `${msg.name}:${summarizeArgs(msg.arguments)}`;
|
|
43
|
-
const existing = failures.get(key);
|
|
44
|
-
const errorText = truncate(typeof msg.content === "string" ? msg.content : getMessageText(msg.content), 100);
|
|
45
|
-
if (existing) {
|
|
46
|
-
existing.count++;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
failures.set(key, {
|
|
50
|
-
tool: msg.name,
|
|
51
|
-
args: summarizeArgs(msg.arguments),
|
|
52
|
-
error: errorText,
|
|
53
|
-
count: 1,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return Array.from(failures.values()).filter((f) => f.count >= 2);
|
|
59
|
-
}
|
|
60
|
-
export class ContextManager {
|
|
61
|
-
contextWindow;
|
|
62
|
-
messages = [];
|
|
63
|
-
compactedBlock = null;
|
|
64
|
-
iterationsSinceCompaction = 0;
|
|
65
|
-
compactionCount = 0;
|
|
66
|
-
peakTokens = 0;
|
|
67
|
-
budget;
|
|
68
|
-
compactionThreshold;
|
|
69
|
-
facts = new FactExtractor();
|
|
70
|
-
/** Latest real user instruction (skips <system-summary> blocks). */
|
|
71
|
-
lastUserTask = "";
|
|
72
|
-
/** First real user instruction of the session — survives resetUserTurn(). */
|
|
73
|
-
sessionMission = "";
|
|
74
|
-
/** Latest user message that looks like a pasted error/log (never a task). */
|
|
75
|
-
lastUserFeedback = "";
|
|
76
|
-
tokenCounter;
|
|
77
|
-
pendingImageParts = [];
|
|
78
|
-
toolTokens = 0;
|
|
79
|
-
onCompact = null;
|
|
80
|
-
/**
|
|
81
|
-
* Optional short line appended to the compaction summary so the model knows
|
|
82
|
-
* an active plan exists with progress. Wired from bootstrap to the execution
|
|
83
|
-
* module — without it, a 9B model re-creates a plan from scratch right after
|
|
84
|
-
* compaction (observed: ses_msvuao0h — plan_e07pb2 (1/6) was discarded for a
|
|
85
|
-
* fresh plan_xzq9xe the same iteration the old plan was still visible).
|
|
86
|
-
*/
|
|
87
|
-
planSummaryProvider = null;
|
|
88
|
-
constructor(contextWindow, contextBudget, tokenCounter) {
|
|
89
|
-
this.contextWindow = contextWindow;
|
|
90
|
-
this.compactionThreshold = contextBudget?.compactionThreshold ?? 0.75;
|
|
91
|
-
this.budget = this.calculateBudget(contextWindow, contextBudget);
|
|
92
|
-
this.tokenCounter = tokenCounter ?? null;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Provide a short "current plan" line for the compaction summary, or null
|
|
96
|
-
* when no plan is active. Injected once at bootstrap (not per-turn state).
|
|
97
|
-
*/
|
|
98
|
-
setPlanSummaryProvider(fn) {
|
|
99
|
-
this.planSummaryProvider = fn;
|
|
100
|
-
}
|
|
101
|
-
calculateBudget(window, contextBudget) {
|
|
102
|
-
if (contextBudget) {
|
|
103
|
-
const systemPrompt = Math.floor(window * contextBudget.systemPrompt);
|
|
104
|
-
const responseReserve = Math.floor(window * contextBudget.responseReserve);
|
|
105
|
-
const history = Math.max(0, window - systemPrompt - responseReserve);
|
|
106
|
-
return { systemPrompt, responseReserve, history };
|
|
107
|
-
}
|
|
108
|
-
// Fallback for backwards compatibility (tests, subagents without explicit budget)
|
|
109
|
-
return {
|
|
110
|
-
systemPrompt: Math.floor(window * 0.25),
|
|
111
|
-
responseReserve: Math.floor(window * 0.12),
|
|
112
|
-
history: Math.floor(window * 0.63),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
getBudget() {
|
|
116
|
-
return { ...this.budget };
|
|
117
|
-
}
|
|
118
|
-
getCompactionCount() {
|
|
119
|
-
return this.compactionCount;
|
|
120
|
-
}
|
|
121
|
-
getIterationsSinceCompaction() {
|
|
122
|
-
return this.iterationsSinceCompaction;
|
|
123
|
-
}
|
|
124
|
-
/** Files known from compaction summaries — for seeding the hallucination
|
|
125
|
-
* checker's known-files set so bare filenames survive context resets. */
|
|
126
|
-
getKnownFiles() {
|
|
127
|
-
return this.facts.getKnownFiles();
|
|
128
|
-
}
|
|
129
|
-
noteIteration() {
|
|
130
|
-
this.iterationsSinceCompaction++;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Start a fresh user turn. The 15-iteration compaction interval must not
|
|
134
|
-
* leak across user messages — otherwise a turn that ends at iteration 14
|
|
135
|
-
* forces a compaction on the very first iteration of the next user message
|
|
136
|
-
* (observed: compaction fired on iteration 8 of a new turn, deleting the
|
|
137
|
-
* user's freshly-sent task alongside 40+ old turns). Facts are kept.
|
|
138
|
-
*/
|
|
139
|
-
resetUserTurn() {
|
|
140
|
-
this.iterationsSinceCompaction = 0;
|
|
141
|
-
// A new user message begins a new turn — drop the previous turn's task
|
|
142
|
-
// so the fresh instruction becomes the one preserved at compaction. The
|
|
143
|
-
// session mission survives: an error/log paste in the new turn must not
|
|
144
|
-
// erase the original goal.
|
|
145
|
-
this.lastUserTask = "";
|
|
146
|
-
this.lastUserFeedback = "";
|
|
147
|
-
}
|
|
148
|
-
getQuality() {
|
|
149
|
-
const usedTokens = this.getEstimatedTokens();
|
|
150
|
-
const tokenLoad = Math.max(0, 1 - usedTokens / this.budget.history);
|
|
151
|
-
// Recoverable penalty: each compaction loses some information, but the
|
|
152
|
-
// penalty is CAPPED so cumulative compactions can never permanently pin
|
|
153
|
-
// quality below the forced-compaction trigger (40%). Before this cap, a
|
|
154
|
-
// session with ~7+ compactions clamped the term to 0 forever; combined
|
|
155
|
-
// with heavy token load + error density, quality stuck below 40 and a
|
|
156
|
-
// compaction fired on EVERY iteration (observed: 56 compactions in 28 min).
|
|
157
|
-
const COMPACTION_PENALTY_FLOOR = 0.5;
|
|
158
|
-
const compactionLoss = Math.max(COMPACTION_PENALTY_FLOOR, 1 - this.compactionCount * 0.15);
|
|
159
|
-
const msgCount = this.messages.length || 1;
|
|
160
|
-
const errorDensity = Math.max(0, 1 - Math.min(1, this.facts.errorCount / msgCount));
|
|
161
|
-
const freshness = Math.max(0, 1 - this.iterationsSinceCompaction / COMPACTION_INTERVAL);
|
|
162
|
-
const score = tokenLoad * 0.4 + compactionLoss * 0.25 + errorDensity * 0.2 + freshness * 0.15;
|
|
163
|
-
return Math.round(Math.min(100, Math.max(0, score * 100)));
|
|
164
|
-
}
|
|
165
|
-
addMessage(msg) {
|
|
166
|
-
// Track the task the agent is working on so it survives compaction. The
|
|
167
|
-
// user's real instruction is the FIRST non-system-summary user message of
|
|
168
|
-
// the turn; everything after it (tool results, retry nudges) are injected
|
|
169
|
-
// `user` envelopes that must not overwrite it (observed: after compaction
|
|
170
|
-
// the model had forgotten "удали /bicycles, почини стили" and re-read
|
|
171
|
-
// files aimlessly for 40+ iterations).
|
|
172
|
-
if (msg.role === "user") {
|
|
173
|
-
const text = typeof msg.content === "string" ? msg.content : getMessageText(msg.content);
|
|
174
|
-
if (text.trim() && !text.startsWith("<system-summary>") && !text.includes("[Compressed:")) {
|
|
175
|
-
if (looksLikeErrorPaste(text) && (this.lastUserTask || this.sessionMission)) {
|
|
176
|
-
this.lastUserFeedback = text.trim().slice(0, 400);
|
|
177
|
-
}
|
|
178
|
-
else if (!this.lastUserTask && !this.lastUserFeedback) {
|
|
179
|
-
// No new task inside a turn that already captured an error/log paste:
|
|
180
|
-
// the paste's follow-up messages are tool-result continuations, not a
|
|
181
|
-
// fresh instruction, so the session mission must win at compaction.
|
|
182
|
-
this.lastUserTask = text.trim();
|
|
183
|
-
if (!this.sessionMission)
|
|
184
|
-
this.sessionMission = text.trim();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
// Auto-attach pending images to the next user message
|
|
189
|
-
if (msg.role === "user" && this.pendingImageParts.length > 0) {
|
|
190
|
-
const textPart = {
|
|
191
|
-
type: "text",
|
|
192
|
-
text: typeof msg.content === "string" ? msg.content : getMessageText(msg.content),
|
|
193
|
-
};
|
|
194
|
-
msg = {
|
|
195
|
-
...msg,
|
|
196
|
-
content: [textPart, ...this.pendingImageParts],
|
|
197
|
-
};
|
|
198
|
-
this.pendingImageParts = [];
|
|
199
|
-
}
|
|
200
|
-
this.messages.push(msg);
|
|
201
|
-
const tokens = this.getEstimatedTokens();
|
|
202
|
-
if (tokens > this.peakTokens)
|
|
203
|
-
this.peakTokens = tokens;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Queue an image part to be attached to the next user message.
|
|
207
|
-
*/
|
|
208
|
-
addPendingImage(part) {
|
|
209
|
-
this.pendingImageParts.push(part);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Check if there are pending images waiting to be attached.
|
|
213
|
-
*/
|
|
214
|
-
hasPendingImages() {
|
|
215
|
-
return this.pendingImageParts.length > 0;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Get pending image parts without clearing them.
|
|
219
|
-
*/
|
|
220
|
-
getPendingImages() {
|
|
221
|
-
return [...this.pendingImageParts];
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Clear pending images (e.g., if user sends a text-only message).
|
|
225
|
-
*/
|
|
226
|
-
clearPendingImages() {
|
|
227
|
-
this.pendingImageParts = [];
|
|
228
|
-
}
|
|
229
|
-
getMessageCount() {
|
|
230
|
-
return this.messages.length;
|
|
231
|
-
}
|
|
232
|
-
// Per-message token cache: messages are treated as immutable once added
|
|
233
|
-
// (compaction/updateSystemPrompt create new objects), so a WeakMap is safe
|
|
234
|
-
// and turns repeated full-history estimation from O(n) encodes into O(1).
|
|
235
|
-
tokenCache = new WeakMap();
|
|
236
|
-
estimateMessageTokensCached(m) {
|
|
237
|
-
let t = this.tokenCache.get(m);
|
|
238
|
-
if (t === undefined) {
|
|
239
|
-
t = this.estimateMessageTokens(m);
|
|
240
|
-
this.tokenCache.set(m, t);
|
|
241
|
-
}
|
|
242
|
-
return t;
|
|
243
|
-
}
|
|
244
|
-
estimateMessageTokens(m) {
|
|
245
|
-
const text = getMessageText(m.content);
|
|
246
|
-
if (this.tokenCounter) {
|
|
247
|
-
let t = this.tokenCounter.count(text);
|
|
248
|
-
// Image tokens: base64 ~130 tokens per 512x512 tile; rough estimate
|
|
249
|
-
if (Array.isArray(m.content)) {
|
|
250
|
-
for (const part of m.content) {
|
|
251
|
-
if (part.type === "image_url" && part.image_url?.url) {
|
|
252
|
-
const b64Len = part.image_url.url.includes(",")
|
|
253
|
-
? (part.image_url.url.split(",")[1]?.length ?? 0)
|
|
254
|
-
: part.image_url.url.length;
|
|
255
|
-
// ~130 tokens per 512 bytes of base64
|
|
256
|
-
t += Math.ceil(b64Len / 512) * 130;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
if (m.tool_calls) {
|
|
261
|
-
for (const tc of m.tool_calls) {
|
|
262
|
-
t += this.tokenCounter.count(tc.id);
|
|
263
|
-
t += this.tokenCounter.count(tc.function.name);
|
|
264
|
-
t += this.tokenCounter.count(tc.function.arguments);
|
|
265
|
-
t += 4;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
return t;
|
|
269
|
-
}
|
|
270
|
-
let t = Math.ceil(text.length / 2);
|
|
271
|
-
if (Array.isArray(m.content)) {
|
|
272
|
-
for (const part of m.content) {
|
|
273
|
-
if (part.type === "image_url" && part.image_url?.url) {
|
|
274
|
-
const b64Len = part.image_url.url.includes(",")
|
|
275
|
-
? (part.image_url.url.split(",")[1]?.length ?? 0)
|
|
276
|
-
: part.image_url.url.length;
|
|
277
|
-
t += Math.ceil(b64Len / 512) * 130;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (m.tool_calls) {
|
|
282
|
-
for (const tc of m.tool_calls) {
|
|
283
|
-
t += Math.ceil(tc.id.length / 2);
|
|
284
|
-
t += Math.ceil(tc.function.name.length / 2);
|
|
285
|
-
t += Math.ceil(tc.function.arguments.length / 2);
|
|
286
|
-
t += 4;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return t;
|
|
290
|
-
}
|
|
291
|
-
needsCompaction() {
|
|
292
|
-
if (this.iterationsSinceCompaction >= COMPACTION_INTERVAL)
|
|
293
|
-
return true;
|
|
294
|
-
const totalTokens = this.messages.reduce((sum, m) => sum + this.estimateMessageTokensCached(m), 0);
|
|
295
|
-
return totalTokens > this.budget.history * this.compactionThreshold;
|
|
296
|
-
}
|
|
297
|
-
compact() {
|
|
298
|
-
// Capture the pre-compaction state BEFORE any counters reset or rise —
|
|
299
|
-
// qualityBefore must reflect the context the model actually saw.
|
|
300
|
-
const tokensBefore = this.getEstimatedTokens();
|
|
301
|
-
const qualityBefore = this.getQuality();
|
|
302
|
-
const messagesBefore = this.messages.length;
|
|
303
|
-
// Reset the counter even when nothing to compact — otherwise
|
|
304
|
-
// needsCompaction() returns true forever after 15 iterations with few messages.
|
|
305
|
-
this.iterationsSinceCompaction = 0;
|
|
306
|
-
if (this.messages.length <= KEEP_LAST_N * 2)
|
|
307
|
-
return null;
|
|
308
|
-
this.compactionCount++;
|
|
309
|
-
const cutoff = this.messages.length - KEEP_LAST_N * 2;
|
|
310
|
-
const oldTurns = this.messages.slice(0, cutoff);
|
|
311
|
-
const recentTurns = this.messages.slice(cutoff);
|
|
312
|
-
this.facts.extract(oldTurns);
|
|
313
|
-
const parts = [];
|
|
314
|
-
parts.push(`[Compressed: ${oldTurns.length} old turns removed]`);
|
|
315
|
-
// Carry the user's actual instruction forward — the model must never lose
|
|
316
|
-
// the task it is working on just because 40 turns got compacted away. The
|
|
317
|
-
// per-turn task falls back to the session mission (first real instruction)
|
|
318
|
-
// so a pasted error/log in the current turn cannot erase the goal.
|
|
319
|
-
const task = (this.lastUserTask || this.sessionMission).slice(0, 400);
|
|
320
|
-
if (task)
|
|
321
|
-
parts.push(`[Task: ${task}]`);
|
|
322
|
-
if (this.lastUserFeedback && !task.startsWith(this.lastUserFeedback)) {
|
|
323
|
-
parts.push(`[User feedback: ${this.lastUserFeedback}]`);
|
|
324
|
-
}
|
|
325
|
-
// Orient the model after compaction: an active plan must not be re-created
|
|
326
|
-
// from scratch (see planSummaryProvider doc).
|
|
327
|
-
const planLine = this.planSummaryProvider?.();
|
|
328
|
-
if (planLine)
|
|
329
|
-
parts.push(`[Plan: ${planLine}]`);
|
|
330
|
-
const filesLine = this.facts.filesLine();
|
|
331
|
-
if (filesLine)
|
|
332
|
-
parts.push(filesLine);
|
|
333
|
-
const deletedLine = this.facts.deletedLine();
|
|
334
|
-
if (deletedLine)
|
|
335
|
-
parts.push(deletedLine);
|
|
336
|
-
const readLine = this.facts.readLine();
|
|
337
|
-
if (readLine)
|
|
338
|
-
parts.push(readLine);
|
|
339
|
-
const decisionsLine = this.facts.decisionsLine();
|
|
340
|
-
if (decisionsLine)
|
|
341
|
-
parts.push(decisionsLine);
|
|
342
|
-
const errorsLine = this.facts.errorsLine();
|
|
343
|
-
if (errorsLine)
|
|
344
|
-
parts.push(errorsLine);
|
|
345
|
-
const triedAndFailed = extractTriedAndFailed(oldTurns);
|
|
346
|
-
if (triedAndFailed.length > 0) {
|
|
347
|
-
const lines = triedAndFailed.map((t) => `- ${t.tool}(${t.args}): ${t.error} (failed ${t.count}x)`);
|
|
348
|
-
parts.push(`[Already tried & failed — do NOT repeat:]\n${lines.join("\n")}`);
|
|
349
|
-
}
|
|
350
|
-
this.compactedBlock = parts.join(" ");
|
|
351
|
-
const summary = {
|
|
352
|
-
role: "user",
|
|
353
|
-
content: `<system-summary>${this.compactedBlock}</system-summary>`,
|
|
354
|
-
};
|
|
355
|
-
const firstSystem = this.messages.find((m) => m.role === "system");
|
|
356
|
-
// Filter out stale system-summary messages from recent turns to prevent nesting
|
|
357
|
-
const freshRecent = recentTurns.filter((m) => {
|
|
358
|
-
if (m.role !== "user")
|
|
359
|
-
return true;
|
|
360
|
-
const text = getMessageText(m.content);
|
|
361
|
-
return !text.startsWith("<system-summary>");
|
|
362
|
-
});
|
|
363
|
-
this.messages = [...(firstSystem ? [firstSystem] : []), summary, ...freshRecent];
|
|
364
|
-
this.iterationsSinceCompaction = 0;
|
|
365
|
-
if (this.onCompact) {
|
|
366
|
-
this.onCompact(summary);
|
|
367
|
-
}
|
|
368
|
-
return {
|
|
369
|
-
removedTurns: oldTurns.length,
|
|
370
|
-
keptTurns: freshRecent.length,
|
|
371
|
-
tokensBefore,
|
|
372
|
-
tokensAfter: this.getEstimatedTokens(),
|
|
373
|
-
qualityBefore,
|
|
374
|
-
qualityAfter: this.getQuality(),
|
|
375
|
-
messagesBefore,
|
|
376
|
-
messagesAfter: this.messages.length,
|
|
377
|
-
summary: this.compactedBlock ?? "",
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Snapshot of the current context state — used to log the initial context
|
|
382
|
-
* structure at session start and per-iteration context stats.
|
|
383
|
-
*/
|
|
384
|
-
getSnapshot() {
|
|
385
|
-
return {
|
|
386
|
-
window: this.contextWindow,
|
|
387
|
-
budget: { ...this.budget },
|
|
388
|
-
tokens: this.getEstimatedTokens(),
|
|
389
|
-
toolTokens: this.toolTokens,
|
|
390
|
-
messageCount: this.messages.length,
|
|
391
|
-
quality: this.getQuality(),
|
|
392
|
-
compactionCount: this.compactionCount,
|
|
393
|
-
iterationsSinceCompaction: this.iterationsSinceCompaction,
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Replace the system prompt in place (keeps it first) or prepend a new one.
|
|
398
|
-
* Used to refresh dynamic prompt blocks (e.g. the plan checklist) mid-run.
|
|
399
|
-
*/
|
|
400
|
-
updateSystemPrompt(content) {
|
|
401
|
-
const idx = this.messages.findIndex((m) => m.role === "system");
|
|
402
|
-
if (idx >= 0) {
|
|
403
|
-
this.messages[idx] = { ...this.messages[idx], content };
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
this.messages.unshift({ role: "system", content });
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
getActiveHistory() {
|
|
410
|
-
return [...this.messages];
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Reset everything that belongs to the current conversation turn.
|
|
414
|
-
* Fact lists (FactExtractor) intentionally survive clear() — they are
|
|
415
|
-
* session-scoped compaction state, not per-turn.
|
|
416
|
-
*/
|
|
417
|
-
clear() {
|
|
418
|
-
this.messages = [];
|
|
419
|
-
this.compactedBlock = null;
|
|
420
|
-
this.iterationsSinceCompaction = 0;
|
|
421
|
-
this.compactionCount = 0;
|
|
422
|
-
this.peakTokens = 0;
|
|
423
|
-
this.lastUserTask = "";
|
|
424
|
-
this.lastUserFeedback = "";
|
|
425
|
-
this.sessionMission = "";
|
|
426
|
-
}
|
|
427
|
-
getEstimatedTokens() {
|
|
428
|
-
return (this.messages.reduce((sum, m) => sum + this.estimateMessageTokensCached(m), 0) + this.toolTokens);
|
|
429
|
-
}
|
|
430
|
-
setToolTokens(tokens) {
|
|
431
|
-
this.toolTokens = tokens;
|
|
432
|
-
}
|
|
433
|
-
resize(contextWindow, contextBudget, tokenCounter) {
|
|
434
|
-
this.contextWindow = contextWindow;
|
|
435
|
-
this.budget = this.calculateBudget(contextWindow, contextBudget);
|
|
436
|
-
if (tokenCounter !== undefined) {
|
|
437
|
-
this.tokenCounter = tokenCounter ?? null;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
2
|
-
import { dirname, join, resolve } from "path";
|
|
3
|
-
import { detectTestResults } from "../../tools/bash";
|
|
4
|
-
import { processRegistry } from "../processes";
|
|
5
|
-
/** Directories never searched for test files. */
|
|
6
|
-
export const SKIP_DIRS = new Set([
|
|
7
|
-
"node_modules",
|
|
8
|
-
".git",
|
|
9
|
-
".mma",
|
|
10
|
-
"dist",
|
|
11
|
-
"build",
|
|
12
|
-
"coverage",
|
|
13
|
-
".next",
|
|
14
|
-
".nuxt",
|
|
15
|
-
"vendor",
|
|
16
|
-
]);
|
|
17
|
-
const TEST_EXT_RE = /\.(test|spec)\.[jt]sx?$/i;
|
|
18
|
-
const PY_TEST_RE = /^test_.*\.py$|^.*_test\.py$/i;
|
|
19
|
-
const TEST_STEP_RE = /\b(test(ing|s)?|тест(ы|ирование|ировать)?|провер\w*\s+тест|запустить\s+тест)\b|bun test|npm test|vitest|pytest|go test|jest|mocha/i;
|
|
20
|
-
/**
|
|
21
|
-
* Resolve the project's test command from its manifest, so the final audit
|
|
22
|
-
* actually runs the runner the project uses instead of always assuming
|
|
23
|
-
* `bun test` (a Python or Go project, or a vitest/jest setup, would fail or
|
|
24
|
-
* silently produce no summary under bun test).
|
|
25
|
-
*
|
|
26
|
-
* Priority: package.json scripts.test → test-framework config files → Python
|
|
27
|
-
* markers (pyproject/pytest.ini/conftest.py) → go.mod → Cargo.toml → bun.
|
|
28
|
-
*/
|
|
29
|
-
export function resolveTestCommand(dir) {
|
|
30
|
-
const pkgPath = join(dir, "package.json");
|
|
31
|
-
if (existsSync(pkgPath)) {
|
|
32
|
-
try {
|
|
33
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
34
|
-
const script = pkg?.scripts?.test;
|
|
35
|
-
if (typeof script === "string" && script.trim())
|
|
36
|
-
return script.trim();
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
/* invalid package.json — fall through */
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
for (const f of [
|
|
43
|
-
"vitest.config.ts",
|
|
44
|
-
"vitest.config.js",
|
|
45
|
-
"vitest.config.mjs",
|
|
46
|
-
"jest.config.js",
|
|
47
|
-
"jest.config.ts",
|
|
48
|
-
"jest.config.mjs",
|
|
49
|
-
"jest.config.cjs",
|
|
50
|
-
"bunfig.toml",
|
|
51
|
-
]) {
|
|
52
|
-
if (existsSync(join(dir, f))) {
|
|
53
|
-
if (f.startsWith("vitest"))
|
|
54
|
-
return "bunx vitest run";
|
|
55
|
-
if (f.startsWith("jest"))
|
|
56
|
-
return "npx --no-install jest";
|
|
57
|
-
if (f === "bunfig.toml")
|
|
58
|
-
return "bun test";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (existsSync(join(dir, "pyproject.toml")) ||
|
|
62
|
-
existsSync(join(dir, "pytest.ini")) ||
|
|
63
|
-
existsSync(join(dir, "conftest.py"))) {
|
|
64
|
-
return "python -m pytest -q";
|
|
65
|
-
}
|
|
66
|
-
if (existsSync(join(dir, "go.mod")))
|
|
67
|
-
return "go test ./...";
|
|
68
|
-
if (existsSync(join(dir, "Cargo.toml")))
|
|
69
|
-
return "cargo test";
|
|
70
|
-
return "bun test";
|
|
71
|
-
}
|
|
72
|
-
/** Recursive, depth-limited walk that stops early on the first test file. */
|
|
73
|
-
export function findTestFile(dir, depth = 0) {
|
|
74
|
-
if (depth > 5)
|
|
75
|
-
return null;
|
|
76
|
-
let entries;
|
|
77
|
-
try {
|
|
78
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
for (const e of entries) {
|
|
84
|
-
const full = join(dir, e.name);
|
|
85
|
-
if (e.isDirectory()) {
|
|
86
|
-
if (SKIP_DIRS.has(e.name))
|
|
87
|
-
continue;
|
|
88
|
-
const found = findTestFile(full, depth + 1);
|
|
89
|
-
if (found)
|
|
90
|
-
return found;
|
|
91
|
-
}
|
|
92
|
-
else if (TEST_EXT_RE.test(e.name) || PY_TEST_RE.test(e.name)) {
|
|
93
|
-
return full;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
/** The plan's step descriptions mention running/checking tests. */
|
|
99
|
-
export function hasTestStep(plan) {
|
|
100
|
-
return plan.steps.some((s) => TEST_STEP_RE.test(s.description));
|
|
101
|
-
}
|
|
102
|
-
/** Extract failing test names from a runner's output (bun/vitest style). */
|
|
103
|
-
function extractFailingNames(output, limit = 5) {
|
|
104
|
-
const names = [];
|
|
105
|
-
for (const m of output.matchAll(/\(fail\)\s*([^\n]+)/g)) {
|
|
106
|
-
const name = m[1].trim();
|
|
107
|
-
if (name && !names.includes(name))
|
|
108
|
-
names.push(name);
|
|
109
|
-
if (names.length >= limit)
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
return names;
|
|
113
|
-
}
|
|
114
|
-
export async function runTests(baseDir) {
|
|
115
|
-
const command = resolveTestCommand(baseDir);
|
|
116
|
-
const entry = processRegistry.start(command, baseDir);
|
|
117
|
-
const exited = await processRegistry.waitForExit(entry.id, 90_000);
|
|
118
|
-
const output = entry.log.join("\n");
|
|
119
|
-
processRegistry.remove(entry.id);
|
|
120
|
-
if (!exited) {
|
|
121
|
-
// Timed out — we cannot claim success or failure from an unfinished run.
|
|
122
|
-
return {
|
|
123
|
-
checked: true,
|
|
124
|
-
passed: true, // don't block completion on an inconclusive run
|
|
125
|
-
failed: 0,
|
|
126
|
-
passedCount: 0,
|
|
127
|
-
detail: `test run timed out after 90s — result unknown`,
|
|
128
|
-
command,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
const run = detectTestResults(output);
|
|
132
|
-
if (!run) {
|
|
133
|
-
// No recognizable runner summary. A non-zero exit means the test run
|
|
134
|
-
// (or its runner) failed — the audit must not pass on it; report a
|
|
135
|
-
// single "at least one failed" since we cannot count them. Exit 0
|
|
136
|
-
// with unrecognized output stays checked-but-inconclusive.
|
|
137
|
-
return {
|
|
138
|
-
checked: true,
|
|
139
|
-
passed: entry.exitCode === 0,
|
|
140
|
-
failed: entry.exitCode === 0 ? 0 : 1,
|
|
141
|
-
passedCount: 0,
|
|
142
|
-
detail: output.slice(0, 200).trim(),
|
|
143
|
-
command,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
const names = extractFailingNames(output);
|
|
147
|
-
return {
|
|
148
|
-
checked: true,
|
|
149
|
-
passed: run.failed === 0,
|
|
150
|
-
failed: run.failed,
|
|
151
|
-
passedCount: run.passed,
|
|
152
|
-
detail: names.length
|
|
153
|
-
? names.join("; ")
|
|
154
|
-
: run.summary || `${run.failed} failed / ${run.passed} passed`,
|
|
155
|
-
command,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
/** First `error TS…` line in a tsc output, or null when none/inconclusive. */
|
|
159
|
-
export function parseTypecheckErrors(output) {
|
|
160
|
-
const line = output.split("\n").find((l) => /error TS\d+/.test(l));
|
|
161
|
-
return line ? line.trim().slice(0, 300) : null;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Locate the nearest project root that owns a tsconfig.json.
|
|
165
|
-
*
|
|
166
|
-
* The agent frequently creates the project in a nested subfolder of its
|
|
167
|
-
* baseDir (e.g. `bicycle-shop/`), so the tsconfig lives at
|
|
168
|
-
* `baseDir/bicycle-shop/` and the old `existsSync(baseDir/tsconfig.json)`
|
|
169
|
-
* gate silently skipped the final typecheck — the audit passed even with
|
|
170
|
-
* dozens of tsc errors (observed in both analyzed sessions). This walks each
|
|
171
|
-
* candidate (baseDir plus the resolved step files) upward to the nearest
|
|
172
|
-
* tsconfig.json, preferring the shallowest hit so the baseDir project wins
|
|
173
|
-
* over a stray tsconfig further up. Returns null when no tsconfig exists in
|
|
174
|
-
* any reachable subtree. `existingFiles` must contain resolved absolute paths
|
|
175
|
-
* (relative tokens would resolve against the process cwd, not baseDir).
|
|
176
|
-
*/
|
|
177
|
-
export function findTypecheckRoot(baseDir, existingFiles = []) {
|
|
178
|
-
const candidates = [baseDir, ...existingFiles];
|
|
179
|
-
let best = null;
|
|
180
|
-
for (const start of candidates) {
|
|
181
|
-
let dir = resolve(start);
|
|
182
|
-
for (let depth = 0; depth <= 10; depth++) {
|
|
183
|
-
if (existsSync(join(dir, "tsconfig.json"))) {
|
|
184
|
-
if (!best || depth < best.depth)
|
|
185
|
-
best = { depth, root: dir };
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
const parent = dirname(dir);
|
|
189
|
-
if (parent === dir)
|
|
190
|
-
break;
|
|
191
|
-
dir = parent;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return best?.root ?? null;
|
|
195
|
-
}
|
|
196
|
-
export async function runTypecheck(baseDir) {
|
|
197
|
-
const entry = processRegistry.start("npx --no-install tsc --noEmit --skipLibCheck", baseDir);
|
|
198
|
-
const exited = await processRegistry.waitForExit(entry.id, 90_000);
|
|
199
|
-
const output = entry.log.join("\n");
|
|
200
|
-
processRegistry.remove(entry.id);
|
|
201
|
-
// A timeout, or output with no `error TS` lines (missing typescript / wrong
|
|
202
|
-
// working dir) is inconclusive — never block completion on those.
|
|
203
|
-
if (!exited)
|
|
204
|
-
return null;
|
|
205
|
-
return parseTypecheckErrors(output);
|
|
206
|
-
}
|