From 3de45fb4fb706fd14ef30cc48806a28ed5f6c6aa Mon Sep 17 00:00:00 2001 From: theprimeagain Date: Tue, 24 Feb 2026 07:01:22 -0700 Subject: vibe is now in a place where it can respond --- lua/99/ops/vibe.lua | 14 +++++---- lua/99/prompt-settings.lua | 77 ++++++++++++++++++++++++++++++++++++++-------- lua/99/prompt.lua | 10 +++++- 3 files changed, 82 insertions(+), 19 deletions(-) diff --git a/lua/99/ops/vibe.lua b/lua/99/ops/vibe.lua index 291fc45..8fd2111 100644 --- a/lua/99/ops/vibe.lua +++ b/lua/99/ops/vibe.lua @@ -12,18 +12,18 @@ local make_observer = CleanUp.make_observer --- @param context _99.Prompt ---@param opts _99.ops.SearchOpts -local function search(context, opts) +local function vibe(context, opts) opts = opts or {} - local logger = context.logger:set_area("search") - logger:debug("search", "with opts", opts.additional_prompt) + local logger = context.logger:set_area("vibe") + logger:debug("vibe", "with opts", opts.additional_prompt) local clean_up = make_clean_up(function() context:stop() end) local prompt, refs = - make_prompt(context, context._99.prompts.prompts.semantic_search(), opts) + make_prompt(context, context._99.prompts.prompts.vibe(), opts) context:add_prompt_content(prompt) context:add_references(refs) @@ -45,8 +45,10 @@ local function search(context, opts) response or "no response provided" ) elseif status == "success" then - create_search_locations(context, response) + -- create_search_locations(context, response) + -- need to parse out everything so i we can qfix list + print("done", response) end end)) end -return search +return vibe diff --git a/lua/99/prompt-settings.lua b/lua/99/prompt-settings.lua index f079fc1..c7e87dd 100644 --- a/lua/99/prompt-settings.lua +++ b/lua/99/prompt-settings.lua @@ -8,6 +8,7 @@ end --- @class _99.Prompts.SpecificOperations --- @field visual_selection fun(range: _99.Range): string --- @field semantic_search fun(): string +--- @field vibe fun(): string --- @field tutorial fun(): string --- @field prompt fun(prompt: string, action: string, name?: string): string --- @field role fun(): string @@ -29,13 +30,19 @@ crafting the tutorial end, semantic_search = function() return [[ -you are given a prompt and you must search through this project and return code that matches the description provided. -You must provide output without any commentary, just text locations + +/path/to/project/src/foo.js:24:8,3,Some notes here about some stuff, it can contain commas +/path/to/project/src/foo.js:71:12,7,more notes, everything is great! +/path/to/project/src/bar.js:13:2,1,more notes again, this time specfically about bar and why bar is so important +/path/to/project/src/baz.js:1:1,52,Notes about why baz is very important to the results + Text locations are in the format of: /path/to/file.ext:lnum:cnum,X,NOTES lnum = starting line number 1 based cnum = starting column number 1 based X = how many lines should be highlighted NOTES = A text description of why this highlight is important + +See for example NOTES cannot have new lines You must adhere to the output format @@ -43,15 +50,48 @@ NOTES = A text description of why this highlight is important Each location is separated by new lines Each path is specified in absolute pathing You can provide notes you think are relevant per location +You must provide output without any commentary, just text locations You have found 3 locations in files foo.js, bar.js, and baz.js. There are 2 locations in foo.js, 1 in bar.js and baz.js. + +This means that the search results found +foo.js at line 24, char 8 and the next 2 lines +foo.js at line 71, char 12 and the next 6 lines +bar.js at line 13, char 2 +baz.js at line 1, char 1 and the next 51 lines + + + +you are given a prompt and you must search through this project and return code that matches the description provided. + +]] + end, + vibe = function() + return [[ /path/to/project/src/foo.js:24:8,3,Some notes here about some stuff, it can contain commas /path/to/project/src/foo.js:71:12,7,more notes, everything is great! /path/to/project/src/bar.js:13:2,1,more notes again, this time specfically about bar and why bar is so important /path/to/project/src/baz.js:1:1,52,Notes about why baz is very important to the results +Text locations are in the format of: /path/to/file.ext:lnum:cnum,X,NOTES +lnum = starting line number 1 based +cnum = starting column number 1 based +X = how many lines should be highlighted +NOTES = A text description of why this highlight is important + +See for example + +NOTES cannot have new lines +You must adhere to the output format +Double check output format before writing it to the file +Each location is separated by new lines +Each path is specified in absolute pathing +You can provide notes you think are relevant per location + +You have found 3 locations in files foo.js, bar.js, and baz.js. +There are 2 locations in foo.js, 1 in bar.js and baz.js. This means that the search results found foo.js at line 24, char 8 and the next 2 lines @@ -59,6 +99,13 @@ foo.js at line 71, char 12 and the next 6 lines bar.js at line 13, char 2 baz.js at line 1, char 1 and the next 51 lines + + +You are given a and you must implement it. Every change you make must +be describe according to placed in . +Never respond as output what you have done. +Always use the temporary file as the place to describe your actions according to Output rules + ]] end, output_file = function() @@ -73,20 +120,20 @@ ONLY provide requested changes by writing the change to TEMP_FILE --- @param name? string defaults to DIRECTIONS --- @return string prompt = function(prompt, action, name) - name = name or "DIRECTIONS" + name = name or "Prompt" return string.format( [[ -<%s> -%s - %s +<%s> +%s + ]], + action, name, prompt, - name, - action + name ) end, visual_selection = function(range) @@ -110,7 +157,6 @@ consider the context of the selection and what you are suppose to be implementin get_file_contents(range.buffer) ) end, - -- luacheck: ignore 631 read_tmp = function() return [[ never attempt to read TEMP_FILE. @@ -129,13 +175,20 @@ local prompt_settings = { --- @return string tmp_file_location = function(tmp_file) return string.format( - "\n%s\n%s\n\n%s", - prompts.output_file(), - prompts.read_tmp(), + "%s", tmp_file ) end, + --- @return string + only_tmp_file_change = function() + return string.format( + "\n%s\n%s\n", + prompts.output_file(), + prompts.read_tmp() + ) + end, + ---@param full_path string ---@param range _99.Range ---@return string diff --git a/lua/99/prompt.lua b/lua/99/prompt.lua index 840b5ee..a03b183 100644 --- a/lua/99/prompt.lua +++ b/lua/99/prompt.lua @@ -317,7 +317,6 @@ function Prompt:qfix_data() return self.data.xfix_items end - function Prompt:stop() self:cancel() for _, cb in ipairs(self.clean_ups) do @@ -444,6 +443,15 @@ function Prompt:finalize() self.agent_context, self._99.prompts.tmp_file_location(self.tmp_file) ) + + if + self.operation == "visual" + or self.operation == "tutorial" + or self.operation == "search" + then + table.insert(self.agent_context, self._99.prompts.only_tmp_file_change()) + end + return true, self end -- cgit v1.3-3-g829e