Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Refactor probe & chat flows #784

Merged
merged 52 commits into from
Sep 26, 2024
Merged
Changes from 2 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
77f828f
[ide] make ast tree generation and set selection work properly
theskcd Sep 18, 2024
21fa941
Merge pull request #777 from codestoryai/features/fix-ast-navigation
theskcd Sep 18, 2024
b810d82
Merge remote-tracking branch 'origin/cs-main' into actually-refactor-…
ghostwriternr Sep 18, 2024
6d1de79
[ide] parse variables properly
theskcd Sep 18, 2024
b5a7895
Merge pull request #778 from codestoryai/features/parse-variables-pro…
theskcd Sep 18, 2024
05ebfe4
[ide] fix q fix arguments
sartoshi-foot-dao Sep 18, 2024
eceb4e1
[ide] remove basename import
theskcd Sep 18, 2024
2b34525
[ide] add o1-preview model
theskcd Sep 18, 2024
c9883d5
Merge pull request #779 from codestoryai/features/add-o1-preview
theskcd Sep 18, 2024
0f74bc0
[ide] fix markdown rendering
theskcd Sep 18, 2024
8f2e08c
Merge pull request #780 from codestoryai/features/fix-markdown-rendering
theskcd Sep 18, 2024
e87b054
[ide] add o1-mini support
theskcd Sep 18, 2024
2fbcffc
Merge pull request #781 from codestoryai/features/add-o1-mini-support
theskcd Sep 18, 2024
db28d2a
[ide] make deep reasoning toggleable
theskcd Sep 18, 2024
e0588cc
Merge pull request #782 from codestoryai/features/make-deep-reasoning…
theskcd Sep 18, 2024
b3b4df8
[ide] toggle deep reasoning true when required
theskcd Sep 20, 2024
5ea5453
Merge pull request #783 from codestoryai/features/use-deep-reasoning-…
theskcd Sep 20, 2024
56d3fde
[ide] start recording context using editor events
theskcd Sep 24, 2024
06cb309
Merge pull request #785 from codestoryai/features/start-recording-con…
theskcd Sep 24, 2024
86d36da
[ide] send context recording to sidecar
theskcd Sep 24, 2024
6ab0bae
Merge pull request #786 from codestoryai/features/send-context-record…
theskcd Sep 24, 2024
b32c1b5
[ide] send recording to sidecar
theskcd Sep 24, 2024
d54ec5e
Merge pull request #787 from codestoryai/features/send-recording-to-s…
theskcd Sep 24, 2024
c7c926d
[ide] track destination after lsp event
theskcd Sep 25, 2024
2ef42fe
Merge pull request #788 from codestoryai/features/track-destination-a…
theskcd Sep 25, 2024
563b245
(mostly working) all extensions installed via vsix
g-danna Sep 25, 2024
da07149
correct dataFolderName variable for copySettings
g-danna Sep 25, 2024
3e0315d
[ide] get word range which got clicked
theskcd Sep 26, 2024
e5a7c3c
Merge pull request #789 from codestoryai/features/get-word-range-whic…
theskcd Sep 26, 2024
efe9737
added missing semicolons
g-danna Sep 25, 2024
6eeec1f
[ide] send editor url on context recording
theskcd Sep 26, 2024
52d4862
Merge pull request #790 from codestoryai/features/send-editor-url-on-…
theskcd Sep 26, 2024
eed8c8a
[ide] do not track 0 length selections
theskcd Sep 26, 2024
3a65809
[ide] do not track 0 length selections even if there are no selections
theskcd Sep 26, 2024
ece2670
Scaffold new aideAgent layer from upstream chat
ghostwriternr Sep 19, 2024
f248447
Move pinned context below file explorer due to height
ghostwriternr Sep 19, 2024
bf59232
Make aide view the default and exclusive member of auxbar
ghostwriternr Sep 19, 2024
c67bc74
Cleanup input actions and default to anysphere theme
ghostwriternr Sep 19, 2024
35bf32d
Fix welcome message icon & name rendering
ghostwriternr Sep 20, 2024
9de39f6
WIP, broken: Bring back cursor-style input suggestions
ghostwriternr Sep 20, 2024
c1ee432
Get selection secondary state filtering working
ghostwriternr Sep 21, 2024
f3d35ee
Show keybindings for chat execute actions
ghostwriternr Sep 21, 2024
2ee54d0
Use subtler highlight for AST navigation
ghostwriternr Sep 24, 2024
9cd9ed2
Remove unnecessary sidebar left border
ghostwriternr Sep 24, 2024
217da5a
Add dummy mode toggle (not a fan)
ghostwriternr Sep 24, 2024
9a16d07
[WIP] Scaffold async chat messages
ghostwriternr Sep 24, 2024
f7816b3
Revert mode-switcher changes
ghostwriternr Sep 26, 2024
67885be
Add new mode picker in aide agent input
ghostwriternr Sep 26, 2024
fffe146
[ide] send line content
theskcd Sep 26, 2024
a8102d3
Merge pull request #791 from codestoryai/features/send-line-content
theskcd Sep 26, 2024
26ad4b7
Merge remote-tracking branch 'origin/cs-main' into actually-refactor-…
ghostwriternr Sep 26, 2024
5a0e570
Pass mode to extension to choose between chat & edits
ghostwriternr Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion extensions/codestory/src/completions/providers/probeProvider.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import { AnswerSplitOnNewLineAccumulatorStreaming, reportAgentEventsToChat, Stre
import postHogClient from '../../posthog/client';
import { applyEdits, applyEditsDirectly, Limiter } from '../../server/applyEdits';
import { handleRequest } from '../../server/requestHandler';
import { EditedCodeStreamingRequest, SidecarApplyEditsRequest } from '../../server/types';
import { EditedCodeStreamingRequest, SidecarApplyEditsRequest, SidecarContextEvent } from '../../server/types';
import { SideCarClient } from '../../sidecar/client';
import { getUniqueId } from '../../utilities/uniqueId';
import { RecentEditsRetriever } from '../../server/editedFiles';
@@ -96,6 +96,19 @@ export class AideProbeProvider implements vscode.Disposable {
);
}

