@yahyahammad/venastine 0.1.0 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +19 -14
- package/CONFIG_ARCHITECTURE.md +2002 -0
- package/NOTICE +1 -1
- package/README.md +249 -93
- package/agents/builtin/build.md +73 -0
- package/agents/builtin/general.md +80 -0
- package/agents/builtin/plan.md +23 -5
- package/agents/builtin/test.md +65 -0
- package/agents/builtin/writer.md +67 -0
- package/agents/manager.py +261 -195
- package/agents/subagent_tool.py +280 -23
- package/agents/tui_commands.py +31 -21
- package/bin/venastine.mjs +528 -382
- package/bin/venastine.py +71 -0
- package/cli_commands.py +835 -0
- package/config.py +95 -1198
- package/config.yaml +1090 -0
- package/config_edit.py +1301 -0
- package/config_schema.py +966 -0
- package/config_update.py +749 -0
- package/core/agent_activity.py +256 -0
- package/core/ansi.py +452 -0
- package/core/approval.py +27 -5
- package/core/call_view.py +364 -0
- package/core/cancel.py +121 -0
- package/core/chatgpt_auth.py +747 -0
- package/core/claims_view.py +107 -0
- package/core/client.py +1249 -82
- package/core/commands.py +454 -0
- package/core/compaction.py +1735 -959
- package/core/config_loader.py +516 -97
- package/core/connect.py +686 -0
- package/core/events.py +68 -6
- package/core/file_mentions.py +280 -0
- package/core/interaction.py +87 -4
- package/core/line_pattern.py +128 -0
- package/core/loop.py +2566 -1353
- package/core/memory.py +482 -370
- package/core/pipeline_models.py +23 -9
- package/core/provider_errors.py +234 -0
- package/core/reasoning/confidence_scoring.py +70 -54
- package/core/reasoning/json_retry.py +19 -1
- package/core/reasoning/orchestrator.py +232 -53
- package/core/reasoning/output_writer.py +90 -31
- package/core/reasoning/payload_validation.py +133 -7
- package/core/reasoning/pipeline_storage.py +427 -361
- package/core/reasoning/review.py +659 -615
- package/core/reasoning/scholar.py +38 -14
- package/core/reasoning/source_corpus.py +110 -4
- package/core/replay.py +315 -167
- package/core/session.py +36 -12
- package/core/session_view.py +259 -0
- package/core/session_wake.py +259 -0
- package/core/shell_sessions.py +1553 -0
- package/core/workspace_trust.py +1 -1
- package/credentials.py +308 -180
- package/database.py +82 -1
- package/{PRIVACY.md → docs/PRIVACY.md} +19 -7
- package/docs/SECURITY.md +108 -0
- package/docs/THIRD_PARTY_NOTICES.md +148 -0
- package/env_secrets.py +118 -77
- package/json_store.py +236 -16
- package/logging_setup.py +121 -11
- package/main.py +1672 -198
- package/mcp_client/client.py +257 -23
- package/mcp_client/config.py +484 -379
- package/mcp_client/registration.py +163 -2
- package/memories/manager.py +15 -0
- package/memories/tui_commands.py +21 -14
- package/package.json +303 -73
- package/project_init/config_files.py +4 -0
- package/project_init/generator.py +201 -37
- package/project_init/manifest.py +418 -406
- package/project_init/tui_commands.py +7 -4
- package/prompts/revalidate.md +1 -1
- package/prompts/revise.md +17 -15
- package/prompts/system_prompts.py +64 -10
- package/providers.json.example +94 -92
- package/pyproject.toml +149 -100
- package/requirements.txt +252 -29
- package/safety/policy_enforcement.py +1082 -682
- package/security/askpass.py +419 -0
- package/security/capability.py +37 -7
- package/security/confine.py +484 -0
- package/security/hosted.py +182 -0
- package/security/permissions.py +54 -7
- package/security/posture.py +124 -12
- package/security/protected_paths.py +198 -6
- package/security/sandbox.py +3262 -139
- package/security/secrets.py +855 -0
- package/skills/tui_commands.py +3 -4
- package/storage.py +1338 -1005
- package/tools/base.py +465 -305
- package/tools/builtin/_math_common.py +306 -16
- package/tools/builtin/_net_common.py +267 -61
- package/tools/builtin/arxiv.py +681 -223
- package/tools/builtin/ask_user.py +231 -213
- package/tools/builtin/discrete_math.py +35 -4
- package/tools/builtin/fetch_url.py +239 -21
- package/tools/builtin/file_ops.py +341 -33
- package/tools/builtin/geometry.py +184 -148
- package/tools/builtin/get_time.py +2 -2
- package/tools/builtin/linear_algebra.py +66 -23
- package/tools/builtin/load_skill.py +10 -0
- package/tools/builtin/logic.py +171 -12
- package/tools/builtin/pin.py +46 -12
- package/tools/builtin/probability_stats.py +224 -228
- package/tools/builtin/project_docs.py +80 -21
- package/tools/builtin/remember.py +21 -4
- package/tools/builtin/shell.py +586 -67
- package/tools/builtin/shell_sessions.py +613 -0
- package/tools/builtin/symbolic_math.py +80 -10
- package/tools/builtin/todo.py +5 -3
- package/tools/builtin/web_search.py +329 -151
- package/tools/context.py +23 -0
- package/tools/isolation.py +387 -314
- package/tools/registry.py +374 -29
- package/tui/app.py +5281 -397
- package/tui/app.tcss +290 -9
- package/tui/commands.py +26 -61
- package/tui/diffs.py +286 -265
- package/tui/history.py +128 -0
- package/tui/hosted_driver.py +102 -0
- package/tui/markdown.py +1329 -0
- package/tui/meters.py +364 -0
- package/tui/screens.py +346 -92
- package/tui/themes.py +599 -366
- package/tui/widgets.py +2673 -116
- package/SECURITY.md +0 -88
- package/THIRD_PARTY_NOTICES.md +0 -100
|
@@ -19,7 +19,9 @@ a translation -- but it is still done HERE, once, rather than teaching
|
|
|
19
19
|
core/client.py about MCP types.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
+
import json
|
|
22
23
|
import logging
|
|
24
|
+
import re
|
|
23
25
|
|
|
24
26
|
from security import permissions
|
|
25
27
|
from tools.base import BUDGET_IO, GRANT_ANYWHERE, ToolSpec
|
|
@@ -28,6 +30,50 @@ logger = logging.getLogger(__name__)
|
|
|
28
30
|
|
|
29
31
|
NAME_PREFIX = "mcp__"
|
|
30
32
|
|
|
33
|
+
# WHAT A PROVIDER WILL ACCEPT AS A TOOL NAME. Anthropic, OpenAI and Google
|
|
34
|
+
# all publish the same rule -- `^[a-zA-Z0-9_-]{1,64}$` -- and BOTH halves
|
|
35
|
+
# of the composed name are outside this repository's control: the server
|
|
36
|
+
# half is a free-form key in mcp.json, the tool half comes from the server.
|
|
37
|
+
# Verified against the installed mcp==2.0.0, and again on 2.2.0 and 2.3.0:
|
|
38
|
+
# Tool.model_fields["name"] is a bare required `str` with empty metadata --
|
|
39
|
+
# no pattern, no max length.
|
|
40
|
+
#
|
|
41
|
+
# The prefix spends 7 of the 64 before either name starts.
|
|
42
|
+
#
|
|
43
|
+
# Checked HERE because this is the last place the fact is knowable:
|
|
44
|
+
# registration is the one function that sees the server name and the tool
|
|
45
|
+
# name together, and neither core/client.py (which translates schemas) nor
|
|
46
|
+
# tools/registry.py (which dispatches) has a reason to know what a
|
|
47
|
+
# provider will accept. All 31 of this harness's own tool names satisfy the
|
|
48
|
+
# rule, which is what makes it a bound on third-party names rather than a
|
|
49
|
+
# constraint the project would have to live down to.
|
|
50
|
+
MAX_TOOL_NAME_CHARS = 64
|
|
51
|
+
_NAME_CHAR = re.compile(r"[A-Za-z0-9_-]")
|
|
52
|
+
|
|
53
|
+
# THE TWO BOUNDS ON THIRD-PARTY TEXT IN AN ADVERTISED SCHEMA. Both are
|
|
54
|
+
# paid on EVERY model call for the rest of the session, because
|
|
55
|
+
# registry.schemas() is recomputed at the top of each one (K7) -- which is
|
|
56
|
+
# the difference between these and the bound on a tool RESULT (A79),
|
|
57
|
+
# paid once per call.
|
|
58
|
+
#
|
|
59
|
+
# Deliberately NOT config.MAX_CATALOG_TEXT_CHARS. 300 is right for a
|
|
60
|
+
# one-line catalog bullet and would mutilate a legitimate tool
|
|
61
|
+
# description; sharing the constant would couple two bounds that answer
|
|
62
|
+
# different questions. 2000 is 2.5x the longest description this harness
|
|
63
|
+
# ships (786, `shell_interactive`) and 25x smaller than the 50 KB a probe
|
|
64
|
+
# drove through here.
|
|
65
|
+
MAX_TOOL_DESCRIPTION_CHARS = 2000
|
|
66
|
+
|
|
67
|
+
# And the whole advertised schema, because `description` is not the only
|
|
68
|
+
# third-party string in it: input_schema arrives from the server untouched
|
|
69
|
+
# and a property description is model-facing text in the same request.
|
|
70
|
+
# Capping the strings INSIDE it was declined -- a truncated enum or
|
|
71
|
+
# pattern is a tool that fails at call time instead of load time -- so an
|
|
72
|
+
# oversized schema loses the tool instead, by name, which is the outcome
|
|
73
|
+
# shape the collision branch below already has. 16384 is ~3.6x the largest
|
|
74
|
+
# schema this harness ships (4544, `shell`).
|
|
75
|
+
MAX_TOOL_SCHEMA_CHARS = 16384
|
|
76
|
+
|
|
31
77
|
# server name -> the exact tool names registered for it.
|
|
32
78
|
#
|
|
33
79
|
# THE PREFIX IS NOT A PARSER. `mcp__<server>__<tool>` cannot be taken
|
|
@@ -49,6 +95,14 @@ NAME_PREFIX = "mcp__"
|
|
|
49
95
|
# Recording what was actually registered fixes both without rejecting any
|
|
50
96
|
# mcp.json content, which decision G rules out: validation here is by
|
|
51
97
|
# CONNECTING, not by schema.
|
|
98
|
+
#
|
|
99
|
+
# THAT SENTENCE IS ABOUT THESE TWO HAZARDS AND NOT ABOUT NAMES IN GENERAL,
|
|
100
|
+
# and batch 150 is where the difference started to matter. A name that
|
|
101
|
+
# COLLIDES is recorded rather than rejected, as above. A name no provider
|
|
102
|
+
# will accept is refused at registration (A30), which is not up-front
|
|
103
|
+
# schema validation of mcp.json -- nothing below reads the file -- and is
|
|
104
|
+
# decision G's own remedy: that one server's named failure rather than a
|
|
105
|
+
# startup error for everything else.
|
|
52
106
|
_registered: dict = {}
|
|
53
107
|
|
|
54
108
|
|
|
@@ -56,6 +110,70 @@ def tool_name_for(server_name: str, tool_name: str) -> str:
|
|
|
56
110
|
return f"{NAME_PREFIX}{server_name}__{tool_name}"
|
|
57
111
|
|
|
58
112
|
|
|
113
|
+
def _illegal_chars(text: str) -> list:
|
|
114
|
+
return sorted({c for c in text if not _NAME_CHAR.match(c)})
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _unadvertisable(name: str) -> str:
|
|
118
|
+
"""Why no provider will accept this as a tool name, or "".
|
|
119
|
+
|
|
120
|
+
A REASON rather than a boolean, because it is going into a log line
|
|
121
|
+
somebody has to act on: the server is theirs to rename and the tool is
|
|
122
|
+
not, and which one they can fix depends on which half is wrong.
|
|
123
|
+
"""
|
|
124
|
+
if not name:
|
|
125
|
+
return "it is empty"
|
|
126
|
+
if len(name) > MAX_TOOL_NAME_CHARS:
|
|
127
|
+
return (f"it is {len(name)} characters and the limit is "
|
|
128
|
+
f"{MAX_TOOL_NAME_CHARS}")
|
|
129
|
+
bad = _illegal_chars(name)
|
|
130
|
+
if bad:
|
|
131
|
+
return ("it contains " + ", ".join(repr(c) for c in bad)
|
|
132
|
+
+ "; only letters, digits, '_' and '-' are accepted")
|
|
133
|
+
return ""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _bounded(text: str) -> str:
|
|
137
|
+
"""One line, capped -- A5's two rules on a string that enters every
|
|
138
|
+
model call, applied at the producer.
|
|
139
|
+
|
|
140
|
+
The same shape as core/config_loader._catalog_text, including the
|
|
141
|
+
VISIBLE ellipsis (a model reading a cut-off description should be able
|
|
142
|
+
to tell), with its own constant for the reason stated above. A5's
|
|
143
|
+
security half applies here too, one step removed: a tool schema is a
|
|
144
|
+
JSON array rather than a rendered list, so a newline cannot leave its
|
|
145
|
+
bullet the way #131's did -- but the newlines still arrive, and what
|
|
146
|
+
they can do then depends on a consumer. That dependence is what A5
|
|
147
|
+
exists to remove, and this project has already paid for it once at the
|
|
148
|
+
consumer end: core/reasoning/authorization.py takes
|
|
149
|
+
`description.strip().splitlines()[0]` for the grant picker, which is a
|
|
150
|
+
consumer defending itself against this producer.
|
|
151
|
+
"""
|
|
152
|
+
collapsed = " ".join(str(text).split())
|
|
153
|
+
if len(collapsed) <= MAX_TOOL_DESCRIPTION_CHARS:
|
|
154
|
+
return collapsed
|
|
155
|
+
return collapsed[:MAX_TOOL_DESCRIPTION_CHARS - 1].rstrip() + "\u2026"
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _too_big(schema: dict) -> str:
|
|
159
|
+
"""Why this schema cannot be advertised, or "".
|
|
160
|
+
|
|
161
|
+
Measured on the SERIALISED form, because that is what is paid: the
|
|
162
|
+
dict goes to the provider as JSON on every call. A schema that will
|
|
163
|
+
not serialise at all is refused by the same gate -- it could not be
|
|
164
|
+
sent either way, and finding that out here names the server instead
|
|
165
|
+
of raising inside the provider branch in core/client.py.
|
|
166
|
+
"""
|
|
167
|
+
try:
|
|
168
|
+
size = len(json.dumps(schema))
|
|
169
|
+
except (TypeError, ValueError) as e:
|
|
170
|
+
return f"its schema is not JSON-serialisable ({e})"
|
|
171
|
+
if size > MAX_TOOL_SCHEMA_CHARS:
|
|
172
|
+
return (f"its schema is {size} characters and the limit is "
|
|
173
|
+
f"{MAX_TOOL_SCHEMA_CHARS}")
|
|
174
|
+
return ""
|
|
175
|
+
|
|
176
|
+
|
|
59
177
|
def schema_for(server_name: str, tool) -> dict:
|
|
60
178
|
"""MCP Tool -> the Anthropic-native schema shape every TOOL_SCHEMA in
|
|
61
179
|
tools/builtin/ uses.
|
|
@@ -77,7 +195,11 @@ def schema_for(server_name: str, tool) -> dict:
|
|
|
77
195
|
description = f"{title}. {description}".strip()
|
|
78
196
|
return {
|
|
79
197
|
"name": tool_name_for(server_name, tool.name),
|
|
80
|
-
|
|
198
|
+
# BOUNDED AFTER the prefix and the title are composed in, so one
|
|
199
|
+
# call covers all three strings: `title` is server-supplied too
|
|
200
|
+
# and reaches the model through this field, which a cap applied
|
|
201
|
+
# before the concatenation would have missed.
|
|
202
|
+
"description": _bounded(f"[MCP: {server_name}] {description}"),
|
|
81
203
|
"input_schema": input_schema,
|
|
82
204
|
}
|
|
83
205
|
|
|
@@ -98,6 +220,20 @@ def register_all(client, registry) -> list:
|
|
|
98
220
|
for server_name in sorted(client.clients):
|
|
99
221
|
cfg = client.server_configs.get(server_name)
|
|
100
222
|
auto_approve = bool(getattr(cfg, "auto_approve", False))
|
|
223
|
+
# ONE WARNING FOR THE SERVER, not one per tool: a character the
|
|
224
|
+
# rule rejects in the SERVER half poisons every name it composes,
|
|
225
|
+
# and `"my.server"` or `"api.example.com"` is an ordinary
|
|
226
|
+
# mcp.json key. The tool half is checked per tool below, where
|
|
227
|
+
# only that tool is lost.
|
|
228
|
+
bad_chars = _illegal_chars(server_name)
|
|
229
|
+
if bad_chars:
|
|
230
|
+
logger.warning(
|
|
231
|
+
"MCP server %r can compose no advertisable tool name: its "
|
|
232
|
+
"name contains %s, and a provider accepts only letters, "
|
|
233
|
+
"digits, '_' and '-' in a tool name. Rename the server in "
|
|
234
|
+
"mcp.json; none of its tools are registered.",
|
|
235
|
+
server_name, ", ".join(repr(c) for c in bad_chars))
|
|
236
|
+
continue
|
|
101
237
|
try:
|
|
102
238
|
tools = client.list_tools(server_name)
|
|
103
239
|
except Exception as e:
|
|
@@ -107,6 +243,31 @@ def register_all(client, registry) -> list:
|
|
|
107
243
|
|
|
108
244
|
for tool in tools:
|
|
109
245
|
name = tool_name_for(server_name, tool.name)
|
|
246
|
+
# REFUSE, DO NOT MANGLE (A30). A silently renamed tool is one
|
|
247
|
+
# the model cannot name back, and the prefix is not a parser,
|
|
248
|
+
# so a generated name maps to no server. Refusing is also the
|
|
249
|
+
# only outcome that keeps this module's own invariant the
|
|
250
|
+
# right way up: "one unreachable server must never take down
|
|
251
|
+
# the others" has an inversion, and advertising a name no
|
|
252
|
+
# provider accepts is it -- one list comprehension builds the
|
|
253
|
+
# whole `tools` array, so one bad name makes EVERY request
|
|
254
|
+
# malformed, in plain chat and all ten research passes, and a
|
|
255
|
+
# 400 is not transient so nothing retries it.
|
|
256
|
+
#
|
|
257
|
+
# Within decision G rather than against it: G says an entry we
|
|
258
|
+
# cannot make sense of becomes that one server's NAMED
|
|
259
|
+
# failure instead of a startup error for everything else,
|
|
260
|
+
# which is exactly what this is. What G rules out is
|
|
261
|
+
# up-front SCHEMA validation of mcp.json, and nothing here
|
|
262
|
+
# reads the file.
|
|
263
|
+
schema = schema_for(server_name, tool)
|
|
264
|
+
refusal = _unadvertisable(name) or _too_big(schema)
|
|
265
|
+
if refusal:
|
|
266
|
+
logger.warning(
|
|
267
|
+
"MCP tool %r from server %r cannot be advertised: %s. "
|
|
268
|
+
"Skipping it; the server's other tools are unaffected.",
|
|
269
|
+
name, server_name, refusal)
|
|
270
|
+
continue
|
|
110
271
|
if name in registry._tools:
|
|
111
272
|
# Never overwrite. The colliding registration would replace
|
|
112
273
|
# BOTH the handler and (via set_dynamic_approval_default
|
|
@@ -124,7 +285,7 @@ def register_all(client, registry) -> list:
|
|
|
124
285
|
permissions.set_dynamic_approval_default(name, not auto_approve)
|
|
125
286
|
registry.register(ToolSpec(
|
|
126
287
|
name=name,
|
|
127
|
-
schema=
|
|
288
|
+
schema=schema,
|
|
128
289
|
handler=_make_handler(client, server_name, tool.name),
|
|
129
290
|
# §25 R13. Stated here rather than left to
|
|
130
291
|
# registry.grant_policy's mcp__* fallback: this is the
|
package/memories/manager.py
CHANGED
|
@@ -103,6 +103,15 @@ class MemoryManager:
|
|
|
103
103
|
truncated list can say so, while a log line reaches nobody
|
|
104
104
|
mid-conversation. Same "no silent caps" rule as §20's
|
|
105
105
|
MAX_REVIEW_FINDINGS.
|
|
106
|
+
|
|
107
|
+
A CAP OF 0 MEANS OFF, IN THIS HALF TOO (batch 154). config.yaml
|
|
108
|
+
says so where the value is set, and `remember`'s available_check
|
|
109
|
+
already honours it by hiding the tool. This half did not: `rows[:0]`
|
|
110
|
+
is empty, `total > 0` fires the truncation branch, and every turn
|
|
111
|
+
got a "## Remembered" header announcing "the 0 most recent of 2"
|
|
112
|
+
with a WARNING behind it -- telling the model that remembered
|
|
113
|
+
content exists and is being withheld, while the tool that could
|
|
114
|
+
have earned it is not on the menu.
|
|
106
115
|
"""
|
|
107
116
|
if not self.wants_memories(agent):
|
|
108
117
|
return ""
|
|
@@ -111,6 +120,12 @@ class MemoryManager:
|
|
|
111
120
|
return ""
|
|
112
121
|
|
|
113
122
|
cap = config.MAX_INJECTED_MEMORIES
|
|
123
|
+
if cap <= 0:
|
|
124
|
+
# `<= 0` because the sentence is "a non-positive cap is off".
|
|
125
|
+
# Only 0 is reachable -- config_schema types this key
|
|
126
|
+
# NonNegativeInt -- so the other half of the comparison is the
|
|
127
|
+
# schema's job and not this line's.
|
|
128
|
+
return ""
|
|
114
129
|
shown, total = rows[:cap], len(rows)
|
|
115
130
|
header = "## Remembered"
|
|
116
131
|
if total > cap:
|
package/memories/tui_commands.py
CHANGED
|
@@ -20,8 +20,9 @@ something the user relies on.
|
|
|
20
20
|
|
|
21
21
|
from uuid import UUID
|
|
22
22
|
|
|
23
|
-
from tui.commands import SlashCommand, registry as commands
|
|
24
23
|
from memories.manager import manager
|
|
24
|
+
from tui.commands import bind
|
|
25
|
+
from tui.commands import registry as commands
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def _cmd_memories(app, args: str) -> None:
|
|
@@ -94,7 +95,14 @@ def _cmd_summary(app, args: str) -> None:
|
|
|
94
95
|
from core import compaction
|
|
95
96
|
try:
|
|
96
97
|
notice = compaction.summarize_thread(
|
|
97
|
-
memory.thread_id, app.model, app.provider_name
|
|
98
|
+
memory.thread_id, app.model, app.provider_name,
|
|
99
|
+
# Batch 59. /summary runs the compactor with
|
|
100
|
+
# nothing above it, so depth 0 -- it IS the stack.
|
|
101
|
+
# getattr: these commands are driven against stub apps
|
|
102
|
+
# in the suite (tests/test_thread_refs.py), and a
|
|
103
|
+
# summary must not depend on a sidebar widget
|
|
104
|
+
# existing. None is a fully supported sink.
|
|
105
|
+
activity=getattr(app, "_activity", None), depth=0)
|
|
98
106
|
except Exception as e: # noqa: BLE001 — same containment as /compact
|
|
99
107
|
app.call_from_thread(
|
|
100
108
|
app._transcript.write_error, f"Summary failed: {e}")
|
|
@@ -122,9 +130,9 @@ def _cmd_ref(app, args: str) -> None:
|
|
|
122
130
|
steer another without their say-so. A model-callable `search_threads`
|
|
123
131
|
stays possible later, on this same retrieval and behind D26's gate.
|
|
124
132
|
"""
|
|
133
|
+
import storage
|
|
125
134
|
from core.loop import clear_refs
|
|
126
135
|
from tui.screens import ThreadPickerScreen
|
|
127
|
-
import storage
|
|
128
136
|
|
|
129
137
|
flag = args.strip().lower()
|
|
130
138
|
if flag in ("--list", "list"):
|
|
@@ -193,7 +201,12 @@ def _attach_in_worker(app, thread_id, threads) -> None:
|
|
|
193
201
|
def _work() -> None:
|
|
194
202
|
try:
|
|
195
203
|
notice = compaction.summarize_thread(
|
|
196
|
-
thread_id, app.model, app.provider_name
|
|
204
|
+
thread_id, app.model, app.provider_name,
|
|
205
|
+
# getattr: these commands are driven against stub apps
|
|
206
|
+
# in the suite (tests/test_thread_refs.py), and a
|
|
207
|
+
# summary must not depend on a sidebar widget
|
|
208
|
+
# existing. None is a fully supported sink.
|
|
209
|
+
activity=getattr(app, "_activity", None), depth=0)
|
|
197
210
|
except Exception as e: # noqa: BLE001
|
|
198
211
|
app.call_from_thread(
|
|
199
212
|
app._transcript.write_error, f"Reference failed: {e}")
|
|
@@ -220,13 +233,7 @@ def register_memory_commands() -> None:
|
|
|
220
233
|
§21c's two live here with §21b's rather than in a module of their own:
|
|
221
234
|
they are the same section's family, and `/ref` reads what `/summary`
|
|
222
235
|
writes."""
|
|
223
|
-
commands.register(
|
|
224
|
-
|
|
225
|
-
commands.register(
|
|
226
|
-
|
|
227
|
-
commands.register(SlashCommand(
|
|
228
|
-
"summary", "distil this conversation without folding it",
|
|
229
|
-
_cmd_summary))
|
|
230
|
-
commands.register(SlashCommand(
|
|
231
|
-
"ref", "reference another conversation's summary", _cmd_ref,
|
|
232
|
-
"[--list|--clear]"))
|
|
236
|
+
commands.register(bind("memories", _cmd_memories))
|
|
237
|
+
commands.register(bind("forget", _cmd_forget))
|
|
238
|
+
commands.register(bind("summary", _cmd_summary))
|
|
239
|
+
commands.register(bind("ref", _cmd_ref))
|