Commit fb19392
feat(azure.ai.agents): add FormatNextForNote renderer for artifact embeds
Phase 3 foundation. Adds a string-returning sibling to PrintNext suitable
for embedding a Next: block inside an artifact's Metadata["note"]. No
production caller yet; the deploy-hook wire-up lands in commit 3.2.
Shape decisions:
* No truncation. The artifact note is a contained region (not interleaved
with command output), so it should surface every suggestion. PrintNext's
maxRendered=2 cap remains in force for the interactive stdout case.
* No leading or trailing newline. The artifact renderer prepends its own
line break; an embedded "\n...\n" would double-space the output.
* Lines 2+ are pre-indented by 4 spaces so the command column stays
aligned with line 1 when core azd's artifact renderer
(cli/azd/pkg/project/artifact.go:128-130) is called with the typical
caller indent of two spaces. The renderer indents line 1 of the note
but lines 2+ are flush-left; pre-indenting compensates.
Strategy delta D21 — drop currentIndentation from the API. The plan's
signature took currentIndentation as a parameter, but the extension
cannot know what value core azd's renderer will pass at display time
(callers above us choose the indent). Hard-coding 4 spaces matches the
two-space caller indent used everywhere in the existing tree. Under
deeper or shallower caller indents the lines drift slightly but the
note remains readable.
Refactor: extracted renderRows(suggestions, limit) from renderBlock so
PrintNext (limit=maxRendered) and FormatNextForNote (limit=0, no cap)
share the partition-then-render core. Renamed the local variable away
from the Go builtin cap. Behavior of renderBlock / PrintNext is
unchanged — verified by the existing 7 TestPrintNext subtests.
Tests added in format_test.go:
- empty input returns ""
- single suggestion: no leading or trailing newline
- multi-line: line 2 pre-indented by 4 spaces
- uncapped: third suggestion preserved (would be dropped by PrintNext)
- trailing entry survives ordering
- TestFormatNextForNote_HostArtifactAlignment: round-trips a synthetic
artifact render to lock the column-alignment contract
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 793af29 commit fb19392
2 files changed
Lines changed: 143 additions & 10 deletions
Lines changed: 49 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
43 | 66 | | |
44 | 67 | | |
45 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
46 | 82 | | |
47 | 83 | | |
48 | 84 | | |
49 | 85 | | |
50 | 86 | | |
51 | 87 | | |
52 | | - | |
53 | | - | |
| 88 | + | |
| 89 | + | |
54 | 90 | | |
55 | 91 | | |
56 | 92 | | |
| |||
76 | 112 | | |
77 | 113 | | |
78 | 114 | | |
79 | | - | |
80 | | - | |
| 115 | + | |
| 116 | + | |
81 | 117 | | |
82 | 118 | | |
83 | 119 | | |
84 | 120 | | |
85 | 121 | | |
86 | 122 | | |
87 | 123 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
91 | 127 | | |
92 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
93 | 134 | | |
94 | 135 | | |
95 | 136 | | |
| |||
104 | 145 | | |
105 | 146 | | |
106 | 147 | | |
107 | | - | |
108 | | - | |
109 | 148 | | |
110 | 149 | | |
111 | 150 | | |
| |||
Lines changed: 94 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
0 commit comments