Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor probe & chat flows #784

Merged
merged 52 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
42 changes: 22 additions & 20 deletions extensions/codestory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"defaultChatParticipant",
"inlineCompletionsAdditions",
"interactive",
"mappedEditsProvider",
"modelSelection",
"terminalSelection"
],
Expand Down Expand Up @@ -58,37 +59,33 @@
"command": "codestory.feedback",
"title": "Provide feedback on Discord",
"icon": "assets/discord.svg"
},
{
"command": "codestory.startRecordingContext",
"title": "Start Recording context"
},
{
"command": "codestory.stopRecordingContext",
"title": "Stop Recording Context"
}
],
"viewsContainers": {
"activitybar": [
{
"id": "changeTracker",
"title": "Change Tracker",
"icon": "assets/versions.svg"
}
]
},
"aideChatParticipants": [
"aideAgents": [
{
"id": "aide",
"name": "Chat",
"name": "Aide",
"fullName": "Aide",
"description": "What can I help you with today?",
"supportsModelPicker": true,
"isDefault": true,
"metadata": {
"icon": "assets/aide-agent.png",
"requester": "assets/aide-user.png"
},
"locations": [
"panel"
]
}
],
"menus": {
"view/title": [
{
"command": "codestory.feedback",
"when": "view == cs-chat",
"group": "navigation"
}
]
},
"configuration": {
"type": "object",
"title": "Aide Extension settings",
Expand Down Expand Up @@ -167,6 +164,11 @@
"type": "boolean",
"default": true,
"description": "Should we allow clip board content to be sent over"
},
"aide.deepReasoning": {
"type": "boolean",
"default": false,
"description": "Should use deep reasoning before making edits"
}
}
}
Expand Down
126 changes: 64 additions & 62 deletions extensions/codestory/src/chatState/convertStreamToMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AdjustedLineContent, LineContent, LineIndentManager } from '../completi

