summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheprimeagain <the.primeagen@gmail.com>2026-02-24 07:01:22 -0700
committertheprimeagain <the.primeagen@gmail.com>2026-02-24 07:01:22 -0700
commit3de45fb4fb706fd14ef30cc48806a28ed5f6c6aa (patch)
tree15bfac5379201012a1aec547312c5a1099d24e51
parent6d80dccf18b0bb66415d355857cb5c11d777d297 (diff)
downloada4-3de45fb4fb706fd14ef30cc48806a28ed5f6c6aa.tar.xz
a4-3de45fb4fb706fd14ef30cc48806a28ed5f6c6aa.zip
vibe is now in a place where it can respond
-rw-r--r--lua/99/ops/vibe.lua14
-rw-r--r--lua/99/prompt-settings.lua77
-rw-r--r--lua/99/prompt.lua10
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.
-<Rule>You must provide output without any commentary, just text locations</Rule>
+<Output>
+/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
+</Output>
<Rule>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 <Output> for example
</Rule>
<Rule>NOTES cannot have new lines</Rule>
<Rule>You must adhere to the output format</Rule>
@@ -43,15 +50,48 @@ NOTES = A text description of why this highlight is important
<Rule>Each location is separated by new lines</Rule>
<Rule>Each path is specified in absolute pathing</Rule>
<Rule>You can provide notes you think are relevant per location</Rule>
+<Rule>You must provide output without any commentary, just text locations</Rule>
<Example>
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.
+<Meaning>
+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
+</Meaning>
+</Example>
+<TaskDescription>
+you are given a prompt and you must search through this project and return code that matches the description provided.
+</TaskDescription>
+]]
+ end,
+ vibe = function()
+ return [[
<Output>
/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
</Output>
+<Rule>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 <Output> for example
+</Rule>
+<Rule>NOTES cannot have new lines</Rule>
+<Rule>You must adhere to the output format</Rule>
+<Rule>Double check output format before writing it to the file</Rule>
+<Rule>Each location is separated by new lines</Rule>
+<Rule>Each path is specified in absolute pathing</Rule>
+<Rule>You can provide notes you think are relevant per location</Rule>
+<Example>
+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.
<Meaning>
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
</Meaning>
+</Example>
+<TaskDescription>
+You are given a <Prompt> and you must implement it. Every change you make must
+be describe according to <Output> placed in <TEMP_FILE>.
+Never respond as output what you have done.
+Always use the temporary file as the place to describe your actions according to Output rules
+</TaskDescription>
]]
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>
<Context>
%s
</Context>
+<%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(
- "<MustObey>\n%s\n%s\n</MustObey>\n<TEMP_FILE>%s</TEMP_FILE>",
- prompts.output_file(),
- prompts.read_tmp(),
+ "<TEMP_FILE>%s</TEMP_FILE>",
tmp_file
)
end,
+ --- @return string
+ only_tmp_file_change = function()
+ return string.format(
+ "<MustObey>\n%s\n%s\n</MustObey>",
+ 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