b6cea42631
An agent chat used to open with the model knowing the name of a machine and nothing about what was on it, so the first two rounds of every reply went on finding out. It now gets a listing: one read-only command, `git ls-files` where that works and `find` otherwise, falling back to an SFTP walk that always does. git first because a repository already carries somebody's considered list of what is not part of the project, and reproducing it by hand is how an index ends up mostly build output. The listing is budgeted rather than dumped. A tree of a thousand files is worse than no tree -- it costs the window on every request forever and buries the four names that mattered -- so directories that will not fit are shown as a count and the model is told to open one itself. Collapsing picks the deepest and largest first: by saving alone it would take `src/` before `src/web/static/vendor/`, because it contains it, and lose every name worth having. Read from a cache and never fetched. `harness.context_variables` is synchronous and sits on the request path; the walk happens in the generation setup, which is async and already doing network work, with a short wait. A chat whose first reply outruns its first walk simply has no listing that turn and the fragment disappears rather than appearing as an empty heading. Then `@`, over the same index and over the library, and `/` for commands with an Alt-based keyboard for the same jobs. A mentioned file arrives as contents, not a reference -- a small model asked to call file_read often does not bother -- and it arrives with its absolute path and the machine it came from, because a model handed `main.py` cannot tell which of four it is and cannot name it back when asked to change something. The rule that matters for `/`: a message that merely starts with a slash still sends. `//` escapes and an unrecognised command is posted as written. Swallowing somebody's message is a much worse failure than an unknown command. Two exceptions to Manual mode now, not one. Browsing and indexing are a person acting, not a model, so neither passes through policy.py -- the same argument the terminal panel rests on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
66 lines
2.2 KiB
HTML
66 lines
2.2 KiB
HTML
{% from "_macros.html" import icon %}
|
|
{#
|
|
What `@` offers. Two sources, one list, because somebody typing `@readme` is
|
|
not thinking about which store the answer is in.
|
|
|
|
Swapped in whole on every keystroke, like the knowledge picker: the library
|
|
is searched with FTS rather than filtered in the browser, and the project
|
|
half is filtered beside it so the client stays one fetch and a list.
|
|
|
|
Every name here came off somebody's filesystem or out of their library, so
|
|
all of it is escaped by autoescaping and none of it is marked safe.
|
|
#}
|
|
<div id="mention-results">
|
|
{% if not files and not documents %}
|
|
<p class="muted text-sm" style="padding: var(--sp-3)">
|
|
{% if q %}
|
|
Nothing matches “{{ q }}”.
|
|
{% else %}
|
|
Nothing to mention yet.
|
|
{% endif %}
|
|
</p>
|
|
{% else %}
|
|
|
|
{% if files %}
|
|
<p class="picker__group">In the project</p>
|
|
<ul class="picker__list">
|
|
{% for file in files %}
|
|
<li>
|
|
<button class="picker__option" type="button"
|
|
data-mention-file="{{ file.path }}" data-mention-token="{{ file.path }}">
|
|
{{ icon("folder" if file.path.endswith("/") else "file-text", "icon--sm") }}
|
|
<span class="picker__option-body">
|
|
<span class="picker__option-name">{{ file.name }}</span>
|
|
<span class="picker__option-note mono">{{ file.path }}</span>
|
|
</span>
|
|
</button>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if documents %}
|
|
<p class="picker__group">In your library</p>
|
|
<ul class="picker__list">
|
|
{% for document in documents %}
|
|
<li>
|
|
<button class="picker__option" type="button"
|
|
data-mention-knowledge="{{ document.id }}"
|
|
data-mention-token="{{ document.title }}">
|
|
{{ icon("image" if document.is_image else "archive", "icon--sm") }}
|
|
<span class="picker__option-body">
|
|
<span class="picker__option-name">{{ document.title }}</span>
|
|
<span class="picker__option-note">
|
|
{% if document.base %}{{ document.base.name }} · {% endif %}{{ document.kind }}
|
|
{%- if document.owner_id != user.id %} · shared{% endif %}
|
|
</span>
|
|
</span>
|
|
</button>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
</div>
|