Merge feature/meta-prompt into main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
modified
.tickets/issues/0270-meta-prompt-command-pick-a-style-prefix-for-the-question.yaml +74 -11 | @@ -1,12 +1,13 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 270 |
| 3 | -title: "/meta-prompt: pick a style prefix ([Brief], [Step-by-Step]…) from a list, for the question" | |
| 4 | -state: open | |
| 3 | +title: "The [ picker: pick a style prefix ([Brief], [Step-by-Step]…) for the question (pk's /meta)" | |
| 4 | +state: closed | |
| 5 | 5 | author: |
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-27T03:30:00.000Z |
| 9 | -updatedAt: 2026-11-27T03:45:00.000Z | |
| 9 | +updatedAt: 2026-11-27T06:00:00.000Z | |
| 10 | +closedAt: 2026-11-27T06:00:00.000Z | |
| 10 | 11 | labels: |
| 11 | 12 | - enhancement |
| 12 | 13 | - kind::feature |
| @@ -94,40 +95,44 @@ tasks: | ||
| 94 | 95 | closedAt: 2026-11-27T03:45:00.000Z |
| 95 | 96 | - id: 2 |
| 96 | 97 | title: "Catalogue package (13 entries) + unit tests of its shape" |
| 97 | - state: open | |
| 98 | + state: closed | |
| 98 | 99 | priority: medium |
| 99 | 100 | author: |
| 100 | 101 | name: k33g |
| 101 | 102 | email: ph.charriere@gmail.com |
| 102 | 103 | createdAt: 2026-11-27T03:30:00.000Z |
| 103 | - updatedAt: 2026-11-27T03:30:00.000Z | |
| 104 | + updatedAt: 2026-11-27T05:00:00.000Z | |
| 105 | + closedAt: 2026-11-27T05:00:00.000Z | |
| 104 | 106 | - id: 3 |
| 105 | 107 | title: "Window: /meta-prompt (and /meta) opens the list, Enter inserts the prefix in the input box, Esc cancels; a `[` picker at the start of the box — with tests" |
| 106 | - state: open | |
| 108 | + state: closed | |
| 107 | 109 | priority: medium |
| 108 | 110 | author: |
| 109 | 111 | name: k33g |
| 110 | 112 | email: ph.charriere@gmail.com |
| 111 | 113 | createdAt: 2026-11-27T03:30:00.000Z |
| 112 | - updatedAt: 2026-11-27T03:30:00.000Z | |
| 114 | + updatedAt: 2026-11-27T05:00:00.000Z | |
| 115 | + closedAt: 2026-11-27T05:00:00.000Z | |
| 113 | 116 | - id: 4 |
| 114 | 117 | title: "Line mode and ACP: list, and /meta-prompt <token|n> <question> — with tests" |
| 115 | - state: open | |
| 118 | + state: closed | |
| 116 | 119 | priority: medium |
| 117 | 120 | author: |
| 118 | 121 | name: k33g |
| 119 | 122 | email: ph.charriere@gmail.com |
| 120 | 123 | createdAt: 2026-11-27T03:30:00.000Z |
| 121 | - updatedAt: 2026-11-27T03:30:00.000Z | |
| 124 | + updatedAt: 2026-11-27T05:00:00.000Z | |
| 125 | + closedAt: 2026-11-27T05:00:00.000Z | |
| 122 | 126 | - id: 5 |
| 123 | 127 | title: "Docs EN+FR (slash commands, the pickers, window how-to, index) — no demo" |
| 124 | - state: open | |
| 128 | + state: closed | |
| 125 | 129 | priority: low |
| 126 | 130 | author: |
| 127 | 131 | name: k33g |
| 128 | 132 | email: ph.charriere@gmail.com |
| 129 | 133 | createdAt: 2026-11-27T03:30:00.000Z |
| 130 | - updatedAt: 2026-11-27T03:30:00.000Z | |
| 134 | + updatedAt: 2026-11-27T05:00:00.000Z | |
| 135 | + closedAt: 2026-11-27T05:00:00.000Z | |
| 131 | 136 | comments: |
| 132 | 137 | - id: 1 |
| 133 | 138 | author: |
| @@ -144,3 +149,61 @@ comments: | ||
| 144 | 149 | literal `[` (Esc closes the picker and keeps the character). |
| 145 | 150 | - Catalogue hard-coded only: no `metaPrompts:` in agent.yaml. |
| 146 | 151 | - No demo. |
| 152 | + - id: 2 | |
| 153 | + author: | |
| 154 | + name: k33g | |
| 155 | + email: ph.charriere@gmail.com | |
| 156 | + createdAt: 2026-11-27T05:00:00.000Z | |
| 157 | + body: | | |
| 158 | + Done on branch feature/meta-prompt (not merged yet): | |
| 159 | + - internal/metaprompt: the 13 entries (Token, Prefix, Description), | |
| 160 | + Matching (the `[` picker), Find (token, number, label), Resolve | |
| 161 | + (`<name> <question>`, a bracketed label read whole), Apply (line | |
| 162 | + mode / editor: the prefixed question or a reply), Listing. | |
| 163 | + - internal/command: `meta-prompt` and `meta`, all three front ends, | |
| 164 | + hint `[<name> <question>]`. | |
| 165 | + - Window: the `[` picker — only when `[` is the first character of a | |
| 166 | + one-line box, cursor at the end, no `]` yet; spaces allowed in what | |
| 167 | + is typed ("[As a"); Enter/Tab put the prefix in the box, cursor | |
| 168 | + after; Esc keeps a literal `[`. `/meta` edits the box (View.send): | |
| 169 | + alone → "[", `/meta bri` → "[bri", `/meta brief` → "[Brief] ", | |
| 170 | + `/meta brief Q` → sends "[Brief] Q". | |
| 171 | + - Line mode: `/meta brief Q` sends "[Brief] Q"; alone → the listing; | |
| 172 | + a name without a question or unknown → a ⚠️ line. | |
| 173 | + - ACP: same; the listing in a fenced block (Zed's Markdown would merge | |
| 174 | + its columns); advertised with the hint. | |
| 175 | + - Tests: metaprompt (shape, Find, Resolve, Matching, Listing, Apply), | |
| 176 | + tui metaprompt_test.go (picker, start-only rules, /meta cases), | |
| 177 | + agent TestMetaArg, acp TestMetaCommandPrefixesTheQuestion; the | |
| 178 | + command-table counts (command, picker, ACP advertisement) updated | |
| 179 | + for the two new commands. go test ./..., vet, gofmt clean. | |
| 180 | + - Live: line mode piped (/meta, /meta brief, /meta brief Q → the | |
| 181 | + session holds "[Brief] What is a goroutine?"); ACP with a Python | |
| 182 | + client against Ada (demos/prompt-variables): listing, hint, turn on | |
| 183 | + the prefixed question, commands advertised. Window not tried live. | |
| 184 | + - Docs EN+FR: reference/slash-commands.md (command row, window | |
| 185 | + subsection, "The four pickers" — renamed from three, links | |
| 186 | + updated —, ACP row and count), reference/cli.md pickers row, | |
| 187 | + how-to/use-the-window-mode.md. | |
| 188 | + - id: 3 | |
| 189 | + author: | |
| 190 | + name: k33g | |
| 191 | + email: ph.charriere@gmail.com | |
| 192 | + createdAt: 2026-11-27T05:30:00.000Z | |
| 193 | + body: | | |
| 194 | + Changed (user, 2026-11-27): the `[` picker is enough — NO /meta and | |
| 195 | + NO /meta-prompt, in any front end. Removed from the branch: the two | |
| 196 | + command-table entries, the window's /meta handling (View.send), the | |
| 197 | + line mode's metaArg, the ACP slashCommand case and metaCommand, and | |
| 198 | + their tests; the command-count tests are back to main's. The | |
| 199 | + metaprompt package keeps only what the picker uses (the catalogue, | |
| 200 | + Label, Matching). Task 4 (line mode and ACP) is therefore void: there | |
| 201 | + a prefix is typed by hand, the model reads it the same. | |
| 202 | + Added at the user's request: `[ meta-prompts` in the window's rule — | |
| 203 | + "Enter sends · Ctrl-J new line · / commands · @ files · $ skills · | |
| 204 | + [ meta-prompts · Tab scroll" — and a line in the F1 help; test | |
| 205 | + TestRuleNamesTheBracketPicker. | |
| 206 | + Docs EN+FR: slash-commands.md "The four pickers" only (the `[` row | |
| 207 | + with the 13 prefixes, the start-only rule, the rule line), cli.md | |
| 208 | + pickers row, skill-format.md and how-to links to the new anchor, | |
| 209 | + how-to window bullet. go test ./..., vet, gofmt clean. | |
| @@ -1,12 +1,13 @@ | |||
| 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | id: 270 | 2 | id: 270 |
| 3 | -title: "/meta-prompt: pick a style prefix ([Brief], [Step-by-Step]…) from a list, for the question" | 3 | +title: "The [ picker: pick a style prefix ([Brief], [Step-by-Step]…) for the question (pk's /meta)" |
| 4 | -state: open | 4 | +state: closed |
| 5 | author: | 5 | author: |
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-27T03:30:00.000Z | 8 | createdAt: 2026-11-27T03:30:00.000Z |
| 9 | -updatedAt: 2026-11-27T03:45:00.000Z | 9 | +updatedAt: 2026-11-27T06:00:00.000Z |
| 10 | +closedAt: 2026-11-27T06:00:00.000Z | ||
| 10 | labels: | 11 | labels: |
| 11 | - enhancement | 12 | - enhancement |
| 12 | - kind::feature | 13 | - kind::feature |
| @@ -94,40 +95,44 @@ tasks: | |||
| 94 | closedAt: 2026-11-27T03:45:00.000Z | 95 | closedAt: 2026-11-27T03:45:00.000Z |
| 95 | - id: 2 | 96 | - id: 2 |
| 96 | title: "Catalogue package (13 entries) + unit tests of its shape" | 97 | title: "Catalogue package (13 entries) + unit tests of its shape" |
| 97 | - state: open | 98 | + state: closed |
| 98 | priority: medium | 99 | priority: medium |
| 99 | author: | 100 | author: |
| 100 | name: k33g | 101 | name: k33g |
| 101 | email: ph.charriere@gmail.com | 102 | email: ph.charriere@gmail.com |
| 102 | createdAt: 2026-11-27T03:30:00.000Z | 103 | createdAt: 2026-11-27T03:30:00.000Z |
| 103 | - updatedAt: 2026-11-27T03:30:00.000Z | 104 | + updatedAt: 2026-11-27T05:00:00.000Z |
| 105 | + closedAt: 2026-11-27T05:00:00.000Z | ||
| 104 | - id: 3 | 106 | - id: 3 |
| 105 | title: "Window: /meta-prompt (and /meta) opens the list, Enter inserts the prefix in the input box, Esc cancels; a `[` picker at the start of the box — with tests" | 107 | title: "Window: /meta-prompt (and /meta) opens the list, Enter inserts the prefix in the input box, Esc cancels; a `[` picker at the start of the box — with tests" |
| 106 | - state: open | 108 | + state: closed |
| 107 | priority: medium | 109 | priority: medium |
| 108 | author: | 110 | author: |
| 109 | name: k33g | 111 | name: k33g |
| 110 | email: ph.charriere@gmail.com | 112 | email: ph.charriere@gmail.com |
| 111 | createdAt: 2026-11-27T03:30:00.000Z | 113 | createdAt: 2026-11-27T03:30:00.000Z |
| 112 | - updatedAt: 2026-11-27T03:30:00.000Z | 114 | + updatedAt: 2026-11-27T05:00:00.000Z |
| 115 | + closedAt: 2026-11-27T05:00:00.000Z | ||
| 113 | - id: 4 | 116 | - id: 4 |
| 114 | title: "Line mode and ACP: list, and /meta-prompt <token|n> <question> — with tests" | 117 | title: "Line mode and ACP: list, and /meta-prompt <token|n> <question> — with tests" |
| 115 | - state: open | 118 | + state: closed |
| 116 | priority: medium | 119 | priority: medium |
| 117 | author: | 120 | author: |
| 118 | name: k33g | 121 | name: k33g |
| 119 | email: ph.charriere@gmail.com | 122 | email: ph.charriere@gmail.com |
| 120 | createdAt: 2026-11-27T03:30:00.000Z | 123 | createdAt: 2026-11-27T03:30:00.000Z |
| 121 | - updatedAt: 2026-11-27T03:30:00.000Z | 124 | + updatedAt: 2026-11-27T05:00:00.000Z |
| 125 | + closedAt: 2026-11-27T05:00:00.000Z | ||
| 122 | - id: 5 | 126 | - id: 5 |
| 123 | title: "Docs EN+FR (slash commands, the pickers, window how-to, index) — no demo" | 127 | title: "Docs EN+FR (slash commands, the pickers, window how-to, index) — no demo" |
| 124 | - state: open | 128 | + state: closed |
| 125 | priority: low | 129 | priority: low |
| 126 | author: | 130 | author: |
| 127 | name: k33g | 131 | name: k33g |
| 128 | email: ph.charriere@gmail.com | 132 | email: ph.charriere@gmail.com |
| 129 | createdAt: 2026-11-27T03:30:00.000Z | 133 | createdAt: 2026-11-27T03:30:00.000Z |
| 130 | - updatedAt: 2026-11-27T03:30:00.000Z | 134 | + updatedAt: 2026-11-27T05:00:00.000Z |
| 135 | + closedAt: 2026-11-27T05:00:00.000Z | ||
| 131 | comments: | 136 | comments: |
| 132 | - id: 1 | 137 | - id: 1 |
| 133 | author: | 138 | author: |
| @@ -144,3 +149,61 @@ comments: | |||
| 144 | literal `[` (Esc closes the picker and keeps the character). | 149 | literal `[` (Esc closes the picker and keeps the character). |
| 145 | - Catalogue hard-coded only: no `metaPrompts:` in agent.yaml. | 150 | - Catalogue hard-coded only: no `metaPrompts:` in agent.yaml. |
| 146 | - No demo. | 151 | - No demo. |
| 152 | + - id: 2 | ||
| 153 | + author: | ||
| 154 | + name: k33g | ||
| 155 | + email: ph.charriere@gmail.com | ||
| 156 | + createdAt: 2026-11-27T05:00:00.000Z | ||
| 157 | + body: | | ||
| 158 | + Done on branch feature/meta-prompt (not merged yet): | ||
| 159 | + - internal/metaprompt: the 13 entries (Token, Prefix, Description), | ||
| 160 | + Matching (the `[` picker), Find (token, number, label), Resolve | ||
| 161 | + (`<name> <question>`, a bracketed label read whole), Apply (line | ||
| 162 | + mode / editor: the prefixed question or a reply), Listing. | ||
| 163 | + - internal/command: `meta-prompt` and `meta`, all three front ends, | ||
| 164 | + hint `[<name> <question>]`. | ||
| 165 | + - Window: the `[` picker — only when `[` is the first character of a | ||
| 166 | + one-line box, cursor at the end, no `]` yet; spaces allowed in what | ||
| 167 | + is typed ("[As a"); Enter/Tab put the prefix in the box, cursor | ||
| 168 | + after; Esc keeps a literal `[`. `/meta` edits the box (View.send): | ||
| 169 | + alone → "[", `/meta bri` → "[bri", `/meta brief` → "[Brief] ", | ||
| 170 | + `/meta brief Q` → sends "[Brief] Q". | ||
| 171 | + - Line mode: `/meta brief Q` sends "[Brief] Q"; alone → the listing; | ||
| 172 | + a name without a question or unknown → a ⚠️ line. | ||
| 173 | + - ACP: same; the listing in a fenced block (Zed's Markdown would merge | ||
| 174 | + its columns); advertised with the hint. | ||
| 175 | + - Tests: metaprompt (shape, Find, Resolve, Matching, Listing, Apply), | ||
| 176 | + tui metaprompt_test.go (picker, start-only rules, /meta cases), | ||
| 177 | + agent TestMetaArg, acp TestMetaCommandPrefixesTheQuestion; the | ||
| 178 | + command-table counts (command, picker, ACP advertisement) updated | ||
| 179 | + for the two new commands. go test ./..., vet, gofmt clean. | ||
| 180 | + - Live: line mode piped (/meta, /meta brief, /meta brief Q → the | ||
| 181 | + session holds "[Brief] What is a goroutine?"); ACP with a Python | ||
| 182 | + client against Ada (demos/prompt-variables): listing, hint, turn on | ||
| 183 | + the prefixed question, commands advertised. Window not tried live. | ||
| 184 | + - Docs EN+FR: reference/slash-commands.md (command row, window | ||
| 185 | + subsection, "The four pickers" — renamed from three, links | ||
| 186 | + updated —, ACP row and count), reference/cli.md pickers row, | ||
| 187 | + how-to/use-the-window-mode.md. | ||
| 188 | + - id: 3 | ||
| 189 | + author: | ||
| 190 | + name: k33g | ||
| 191 | + email: ph.charriere@gmail.com | ||
| 192 | + createdAt: 2026-11-27T05:30:00.000Z | ||
| 193 | + body: | | ||
| 194 | + Changed (user, 2026-11-27): the `[` picker is enough — NO /meta and | ||
| 195 | + NO /meta-prompt, in any front end. Removed from the branch: the two | ||
| 196 | + command-table entries, the window's /meta handling (View.send), the | ||
| 197 | + line mode's metaArg, the ACP slashCommand case and metaCommand, and | ||
| 198 | + their tests; the command-count tests are back to main's. The | ||
| 199 | + metaprompt package keeps only what the picker uses (the catalogue, | ||
| 200 | + Label, Matching). Task 4 (line mode and ACP) is therefore void: there | ||
| 201 | + a prefix is typed by hand, the model reads it the same. | ||
| 202 | + Added at the user's request: `[ meta-prompts` in the window's rule — | ||
| 203 | + "Enter sends · Ctrl-J new line · / commands · @ files · $ skills · | ||
| 204 | + [ meta-prompts · Tab scroll" — and a line in the F1 help; test | ||
| 205 | + TestRuleNamesTheBracketPicker. | ||
| 206 | + Docs EN+FR: slash-commands.md "The four pickers" only (the `[` row | ||
| 207 | + with the 13 prefixes, the start-only rule, the rule line), cli.md | ||
| 208 | + pickers row, skill-format.md and how-to links to the new anchor, | ||
| 209 | + how-to window bullet. go test ./..., vet, gofmt clean. | ||
modified
docs/en/how-to/use-the-window-mode.md +1 -0 | @@ -27,6 +27,7 @@ This guide shows how to run mini-me as a single full-screen window — the conve | ||
| 27 | 27 | ## Variants |
| 28 | 28 | |
| 29 | 29 | - **Ask before every `bash` and file tool.** Set `yolo: false` in the YAML. The box is replaced by the question `? bash: rm -rf build` and four keys answer it: `a` allow once, `s` allow this tool for the session, `r` (or Esc) reject, `n` never allow this tool in this session. A rejected tool tells the model `[command rejected by the user]`. The default, `yolo: true`, runs tools without asking. See [How to confirm tool calls](confirm-tool-calls.md). |
| 30 | +- **Ask for an answer in a given form.** Type `[` at the start of the box: a list of 13 meta-prompts opens — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Enter puts the prefix in the box, type the question after it. See [The four pickers](../reference/slash-commands.md#the-four-pickers). | |
| 30 | 31 | - **Point the model at a file.** `@path` works exactly as in the line mode: existing paths are attached and echoed as `📎` lines. See [Point the model at a file with `@path`](attach-a-file.md). |
| 31 | 32 | - **See which agent answers.** The header and the label above each answer name the agent: `mm`, or `mm [<acp.title>]` when the config gives a title. While another agent works — `/ask-<name>`, or the `ask_agent` tool — the header names it with its model and `asked by` your agent, and its answer is labelled with its title (or its `mmConfigs` name); then both come back to your agent. See [How to let your agent call other agents](let-the-agent-call-other-agents.md). |
| 32 | 33 | - **Keep and resume sessions.** With `sessions.enabled: true`, the header shows the session id being saved; `/sessions` and `/resume` work as in the line mode. See [Keep sessions and resume them](keep-sessions.md). |
| @@ -27,6 +27,7 @@ This guide shows how to run mini-me as a single full-screen window — the conve | |||
| 27 | ## Variants | 27 | ## Variants |
| 28 | 28 | ||
| 29 | - **Ask before every `bash` and file tool.** Set `yolo: false` in the YAML. The box is replaced by the question `? bash: rm -rf build` and four keys answer it: `a` allow once, `s` allow this tool for the session, `r` (or Esc) reject, `n` never allow this tool in this session. A rejected tool tells the model `[command rejected by the user]`. The default, `yolo: true`, runs tools without asking. See [How to confirm tool calls](confirm-tool-calls.md). | 29 | - **Ask before every `bash` and file tool.** Set `yolo: false` in the YAML. The box is replaced by the question `? bash: rm -rf build` and four keys answer it: `a` allow once, `s` allow this tool for the session, `r` (or Esc) reject, `n` never allow this tool in this session. A rejected tool tells the model `[command rejected by the user]`. The default, `yolo: true`, runs tools without asking. See [How to confirm tool calls](confirm-tool-calls.md). |
| 30 | +- **Ask for an answer in a given form.** Type `[` at the start of the box: a list of 13 meta-prompts opens — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Enter puts the prefix in the box, type the question after it. See [The four pickers](../reference/slash-commands.md#the-four-pickers). | ||
| 30 | - **Point the model at a file.** `@path` works exactly as in the line mode: existing paths are attached and echoed as `📎` lines. See [Point the model at a file with `@path`](attach-a-file.md). | 31 | - **Point the model at a file.** `@path` works exactly as in the line mode: existing paths are attached and echoed as `📎` lines. See [Point the model at a file with `@path`](attach-a-file.md). |
| 31 | - **See which agent answers.** The header and the label above each answer name the agent: `mm`, or `mm [<acp.title>]` when the config gives a title. While another agent works — `/ask-<name>`, or the `ask_agent` tool — the header names it with its model and `asked by` your agent, and its answer is labelled with its title (or its `mmConfigs` name); then both come back to your agent. See [How to let your agent call other agents](let-the-agent-call-other-agents.md). | 32 | - **See which agent answers.** The header and the label above each answer name the agent: `mm`, or `mm [<acp.title>]` when the config gives a title. While another agent works — `/ask-<name>`, or the `ask_agent` tool — the header names it with its model and `asked by` your agent, and its answer is labelled with its title (or its `mmConfigs` name); then both come back to your agent. See [How to let your agent call other agents](let-the-agent-call-other-agents.md). |
| 32 | - **Keep and resume sessions.** With `sessions.enabled: true`, the header shows the session id being saved; `/sessions` and `/resume` work as in the line mode. See [Keep sessions and resume them](keep-sessions.md). | 33 | - **Keep and resume sessions.** With `sessions.enabled: true`, the header shows the session id being saved; `/sessions` and `/resume` work as in the line mode. See [Keep sessions and resume them](keep-sessions.md). |
modified
docs/en/reference/cli.md +1 -1 | @@ -157,7 +157,7 @@ mm v0.1.7 | config: agent.llamacpp.yaml | provider: llamacpp | model: jetbrains/ | ||
| 157 | 157 | | Model name | The header shows a short form of the model identifier: registry host and organisation dropped, the `-gguf` format suffix dropped, the tag kept, capped at 28 characters (`huggingface.co/unsloth/qwen3.5-2b-gguf:Q4_K_M` → `qwen3.5-2b:Q4_K_M`). The full identifier is in the start-up banner, which the window keeps as the conversation's first line. | |
| 158 | 158 | | Layout | Header line (agent, model `@` provider, context use as `ctx N% (used/window)` or `ctx ~used (window unknown)`, `session <id>` when sessions are on); conversation with a scroll bar; rule with state and key hints; 3-row input box; status bar (`F1 help · Ctrl-Y copy · F2 mouse: … · Ctrl-C quit` on the left, `<version> · ⏱ <duration> · N msgs · N tools` on the right — the version is dropped when the two sides would not fit, so the key hints are never truncated to make room for it). | |
| 159 | 159 | | Tool calls | `‣ <tool> <detail> <status> <time>` where status is `… pending`, `… waiting for permission`, `… running`, `✓ done` or `✗ failed`; output folded to `previewLines` lines (`… N more line(s)`); `+`/`-` lines of `write_file`/`edit_file` output coloured. | |
| 160 | -| Pickers | `/` completes a command, `@` a path under the working directory, `$` a skill of the catalogue — the last two anywhere in a sentence, keeping their prefix. See [Slash commands](slash-commands.md#the-three-pickers). | | |
| 160 | +| Pickers | `/` completes a command, `@` a path under the working directory, `$` a skill of the catalogue — the last two anywhere in a sentence, keeping their prefix — and `[` at the start of the box a meta-prompt (`[Brief] `). See [Slash commands](slash-commands.md#the-four-pickers). | | |
| 161 | 161 | | Thinking | A thinking model's reasoning is its own `‣ thinking` entry, dim italic in a different colour, before the answer. Hidden with `showThinking: false`. | |
| 162 | 162 | | Errors | One line `[error: <explanation>]`; a cancelled turn shows `🔴 Generation aborted.`; each turn ends with `⚙ N command(s) [· 📝 N file op(s)] [· 📖 N skill(s)]`. | |
| 163 | 163 | | Permissions | With `yolo: false` (and for MCP tools marked `ask`), the box shows `? <tool title>` with `[a] allow once [s] allow <tool> for this session [r] reject [n] never <tool>` until answered (`Esc` = `r`); a turn cancelled while asking rejects. | |
| @@ -157,7 +157,7 @@ mm v0.1.7 | config: agent.llamacpp.yaml | provider: llamacpp | model: jetbrains/ | |||
| 157 | | Model name | The header shows a short form of the model identifier: registry host and organisation dropped, the `-gguf` format suffix dropped, the tag kept, capped at 28 characters (`huggingface.co/unsloth/qwen3.5-2b-gguf:Q4_K_M` → `qwen3.5-2b:Q4_K_M`). The full identifier is in the start-up banner, which the window keeps as the conversation's first line. | | 157 | | Model name | The header shows a short form of the model identifier: registry host and organisation dropped, the `-gguf` format suffix dropped, the tag kept, capped at 28 characters (`huggingface.co/unsloth/qwen3.5-2b-gguf:Q4_K_M` → `qwen3.5-2b:Q4_K_M`). The full identifier is in the start-up banner, which the window keeps as the conversation's first line. | |
| 158 | | Layout | Header line (agent, model `@` provider, context use as `ctx N% (used/window)` or `ctx ~used (window unknown)`, `session <id>` when sessions are on); conversation with a scroll bar; rule with state and key hints; 3-row input box; status bar (`F1 help · Ctrl-Y copy · F2 mouse: … · Ctrl-C quit` on the left, `<version> · ⏱ <duration> · N msgs · N tools` on the right — the version is dropped when the two sides would not fit, so the key hints are never truncated to make room for it). | | 158 | | Layout | Header line (agent, model `@` provider, context use as `ctx N% (used/window)` or `ctx ~used (window unknown)`, `session <id>` when sessions are on); conversation with a scroll bar; rule with state and key hints; 3-row input box; status bar (`F1 help · Ctrl-Y copy · F2 mouse: … · Ctrl-C quit` on the left, `<version> · ⏱ <duration> · N msgs · N tools` on the right — the version is dropped when the two sides would not fit, so the key hints are never truncated to make room for it). | |
| 159 | | Tool calls | `‣ <tool> <detail> <status> <time>` where status is `… pending`, `… waiting for permission`, `… running`, `✓ done` or `✗ failed`; output folded to `previewLines` lines (`… N more line(s)`); `+`/`-` lines of `write_file`/`edit_file` output coloured. | | 159 | | Tool calls | `‣ <tool> <detail> <status> <time>` where status is `… pending`, `… waiting for permission`, `… running`, `✓ done` or `✗ failed`; output folded to `previewLines` lines (`… N more line(s)`); `+`/`-` lines of `write_file`/`edit_file` output coloured. | |
| 160 | -| Pickers | `/` completes a command, `@` a path under the working directory, `$` a skill of the catalogue — the last two anywhere in a sentence, keeping their prefix. See [Slash commands](slash-commands.md#the-three-pickers). | | 160 | +| Pickers | `/` completes a command, `@` a path under the working directory, `$` a skill of the catalogue — the last two anywhere in a sentence, keeping their prefix — and `[` at the start of the box a meta-prompt (`[Brief] `). See [Slash commands](slash-commands.md#the-four-pickers). | |
| 161 | | Thinking | A thinking model's reasoning is its own `‣ thinking` entry, dim italic in a different colour, before the answer. Hidden with `showThinking: false`. | | 161 | | Thinking | A thinking model's reasoning is its own `‣ thinking` entry, dim italic in a different colour, before the answer. Hidden with `showThinking: false`. | |
| 162 | | Errors | One line `[error: <explanation>]`; a cancelled turn shows `🔴 Generation aborted.`; each turn ends with `⚙ N command(s) [· 📝 N file op(s)] [· 📖 N skill(s)]`. | | 162 | | Errors | One line `[error: <explanation>]`; a cancelled turn shows `🔴 Generation aborted.`; each turn ends with `⚙ N command(s) [· 📝 N file op(s)] [· 📖 N skill(s)]`. | |
| 163 | | Permissions | With `yolo: false` (and for MCP tools marked `ask`), the box shows `? <tool title>` with `[a] allow once [s] allow <tool> for this session [r] reject [n] never <tool>` until answered (`Esc` = `r`); a turn cancelled while asking rejects. | | 163 | | Permissions | With `yolo: false` (and for MCP tools marked `ask`), the box shows `? <tool title>` with `[a] allow once [s] allow <tool> for this session [r] reject [n] never <tool>` until answered (`Esc` = `r`); a turn cancelled while asking rejects. | |
modified
docs/en/reference/skill-format.md +1 -1 | @@ -59,7 +59,7 @@ The `keywords` of that example reach the catalogue as `what-time-is-it — Give | ||
| 59 | 59 | |
| 60 | 60 | ## Asking for a skill by name |
| 61 | 61 | |
| 62 | -`$name` in a question names a skill to carry out, with the rest of the line as its parameters — `use $greetings Bob`. The window's `$` picker writes it for you; typed by hand it works in the line mode and over ACP too. In an editor the skill also appears in the client's own `/` menu, with an input hint for its parameters — see [ACP — skills as commands](acp.md#skills-as-commands). It appends one line to what the model reads, and the model still makes the `read_skill` call itself. See [Slash commands — the three pickers](slash-commands.md#the-three-pickers). | |
| 62 | +`$name` in a question names a skill to carry out, with the rest of the line as its parameters — `use $greetings Bob`. The window's `$` picker writes it for you; typed by hand it works in the line mode and over ACP too. In an editor the skill also appears in the client's own `/` menu, with an input hint for its parameters — see [ACP — skills as commands](acp.md#skills-as-commands). It appends one line to what the model reads, and the model still makes the `read_skill` call itself. See [Slash commands — the three pickers](slash-commands.md#the-four-pickers). | |
| 63 | 63 | |
| 64 | 64 | ## Writing a skill the model will ACT on |
| 65 | 65 | |
| @@ -59,7 +59,7 @@ The `keywords` of that example reach the catalogue as `what-time-is-it — Give | |||
| 59 | 59 | ||
| 60 | ## Asking for a skill by name | 60 | ## Asking for a skill by name |
| 61 | 61 | ||
| 62 | -`$name` in a question names a skill to carry out, with the rest of the line as its parameters — `use $greetings Bob`. The window's `$` picker writes it for you; typed by hand it works in the line mode and over ACP too. In an editor the skill also appears in the client's own `/` menu, with an input hint for its parameters — see [ACP — skills as commands](acp.md#skills-as-commands). It appends one line to what the model reads, and the model still makes the `read_skill` call itself. See [Slash commands — the three pickers](slash-commands.md#the-three-pickers). | 62 | +`$name` in a question names a skill to carry out, with the rest of the line as its parameters — `use $greetings Bob`. The window's `$` picker writes it for you; typed by hand it works in the line mode and over ACP too. In an editor the skill also appears in the client's own `/` menu, with an input hint for its parameters — see [ACP — skills as commands](acp.md#skills-as-commands). It appends one line to what the model reads, and the model still makes the `read_skill` call itself. See [Slash commands — the three pickers](slash-commands.md#the-four-pickers). |
| 63 | 63 | ||
| 64 | ## Writing a skill the model will ACT on | 64 | ## Writing a skill the model will ACT on |
| 65 | 65 | ||
modified
docs/en/reference/slash-commands.md +7 -5 | @@ -108,7 +108,7 @@ Details and examples: [Point the model at a file with `@path`](../how-to/attach- | ||
| 108 | 108 | |
| 109 | 109 | ## Window mode keys |
| 110 | 110 | |
| 111 | -In `mm -tui` the same commands exist, plus `/shell` and `/queue`; `/abort` when idle prints `⚠️ No generation in progress.` as a notice, and the picker opened by `/` lists them — see [The three pickers](#the-three-pickers). | |
| 111 | +In `mm -tui` the same commands exist, plus `/shell` and `/queue`; `/abort` when idle prints `⚠️ No generation in progress.` as a notice, and the picker opened by `/` lists them — see [The four pickers](#the-four-pickers). | |
| 112 | 112 | |
| 113 | 113 | `/quit`, `/abort`, `/shell` and `/queue` take effect **immediately**, even while a turn is running. A question sent during a turn **steers** it: the model reads it after its current step, and the turn goes on (see the `Enter` key below). Every other command waits for the turn to end, because it needs the history the turn is still writing. See [Leaving a turn that will not stop](#leaving-a-turn-that-will-not-stop). |
| 114 | 114 | |
| @@ -186,23 +186,25 @@ The way out, in order: | ||
| 186 | 186 | |
| 187 | 187 | Leaving this way does not wait for the stuck job: the session file holds everything saved up to the last completed turn. |
| 188 | 188 | |
| 189 | -## The three pickers | |
| 189 | +## The four pickers | |
| 190 | 190 | |
| 191 | -A popup opens over the conversation as you type one of three triggers, and narrows as you type more. **Tab** completes the highlighted row, **↑/↓** move, **Esc** dismisses it until the text changes. | |
| 191 | +A popup opens over the conversation as you type one of four triggers, and narrows as you type more. **Tab** completes the highlighted row, **↑/↓** move, **Esc** dismisses it until the text changes. The rule under the conversation names the four while the box has the focus: `/ commands · @ files · $ skills · [ meta-prompts`. | |
| 192 | 192 | |
| 193 | 193 | | Trigger | Offers | Where it works | What Tab writes | |
| 194 | 194 | |---|---|---|---| |
| 195 | 195 | | `/` | the window's commands | only as the whole first word of the box — a command *is* the message | the command, replacing the box, with a space when it takes an argument | |
| 196 | 196 | | `@` | files and directories under the working directory | anywhere in a sentence | the path with its `@` kept. A **directory** gets a trailing `/` and no space, so Tab again walks down the tree; a **file** gets a space, so the sentence continues | |
| 197 | 197 | | `$` | the skills of the catalogue | anywhere in a sentence | `$name` — the `$` **kept** — plus a space, with the cursor after it, ready for the skill's parameters | |
| 198 | +| `[` | the 13 meta-prompts (ticket 270): style prefixes that steer the form of the answer — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — narrowed by the name typed after the `[`, spaces included (`[As a` → the three "As a …") | only as the **first character** of a one-line box, the cursor at its end, before any `]` | the prefix with its trailing space (`[Brief] `), replacing the box's `[…`, the cursor after it: type the question. The prefix is part of the question, sent and stored as typed | | |
| 198 | 199 | |
| 199 | -Three rules keep the popup out of the way: | |
| 200 | +Four rules keep the popup out of the way: | |
| 200 | 201 | |
| 201 | 202 | - A trigger glued to the end of a word is not a trigger: `bob@example.com` opens nothing, and neither does `5$`. |
| 202 | 203 | - `@` hides dotfiles until you type the `.` yourself. |
| 203 | 204 | - `$` offers nothing when no skill matches, so `echo $HOME` and `$PATH` are left alone. |
| 205 | +- `[` opens only at the very start of the box: `see [the docs]` in a sentence opens nothing, nor does `[x] done` once its `]` is typed. Esc closes it and keeps a literal `[`; a name that matches nothing (`[1, 2]`, `[Bug]` once past `[B`) closes it too. | |
| 204 | 206 | |
| 205 | -`Enter` on a `@` or `$` token completes it rather than sending: the message is not finished. `Enter` on a command whose name is already complete sends it. | |
| 207 | +`Enter` on a `@`, `$` or `[` token completes it rather than sending: the message is not finished. `Enter` on a command whose name is already complete sends it. | |
| 206 | 208 | |
| 207 | 209 | ### What `$name` does when sent |
| 208 | 210 | |
| @@ -108,7 +108,7 @@ Details and examples: [Point the model at a file with `@path`](../how-to/attach- | |||
| 108 | 108 | ||
| 109 | ## Window mode keys | 109 | ## Window mode keys |
| 110 | 110 | ||
| 111 | -In `mm -tui` the same commands exist, plus `/shell` and `/queue`; `/abort` when idle prints `⚠️ No generation in progress.` as a notice, and the picker opened by `/` lists them — see [The three pickers](#the-three-pickers). | 111 | +In `mm -tui` the same commands exist, plus `/shell` and `/queue`; `/abort` when idle prints `⚠️ No generation in progress.` as a notice, and the picker opened by `/` lists them — see [The four pickers](#the-four-pickers). |
| 112 | 112 | ||
| 113 | `/quit`, `/abort`, `/shell` and `/queue` take effect **immediately**, even while a turn is running. A question sent during a turn **steers** it: the model reads it after its current step, and the turn goes on (see the `Enter` key below). Every other command waits for the turn to end, because it needs the history the turn is still writing. See [Leaving a turn that will not stop](#leaving-a-turn-that-will-not-stop). | 113 | `/quit`, `/abort`, `/shell` and `/queue` take effect **immediately**, even while a turn is running. A question sent during a turn **steers** it: the model reads it after its current step, and the turn goes on (see the `Enter` key below). Every other command waits for the turn to end, because it needs the history the turn is still writing. See [Leaving a turn that will not stop](#leaving-a-turn-that-will-not-stop). |
| 114 | 114 | ||
| @@ -186,23 +186,25 @@ The way out, in order: | |||
| 186 | 186 | ||
| 187 | Leaving this way does not wait for the stuck job: the session file holds everything saved up to the last completed turn. | 187 | Leaving this way does not wait for the stuck job: the session file holds everything saved up to the last completed turn. |
| 188 | 188 | ||
| 189 | -## The three pickers | 189 | +## The four pickers |
| 190 | 190 | ||
| 191 | -A popup opens over the conversation as you type one of three triggers, and narrows as you type more. **Tab** completes the highlighted row, **↑/↓** move, **Esc** dismisses it until the text changes. | 191 | +A popup opens over the conversation as you type one of four triggers, and narrows as you type more. **Tab** completes the highlighted row, **↑/↓** move, **Esc** dismisses it until the text changes. The rule under the conversation names the four while the box has the focus: `/ commands · @ files · $ skills · [ meta-prompts`. |
| 192 | 192 | ||
| 193 | | Trigger | Offers | Where it works | What Tab writes | | 193 | | Trigger | Offers | Where it works | What Tab writes | |
| 194 | |---|---|---|---| | 194 | |---|---|---|---| |
| 195 | | `/` | the window's commands | only as the whole first word of the box — a command *is* the message | the command, replacing the box, with a space when it takes an argument | | 195 | | `/` | the window's commands | only as the whole first word of the box — a command *is* the message | the command, replacing the box, with a space when it takes an argument | |
| 196 | | `@` | files and directories under the working directory | anywhere in a sentence | the path with its `@` kept. A **directory** gets a trailing `/` and no space, so Tab again walks down the tree; a **file** gets a space, so the sentence continues | | 196 | | `@` | files and directories under the working directory | anywhere in a sentence | the path with its `@` kept. A **directory** gets a trailing `/` and no space, so Tab again walks down the tree; a **file** gets a space, so the sentence continues | |
| 197 | | `$` | the skills of the catalogue | anywhere in a sentence | `$name` — the `$` **kept** — plus a space, with the cursor after it, ready for the skill's parameters | | 197 | | `$` | the skills of the catalogue | anywhere in a sentence | `$name` — the `$` **kept** — plus a space, with the cursor after it, ready for the skill's parameters | |
| 198 | +| `[` | the 13 meta-prompts (ticket 270): style prefixes that steer the form of the answer — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — narrowed by the name typed after the `[`, spaces included (`[As a` → the three "As a …") | only as the **first character** of a one-line box, the cursor at its end, before any `]` | the prefix with its trailing space (`[Brief] `), replacing the box's `[…`, the cursor after it: type the question. The prefix is part of the question, sent and stored as typed | | ||
| 198 | 199 | ||
| 199 | -Three rules keep the popup out of the way: | 200 | +Four rules keep the popup out of the way: |
| 200 | 201 | ||
| 201 | - A trigger glued to the end of a word is not a trigger: `bob@example.com` opens nothing, and neither does `5$`. | 202 | - A trigger glued to the end of a word is not a trigger: `bob@example.com` opens nothing, and neither does `5$`. |
| 202 | - `@` hides dotfiles until you type the `.` yourself. | 203 | - `@` hides dotfiles until you type the `.` yourself. |
| 203 | - `$` offers nothing when no skill matches, so `echo $HOME` and `$PATH` are left alone. | 204 | - `$` offers nothing when no skill matches, so `echo $HOME` and `$PATH` are left alone. |
| 205 | +- `[` opens only at the very start of the box: `see [the docs]` in a sentence opens nothing, nor does `[x] done` once its `]` is typed. Esc closes it and keeps a literal `[`; a name that matches nothing (`[1, 2]`, `[Bug]` once past `[B`) closes it too. | ||
| 204 | 206 | ||
| 205 | -`Enter` on a `@` or `$` token completes it rather than sending: the message is not finished. `Enter` on a command whose name is already complete sends it. | 207 | +`Enter` on a `@`, `$` or `[` token completes it rather than sending: the message is not finished. `Enter` on a command whose name is already complete sends it. |
| 206 | 208 | ||
| 207 | ### What `$name` does when sent | 209 | ### What `$name` does when sent |
| 208 | 210 | ||
modified
docs/fr/how-to/use-the-window-mode.md +1 -0 | @@ -27,6 +27,7 @@ Ce guide montre comment lancer mini-me dans une fenêtre unique en plein écran | ||
| 27 | 27 | ## Variantes |
| 28 | 28 | |
| 29 | 29 | - **Demander avant chaque `bash` et chaque outil de fichier.** Mettez `yolo: false` dans le YAML. La zone de saisie est remplacée par la question `? bash: rm -rf build` et quatre touches y répondent : `a` autoriser une fois, `s` autoriser cet outil pour la session, `r` (ou Échap) refuser, `n` ne jamais autoriser cet outil dans cette session. Un outil refusé dit au modèle `[command rejected by the user]`. La valeur par défaut, `yolo: true`, exécute les outils sans demander. Voir [Confirmer les appels d'outils](confirm-tool-calls.md). |
| 30 | +- **Demander une réponse sous une forme donnée.** Tapez `[` en début de zone : une liste de 13 méta-prompts s'ouvre — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Entrée met le préfixe dans la zone, tapez la question après. Voir [Les quatre sélecteurs](../reference/slash-commands.md#les-quatre-sélecteurs). | |
| 30 | 31 | - **Désigner un fichier au modèle.** `@chemin` fonctionne exactement comme dans le mode ligne : les chemins existants sont attachés et repris en lignes `📎`. Voir [Désigner un fichier au modèle avec `@chemin`](attach-a-file.md). |
| 31 | 32 | - **Voir quel agent répond.** L'en-tête et l'étiquette au-dessus de chaque réponse nomment l'agent : `mm`, ou `mm [<acp.title>]` quand la configuration donne un titre. Pendant qu'un autre agent travaille — `/ask-<nom>`, ou l'outil `ask_agent` — l'en-tête le nomme avec son modèle et `asked by` votre agent, et sa réponse porte son titre (ou son nom dans `mmConfigs`) ; puis les deux reviennent à votre agent. Voir [Laisser votre agent appeler d'autres agents](let-the-agent-call-other-agents.md). |
| 32 | 33 | - **Conserver et reprendre des sessions.** Avec `sessions.enabled: true`, l'en-tête affiche l'identifiant de la session enregistrée ; `/sessions` et `/resume` fonctionnent comme dans le mode ligne. Voir [Conserver les sessions et les reprendre](keep-sessions.md). |
| @@ -27,6 +27,7 @@ Ce guide montre comment lancer mini-me dans une fenêtre unique en plein écran | |||
| 27 | ## Variantes | 27 | ## Variantes |
| 28 | 28 | ||
| 29 | - **Demander avant chaque `bash` et chaque outil de fichier.** Mettez `yolo: false` dans le YAML. La zone de saisie est remplacée par la question `? bash: rm -rf build` et quatre touches y répondent : `a` autoriser une fois, `s` autoriser cet outil pour la session, `r` (ou Échap) refuser, `n` ne jamais autoriser cet outil dans cette session. Un outil refusé dit au modèle `[command rejected by the user]`. La valeur par défaut, `yolo: true`, exécute les outils sans demander. Voir [Confirmer les appels d'outils](confirm-tool-calls.md). | 29 | - **Demander avant chaque `bash` et chaque outil de fichier.** Mettez `yolo: false` dans le YAML. La zone de saisie est remplacée par la question `? bash: rm -rf build` et quatre touches y répondent : `a` autoriser une fois, `s` autoriser cet outil pour la session, `r` (ou Échap) refuser, `n` ne jamais autoriser cet outil dans cette session. Un outil refusé dit au modèle `[command rejected by the user]`. La valeur par défaut, `yolo: true`, exécute les outils sans demander. Voir [Confirmer les appels d'outils](confirm-tool-calls.md). |
| 30 | +- **Demander une réponse sous une forme donnée.** Tapez `[` en début de zone : une liste de 13 méta-prompts s'ouvre — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Entrée met le préfixe dans la zone, tapez la question après. Voir [Les quatre sélecteurs](../reference/slash-commands.md#les-quatre-sélecteurs). | ||
| 30 | - **Désigner un fichier au modèle.** `@chemin` fonctionne exactement comme dans le mode ligne : les chemins existants sont attachés et repris en lignes `📎`. Voir [Désigner un fichier au modèle avec `@chemin`](attach-a-file.md). | 31 | - **Désigner un fichier au modèle.** `@chemin` fonctionne exactement comme dans le mode ligne : les chemins existants sont attachés et repris en lignes `📎`. Voir [Désigner un fichier au modèle avec `@chemin`](attach-a-file.md). |
| 31 | - **Voir quel agent répond.** L'en-tête et l'étiquette au-dessus de chaque réponse nomment l'agent : `mm`, ou `mm [<acp.title>]` quand la configuration donne un titre. Pendant qu'un autre agent travaille — `/ask-<nom>`, ou l'outil `ask_agent` — l'en-tête le nomme avec son modèle et `asked by` votre agent, et sa réponse porte son titre (ou son nom dans `mmConfigs`) ; puis les deux reviennent à votre agent. Voir [Laisser votre agent appeler d'autres agents](let-the-agent-call-other-agents.md). | 32 | - **Voir quel agent répond.** L'en-tête et l'étiquette au-dessus de chaque réponse nomment l'agent : `mm`, ou `mm [<acp.title>]` quand la configuration donne un titre. Pendant qu'un autre agent travaille — `/ask-<nom>`, ou l'outil `ask_agent` — l'en-tête le nomme avec son modèle et `asked by` votre agent, et sa réponse porte son titre (ou son nom dans `mmConfigs`) ; puis les deux reviennent à votre agent. Voir [Laisser votre agent appeler d'autres agents](let-the-agent-call-other-agents.md). |
| 32 | - **Conserver et reprendre des sessions.** Avec `sessions.enabled: true`, l'en-tête affiche l'identifiant de la session enregistrée ; `/sessions` et `/resume` fonctionnent comme dans le mode ligne. Voir [Conserver les sessions et les reprendre](keep-sessions.md). | 33 | - **Conserver et reprendre des sessions.** Avec `sessions.enabled: true`, l'en-tête affiche l'identifiant de la session enregistrée ; `/sessions` et `/resume` fonctionnent comme dans le mode ligne. Voir [Conserver les sessions et les reprendre](keep-sessions.md). |
modified
docs/fr/reference/cli.md +1 -1 | @@ -157,7 +157,7 @@ mm v0.1.7 | config: agent.llamacpp.yaml | provider: llamacpp | model: jetbrains/ | ||
| 157 | 157 | | Nom du modèle | L'en-tête affiche une forme courte de l'identifiant : hôte du registre et organisation retirés, suffixe de format `-gguf` retiré, tag conservé, plafonné à 28 caractères (`huggingface.co/unsloth/qwen3.5-2b-gguf:Q4_K_M` → `qwen3.5-2b:Q4_K_M`). L'identifiant complet figure dans la bannière de démarrage, que la fenêtre conserve comme première ligne de la conversation. | |
| 158 | 158 | | Disposition | Ligne d'en-tête (agent, modèle `@` fournisseur, usage du contexte en `ctx N% (utilisé/fenêtre)` ou `ctx ~utilisé (window unknown)`, `session <id>` quand les sessions sont actives) ; conversation avec barre de défilement ; règle avec l'état et les rappels de touches ; zone de saisie de 3 lignes ; barre d'état (`F1 help · Ctrl-Y copy · F2 mouse: … · Ctrl-C quit` à gauche, `<version> · ⏱ <durée> · N msgs · N tools` à droite — la version disparaît quand les deux côtés ne tiennent pas, pour que les rappels de touches ne soient jamais tronqués à cause d'elle). | |
| 159 | 159 | | Appels d'outils | `‣ <outil> <détail> <statut> <durée>` où le statut est `… pending`, `… waiting for permission`, `… running`, `✓ done` ou `✗ failed` ; sortie repliée à `previewLines` lignes (`… N more line(s)`) ; lignes `+`/`-` des sorties de `write_file`/`edit_file` colorées. | |
| 160 | -| Sélecteurs | `/` complète une commande, `@` un chemin sous le répertoire de travail, `$` un skill du catalogue — les deux derniers n'importe où dans une phrase, en conservant leur préfixe. Voir [Commandes slash](slash-commands.md#les-trois-sélecteurs). | | |
| 160 | +| Sélecteurs | `/` complète une commande, `@` un chemin sous le répertoire de travail, `$` un skill du catalogue — les deux derniers n'importe où dans une phrase, en conservant leur préfixe — et `[` en début de zone un méta-prompt (`[Brief] `). Voir [Commandes slash](slash-commands.md#les-quatre-sélecteurs). | | |
| 161 | 161 | | Réflexion | Le raisonnement d'un modèle à raisonnement forme son entrée `‣ thinking`, grisée, en italique et d'une autre couleur, avant la réponse. Masquée avec `showThinking: false`. | |
| 162 | 162 | | Erreurs | Une ligne `[error: <explication>]` ; un tour annulé affiche `🔴 Generation aborted.` ; chaque tour se termine par `⚙ N command(s) [· 📝 N file op(s)] [· 📖 N skill(s)]`. | |
| 163 | 163 | | Permissions | Avec `yolo: false` (et pour les outils MCP marqués `ask`), la zone affiche `? <titre de l'outil>` et `[a] allow once [s] allow <outil> for this session [r] reject [n] never <outil>` jusqu'à la réponse (`Échap` = `r`) ; un tour annulé pendant la question refuse. | |
| @@ -157,7 +157,7 @@ mm v0.1.7 | config: agent.llamacpp.yaml | provider: llamacpp | model: jetbrains/ | |||
| 157 | | Nom du modèle | L'en-tête affiche une forme courte de l'identifiant : hôte du registre et organisation retirés, suffixe de format `-gguf` retiré, tag conservé, plafonné à 28 caractères (`huggingface.co/unsloth/qwen3.5-2b-gguf:Q4_K_M` → `qwen3.5-2b:Q4_K_M`). L'identifiant complet figure dans la bannière de démarrage, que la fenêtre conserve comme première ligne de la conversation. | | 157 | | Nom du modèle | L'en-tête affiche une forme courte de l'identifiant : hôte du registre et organisation retirés, suffixe de format `-gguf` retiré, tag conservé, plafonné à 28 caractères (`huggingface.co/unsloth/qwen3.5-2b-gguf:Q4_K_M` → `qwen3.5-2b:Q4_K_M`). L'identifiant complet figure dans la bannière de démarrage, que la fenêtre conserve comme première ligne de la conversation. | |
| 158 | | Disposition | Ligne d'en-tête (agent, modèle `@` fournisseur, usage du contexte en `ctx N% (utilisé/fenêtre)` ou `ctx ~utilisé (window unknown)`, `session <id>` quand les sessions sont actives) ; conversation avec barre de défilement ; règle avec l'état et les rappels de touches ; zone de saisie de 3 lignes ; barre d'état (`F1 help · Ctrl-Y copy · F2 mouse: … · Ctrl-C quit` à gauche, `<version> · ⏱ <durée> · N msgs · N tools` à droite — la version disparaît quand les deux côtés ne tiennent pas, pour que les rappels de touches ne soient jamais tronqués à cause d'elle). | | 158 | | Disposition | Ligne d'en-tête (agent, modèle `@` fournisseur, usage du contexte en `ctx N% (utilisé/fenêtre)` ou `ctx ~utilisé (window unknown)`, `session <id>` quand les sessions sont actives) ; conversation avec barre de défilement ; règle avec l'état et les rappels de touches ; zone de saisie de 3 lignes ; barre d'état (`F1 help · Ctrl-Y copy · F2 mouse: … · Ctrl-C quit` à gauche, `<version> · ⏱ <durée> · N msgs · N tools` à droite — la version disparaît quand les deux côtés ne tiennent pas, pour que les rappels de touches ne soient jamais tronqués à cause d'elle). | |
| 159 | | Appels d'outils | `‣ <outil> <détail> <statut> <durée>` où le statut est `… pending`, `… waiting for permission`, `… running`, `✓ done` ou `✗ failed` ; sortie repliée à `previewLines` lignes (`… N more line(s)`) ; lignes `+`/`-` des sorties de `write_file`/`edit_file` colorées. | | 159 | | Appels d'outils | `‣ <outil> <détail> <statut> <durée>` où le statut est `… pending`, `… waiting for permission`, `… running`, `✓ done` ou `✗ failed` ; sortie repliée à `previewLines` lignes (`… N more line(s)`) ; lignes `+`/`-` des sorties de `write_file`/`edit_file` colorées. | |
| 160 | -| Sélecteurs | `/` complète une commande, `@` un chemin sous le répertoire de travail, `$` un skill du catalogue — les deux derniers n'importe où dans une phrase, en conservant leur préfixe. Voir [Commandes slash](slash-commands.md#les-trois-sélecteurs). | | 160 | +| Sélecteurs | `/` complète une commande, `@` un chemin sous le répertoire de travail, `$` un skill du catalogue — les deux derniers n'importe où dans une phrase, en conservant leur préfixe — et `[` en début de zone un méta-prompt (`[Brief] `). Voir [Commandes slash](slash-commands.md#les-quatre-sélecteurs). | |
| 161 | | Réflexion | Le raisonnement d'un modèle à raisonnement forme son entrée `‣ thinking`, grisée, en italique et d'une autre couleur, avant la réponse. Masquée avec `showThinking: false`. | | 161 | | Réflexion | Le raisonnement d'un modèle à raisonnement forme son entrée `‣ thinking`, grisée, en italique et d'une autre couleur, avant la réponse. Masquée avec `showThinking: false`. | |
| 162 | | Erreurs | Une ligne `[error: <explication>]` ; un tour annulé affiche `🔴 Generation aborted.` ; chaque tour se termine par `⚙ N command(s) [· 📝 N file op(s)] [· 📖 N skill(s)]`. | | 162 | | Erreurs | Une ligne `[error: <explication>]` ; un tour annulé affiche `🔴 Generation aborted.` ; chaque tour se termine par `⚙ N command(s) [· 📝 N file op(s)] [· 📖 N skill(s)]`. | |
| 163 | | Permissions | Avec `yolo: false` (et pour les outils MCP marqués `ask`), la zone affiche `? <titre de l'outil>` et `[a] allow once [s] allow <outil> for this session [r] reject [n] never <outil>` jusqu'à la réponse (`Échap` = `r`) ; un tour annulé pendant la question refuse. | | 163 | | Permissions | Avec `yolo: false` (et pour les outils MCP marqués `ask`), la zone affiche `? <titre de l'outil>` et `[a] allow once [s] allow <outil> for this session [r] reject [n] never <outil>` jusqu'à la réponse (`Échap` = `r`) ; un tour annulé pendant la question refuse. | |
modified
docs/fr/reference/skill-format.md +1 -1 | @@ -58,7 +58,7 @@ Les `keywords` de cet exemple arrivent dans le catalogue sous la forme `what-tim | ||
| 58 | 58 | |
| 59 | 59 | ## Demander un skill par son nom |
| 60 | 60 | |
| 61 | -`$nom` dans une question désigne un skill à exécuter, avec le reste de la ligne comme paramètres — `use $greetings Bob`. Le sélecteur `$` de la fenêtre l'écrit pour vous ; tapé à la main il marche aussi en mode ligne et en ACP. Dans un éditeur, le skill apparaît en plus dans le menu `/` du client, avec une aide de saisie pour ses paramètres — voir [ACP — les skills comme commandes](acp.md#les-skills-comme-commandes). Il ajoute une ligne à ce que lit le modèle, et c'est toujours le modèle qui fait l'appel `read_skill`. Voir [Commandes slash — les trois sélecteurs](slash-commands.md#les-trois-sélecteurs). | |
| 61 | +`$nom` dans une question désigne un skill à exécuter, avec le reste de la ligne comme paramètres — `use $greetings Bob`. Le sélecteur `$` de la fenêtre l'écrit pour vous ; tapé à la main il marche aussi en mode ligne et en ACP. Dans un éditeur, le skill apparaît en plus dans le menu `/` du client, avec une aide de saisie pour ses paramètres — voir [ACP — les skills comme commandes](acp.md#les-skills-comme-commandes). Il ajoute une ligne à ce que lit le modèle, et c'est toujours le modèle qui fait l'appel `read_skill`. Voir [Commandes slash — les trois sélecteurs](slash-commands.md#les-quatre-sélecteurs). | |
| 62 | 62 | |
| 63 | 63 | ## Écrire un skill que le modèle va EXÉCUTER |
| 64 | 64 | |
| @@ -58,7 +58,7 @@ Les `keywords` de cet exemple arrivent dans le catalogue sous la forme `what-tim | |||
| 58 | 58 | ||
| 59 | ## Demander un skill par son nom | 59 | ## Demander un skill par son nom |
| 60 | 60 | ||
| 61 | -`$nom` dans une question désigne un skill à exécuter, avec le reste de la ligne comme paramètres — `use $greetings Bob`. Le sélecteur `$` de la fenêtre l'écrit pour vous ; tapé à la main il marche aussi en mode ligne et en ACP. Dans un éditeur, le skill apparaît en plus dans le menu `/` du client, avec une aide de saisie pour ses paramètres — voir [ACP — les skills comme commandes](acp.md#les-skills-comme-commandes). Il ajoute une ligne à ce que lit le modèle, et c'est toujours le modèle qui fait l'appel `read_skill`. Voir [Commandes slash — les trois sélecteurs](slash-commands.md#les-trois-sélecteurs). | 61 | +`$nom` dans une question désigne un skill à exécuter, avec le reste de la ligne comme paramètres — `use $greetings Bob`. Le sélecteur `$` de la fenêtre l'écrit pour vous ; tapé à la main il marche aussi en mode ligne et en ACP. Dans un éditeur, le skill apparaît en plus dans le menu `/` du client, avec une aide de saisie pour ses paramètres — voir [ACP — les skills comme commandes](acp.md#les-skills-comme-commandes). Il ajoute une ligne à ce que lit le modèle, et c'est toujours le modèle qui fait l'appel `read_skill`. Voir [Commandes slash — les trois sélecteurs](slash-commands.md#les-quatre-sélecteurs). |
| 62 | 62 | ||
| 63 | ## Écrire un skill que le modèle va EXÉCUTER | 63 | ## Écrire un skill que le modèle va EXÉCUTER |
| 64 | 64 | ||
modified
docs/fr/reference/slash-commands.md +6 -4 | @@ -187,23 +187,25 @@ La sortie, dans l'ordre : | ||
| 187 | 187 | |
| 188 | 188 | Sortir ainsi n'attend pas le travail bloqué : le fichier de session contient tout ce qui a été enregistré jusqu'au dernier tour terminé. |
| 189 | 189 | |
| 190 | -## Les trois sélecteurs | |
| 190 | +## Les quatre sélecteurs | |
| 191 | 191 | |
| 192 | -Une fenêtre surgissante s'ouvre au-dessus de la conversation dès que vous tapez l'un des trois déclencheurs, et se resserre à mesure que vous tapez. **Tab** complète la ligne surlignée, **↑/↓** déplacent, **Échap** la referme jusqu'à ce que le texte change. | |
| 192 | +Une fenêtre surgissante s'ouvre au-dessus de la conversation dès que vous tapez l'un des quatre déclencheurs, et se resserre à mesure que vous tapez. **Tab** complète la ligne surlignée, **↑/↓** déplacent, **Échap** la referme jusqu'à ce que le texte change. La règle sous la conversation nomme les quatre quand la zone a le focus : `/ commands · @ files · $ skills · [ meta-prompts`. | |
| 193 | 193 | |
| 194 | 194 | | Déclencheur | Propose | Où ça marche | Ce que Tab écrit | |
| 195 | 195 | |---|---|---|---| |
| 196 | 196 | | `/` | les commandes de la fenêtre | seulement comme premier mot entier de la zone — une commande *est* le message | la commande, en remplaçant la zone, avec une espace si elle prend un argument | |
| 197 | 197 | | `@` | fichiers et dossiers sous le répertoire de travail | n'importe où dans une phrase | le chemin avec son `@` conservé. Un **dossier** reçoit un `/` final et pas d'espace, donc Tab à nouveau descend dans l'arbre ; un **fichier** reçoit une espace, donc la phrase continue | |
| 198 | 198 | | `$` | les skills du catalogue | n'importe où dans une phrase | `$nom` — le `$` **conservé** — plus une espace, curseur après, prêt pour les paramètres du skill | |
| 199 | +| `[` | les 13 méta-prompts (ticket 270) : des préfixes de style qui orientent la forme de la réponse — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — resserrés par le nom tapé après le `[`, espaces compris (`[As a` → les trois « As a … ») | seulement comme **premier caractère** d'une zone d'une ligne, curseur à la fin, avant tout `]` | le préfixe avec son espace finale (`[Brief] `), à la place du `[…` de la zone, curseur après : tapez la question. Le préfixe fait partie de la question, envoyé et enregistré tel quel | | |
| 199 | 200 | |
| 200 | -Trois règles gardent la fenêtre à sa place : | |
| 201 | +Quatre règles gardent la fenêtre à sa place : | |
| 201 | 202 | |
| 202 | 203 | - Un déclencheur collé à la fin d'un mot n'en est pas un : `bob@example.com` n'ouvre rien, ni `5$`. |
| 203 | 204 | - `@` masque les fichiers cachés jusqu'à ce que vous tapiez le `.` vous-même. |
| 204 | 205 | - `$` ne propose rien quand aucun skill ne correspond, donc `echo $HOME` et `$PATH` sont laissés tranquilles. |
| 206 | +- `[` ne s'ouvre qu'au tout début de la zone : `voir [la doc]` dans une phrase n'ouvre rien, ni `[x] fait` une fois son `]` tapé. Échap la referme et garde un `[` littéral ; un nom qui ne correspond à rien (`[1, 2]`, `[Bug]` passé `[B`) la referme aussi. | |
| 205 | 207 | |
| 206 | -`Entrée` sur un token `@` ou `$` le complète au lieu d'envoyer : le message n'est pas fini. `Entrée` sur une commande dont le nom est déjà complet l'envoie. | |
| 208 | +`Entrée` sur un token `@`, `$` ou `[` le complète au lieu d'envoyer : le message n'est pas fini. `Entrée` sur une commande dont le nom est déjà complet l'envoie. | |
| 207 | 209 | |
| 208 | 210 | ### Ce que fait `$nom` à l'envoi |
| 209 | 211 | |
| @@ -187,23 +187,25 @@ La sortie, dans l'ordre : | |||
| 187 | 187 | ||
| 188 | Sortir ainsi n'attend pas le travail bloqué : le fichier de session contient tout ce qui a été enregistré jusqu'au dernier tour terminé. | 188 | Sortir ainsi n'attend pas le travail bloqué : le fichier de session contient tout ce qui a été enregistré jusqu'au dernier tour terminé. |
| 189 | 189 | ||
| 190 | -## Les trois sélecteurs | 190 | +## Les quatre sélecteurs |
| 191 | 191 | ||
| 192 | -Une fenêtre surgissante s'ouvre au-dessus de la conversation dès que vous tapez l'un des trois déclencheurs, et se resserre à mesure que vous tapez. **Tab** complète la ligne surlignée, **↑/↓** déplacent, **Échap** la referme jusqu'à ce que le texte change. | 192 | +Une fenêtre surgissante s'ouvre au-dessus de la conversation dès que vous tapez l'un des quatre déclencheurs, et se resserre à mesure que vous tapez. **Tab** complète la ligne surlignée, **↑/↓** déplacent, **Échap** la referme jusqu'à ce que le texte change. La règle sous la conversation nomme les quatre quand la zone a le focus : `/ commands · @ files · $ skills · [ meta-prompts`. |
| 193 | 193 | ||
| 194 | | Déclencheur | Propose | Où ça marche | Ce que Tab écrit | | 194 | | Déclencheur | Propose | Où ça marche | Ce que Tab écrit | |
| 195 | |---|---|---|---| | 195 | |---|---|---|---| |
| 196 | | `/` | les commandes de la fenêtre | seulement comme premier mot entier de la zone — une commande *est* le message | la commande, en remplaçant la zone, avec une espace si elle prend un argument | | 196 | | `/` | les commandes de la fenêtre | seulement comme premier mot entier de la zone — une commande *est* le message | la commande, en remplaçant la zone, avec une espace si elle prend un argument | |
| 197 | | `@` | fichiers et dossiers sous le répertoire de travail | n'importe où dans une phrase | le chemin avec son `@` conservé. Un **dossier** reçoit un `/` final et pas d'espace, donc Tab à nouveau descend dans l'arbre ; un **fichier** reçoit une espace, donc la phrase continue | | 197 | | `@` | fichiers et dossiers sous le répertoire de travail | n'importe où dans une phrase | le chemin avec son `@` conservé. Un **dossier** reçoit un `/` final et pas d'espace, donc Tab à nouveau descend dans l'arbre ; un **fichier** reçoit une espace, donc la phrase continue | |
| 198 | | `$` | les skills du catalogue | n'importe où dans une phrase | `$nom` — le `$` **conservé** — plus une espace, curseur après, prêt pour les paramètres du skill | | 198 | | `$` | les skills du catalogue | n'importe où dans une phrase | `$nom` — le `$` **conservé** — plus une espace, curseur après, prêt pour les paramètres du skill | |
| 199 | +| `[` | les 13 méta-prompts (ticket 270) : des préfixes de style qui orientent la forme de la réponse — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — resserrés par le nom tapé après le `[`, espaces compris (`[As a` → les trois « As a … ») | seulement comme **premier caractère** d'une zone d'une ligne, curseur à la fin, avant tout `]` | le préfixe avec son espace finale (`[Brief] `), à la place du `[…` de la zone, curseur après : tapez la question. Le préfixe fait partie de la question, envoyé et enregistré tel quel | | ||
| 199 | 200 | ||
| 200 | -Trois règles gardent la fenêtre à sa place : | 201 | +Quatre règles gardent la fenêtre à sa place : |
| 201 | 202 | ||
| 202 | - Un déclencheur collé à la fin d'un mot n'en est pas un : `bob@example.com` n'ouvre rien, ni `5$`. | 203 | - Un déclencheur collé à la fin d'un mot n'en est pas un : `bob@example.com` n'ouvre rien, ni `5$`. |
| 203 | - `@` masque les fichiers cachés jusqu'à ce que vous tapiez le `.` vous-même. | 204 | - `@` masque les fichiers cachés jusqu'à ce que vous tapiez le `.` vous-même. |
| 204 | - `$` ne propose rien quand aucun skill ne correspond, donc `echo $HOME` et `$PATH` sont laissés tranquilles. | 205 | - `$` ne propose rien quand aucun skill ne correspond, donc `echo $HOME` et `$PATH` sont laissés tranquilles. |
| 206 | +- `[` ne s'ouvre qu'au tout début de la zone : `voir [la doc]` dans une phrase n'ouvre rien, ni `[x] fait` une fois son `]` tapé. Échap la referme et garde un `[` littéral ; un nom qui ne correspond à rien (`[1, 2]`, `[Bug]` passé `[B`) la referme aussi. | ||
| 205 | 207 | ||
| 206 | -`Entrée` sur un token `@` ou `$` le complète au lieu d'envoyer : le message n'est pas fini. `Entrée` sur une commande dont le nom est déjà complet l'envoie. | 208 | +`Entrée` sur un token `@`, `$` ou `[` le complète au lieu d'envoyer : le message n'est pas fini. `Entrée` sur une commande dont le nom est déjà complet l'envoie. |
| 207 | 209 | ||
| 208 | ### Ce que fait `$nom` à l'envoi | 210 | ### Ce que fait `$nom` à l'envoi |
| 209 | 211 | ||
added
internal/metaprompt/metaprompt.go +74 -0 | new file mode 100644 | ||
| @@ -0,0 +1,74 @@ | ||
| 1 | +// Package metaprompt is the catalogue of meta-prompts (ticket 270): short | |
| 2 | +// bracketed prefixes put before a question to steer the FORM of the answer — | |
| 3 | +// "[Brief] What is machine learning?". The prefix means nothing to mm: it is | |
| 4 | +// part of the user's message and the model reads it as an inline | |
| 5 | +// instruction. No front end and no part of the agent loop treats it apart. | |
| 6 | +// | |
| 7 | +// The catalogue is hard-coded (the user's decision): thirteen entries, the | |
| 8 | +// ones pk offers. The window lists them in its `[` picker — the only way in | |
| 9 | +// (no slash command): the line mode and an editor take a prefix typed by | |
| 10 | +// hand, which the model reads just the same. | |
| 11 | +// | |
| 12 | +// for _, m := range metaprompt.Matching("as") { fmt.Println(m.Label()) } | |
| 13 | +// // [As a Story] [As a Poem] [As a Recipe] | |
| 14 | +package metaprompt | |
| 15 | + | |
| 16 | +import "strings" | |
| 17 | + | |
| 18 | +// MetaPrompt is one entry of the catalogue. | |
| 19 | +type MetaPrompt struct { | |
| 20 | + // Token names it in code and tests: kebab-case, "brief". | |
| 21 | + Token string | |
| 22 | + // Prefix is what goes before the question, ending with ONE space: | |
| 23 | + // "[Brief] ". | |
| 24 | + Prefix string | |
| 25 | + // Description is the short label shown beside it. | |
| 26 | + Description string | |
| 27 | +} | |
| 28 | + | |
| 29 | +// Label is the prefix without its trailing space: "[Brief]". | |
| 30 | +func (m MetaPrompt) Label() string { return strings.TrimSuffix(m.Prefix, " ") } | |
| 31 | + | |
| 32 | +// name is the prefix without its brackets: "Brief", what the `[` picker | |
| 33 | +// matches what is typed against. | |
| 34 | +func (m MetaPrompt) name() string { | |
| 35 | + return strings.TrimSuffix(strings.TrimPrefix(m.Label(), "["), "]") | |
| 36 | +} | |
| 37 | + | |
| 38 | +// catalogue is the source of truth, in display order. | |
| 39 | +var catalogue = []MetaPrompt{ | |
| 40 | + {Token: "brief", Prefix: "[Brief] ", Description: "Concise answer"}, | |
| 41 | + {Token: "layman", Prefix: "[In Layman's Terms] ", Description: "Simplified explanation"}, | |
| 42 | + {Token: "story", Prefix: "[As a Story] ", Description: "Information as a story"}, | |
| 43 | + {Token: "pros-cons", Prefix: "[Pros and Cons] ", Description: "Balanced view, advantages and drawbacks"}, | |
| 44 | + {Token: "step-by-step", Prefix: "[Step-by-Step] ", Description: "Detailed step-by-step guide"}, | |
| 45 | + {Token: "factual", Prefix: "[Factual] ", Description: "Direct factual answer"}, | |
| 46 | + {Token: "opinion", Prefix: "[Opinion] ", Description: "Opinion-based answer"}, | |
| 47 | + {Token: "comparison", Prefix: "[Comparison] ", Description: "Comparative analysis"}, | |
| 48 | + {Token: "timeline", Prefix: "[Timeline] ", Description: "Chronological account of the key events"}, | |
| 49 | + {Token: "poem", Prefix: "[As a Poem] ", Description: "Poetic description"}, | |
| 50 | + {Token: "kids", Prefix: "[For Kids] ", Description: "Explanation for children"}, | |
| 51 | + {Token: "advantages", Prefix: "[Advantages Only] ", Description: "Advantages only"}, | |
| 52 | + {Token: "recipe", Prefix: "[As a Recipe] ", Description: "Information as a recipe"}, | |
| 53 | +} | |
| 54 | + | |
| 55 | +// All returns the catalogue, in display order. The slice is a copy. | |
| 56 | +func All() []MetaPrompt { return append([]MetaPrompt(nil), catalogue...) } | |
| 57 | + | |
| 58 | +// Matching returns the entries whose name starts with what was typed after | |
| 59 | +// the `[`, case ignored: "Ste" → [Step-by-Step]. | |
| 60 | +// Empty matches them all. The name is matched, not the token, because the | |
| 61 | +// name is what the box shows: "[Ste" → [Step-by-Step]. | |
| 62 | +// | |
| 63 | +// metaprompt.Matching("b") // [Brief] | |
| 64 | +// metaprompt.Matching("as") // [As a Story], [As a Poem], [As a Recipe] | |
| 65 | +func Matching(typed string) []MetaPrompt { | |
| 66 | + typed = strings.ToLower(typed) | |
| 67 | + var out []MetaPrompt | |
| 68 | + for _, m := range catalogue { | |
| 69 | + if strings.HasPrefix(strings.ToLower(m.name()), typed) { | |
| 70 | + out = append(out, m) | |
| 71 | + } | |
| 72 | + } | |
| 73 | + return out | |
| 74 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | +// Package metaprompt is the catalogue of meta-prompts (ticket 270): short | ||
| 2 | +// bracketed prefixes put before a question to steer the FORM of the answer — | ||
| 3 | +// "[Brief] What is machine learning?". The prefix means nothing to mm: it is | ||
| 4 | +// part of the user's message and the model reads it as an inline | ||
| 5 | +// instruction. No front end and no part of the agent loop treats it apart. | ||
| 6 | +// | ||
| 7 | +// The catalogue is hard-coded (the user's decision): thirteen entries, the | ||
| 8 | +// ones pk offers. The window lists them in its `[` picker — the only way in | ||
| 9 | +// (no slash command): the line mode and an editor take a prefix typed by | ||
| 10 | +// hand, which the model reads just the same. | ||
| 11 | +// | ||
| 12 | +// for _, m := range metaprompt.Matching("as") { fmt.Println(m.Label()) } | ||
| 13 | +// // [As a Story] [As a Poem] [As a Recipe] | ||
| 14 | +package metaprompt | ||
| 15 | + | ||
| 16 | +import "strings" | ||
| 17 | + | ||
| 18 | +// MetaPrompt is one entry of the catalogue. | ||
| 19 | +type MetaPrompt struct { | ||
| 20 | + // Token names it in code and tests: kebab-case, "brief". | ||
| 21 | + Token string | ||
| 22 | + // Prefix is what goes before the question, ending with ONE space: | ||
| 23 | + // "[Brief] ". | ||
| 24 | + Prefix string | ||
| 25 | + // Description is the short label shown beside it. | ||
| 26 | + Description string | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// Label is the prefix without its trailing space: "[Brief]". | ||
| 30 | +func (m MetaPrompt) Label() string { return strings.TrimSuffix(m.Prefix, " ") } | ||
| 31 | + | ||
| 32 | +// name is the prefix without its brackets: "Brief", what the `[` picker | ||
| 33 | +// matches what is typed against. | ||
| 34 | +func (m MetaPrompt) name() string { | ||
| 35 | + return strings.TrimSuffix(strings.TrimPrefix(m.Label(), "["), "]") | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +// catalogue is the source of truth, in display order. | ||
| 39 | +var catalogue = []MetaPrompt{ | ||
| 40 | + {Token: "brief", Prefix: "[Brief] ", Description: "Concise answer"}, | ||
| 41 | + {Token: "layman", Prefix: "[In Layman's Terms] ", Description: "Simplified explanation"}, | ||
| 42 | + {Token: "story", Prefix: "[As a Story] ", Description: "Information as a story"}, | ||
| 43 | + {Token: "pros-cons", Prefix: "[Pros and Cons] ", Description: "Balanced view, advantages and drawbacks"}, | ||
| 44 | + {Token: "step-by-step", Prefix: "[Step-by-Step] ", Description: "Detailed step-by-step guide"}, | ||
| 45 | + {Token: "factual", Prefix: "[Factual] ", Description: "Direct factual answer"}, | ||
| 46 | + {Token: "opinion", Prefix: "[Opinion] ", Description: "Opinion-based answer"}, | ||
| 47 | + {Token: "comparison", Prefix: "[Comparison] ", Description: "Comparative analysis"}, | ||
| 48 | + {Token: "timeline", Prefix: "[Timeline] ", Description: "Chronological account of the key events"}, | ||
| 49 | + {Token: "poem", Prefix: "[As a Poem] ", Description: "Poetic description"}, | ||
| 50 | + {Token: "kids", Prefix: "[For Kids] ", Description: "Explanation for children"}, | ||
| 51 | + {Token: "advantages", Prefix: "[Advantages Only] ", Description: "Advantages only"}, | ||
| 52 | + {Token: "recipe", Prefix: "[As a Recipe] ", Description: "Information as a recipe"}, | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +// All returns the catalogue, in display order. The slice is a copy. | ||
| 56 | +func All() []MetaPrompt { return append([]MetaPrompt(nil), catalogue...) } | ||
| 57 | + | ||
| 58 | +// Matching returns the entries whose name starts with what was typed after | ||
| 59 | +// the `[`, case ignored: "Ste" → [Step-by-Step]. | ||
| 60 | +// Empty matches them all. The name is matched, not the token, because the | ||
| 61 | +// name is what the box shows: "[Ste" → [Step-by-Step]. | ||
| 62 | +// | ||
| 63 | +// metaprompt.Matching("b") // [Brief] | ||
| 64 | +// metaprompt.Matching("as") // [As a Story], [As a Poem], [As a Recipe] | ||
| 65 | +func Matching(typed string) []MetaPrompt { | ||
| 66 | + typed = strings.ToLower(typed) | ||
| 67 | + var out []MetaPrompt | ||
| 68 | + for _, m := range catalogue { | ||
| 69 | + if strings.HasPrefix(strings.ToLower(m.name()), typed) { | ||
| 70 | + out = append(out, m) | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + return out | ||
| 74 | +} | ||
added
internal/metaprompt/metaprompt_test.go +54 -0 | new file mode 100644 | ||
| @@ -0,0 +1,54 @@ | ||
| 1 | +package metaprompt | |
| 2 | + | |
| 3 | +import ( | |
| 4 | + "strings" | |
| 5 | + "testing" | |
| 6 | +) | |
| 7 | + | |
| 8 | +// The catalogue's shape: pk's rules — fields filled, "[…] " prefixes that | |
| 9 | +// end with ONE space, tokens and prefixes unique, tokens kebab-case. | |
| 10 | +func TestCatalogueShape(t *testing.T) { | |
| 11 | + if len(All()) != 13 { | |
| 12 | + t.Errorf("%d entries, want 13", len(All())) | |
| 13 | + } | |
| 14 | + tokens, prefixes := map[string]bool{}, map[string]bool{} | |
| 15 | + for _, m := range All() { | |
| 16 | + if m.Token == "" || m.Prefix == "" || m.Description == "" { | |
| 17 | + t.Errorf("empty field: %+v", m) | |
| 18 | + } | |
| 19 | + if !strings.HasPrefix(m.Prefix, "[") || !strings.HasSuffix(m.Prefix, "] ") || strings.HasSuffix(m.Prefix, " ") { | |
| 20 | + t.Errorf("prefix %q: want \"[…] \" with one trailing space", m.Prefix) | |
| 21 | + } | |
| 22 | + if m.Token != strings.ToLower(m.Token) || strings.ContainsAny(m.Token, " _") { | |
| 23 | + t.Errorf("token %q: want kebab-case", m.Token) | |
| 24 | + } | |
| 25 | + if tokens[m.Token] || prefixes[m.Prefix] { | |
| 26 | + t.Errorf("duplicate: %+v", m) | |
| 27 | + } | |
| 28 | + tokens[m.Token], prefixes[m.Prefix] = true, true | |
| 29 | + } | |
| 30 | +} | |
| 31 | + | |
| 32 | +func TestMatching(t *testing.T) { | |
| 33 | + names := func(ms []MetaPrompt) string { | |
| 34 | + var out []string | |
| 35 | + for _, m := range ms { | |
| 36 | + out = append(out, m.Label()) | |
| 37 | + } | |
| 38 | + return strings.Join(out, ",") | |
| 39 | + } | |
| 40 | + cases := map[string]string{ | |
| 41 | + "b": "[Brief]", | |
| 42 | + "as": "[As a Story],[As a Poem],[As a Recipe]", | |
| 43 | + "STE": "[Step-by-Step]", | |
| 44 | + "x": "", | |
| 45 | + } | |
| 46 | + for in, want := range cases { | |
| 47 | + if got := names(Matching(in)); got != want { | |
| 48 | + t.Errorf("Matching(%q) = %s; want %s", in, got, want) | |
| 49 | + } | |
| 50 | + } | |
| 51 | + if len(Matching("")) != 13 { | |
| 52 | + t.Errorf("empty matches %d", len(Matching(""))) | |
| 53 | + } | |
| 54 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | +package metaprompt | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "strings" | ||
| 5 | + "testing" | ||
| 6 | +) | ||
| 7 | + | ||
| 8 | +// The catalogue's shape: pk's rules — fields filled, "[…] " prefixes that | ||
| 9 | +// end with ONE space, tokens and prefixes unique, tokens kebab-case. | ||
| 10 | +func TestCatalogueShape(t *testing.T) { | ||
| 11 | + if len(All()) != 13 { | ||
| 12 | + t.Errorf("%d entries, want 13", len(All())) | ||
| 13 | + } | ||
| 14 | + tokens, prefixes := map[string]bool{}, map[string]bool{} | ||
| 15 | + for _, m := range All() { | ||
| 16 | + if m.Token == "" || m.Prefix == "" || m.Description == "" { | ||
| 17 | + t.Errorf("empty field: %+v", m) | ||
| 18 | + } | ||
| 19 | + if !strings.HasPrefix(m.Prefix, "[") || !strings.HasSuffix(m.Prefix, "] ") || strings.HasSuffix(m.Prefix, " ") { | ||
| 20 | + t.Errorf("prefix %q: want \"[…] \" with one trailing space", m.Prefix) | ||
| 21 | + } | ||
| 22 | + if m.Token != strings.ToLower(m.Token) || strings.ContainsAny(m.Token, " _") { | ||
| 23 | + t.Errorf("token %q: want kebab-case", m.Token) | ||
| 24 | + } | ||
| 25 | + if tokens[m.Token] || prefixes[m.Prefix] { | ||
| 26 | + t.Errorf("duplicate: %+v", m) | ||
| 27 | + } | ||
| 28 | + tokens[m.Token], prefixes[m.Prefix] = true, true | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +func TestMatching(t *testing.T) { | ||
| 33 | + names := func(ms []MetaPrompt) string { | ||
| 34 | + var out []string | ||
| 35 | + for _, m := range ms { | ||
| 36 | + out = append(out, m.Label()) | ||
| 37 | + } | ||
| 38 | + return strings.Join(out, ",") | ||
| 39 | + } | ||
| 40 | + cases := map[string]string{ | ||
| 41 | + "b": "[Brief]", | ||
| 42 | + "as": "[As a Story],[As a Poem],[As a Recipe]", | ||
| 43 | + "STE": "[Step-by-Step]", | ||
| 44 | + "x": "", | ||
| 45 | + } | ||
| 46 | + for in, want := range cases { | ||
| 47 | + if got := names(Matching(in)); got != want { | ||
| 48 | + t.Errorf("Matching(%q) = %s; want %s", in, got, want) | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + if len(Matching("")) != 13 { | ||
| 52 | + t.Errorf("empty matches %d", len(Matching(""))) | ||
| 53 | + } | ||
| 54 | +} | ||
modified
internal/tui/commands.go +1 -1 | @@ -192,7 +192,7 @@ func (r *runner) unload(model string) { | ||
| 192 | 192 | |
| 193 | 193 | // help lists the window's commands and keys. |
| 194 | 194 | func (r *runner) help() { |
| 195 | - r.t.Notice(command.Usage(command.Window) + "\n\nEnter sends (during a turn: steers — the model reads it after its current step; /queue <question> waits for the end of the turn) · Ctrl-J new line · Esc cancels the turn (idle: clears the box) · ↑/↓ recall earlier questions (sessions on) · Ctrl-C cancels then quits (twice to leave a turn that will not stop) · Ctrl-L clears · Ctrl-Y copies the last answer · F2 mouse on/off (off: select text with the mouse as usual) · PgUp/PgDn scroll · Tab moves the focus · @path attaches a file") | |
| 195 | + r.t.Notice(command.Usage(command.Window) + "\n\nEnter sends (during a turn: steers — the model reads it after its current step; /queue <question> waits for the end of the turn) · Ctrl-J new line · Esc cancels the turn (idle: clears the box) · ↑/↓ recall earlier questions (sessions on) · Ctrl-C cancels then quits (twice to leave a turn that will not stop) · Ctrl-L clears · Ctrl-Y copies the last answer · F2 mouse on/off (off: select text with the mouse as usual) · PgUp/PgDn scroll · Tab moves the focus · @path attaches a file · [ at the start of the box picks a style prefix ([Brief], [Step-by-Step]…)") | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // quitNow ends the loop on its next turn. |
| @@ -192,7 +192,7 @@ func (r *runner) unload(model string) { | |||
| 192 | 192 | ||
| 193 | // help lists the window's commands and keys. | 193 | // help lists the window's commands and keys. |
| 194 | func (r *runner) help() { | 194 | func (r *runner) help() { |
| 195 | - r.t.Notice(command.Usage(command.Window) + "\n\nEnter sends (during a turn: steers — the model reads it after its current step; /queue <question> waits for the end of the turn) · Ctrl-J new line · Esc cancels the turn (idle: clears the box) · ↑/↓ recall earlier questions (sessions on) · Ctrl-C cancels then quits (twice to leave a turn that will not stop) · Ctrl-L clears · Ctrl-Y copies the last answer · F2 mouse on/off (off: select text with the mouse as usual) · PgUp/PgDn scroll · Tab moves the focus · @path attaches a file") | 195 | + r.t.Notice(command.Usage(command.Window) + "\n\nEnter sends (during a turn: steers — the model reads it after its current step; /queue <question> waits for the end of the turn) · Ctrl-J new line · Esc cancels the turn (idle: clears the box) · ↑/↓ recall earlier questions (sessions on) · Ctrl-C cancels then quits (twice to leave a turn that will not stop) · Ctrl-L clears · Ctrl-Y copies the last answer · F2 mouse on/off (off: select text with the mouse as usual) · PgUp/PgDn scroll · Tab moves the focus · @path attaches a file · [ at the start of the box picks a style prefix ([Brief], [Step-by-Step]…)") |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | // quitNow ends the loop on its next turn. | 198 | // quitNow ends the loop on its next turn. |
modified
internal/tui/draw.go +1 -1 | @@ -104,7 +104,7 @@ func (v *View) ruleLabel() string { | ||
| 104 | 104 | case !v.onInput: |
| 105 | 105 | return " ↑↓ PgUp PgDn scroll · Home End · Tab back to the box " |
| 106 | 106 | default: |
| 107 | - return " Enter sends · Ctrl-J new line · / commands · @ files · $ skills · Tab scroll " | |
| 107 | + return " Enter sends · Ctrl-J new line · / commands · @ files · $ skills · [ meta-prompts · Tab scroll " | |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| @@ -104,7 +104,7 @@ func (v *View) ruleLabel() string { | |||
| 104 | case !v.onInput: | 104 | case !v.onInput: |
| 105 | return " ↑↓ PgUp PgDn scroll · Home End · Tab back to the box " | 105 | return " ↑↓ PgUp PgDn scroll · Home End · Tab back to the box " |
| 106 | default: | 106 | default: |
| 107 | - return " Enter sends · Ctrl-J new line · / commands · @ files · $ skills · Tab scroll " | 107 | + return " Enter sends · Ctrl-J new line · / commands · @ files · $ skills · [ meta-prompts · Tab scroll " |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| 110 | 110 | ||
added
internal/tui/metaprompt_test.go +74 -0 | new file mode 100644 | ||
| @@ -0,0 +1,74 @@ | ||
| 1 | +package tui | |
| 2 | + | |
| 3 | +import ( | |
| 4 | + "strings" | |
| 5 | + "testing" | |
| 6 | + | |
| 7 | + "github.com/gdamore/tcell/v2" | |
| 8 | +) | |
| 9 | + | |
| 10 | +// Ticket 270: `[` as the first character of the box opens the meta-prompt | |
| 11 | +// picker; typing narrows it (spaces included); Enter puts the prefix in the | |
| 12 | +// box with the cursor after it; the question then goes out prefixed. | |
| 13 | +func TestBracketPickerInsertsThePrefix(t *testing.T) { | |
| 14 | + hs := newHarness(t, 80, 24) | |
| 15 | + hs.typeText("[") | |
| 16 | + if got := len(hs.v.choices()); got != 13 { | |
| 17 | + t.Fatalf("%d choices on '[', want 13", got) | |
| 18 | + } | |
| 19 | + if text := hs.screenText(); !strings.Contains(text, "[Brief]") || !strings.Contains(text, "Concise answer") { | |
| 20 | + t.Errorf("picker not drawn:\n%s", text) | |
| 21 | + } | |
| 22 | + hs.typeText("As a") | |
| 23 | + if cs := hs.v.choices(); len(cs) != 3 || cs[0].label != "[As a Story]" { | |
| 24 | + t.Fatalf("choices for '[As a': %+v", cs) | |
| 25 | + } | |
| 26 | + hs.key(tcell.KeyDown, tcell.ModNone) // [As a Poem] | |
| 27 | + hs.key(tcell.KeyEnter, tcell.ModNone) | |
| 28 | + if hs.v.Input() != "[As a Poem] " || hs.v.pickerOpen() || len(hs.sent) != 0 { | |
| 29 | + t.Fatalf("after Enter: box %q, picker %v, sent %q", hs.v.Input(), hs.v.pickerOpen(), hs.sent) | |
| 30 | + } | |
| 31 | + hs.typeText("the sea") | |
| 32 | + hs.key(tcell.KeyEnter, tcell.ModNone) | |
| 33 | + if len(hs.sent) != 1 || hs.sent[0] != "[As a Poem] the sea" { | |
| 34 | + t.Errorf("sent %q", hs.sent) | |
| 35 | + } | |
| 36 | +} | |
| 37 | + | |
| 38 | +// The `[` picker stays shut where `[` is ordinary text: not first, after a | |
| 39 | +// `]`, on a second line; Escape closes it and keeps a literal `[`. | |
| 40 | +func TestBracketPickerOnlyAtTheStart(t *testing.T) { | |
| 41 | + hs := newHarness(t, 80, 24) | |
| 42 | + hs.typeText("see [the docs") | |
| 43 | + if hs.v.pickerOpen() { | |
| 44 | + t.Error("open on a `[` in the middle of a sentence") | |
| 45 | + } | |
| 46 | + hs.v.setInput("") | |
| 47 | + hs.typeText("[x] done") | |
| 48 | + if hs.v.pickerOpen() { | |
| 49 | + t.Error("open after a `]`") | |
| 50 | + } | |
| 51 | + hs.v.setInput("") | |
| 52 | + hs.typeText("[") | |
| 53 | + hs.key(tcell.KeyEscape, tcell.ModNone) | |
| 54 | + if hs.v.pickerOpen() || hs.v.Input() != "[" || hs.cancelled != 0 { | |
| 55 | + t.Fatalf("Escape: picker %v, box %q, cancelled %d", hs.v.pickerOpen(), hs.v.Input(), hs.cancelled) | |
| 56 | + } | |
| 57 | + hs.typeText("1, 2]") | |
| 58 | + hs.key(tcell.KeyEnter, tcell.ModNone) | |
| 59 | + if len(hs.sent) != 1 || hs.sent[0] != "[1, 2]" { | |
| 60 | + t.Errorf("a literal `[…]` must go out as typed: %q", hs.sent) | |
| 61 | + } | |
| 62 | + hs.typeText("[Zzz") | |
| 63 | + if hs.v.pickerOpen() { | |
| 64 | + t.Error("open on a name that matches nothing") | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 68 | +// The rule under the conversation names the four pickers, `[` included. | |
| 69 | +func TestRuleNamesTheBracketPicker(t *testing.T) { | |
| 70 | + hs := newHarness(t, 120, 24) | |
| 71 | + if text := hs.screenText(); !strings.Contains(text, "/ commands · @ files · $ skills · [ meta-prompts") { | |
| 72 | + t.Errorf("rule without the `[` picker:\n%s", text) | |
| 73 | + } | |
| 74 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | +package tui | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "strings" | ||
| 5 | + "testing" | ||
| 6 | + | ||
| 7 | + "github.com/gdamore/tcell/v2" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +// Ticket 270: `[` as the first character of the box opens the meta-prompt | ||
| 11 | +// picker; typing narrows it (spaces included); Enter puts the prefix in the | ||
| 12 | +// box with the cursor after it; the question then goes out prefixed. | ||
| 13 | +func TestBracketPickerInsertsThePrefix(t *testing.T) { | ||
| 14 | + hs := newHarness(t, 80, 24) | ||
| 15 | + hs.typeText("[") | ||
| 16 | + if got := len(hs.v.choices()); got != 13 { | ||
| 17 | + t.Fatalf("%d choices on '[', want 13", got) | ||
| 18 | + } | ||
| 19 | + if text := hs.screenText(); !strings.Contains(text, "[Brief]") || !strings.Contains(text, "Concise answer") { | ||
| 20 | + t.Errorf("picker not drawn:\n%s", text) | ||
| 21 | + } | ||
| 22 | + hs.typeText("As a") | ||
| 23 | + if cs := hs.v.choices(); len(cs) != 3 || cs[0].label != "[As a Story]" { | ||
| 24 | + t.Fatalf("choices for '[As a': %+v", cs) | ||
| 25 | + } | ||
| 26 | + hs.key(tcell.KeyDown, tcell.ModNone) // [As a Poem] | ||
| 27 | + hs.key(tcell.KeyEnter, tcell.ModNone) | ||
| 28 | + if hs.v.Input() != "[As a Poem] " || hs.v.pickerOpen() || len(hs.sent) != 0 { | ||
| 29 | + t.Fatalf("after Enter: box %q, picker %v, sent %q", hs.v.Input(), hs.v.pickerOpen(), hs.sent) | ||
| 30 | + } | ||
| 31 | + hs.typeText("the sea") | ||
| 32 | + hs.key(tcell.KeyEnter, tcell.ModNone) | ||
| 33 | + if len(hs.sent) != 1 || hs.sent[0] != "[As a Poem] the sea" { | ||
| 34 | + t.Errorf("sent %q", hs.sent) | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +// The `[` picker stays shut where `[` is ordinary text: not first, after a | ||
| 39 | +// `]`, on a second line; Escape closes it and keeps a literal `[`. | ||
| 40 | +func TestBracketPickerOnlyAtTheStart(t *testing.T) { | ||
| 41 | + hs := newHarness(t, 80, 24) | ||
| 42 | + hs.typeText("see [the docs") | ||
| 43 | + if hs.v.pickerOpen() { | ||
| 44 | + t.Error("open on a `[` in the middle of a sentence") | ||
| 45 | + } | ||
| 46 | + hs.v.setInput("") | ||
| 47 | + hs.typeText("[x] done") | ||
| 48 | + if hs.v.pickerOpen() { | ||
| 49 | + t.Error("open after a `]`") | ||
| 50 | + } | ||
| 51 | + hs.v.setInput("") | ||
| 52 | + hs.typeText("[") | ||
| 53 | + hs.key(tcell.KeyEscape, tcell.ModNone) | ||
| 54 | + if hs.v.pickerOpen() || hs.v.Input() != "[" || hs.cancelled != 0 { | ||
| 55 | + t.Fatalf("Escape: picker %v, box %q, cancelled %d", hs.v.pickerOpen(), hs.v.Input(), hs.cancelled) | ||
| 56 | + } | ||
| 57 | + hs.typeText("1, 2]") | ||
| 58 | + hs.key(tcell.KeyEnter, tcell.ModNone) | ||
| 59 | + if len(hs.sent) != 1 || hs.sent[0] != "[1, 2]" { | ||
| 60 | + t.Errorf("a literal `[…]` must go out as typed: %q", hs.sent) | ||
| 61 | + } | ||
| 62 | + hs.typeText("[Zzz") | ||
| 63 | + if hs.v.pickerOpen() { | ||
| 64 | + t.Error("open on a name that matches nothing") | ||
| 65 | + } | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +// The rule under the conversation names the four pickers, `[` included. | ||
| 69 | +func TestRuleNamesTheBracketPicker(t *testing.T) { | ||
| 70 | + hs := newHarness(t, 120, 24) | ||
| 71 | + if text := hs.screenText(); !strings.Contains(text, "/ commands · @ files · $ skills · [ meta-prompts") { | ||
| 72 | + t.Errorf("rule without the `[` picker:\n%s", text) | ||
| 73 | + } | ||
| 74 | +} | ||
modified
internal/tui/picker.go +48 -1 | @@ -7,18 +7,25 @@ import ( | ||
| 7 | 7 | "strings" |
| 8 | 8 | |
| 9 | 9 | "mm/internal/command" |
| 10 | + "mm/internal/metaprompt" | |
| 10 | 11 | "mm/internal/skills" |
| 11 | 12 | ) |
| 12 | 13 | |
| 13 | 14 | // pickerRows is how many choices the popup shows at most. |
| 14 | 15 | const pickerRows = 8 |
| 15 | 16 | |
| 16 | -// The popup that completes what is being typed. Three triggers, three | |
| 17 | +// The popup that completes what is being typed. Four triggers, four | |
| 17 | 18 | // sources, one mechanism: |
| 18 | 19 | // |
| 19 | 20 | // / the window's commands only as the whole first word of the box |
| 20 | 21 | // @ files and directories anywhere in the text |
| 21 | 22 | // $ the skills of the catalogue anywhere in the text |
| 23 | +// [ the meta-prompts only as the first character of the box | |
| 24 | +// | |
| 25 | +// The `[` picker (ticket 270) puts a style prefix before the question | |
| 26 | +// ("[Brief] "). It opens only on a box that STARTS with `[`, holds one line | |
| 27 | +// and no `]` yet, the cursor at its end — so a Markdown link or an array in | |
| 28 | +// a sentence never opens it — and Escape keeps a literal `[`. | |
| 22 | 29 | // |
| 23 | 30 | // The `/` case is the original one and keeps its rule: a command is the whole |
| 24 | 31 | // message, so it only makes sense at the start, and completing it replaces |
| @@ -90,6 +97,12 @@ func isSpaceRune(r rune) bool { return r == ' ' || r == '\t' } | ||
| 90 | 97 | |
| 91 | 98 | // choices returns what the popup offers, or nothing when it must stay shut. |
| 92 | 99 | func (v *View) choices() []choice { |
| 100 | + if typed, ok := v.bracketPartial(); ok { | |
| 101 | + if v.pick.dismissed && v.pick.dismissedFor == v.Input() { | |
| 102 | + return nil | |
| 103 | + } | |
| 104 | + return metaChoices(typed) | |
| 105 | + } | |
| 93 | 106 | tok, ok := v.tokenAtCursor() |
| 94 | 107 | if !ok || (v.pick.dismissed && v.pick.dismissedFor == v.Input()) { |
| 95 | 108 | return nil |
| @@ -110,6 +123,33 @@ func (v *View) choices() []choice { | ||
| 110 | 123 | return out |
| 111 | 124 | } |
| 112 | 125 | |
| 126 | +// bracketPartial is what follows the `[` when the `[` picker may open: the | |
| 127 | +// box is one line that starts with `[`, has no `]` yet, and the cursor is at | |
| 128 | +// its end. Spaces are part of it — "[As a" narrows to the three "As a …". | |
| 129 | +func (v *View) bracketPartial() (string, bool) { | |
| 130 | + if len(v.input) != 1 { | |
| 131 | + return "", false | |
| 132 | + } | |
| 133 | + line := []rune(v.input[0]) | |
| 134 | + if len(line) == 0 || line[0] != '[' || v.column != len(line) { | |
| 135 | + return "", false | |
| 136 | + } | |
| 137 | + rest := string(line[1:]) | |
| 138 | + if strings.ContainsRune(rest, ']') { | |
| 139 | + return "", false | |
| 140 | + } | |
| 141 | + return rest, true | |
| 142 | +} | |
| 143 | + | |
| 144 | +// metaChoices narrows the meta-prompts by what follows the `[`. | |
| 145 | +func metaChoices(typed string) []choice { | |
| 146 | + var out []choice | |
| 147 | + for _, m := range metaprompt.Matching(typed) { | |
| 148 | + out = append(out, choice{insert: m.Prefix, label: m.Label(), detail: m.Description}) | |
| 149 | + } | |
| 150 | + return out | |
| 151 | +} | |
| 152 | + | |
| 113 | 153 | func commandChoices(partial string) []choice { |
| 114 | 154 | var out []choice |
| 115 | 155 | for _, c := range command.For(command.Window) { |
| @@ -225,6 +265,13 @@ func (v *View) complete() { | ||
| 225 | 265 | if !ok { |
| 226 | 266 | return |
| 227 | 267 | } |
| 268 | + // A meta-prompt replaces the box's `[…` with its prefix, the cursor | |
| 269 | + // after it: the question comes next. | |
| 270 | + if _, ok := v.bracketPartial(); ok { | |
| 271 | + v.setInput(c.insert) | |
| 272 | + v.pick.dismiss(v.Input()) | |
| 273 | + return | |
| 274 | + } | |
| 228 | 275 | tok, ok := v.tokenAtCursor() |
| 229 | 276 | if !ok { |
| 230 | 277 | return |
| @@ -7,18 +7,25 @@ import ( | |||
| 7 | "strings" | 7 | "strings" |
| 8 | 8 | ||
| 9 | "mm/internal/command" | 9 | "mm/internal/command" |
| 10 | + "mm/internal/metaprompt" | ||
| 10 | "mm/internal/skills" | 11 | "mm/internal/skills" |
| 11 | ) | 12 | ) |
| 12 | 13 | ||
| 13 | // pickerRows is how many choices the popup shows at most. | 14 | // pickerRows is how many choices the popup shows at most. |
| 14 | const pickerRows = 8 | 15 | const pickerRows = 8 |
| 15 | 16 | ||
| 16 | -// The popup that completes what is being typed. Three triggers, three | 17 | +// The popup that completes what is being typed. Four triggers, four |
| 17 | // sources, one mechanism: | 18 | // sources, one mechanism: |
| 18 | // | 19 | // |
| 19 | // / the window's commands only as the whole first word of the box | 20 | // / the window's commands only as the whole first word of the box |
| 20 | // @ files and directories anywhere in the text | 21 | // @ files and directories anywhere in the text |
| 21 | // $ the skills of the catalogue anywhere in the text | 22 | // $ the skills of the catalogue anywhere in the text |
| 23 | +// [ the meta-prompts only as the first character of the box | ||
| 24 | +// | ||
| 25 | +// The `[` picker (ticket 270) puts a style prefix before the question | ||
| 26 | +// ("[Brief] "). It opens only on a box that STARTS with `[`, holds one line | ||
| 27 | +// and no `]` yet, the cursor at its end — so a Markdown link or an array in | ||
| 28 | +// a sentence never opens it — and Escape keeps a literal `[`. | ||
| 22 | // | 29 | // |
| 23 | // The `/` case is the original one and keeps its rule: a command is the whole | 30 | // The `/` case is the original one and keeps its rule: a command is the whole |
| 24 | // message, so it only makes sense at the start, and completing it replaces | 31 | // message, so it only makes sense at the start, and completing it replaces |
| @@ -90,6 +97,12 @@ func isSpaceRune(r rune) bool { return r == ' ' || r == '\t' } | |||
| 90 | 97 | ||
| 91 | // choices returns what the popup offers, or nothing when it must stay shut. | 98 | // choices returns what the popup offers, or nothing when it must stay shut. |
| 92 | func (v *View) choices() []choice { | 99 | func (v *View) choices() []choice { |
| 100 | + if typed, ok := v.bracketPartial(); ok { | ||
| 101 | + if v.pick.dismissed && v.pick.dismissedFor == v.Input() { | ||
| 102 | + return nil | ||
| 103 | + } | ||
| 104 | + return metaChoices(typed) | ||
| 105 | + } | ||
| 93 | tok, ok := v.tokenAtCursor() | 106 | tok, ok := v.tokenAtCursor() |
| 94 | if !ok || (v.pick.dismissed && v.pick.dismissedFor == v.Input()) { | 107 | if !ok || (v.pick.dismissed && v.pick.dismissedFor == v.Input()) { |
| 95 | return nil | 108 | return nil |
| @@ -110,6 +123,33 @@ func (v *View) choices() []choice { | |||
| 110 | return out | 123 | return out |
| 111 | } | 124 | } |
| 112 | 125 | ||
| 126 | +// bracketPartial is what follows the `[` when the `[` picker may open: the | ||
| 127 | +// box is one line that starts with `[`, has no `]` yet, and the cursor is at | ||
| 128 | +// its end. Spaces are part of it — "[As a" narrows to the three "As a …". | ||
| 129 | +func (v *View) bracketPartial() (string, bool) { | ||
| 130 | + if len(v.input) != 1 { | ||
| 131 | + return "", false | ||
| 132 | + } | ||
| 133 | + line := []rune(v.input[0]) | ||
| 134 | + if len(line) == 0 || line[0] != '[' || v.column != len(line) { | ||
| 135 | + return "", false | ||
| 136 | + } | ||
| 137 | + rest := string(line[1:]) | ||
| 138 | + if strings.ContainsRune(rest, ']') { | ||
| 139 | + return "", false | ||
| 140 | + } | ||
| 141 | + return rest, true | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | +// metaChoices narrows the meta-prompts by what follows the `[`. | ||
| 145 | +func metaChoices(typed string) []choice { | ||
| 146 | + var out []choice | ||
| 147 | + for _, m := range metaprompt.Matching(typed) { | ||
| 148 | + out = append(out, choice{insert: m.Prefix, label: m.Label(), detail: m.Description}) | ||
| 149 | + } | ||
| 150 | + return out | ||
| 151 | +} | ||
| 152 | + | ||
| 113 | func commandChoices(partial string) []choice { | 153 | func commandChoices(partial string) []choice { |
| 114 | var out []choice | 154 | var out []choice |
| 115 | for _, c := range command.For(command.Window) { | 155 | for _, c := range command.For(command.Window) { |
| @@ -225,6 +265,13 @@ func (v *View) complete() { | |||
| 225 | if !ok { | 265 | if !ok { |
| 226 | return | 266 | return |
| 227 | } | 267 | } |
| 268 | + // A meta-prompt replaces the box's `[…` with its prefix, the cursor | ||
| 269 | + // after it: the question comes next. | ||
| 270 | + if _, ok := v.bracketPartial(); ok { | ||
| 271 | + v.setInput(c.insert) | ||
| 272 | + v.pick.dismiss(v.Input()) | ||
| 273 | + return | ||
| 274 | + } | ||
| 228 | tok, ok := v.tokenAtCursor() | 275 | tok, ok := v.tokenAtCursor() |
| 229 | if !ok { | 276 | if !ok { |
| 230 | return | 277 | return |