/**
*
* @returns Retuns the optional editor url (which is weird, maybe we should just crash
* if we don't get the editor url as its a necessary component now?)
*/
editorUrl(): string | undefined {
return this._editorUrl;
}

async sendContextRecording(events: SidecarContextEvent[]) {
await this._sideCarClient.sendContextRecording(events, this._editorUrl);
}

async sessionFollowup(sessionAction: vscode.AideProbeSessionAction) {
if (sessionAction.action.type === 'newIteration') {
// @theskcd - This is where we can accept the iteration
2 changes: 1 addition & 1 deletion extensions/codestory/src/csEvents/csEventHandler.ts
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ export class CSEventHandler implements vscode.CSEventHandler, vscode.Disposable
// The current recording session which the user is going through over here
private _currentSession: SidecarContextEvent[];

constructor(private readonly _context: vscode.ExtensionContext) {
constructor(private readonly _context: vscode.ExtensionContext, _editorUrl: string | undefined) {
this._disposable = vscode.csevents.registerCSEventHandler(this);
this._currentSession = [];

96 changes: 49 additions & 47 deletions extensions/codestory/src/extension.ts
Original file line number Diff line number Diff line change
@@ -42,35 +42,13 @@ export async function activate(context: ExtensionContext) {
},
});

// Gets access to all the events the editor is throwing our way
const csEventHandler = new CSEventHandler(context);
context.subscriptions.push(csEventHandler);

const registerPreCopyCommand = commands.registerCommand(
'webview.preCopySettings',
async () => {
await copySettings(env.appRoot, logger);
}
);
context.subscriptions.push(registerPreCopyCommand);
const startRecording = commands.registerCommand(
'codestory.startRecordingContext',
async () => {
await csEventHandler.startRecording();
console.log('start recording context');
}
);
context.subscriptions.push(startRecording);
const stopRecording = commands.registerCommand(
'codestory.stopRecordingContext',
async () => {
const response = await csEventHandler.stopRecording();
await sidecarClient.sendContextRecording(response);
console.log(JSON.stringify(response));
console.log('stop recording context');
}
);
context.subscriptions.push(stopRecording);
let rootPath = workspace.rootPath;
if (!rootPath) {
rootPath = '';
@@ -209,6 +187,7 @@ export async function activate(context: ExtensionContext) {
context.subscriptions.push(recentEditsRetriever);

const probeProvider = new AideProbeProvider(sidecarClient, rootPath, recentEditsRetriever);
const editorUrl = probeProvider.editorUrl();
context.subscriptions.push(probeProvider);

// Register feedback commands
@@ -219,31 +198,6 @@ export async function activate(context: ExtensionContext) {
})
);

// records when we change to a new text document
workspace.onDidChangeTextDocument(async (event) => {
console.log('onDidChangeTextDocument');
const fileName = event.document.fileName;
await csEventHandler.onDidChangeTextDocument(fileName);
});

window.onDidChangeActiveTextEditor(async (editor) => {
if (editor) {
const activeDocument = editor.document;
if (activeDocument) {
const activeDocumentUri = activeDocument.uri;
if (shouldTrackFile(activeDocumentUri)) {
// track that changed document over here
await csEventHandler.onDidChangeTextDocument(activeDocumentUri.fsPath);
await sidecarClient.documentOpen(
activeDocumentUri.fsPath,
activeDocument.getText(),
activeDocument.languageId
);
}
}
}
});

// When the selection changes in the editor we should trigger an event
window.onDidChangeTextEditorSelection(async (event) => {
const textEditor = event.textEditor;
@@ -292,6 +246,54 @@ export async function activate(context: ExtensionContext) {
}
});

// Gets access to all the events the editor is throwing our way
const csEventHandler = new CSEventHandler(context, editorUrl);
context.subscriptions.push(csEventHandler);

const startRecording = commands.registerCommand(
'codestory.startRecordingContext',
async () => {
await csEventHandler.startRecording();
console.log('start recording context');
}
);
context.subscriptions.push(startRecording);
const stopRecording = commands.registerCommand(
'codestory.stopRecordingContext',
async () => {
const response = await csEventHandler.stopRecording();
await probeProvider.sendContextRecording(response);
console.log(JSON.stringify(response));
console.log('stop recording context');
}
);
context.subscriptions.push(stopRecording);

// records when we change to a new text document
workspace.onDidChangeTextDocument(async (event) => {
console.log('onDidChangeTextDocument');
const fileName = event.document.fileName;
await csEventHandler.onDidChangeTextDocument(fileName);
});

window.onDidChangeActiveTextEditor(async (editor) => {
if (editor) {
const activeDocument = editor.document;
if (activeDocument) {
const activeDocumentUri = activeDocument.uri;
if (shouldTrackFile(activeDocumentUri)) {
// track that changed document over here
await csEventHandler.onDidChangeTextDocument(activeDocumentUri.fsPath);
await sidecarClient.documentOpen(
activeDocumentUri.fsPath,
activeDocument.getText(),
activeDocument.languageId
);
}
}
}
});

// shouldn't all listeners have this?
context.subscriptions.push(diagnosticsListener);
}
6 changes: 6 additions & 0 deletions extensions/codestory/src/sidecar/client.ts
Original file line number Diff line number Diff line change
@@ -984,12 +984,18 @@ export class SideCarClient {

async sendContextRecording(
contextEvents: readonly SidecarContextEvent[],
editorUrl: string | undefined,
) {
if (editorUrl === undefined) {
console.log('editorUrl not found');
return;
}
const baseUrl = new URL(this._url);
baseUrl.pathname = '/api/agentic/context_recording';
const url = baseUrl.toString();
const body = {
context_events: contextEvents,
editor_url: editorUrl,
};
await fetch(url, {
method: 'POST',