From 2f7107d44cebe1f2ceb9e21688e3eb75535a3b2c Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 3 May 2026 14:59:05 +0200 Subject: [PATCH] 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. --- agents/copilot.json | 2 +- core | 2 +- scripts/u/complete | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/agents/copilot.json b/agents/copilot.json index 32fa871..688143f 100644 --- a/agents/copilot.json +++ b/agents/copilot.json @@ -1,6 +1,6 @@ { "prompt": [], - "trustedTools": [], + "tools": false, "hooks": { "turnError": [ "$OLLIE/x/freeloader $OLLIE_SESSION_ID" diff --git a/core b/core index 1b04d6a..c069dec 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 1b04d6a75b522ce01ad65aa73e4d21f36874bb26 +Subproject commit c069deccca6553e5df0a9680b35c947e42a45d26 diff --git a/scripts/u/complete b/scripts/u/complete index 237c6f1..6714fb0 100644 --- a/scripts/u/complete +++ b/scripts/u/complete @@ -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} @@ -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