u/complete: strip markdown fences, insert at cursor, info to stderr

Also set tools:false on copilot agent and update core submodule
with the new tools config field.
This commit is contained in:
Levi Neely 2026-05-03 14:59:05 +02:00
parent 57e383b02b
commit 2f7107d44c
3 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"prompt": [],
"trustedTools": [],
"tools": false,
"hooks": {
"turnError": [
"$OLLIE/x/freeloader $OLLIE_SESSION_ID"

2
core

@ -1 +1 @@
Subproject commit 1b04d6a75b522ce01ad65aa73e4d21f36874bb26
Subproject commit c069deccca6553e5df0a9680b35c947e42a45d26

View File

@ -106,7 +106,7 @@ suffix="${suffix:0:$SUFFIX_MAX}"
sid=$(find_or_create_session "$PWD")
B="$MOUNT/s/$sid"
printf '%s\n' "Complete the code at the cursor in ${filename}. Output ONLY the text to insert — no explanation, no markdown, no preamble.
printf '%s\n' "Complete the code at the cursor in ${filename}. Output ONLY the raw text to insert at the cursor position. Do NOT wrap the output in markdown code fences or backticks. No explanation, no preamble.
<prefix>
${prefix}
@ -124,10 +124,13 @@ done
# Read result from offset, then clear context for next completion
offset=$(cat "$B/offset" 2>/dev/null || echo 0)
result=$(tail -c +$((offset + 1)) "$B/chat" 2>/dev/null)
# Strip markdown code fences if the model wrapped the output.
result=$(printf '%s' "$result" | sed '/^```[a-zA-Z]*$/d; /^```$/d')
# Print info lines (:: prefix) to stderr; keep only code.
printf '%s\n' "$result" | grep '^:: ' >&2 || true
result=$(printf '%s' "$result" | grep -v '^:: ')
echo "clear" > "$B/ctl"
# Write completion to a new acme window
newid=$(9p read acme/new/ctl | awk 'NR==1{print $1}')
printf 'name ollie/complete\n' | 9p write acme/$newid/ctl
printf '%s' "$result" | 9p write acme/$newid/body
printf 'clean\n' | 9p write acme/$newid/ctl
# Insert completion at the cursor position (dot)
echo "addr=dot" | 9p write acme/$winid/ctl
printf '%s' "$result" | 9p write acme/$winid/data