export const reportFromStreamToSearchProgress = async (
stream: AsyncIterator<ConversationMessage>,
response: vscode.AideChatResponseStream,
response: vscode.ChatResponseStream,
cancellationToken: vscode.CancellationToken,
workingDirectory: string,
): Promise<string> => {
Expand Down Expand Up @@ -79,7 +79,11 @@ export const reportFromStreamToSearchProgress = async (
// the reporef location to the message and that would solve a lot of
// problems.
if (!enteredAnswerGenerationLoop) {
response.markdown('\n');
if (conversationMessage.answer.delta !== null) {
response.markdown(conversationMessage.answer.delta);
} else {
response.markdown('\n');
}
// progress.report(new CSChatProgressContent('\n## Answer\n\n' + conversationMessage.answer.delta));
enteredAnswerGenerationLoop = true;
} else {
Expand Down Expand Up @@ -193,7 +197,7 @@ export const reportCodeSpansToChat = (codeSpans: CodeSpan[], workingDirectory: s
return '## Relevant code snippets\n\n' + codeSpansString + suffixString;
};

export const reportCodeReferencesToChat = (response: vscode.AideChatResponseStream, codeSpans: CodeSpan[], workingDirectory: string) => {
export const reportCodeReferencesToChat = (response: vscode.ChatResponseStream, codeSpans: CodeSpan[], workingDirectory: string) => {
const sortedCodeSpans = codeSpans.sort((a, b) => {
if (a.score !== null && b.score !== null) {
return b.score - a.score;
Expand Down Expand Up @@ -225,7 +229,7 @@ export const reportCodeReferencesToChat = (response: vscode.AideChatResponseStre


export const reportProcUpdateToChat = (
progress: vscode.AideChatResponseStream,
progress: vscode.ChatResponseStream,
proc: AgentStep,
workingDirectory: string,
) => {
Expand All @@ -252,7 +256,7 @@ const pattern = /(?:^|\s)(\w+\s+at\s+[\w/.-]+)?(.*)/s;
export const reportAgentEventsToChat = async (
editMode: boolean,
stream: AsyncIterableIterator<SideCarAgentEvent>,
response: vscode.AgentResponseStream,
response: vscode.AideAgentResponseStream,
threadId: string,
token: vscode.CancellationToken,
sidecarClient: SideCarClient,
Expand Down Expand Up @@ -294,33 +298,31 @@ export const reportAgentEventsToChat = async (
thinking: item.thinking,
};
});
response.initialSearchSymbols(initialSearchSymbolInformation);
// response.initialSearchSymbols(initialSearchSymbolInformation);
} else if (event.event.FrameworkEvent.RepoMapGenerationStart) {
response.repoMapGeneration(false);
// response.repoMapGeneration(false);
} else if (event.event.FrameworkEvent.RepoMapGenerationFinished) {
response.repoMapGeneration(true);
// response.repoMapGeneration(true);
} else if (event.event.FrameworkEvent.LongContextSearchStart) {
response.longContextSearch(false);
// response.longContextSearch(false);
} else if (event.event.FrameworkEvent.LongContextSearchFinished) {
response.longContextSearch(true);
// response.longContextSearch(true);
} else if (event.event.FrameworkEvent.OpenFile) {
const filePath = event.event.FrameworkEvent.OpenFile.fs_file_path;
if (filePath) {
response.openFile({
uri: vscode.Uri.file(filePath),
});
response.reference(vscode.Uri.file(filePath));
}
} else if (event.event.FrameworkEvent.CodeIterationFinished) {
response.codeIterationFinished({ edits: iterationEdits });
// response.codeIterationFinished({ edits: iterationEdits });
} else if (event.event.FrameworkEvent.ReferenceFound) {
response.referenceFound({ references: event.event.FrameworkEvent.ReferenceFound });
// response.referenceFound({ references: event.event.FrameworkEvent.ReferenceFound });
} else if (event.event.FrameworkEvent.RelevantReference) {
const ref = event.event.FrameworkEvent.RelevantReference;
response.relevantReference({
uri: vscode.Uri.file(ref.fs_file_path),
symbolName: ref.symbol_name,
reason: ref.reason,
});
// response.relevantReference({
// uri: vscode.Uri.file(ref.fs_file_path),
// symbolName: ref.symbol_name,
// reason: ref.reason,
// });
} else if (event.event.FrameworkEvent.GroupedReferences) {
const groupedRefs = event.event.FrameworkEvent.GroupedReferences;
const followups: { [key: string]: { symbolName: string; uri: vscode.Uri }[] } = {};
Expand All @@ -332,7 +334,7 @@ export const reportAgentEventsToChat = async (
};
});
}
response.followups(followups);
// response.followups(followups);
} else if (event.event.FrameworkEvent.SearchIteration) {
// console.log(event.event.FrameworkEvent.SearchIteration);
} else if (event.event.FrameworkEvent.AgenticTopLevelThinking) {
Expand All @@ -349,13 +351,13 @@ export const reportAgentEventsToChat = async (
const symbolEventKey = symbolEventKeys[0] as keyof typeof symbolEvent;
// If this is a symbol event then we have to make sure that we are getting the probe request over here
if (!editMode && symbolEventKey === 'Probe' && symbolEvent.Probe !== undefined) {
response.breakdown({
reference: {
uri: vscode.Uri.file(symbolEvent.Probe.symbol_identifier.fs_file_path ?? 'symbol_not_found'),
name: symbolEvent.Probe.symbol_identifier.symbol_name,
},
query: new vscode.MarkdownString(symbolEvent.Probe.probe_request)
});
// response.breakdown({
// reference: {
// uri: vscode.Uri.file(symbolEvent.Probe.symbol_identifier.fs_file_path ?? 'symbol_not_found'),
// name: symbolEvent.Probe.symbol_identifier.symbol_name,
// },
// query: new vscode.MarkdownString(symbolEvent.Probe.probe_request)
// });
}
} else if (event.event.SymbolEventSubStep) {
const { symbol_identifier, event: symbolEventSubStep } = event.event.SymbolEventSubStep;
Expand All @@ -369,7 +371,7 @@ export const reportAgentEventsToChat = async (
const startPosition = new vscode.Position(goToDefinition.range.startPosition.line, goToDefinition.range.startPosition.character);
const endPosition = new vscode.Position(goToDefinition.range.endPosition.line, goToDefinition.range.endPosition.character);
const range = new vscode.Range(startPosition, endPosition);
response.location({ uri, range, name: symbol_identifier.symbol_name, thinking: goToDefinition.thinking });
// response.location({ uri, range, name: symbol_identifier.symbol_name, thinking: goToDefinition.thinking });
continue;
} else if (symbolEventSubStep.Edit) {
if (!symbol_identifier.fs_file_path) {
Expand All @@ -381,21 +383,21 @@ export const reportAgentEventsToChat = async (
if (editEvent.CodeCorrectionTool) { }

if (editEvent.ThinkingForEdit) {
response.breakdown({
reference: {
uri: vscode.Uri.file(symbol_identifier.fs_file_path),
name: symbol_identifier.symbol_name
},
response: new vscode.MarkdownString(editEvent.ThinkingForEdit.thinking),
});
// response.breakdown({
// reference: {
// uri: vscode.Uri.file(symbol_identifier.fs_file_path),
// name: symbol_identifier.symbol_name
// },
// response: new vscode.MarkdownString(editEvent.ThinkingForEdit.thinking),
// });
}
if (editEvent.RangeSelectionForEdit) {
response.breakdown({
reference: {
uri: vscode.Uri.file(symbol_identifier.fs_file_path),
name: symbol_identifier.symbol_name,
}
});
// response.breakdown({
// reference: {
// uri: vscode.Uri.file(symbol_identifier.fs_file_path),
// name: symbol_identifier.symbol_name,
// }
// });
} else if (editEvent.EditCodeStreaming) {
// we have to do some state management over here
// we send 3 distinct type of events over here
Expand Down Expand Up @@ -469,13 +471,13 @@ export const reportAgentEventsToChat = async (
const subStepType = probeRequestKeys[0];
if (!editMode && subStepType === 'ProbeAnswer' && probeSubStep.ProbeAnswer !== undefined) {
const probeAnswer = probeSubStep.ProbeAnswer;
response.breakdown({
reference: {
uri: vscode.Uri.file(symbol_identifier.fs_file_path),
name: symbol_identifier.symbol_name
},
response: new vscode.MarkdownString(probeAnswer)
});
// response.breakdown({
// reference: {
// uri: vscode.Uri.file(symbol_identifier.fs_file_path),
// name: symbol_identifier.symbol_name
// },
// response: new vscode.MarkdownString(probeAnswer)
// });
}
}
} else if (event.event.RequestEvent) {
Expand Down Expand Up @@ -600,7 +602,7 @@ export class StreamProcessor {
documentLineIndex: number;
sentEdits: boolean;
documentLineLimit: number;
constructor(progress: vscode.AgentResponseStream,
constructor(progress: vscode.ChatResponseStream,
lines: string[],
indentStyle: IndentStyleSpaces | undefined,
uri: vscode.Uri,
Expand Down Expand Up @@ -712,7 +714,7 @@ export class StreamProcessor {

class DocumentManager {
indentStyle: IndentStyleSpaces;
progress: vscode.AgentResponseStream;
progress: vscode.ChatResponseStream;
lines: LineContent[];
firstSentLineIndex: number;
firstRangeLine: number;
Expand All @@ -722,7 +724,7 @@ class DocumentManager {
applyDirectly: boolean;

constructor(
progress: vscode.AgentResponseStream,
progress: vscode.ChatResponseStream,
lines: string[],
// Fix the way we provide context over here?
range: SidecarRequestRange,
Expand Down Expand Up @@ -795,10 +797,10 @@ class DocumentManager {
await vscode.workspace.applyEdit(edits);
}
else if (this.limiter === null) {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
} else {
await this.limiter.queue(async () => {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
});
}
return index + 1;
Expand All @@ -810,10 +812,10 @@ class DocumentManager {
await vscode.workspace.applyEdit(edits);
}
else if (this.limiter === null) {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
} else {
await this.limiter.queue(async () => {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
});
}
return index + 1;
Expand Down Expand Up @@ -845,10 +847,10 @@ class DocumentManager {
await vscode.workspace.applyEdit(edits);
}
else if (this.limiter === null) {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
} else {
await this.limiter.queue(async () => {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
});
}
return startIndex + 1;
Expand All @@ -872,10 +874,10 @@ class DocumentManager {
await vscode.workspace.applyEdit(edits);
}
else if (this.limiter === null) {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
} else {
await this.limiter.queue(async () => {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
});
}
return this.lines.length;
Expand All @@ -898,10 +900,10 @@ class DocumentManager {
await vscode.workspace.applyEdit(edits);
}
else if (this.limiter === null) {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
} else {
await this.limiter.queue(async () => {
await this.progress.codeEdit({ edits, iterationId: 'mock' });
// await this.progress.codeEdit({ edits, iterationId: 'mock' });
});
}
return index + 2;
Expand Down
Loading
Loading