@thegitai/cli 1.0.0-preview.4 → 1.0.0-preview.41
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 +49 -4
- package/dist/bin/ai.js +119 -111
- package/dist/bin/browser-host.js +265 -0
- package/dist/src/agent-mode.js +11 -6
- package/dist/src/api/auth.js +6 -4
- package/dist/src/api/browser-login.js +152 -37
- package/dist/src/api/chat.js +286 -44
- package/dist/src/api/contracts.js +55 -1
- package/dist/src/api/default-host.js +1 -0
- package/dist/src/api/http.js +127 -7
- package/dist/src/api/models.js +29 -10
- package/dist/src/background-jobs.js +4 -2
- package/dist/src/browser/bridge.js +232 -0
- package/dist/src/browser/framing.js +42 -0
- package/dist/src/browser/native-host.js +209 -0
- package/dist/src/browser/protocol.js +46 -0
- package/dist/src/browser/session-bridge.js +104 -0
- package/dist/src/cli-args.js +19 -5
- package/dist/src/client-environment.js +2 -0
- package/dist/src/core/clipboard.js +7 -13
- package/dist/src/core/image-limits.js +56 -0
- package/dist/src/core/image-path-extractor.js +70 -3
- package/dist/src/core/session-image-store.js +246 -0
- package/dist/src/edit-journal.js +33 -2
- package/dist/src/executor.js +25 -3
- package/dist/src/help-text.js +58 -17
- package/dist/src/patcher.js +43 -4
- package/dist/src/permissions.js +288 -0
- package/dist/src/session-safety.js +0 -12
- package/dist/src/session-store.js +121 -20
- package/dist/src/session.js +19 -4
- package/dist/src/signin.js +58 -0
- package/dist/src/tool-executor.js +12 -46
- package/dist/src/tools/browser.js +628 -0
- package/dist/src/tools/delete-file.js +20 -4
- package/dist/src/tools/index.js +32 -10
- package/dist/src/tools/patch-file.js +12 -26
- package/dist/src/tools/read-image-file.js +85 -0
- package/dist/src/tools/replace-document-text.js +28 -18
- package/dist/src/tools/restore-checkpoint.js +0 -1
- package/dist/src/tools/run-command.js +14 -71
- package/dist/src/tools/run-node-script.js +12 -81
- package/dist/src/tools/save-generated-image.js +120 -0
- package/dist/src/tools/str-replace.js +12 -26
- package/dist/src/tools/undo-edit.js +1 -6
- package/dist/src/tools/write-file.js +67 -11
- package/dist/src/ui/prompt-history-store.js +1 -1
- package/dist/src/ui/repl.js +802 -195
- package/dist/src/ui/tui/bridge.js +10 -0
- package/dist/src/ui/tui/build-frame.js +517 -165
- package/dist/src/ui/tui/composer-layout.js +76 -0
- package/dist/src/ui/tui/markdown-render.js +81 -73
- package/dist/src/ui/tui/shell-input.js +227 -67
- package/dist/src/ui/tui/terminal-theme.js +28 -0
- package/dist/src/ui/tui/terminal-title.js +3 -0
- package/dist/src/ui/tui/terminal-writes.js +48 -0
- package/dist/src/ui/tui/text.js +158 -4
- package/dist/src/ui/tui/user-input.js +568 -0
- package/dist/src/utils.js +9 -0
- package/package.json +20 -8
- package/dist/src/markdown-renderer.js +0 -112
- package/dist/src/project-index.js +0 -221
- package/dist/src/tools/code-intel.js +0 -472
- package/dist/src/tools/find-symbol.js +0 -70
- package/dist/src/tools/hover-symbol.js +0 -95
- package/dist/src/tools/list-symbols.js +0 -55
- package/dist/src/tools/search-code.js +0 -37
- package/dist/src/tools/signature-help.js +0 -118
|
@@ -4,7 +4,6 @@ import { clearEditFailure, collectCommandMutations, captureMutationBaseline, ens
|
|
|
4
4
|
import { buildAgentModeToolBlockedResult, } from './agent-mode.js';
|
|
5
5
|
import { classifyProjectPath } from './patcher.js';
|
|
6
6
|
import { dispatchTool } from './tools/index.js';
|
|
7
|
-
import { syncIndexFromDisk } from './project-index.js';
|
|
8
7
|
import { PATH_REPAIRING_EDIT_TOOLS, repairFilePath } from './tools/path-suggest.js';
|
|
9
8
|
import { invalidateShellDiagnosticsCache, runShellDiagnostics, } from './tools/shell-diagnostics.js';
|
|
10
9
|
import { extractTodosArg } from './todo-list.js';
|
|
@@ -69,7 +68,7 @@ function editToolWritesSeparateOutput(call) {
|
|
|
69
68
|
const output = args.outputPath ?? args.output_path;
|
|
70
69
|
return typeof output === 'string' && output.trim().length > 0;
|
|
71
70
|
}
|
|
72
|
-
async function collectTrackedCommandMutations({ session,
|
|
71
|
+
async function collectTrackedCommandMutations({ session, result, tracker, toolName, toolCallId, turnId, }) {
|
|
73
72
|
const checkpoint = ensureActiveCheckpoint(session.clientState.safety, turnId);
|
|
74
73
|
const records = collectCommandMutations({
|
|
75
74
|
state: session.clientState.safety,
|
|
@@ -84,40 +83,11 @@ async function collectTrackedCommandMutations({ session, projectIndex, result, t
|
|
|
84
83
|
return;
|
|
85
84
|
invalidateShellDiagnosticsCache(session.rootDir);
|
|
86
85
|
rememberCheckpointFiles(session.clientState.safety, session.rootDir, records.map((record) => record.filePath), turnId);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
removed: records.filter((record) => record.operation === 'delete').length,
|
|
93
|
-
indexedChunks: 0,
|
|
94
|
-
retrievalTokensUsed: 0,
|
|
95
|
-
};
|
|
96
|
-
if (priorSync?.error) {
|
|
97
|
-
result.repoSync = {
|
|
98
|
-
...mutationCounts,
|
|
99
|
-
indexSyncError: priorSync.error,
|
|
100
|
-
skipped: true,
|
|
101
|
-
reason: 'local index sync failed after command execution',
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
try {
|
|
106
|
-
const repoSync = await syncIndexFromDisk(projectIndex);
|
|
107
|
-
result.repoSync = {
|
|
108
|
-
...repoSync,
|
|
109
|
-
added: Math.max(repoSync.added, mutationCounts.added),
|
|
110
|
-
modified: Math.max(repoSync.modified, mutationCounts.modified),
|
|
111
|
-
removed: Math.max(repoSync.removed, mutationCounts.removed),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
const indexSyncError = error instanceof Error ? error.message : String(error);
|
|
116
|
-
result.repoSync = { ...mutationCounts, indexSyncError };
|
|
117
|
-
session.onStatus(`Repository changes were recorded, but local index sync failed: ${indexSyncError}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
86
|
+
result.repoSync = {
|
|
87
|
+
added: records.filter((record) => record.operation === 'create').length,
|
|
88
|
+
modified: records.filter((record) => record.operation === 'update').length,
|
|
89
|
+
removed: records.filter((record) => record.operation === 'delete').length,
|
|
90
|
+
};
|
|
121
91
|
result.sessionEdits = records.map((record) => ({
|
|
122
92
|
id: record.id,
|
|
123
93
|
filePath: record.filePath,
|
|
@@ -127,7 +97,7 @@ async function collectTrackedCommandMutations({ session, projectIndex, result, t
|
|
|
127
97
|
}));
|
|
128
98
|
result.diagnostics = runShellDiagnostics(session.rootDir);
|
|
129
99
|
}
|
|
130
|
-
export async function collectBackgroundJobUiKillMutations({ session,
|
|
100
|
+
export async function collectBackgroundJobUiKillMutations({ session, jobId, result, }) {
|
|
131
101
|
const normalizedJobId = String(jobId ?? result.snapshot?.id ?? '').trim();
|
|
132
102
|
if (!normalizedJobId || !result.ok)
|
|
133
103
|
return;
|
|
@@ -137,7 +107,6 @@ export async function collectBackgroundJobUiKillMutations({ session, projectInde
|
|
|
137
107
|
const mutationResult = result;
|
|
138
108
|
await collectTrackedCommandMutations({
|
|
139
109
|
session,
|
|
140
|
-
projectIndex,
|
|
141
110
|
result: mutationResult,
|
|
142
111
|
tracker: tracked.tracker,
|
|
143
112
|
toolName: tracked.toolName,
|
|
@@ -151,7 +120,7 @@ export async function collectBackgroundJobUiKillMutations({ session, projectInde
|
|
|
151
120
|
backgroundCommandTrackers.delete(normalizedJobId);
|
|
152
121
|
}
|
|
153
122
|
}
|
|
154
|
-
export async function collectBackgroundJobUiOutputMutations({ session,
|
|
123
|
+
export async function collectBackgroundJobUiOutputMutations({ session, jobId, }) {
|
|
155
124
|
const normalizedJobId = String(jobId ?? '').trim();
|
|
156
125
|
if (!normalizedJobId)
|
|
157
126
|
return;
|
|
@@ -165,7 +134,6 @@ export async function collectBackgroundJobUiOutputMutations({ session, projectIn
|
|
|
165
134
|
return;
|
|
166
135
|
await collectTrackedCommandMutations({
|
|
167
136
|
session,
|
|
168
|
-
projectIndex,
|
|
169
137
|
result: {},
|
|
170
138
|
tracker: tracked.tracker,
|
|
171
139
|
toolName: tracked.toolName,
|
|
@@ -244,7 +212,7 @@ function recordAssistantEdit(session, call, result, before) {
|
|
|
244
212
|
});
|
|
245
213
|
clearEditFailure(session.clientState.safety, filePath);
|
|
246
214
|
}
|
|
247
|
-
export async function executeLocalToolCall(
|
|
215
|
+
export async function executeLocalToolCall(session, call) {
|
|
248
216
|
session.onStatus(formatToolCallForStatus(call));
|
|
249
217
|
try {
|
|
250
218
|
const agentModeBlocked = buildAgentModeToolBlockedResult(session.agentMode, call);
|
|
@@ -275,10 +243,10 @@ export async function executeLocalToolCall(toolContext, session, call) {
|
|
|
275
243
|
const context = {
|
|
276
244
|
rootDir: session.rootDir,
|
|
277
245
|
sessionId: session.sessionId,
|
|
278
|
-
projectIndex: toolContext.projectIndex,
|
|
279
246
|
autoYes: session.autoYes,
|
|
280
|
-
|
|
281
|
-
|
|
247
|
+
agentMode: session.agentMode,
|
|
248
|
+
grants: session.grants,
|
|
249
|
+
requestPermission: session.requestPermission,
|
|
282
250
|
requestSudoPassword: session.requestSudoPassword,
|
|
283
251
|
onStatus: session.onStatus,
|
|
284
252
|
editJournal: session.clientState.editJournal,
|
|
@@ -299,7 +267,6 @@ export async function executeLocalToolCall(toolContext, session, call) {
|
|
|
299
267
|
if (result && typeof result === 'object' && commandTracker) {
|
|
300
268
|
await collectTrackedCommandMutations({
|
|
301
269
|
session,
|
|
302
|
-
projectIndex: toolContext.projectIndex,
|
|
303
270
|
result,
|
|
304
271
|
tracker: commandTracker,
|
|
305
272
|
toolName: call.name,
|
|
@@ -326,7 +293,6 @@ export async function executeLocalToolCall(toolContext, session, call) {
|
|
|
326
293
|
if (tracked) {
|
|
327
294
|
await collectTrackedCommandMutations({
|
|
328
295
|
session,
|
|
329
|
-
projectIndex: toolContext.projectIndex,
|
|
330
296
|
result,
|
|
331
297
|
tracker: tracked.tracker,
|
|
332
298
|
toolName: tracked.toolName,
|