@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.
Files changed (130) hide show
  1. package/.env.example +19 -14
  2. package/CONFIG_ARCHITECTURE.md +2002 -0
  3. package/NOTICE +1 -1
  4. package/README.md +249 -93
  5. package/agents/builtin/build.md +73 -0
  6. package/agents/builtin/general.md +80 -0
  7. package/agents/builtin/plan.md +23 -5
  8. package/agents/builtin/test.md +65 -0
  9. package/agents/builtin/writer.md +67 -0
  10. package/agents/manager.py +261 -195
  11. package/agents/subagent_tool.py +280 -23
  12. package/agents/tui_commands.py +31 -21
  13. package/bin/venastine.mjs +528 -382
  14. package/bin/venastine.py +71 -0
  15. package/cli_commands.py +835 -0
  16. package/config.py +95 -1198
  17. package/config.yaml +1090 -0
  18. package/config_edit.py +1301 -0
  19. package/config_schema.py +966 -0
  20. package/config_update.py +749 -0
  21. package/core/agent_activity.py +256 -0
  22. package/core/ansi.py +452 -0
  23. package/core/approval.py +27 -5
  24. package/core/call_view.py +364 -0
  25. package/core/cancel.py +121 -0
  26. package/core/chatgpt_auth.py +747 -0
  27. package/core/claims_view.py +107 -0
  28. package/core/client.py +1249 -82
  29. package/core/commands.py +454 -0
  30. package/core/compaction.py +1735 -959
  31. package/core/config_loader.py +516 -97
  32. package/core/connect.py +686 -0
  33. package/core/events.py +68 -6
  34. package/core/file_mentions.py +280 -0
  35. package/core/interaction.py +87 -4
  36. package/core/line_pattern.py +128 -0
  37. package/core/loop.py +2566 -1353
  38. package/core/memory.py +482 -370
  39. package/core/pipeline_models.py +23 -9
  40. package/core/provider_errors.py +234 -0
  41. package/core/reasoning/confidence_scoring.py +70 -54
  42. package/core/reasoning/json_retry.py +19 -1
  43. package/core/reasoning/orchestrator.py +232 -53
  44. package/core/reasoning/output_writer.py +90 -31
  45. package/core/reasoning/payload_validation.py +133 -7
  46. package/core/reasoning/pipeline_storage.py +427 -361
  47. package/core/reasoning/review.py +659 -615
  48. package/core/reasoning/scholar.py +38 -14
  49. package/core/reasoning/source_corpus.py +110 -4
  50. package/core/replay.py +315 -167
  51. package/core/session.py +36 -12
  52. package/core/session_view.py +259 -0
  53. package/core/session_wake.py +259 -0
  54. package/core/shell_sessions.py +1553 -0
  55. package/core/workspace_trust.py +1 -1
  56. package/credentials.py +308 -180
  57. package/database.py +82 -1
  58. package/{PRIVACY.md → docs/PRIVACY.md} +19 -7
  59. package/docs/SECURITY.md +108 -0
  60. package/docs/THIRD_PARTY_NOTICES.md +148 -0
  61. package/env_secrets.py +118 -77
  62. package/json_store.py +236 -16
  63. package/logging_setup.py +121 -11
  64. package/main.py +1672 -198
  65. package/mcp_client/client.py +257 -23
  66. package/mcp_client/config.py +484 -379
  67. package/mcp_client/registration.py +163 -2
  68. package/memories/manager.py +15 -0
  69. package/memories/tui_commands.py +21 -14
  70. package/package.json +303 -73
  71. package/project_init/config_files.py +4 -0
  72. package/project_init/generator.py +201 -37
  73. package/project_init/manifest.py +418 -406
  74. package/project_init/tui_commands.py +7 -4
  75. package/prompts/revalidate.md +1 -1
  76. package/prompts/revise.md +17 -15
  77. package/prompts/system_prompts.py +64 -10
  78. package/providers.json.example +94 -92
  79. package/pyproject.toml +149 -100
  80. package/requirements.txt +252 -29
  81. package/safety/policy_enforcement.py +1082 -682
  82. package/security/askpass.py +419 -0
  83. package/security/capability.py +37 -7
  84. package/security/confine.py +484 -0
  85. package/security/hosted.py +182 -0
  86. package/security/permissions.py +54 -7
  87. package/security/posture.py +124 -12
  88. package/security/protected_paths.py +198 -6
  89. package/security/sandbox.py +3262 -139
  90. package/security/secrets.py +855 -0
  91. package/skills/tui_commands.py +3 -4
  92. package/storage.py +1338 -1005
  93. package/tools/base.py +465 -305
  94. package/tools/builtin/_math_common.py +306 -16
  95. package/tools/builtin/_net_common.py +267 -61
  96. package/tools/builtin/arxiv.py +681 -223
  97. package/tools/builtin/ask_user.py +231 -213
  98. package/tools/builtin/discrete_math.py +35 -4
  99. package/tools/builtin/fetch_url.py +239 -21
  100. package/tools/builtin/file_ops.py +341 -33
  101. package/tools/builtin/geometry.py +184 -148
  102. package/tools/builtin/get_time.py +2 -2
  103. package/tools/builtin/linear_algebra.py +66 -23
  104. package/tools/builtin/load_skill.py +10 -0
  105. package/tools/builtin/logic.py +171 -12
  106. package/tools/builtin/pin.py +46 -12
  107. package/tools/builtin/probability_stats.py +224 -228
  108. package/tools/builtin/project_docs.py +80 -21
  109. package/tools/builtin/remember.py +21 -4
  110. package/tools/builtin/shell.py +586 -67
  111. package/tools/builtin/shell_sessions.py +613 -0
  112. package/tools/builtin/symbolic_math.py +80 -10
  113. package/tools/builtin/todo.py +5 -3
  114. package/tools/builtin/web_search.py +329 -151
  115. package/tools/context.py +23 -0
  116. package/tools/isolation.py +387 -314
  117. package/tools/registry.py +374 -29
  118. package/tui/app.py +5281 -397
  119. package/tui/app.tcss +290 -9
  120. package/tui/commands.py +26 -61
  121. package/tui/diffs.py +286 -265
  122. package/tui/history.py +128 -0
  123. package/tui/hosted_driver.py +102 -0
  124. package/tui/markdown.py +1329 -0
  125. package/tui/meters.py +364 -0
  126. package/tui/screens.py +346 -92
  127. package/tui/themes.py +599 -366
  128. package/tui/widgets.py +2673 -116
  129. package/SECURITY.md +0 -88
  130. package/THIRD_PARTY_NOTICES.md +0 -100
@@ -11,6 +11,18 @@ first-order proof assistant -- it can't verify a multi-step natural-
11
11
  deduction proof or reason over quantifiers. What it CAN do is give the
12
12
  model a deterministic ground-truth check for a specific logical claim,
13
13
  which is still real uplift over the model reasoning about it unaided.
14
+
15
+ AND THAT IS WHY THE DOMAIN IS CHECKED (batch 143). `safe_parse` admits
16
+ the whole 230-name allowlist, so `expression` need not be Boolean, and no
17
+ operation used to look. SymPy's `truth_table` substitutes 0/1 and coerces
18
+ the arithmetic value through `bool()`, so `x - 1` was returned as a
19
+ confident NOT table and `x + y` as the truth table of OR -- which has a
20
+ plausible caller, because in GF(2) and in coding theory `x + y` IS XOR.
21
+ `bool()` of an arithmetic value is not a ground-truth check for a logical
22
+ claim; it is a coincidence that agrees with OR for `+` and with AND for
23
+ `*` and diverges elsewhere. A tool whose stated value is that it is
24
+ mechanical has to refuse the inputs it cannot be mechanical about, so
25
+ `_require_boolean` is the paragraph above enforced rather than asserted.
14
26
  """
15
27
 
16
28
  from __future__ import annotations
@@ -18,24 +30,69 @@ from __future__ import annotations
18
30
  from typing import Literal, Optional
19
31
 
20
32
  import sympy
21
- from sympy.logic.boolalg import simplify_logic, truth_table
22
- from sympy.logic.inference import satisfiable
23
33
  from pydantic import BaseModel, Field
34
+ from sympy.logic.boolalg import Boolean, simplify_logic, truth_table
35
+ from sympy.logic.inference import satisfiable
24
36
 
25
- from tools.builtin._math_common import safe_parse, MathParseError
37
+ from tools.builtin._math_common import (
38
+ MathParseError,
39
+ _split_warnings,
40
+ parse_params,
41
+ safe_parse,
42
+ )
26
43
 
27
44
  _OPERATIONS = Literal["simplify", "equivalent", "satisfiable", "tautology", "truth_table"]
28
45
 
46
+ # THE OUTPUT BOUND (batch 143), on the INPUT rather than on the rendered
47
+ # output, because this is the one math operation whose size is predictable
48
+ # before anything is computed: `truth_table` materialises 2**n rows into a
49
+ # list where n comes from a model-supplied string. H5's move -- refuse at
50
+ # the boundary rather than pay a full budget to learn the answer cannot be
51
+ # returned -- and it does NOT touch H4 ("no maximum on any math
52
+ # parameter"), because the symbol count is derived from the expression and
53
+ # is not a parameter anyone can cap.
54
+ #
55
+ # Measured on the real `logic.run`, with `config.MAX_READ_CHARS` (50,000)
56
+ # as the ceiling the other five tools get in `serialize`:
57
+ #
58
+ # columns rows chars returned secs
59
+ # 7 128 15,207 0.01
60
+ # 8 256 33,575 0.01 <- the last one under
61
+ # 9 512 73,511 0.03
62
+ # 10 1,024 159,783 0.06
63
+ # 14 16,384 3,440,679 1.36 <- returned to the model
64
+ # 15 32,768 7,323,687 3.03 before this bound
65
+ #
66
+ # So 8 is where a character cap would have landed anyway; stating it in
67
+ # columns is what lets the refusal name the number the caller controls.
68
+ # Nothing in the suite's own battery exceeds 3 columns.
69
+ _MAX_TRUTH_TABLE_SYMBOLS = 8
70
+
29
71
 
30
72
  class LogicParams(BaseModel):
31
73
  operation: _OPERATIONS = Field(..., description="Which operation to perform")
32
74
  expression: str = Field(
33
75
  ...,
34
- description="Boolean expression using variables and operators & (and), | (or), ~ (not), >> (implies)",
76
+ description=(
77
+ "Boolean expression using variables and operators & (and), "
78
+ "| (or), ~ (not), >> (implies), Xor, Equivalent -- or a "
79
+ "comparison such as Eq(x, 5) or x > 0. It must be a "
80
+ "PROPOSITION: an arithmetic expression like 'x + y' has no "
81
+ "truth value and is refused."
82
+ ),
35
83
  )
36
84
  expression_b: Optional[str] = Field(None, description="Second expression, for the 'equivalent' operation")
37
85
  variables: Optional[list[str]] = Field(
38
- None, description="Explicit variable names/order -- mainly useful for truth_table"
86
+ None,
87
+ description=(
88
+ "Variable names. A name listed here is kept WHOLE -- that is "
89
+ "the load-bearing half: any multi-character name NOT listed is "
90
+ "read as a product of single letters, so 'rain' alone becomes "
91
+ "a*i*n*r (a 16-row table over a, i, n, r) and 'rain & snow' is "
92
+ "a parse error. It also sets the column set and order for "
93
+ "truth_table, and a listed name that does not occur in the "
94
+ "expression becomes a constant column."
95
+ ),
39
96
  )
40
97
 
41
98
 
@@ -51,12 +108,93 @@ TOOL_SCHEMA = {
51
108
  }
52
109
 
53
110
 
111
+ def _require_boolean(expr, field: str, rewritten: set) -> None:
112
+ """Refuse an expression that is not a proposition. See the module docstring.
113
+
114
+ ONE `isinstance`, not a union of four types, and that was measured
115
+ rather than assumed: `Symbol`, `BooleanTrue`, `BooleanFalse` and every
116
+ `Relational` are already `Boolean` subclasses, so the single check
117
+ accepts `a & b`, `a >> b`, `~a`, `Xor(a, b)`, `ITE(a, b, c)`,
118
+ `Eq(x, 5)`, `x > 0`, `a`, `true`, `1 = 1` and refuses `x - 1`,
119
+ `x + y`, `x**2`, `pi`, `2`, `Matrix([[1]])`. One name is also CLOSED
120
+ over whatever Boolean type a future SymPy adds, which an enumeration
121
+ of four would not be.
122
+
123
+ `a & 1` and `a | 0` never reach here -- SymPy's own `&` raises on an
124
+ Integer operand, so an arithmetic constant inside a formula was
125
+ already refused loudly (batch 143).
126
+ """
127
+ if isinstance(expr, Boolean):
128
+ return
129
+ message = (
130
+ "%s parsed as %s, which has no truth value. This tool checks "
131
+ "PROPOSITIONAL claims: combine variables with & (and), | (or), "
132
+ "~ (not), >> (implies), Xor or Equivalent, or use a comparison "
133
+ "such as Eq(x, 5) or x > 0. Substituting 0 and 1 into an "
134
+ "arithmetic expression answers a different question -- 'x + y' "
135
+ "would come back as the truth table of OR."
136
+ % (field, type(expr).__name__))
137
+ # The commonest way to land here is not an arithmetic expression at
138
+ # all: `truth_table expression="rain"` parses as `a*i*n*r`, a Mul, so
139
+ # the domain refusal fires on a perfectly good propositional name. The
140
+ # cause the caller can act on is the SPLIT, so it is appended rather
141
+ # than left for them to infer from "Mul" (batch 143).
142
+ if rewritten:
143
+ message += " " + " ".join(_split_warnings(rewritten, "variables"))
144
+ raise MathParseError(message)
145
+
146
+
147
+ def _truth_table_columns(expr, declared: list[str]) -> list:
148
+ """The column set and order for a truth table.
149
+
150
+ The declared names FIRST, in the order given, then every free symbol
151
+ the caller did not declare, sorted. The second half is not optional and
152
+ is why this is a function: handed a list that does not cover every free
153
+ symbol, SymPy's `truth_table` leaves the rest UNSUBSTITUTED and returns
154
+ the symbol itself as the output -- measured, `truth_table(a & b, [a])`
155
+ gives `([1], b)`, and `bool(Symbol('b'))` is then drawn as `true`. So
156
+ "the declared names" alone would have replaced an ignored parameter
157
+ with a wrong table.
158
+
159
+ A declared name absent from the expression becomes a constant column,
160
+ which is what a caller asking for an explicit order wants (batch 143).
161
+ """
162
+ free = {str(s): s for s in expr.free_symbols}
163
+ columns, seen = [], set()
164
+ for name in declared:
165
+ if name not in seen:
166
+ seen.add(name)
167
+ columns.append(free[name] if name in free else sympy.Symbol(name))
168
+ for name in sorted(free):
169
+ if name not in seen:
170
+ seen.add(name)
171
+ columns.append(free[name])
172
+ return columns
173
+
174
+
54
175
  def run(params: dict) -> dict:
55
- parsed = LogicParams(**params)
176
+ try:
177
+ parsed = parse_params(LogicParams, params)
178
+ except MathParseError as e:
179
+ return {"error": str(e)}
180
+
181
+ # The fourth parsing tool reports a split name too. Batch 131 added
182
+ # this to the three tools that could not reach `symbols=` at all and
183
+ # left this one out, because `variables` already reached it -- but a
184
+ # caller who does not pass it still gets an answer about a product of
185
+ # single letters, and in the FUNCTIONAL spellings that answer is
186
+ # Boolean and therefore silent: `Xor(rain, b)`, `Not(rain)`,
187
+ # `Eq(rain, 5)` and `Implies(rain, b)` all parse, all pass the domain
188
+ # check, and `truth_table` then draws 16 rows over a, i, n, r as a
189
+ # success. Only the infix spellings (`rain & b`) fail loudly, and they
190
+ # fail naming SymPy's operand types (batch 143).
191
+ rewritten: set = set()
56
192
 
57
193
  try:
58
194
  var_names = parsed.variables or []
59
- expr = safe_parse(parsed.expression, symbols=var_names)
195
+ expr = safe_parse(parsed.expression, symbols=var_names,
196
+ rewritten=rewritten)
197
+ _require_boolean(expr, "expression", rewritten)
60
198
  op = parsed.operation
61
199
 
62
200
  if op == "simplify":
@@ -65,7 +203,9 @@ def run(params: dict) -> dict:
65
203
  elif op == "equivalent":
66
204
  if not parsed.expression_b:
67
205
  return {"error": "expression_b is required for 'equivalent'"}
68
- expr_b = safe_parse(parsed.expression_b, symbols=var_names)
206
+ expr_b = safe_parse(parsed.expression_b, symbols=var_names,
207
+ rewritten=rewritten)
208
+ _require_boolean(expr_b, "expression_b", rewritten)
69
209
  result = simplify_logic(expr) == simplify_logic(expr_b)
70
210
 
71
211
  elif op == "satisfiable":
@@ -75,11 +215,27 @@ def run(params: dict) -> dict:
75
215
  result = not satisfiable(sympy.Not(expr))
76
216
 
77
217
  elif op == "truth_table":
78
- free_syms = sorted(expr.free_symbols, key=str)
79
- rows = list(truth_table(expr, free_syms))
218
+ # `variables` decides the columns when it is given, which is
219
+ # the half of its description that used to be inert: this list
220
+ # was `sorted(expr.free_symbols, key=str)` regardless, so
221
+ # neither the requested SET nor the requested ORDER had any
222
+ # effect, while the field was silently load-bearing for the
223
+ # parse (batch 143).
224
+ columns = _truth_table_columns(expr, var_names)
225
+ if len(columns) > _MAX_TRUTH_TABLE_SYMBOLS:
226
+ return {"error":
227
+ "truth_table would need %d columns, which is 2**%d "
228
+ "rows -- too large to return. The ceiling is %d "
229
+ "columns (%d rows). Ask about fewer variables, or "
230
+ "use 'satisfiable' or 'tautology', which answer "
231
+ "whether a row exists without enumerating any."
232
+ % (len(columns), len(columns),
233
+ _MAX_TRUTH_TABLE_SYMBOLS,
234
+ 2 ** _MAX_TRUTH_TABLE_SYMBOLS)}
235
+ rows = list(truth_table(expr, columns))
80
236
  result = [
81
237
  {
82
- "inputs": {str(s): bool(v) for s, v in zip(free_syms, row[0])},
238
+ "inputs": {str(s): bool(v) for s, v in zip(columns, row[0])},
83
239
  "output": bool(row[1]),
84
240
  }
85
241
  for row in rows
@@ -93,4 +249,7 @@ def run(params: dict) -> dict:
93
249
  except Exception as e:
94
250
  return {"error": f"Computation failed: {e}"}
95
251
 
96
- return {"result": result, "operation": op}
252
+ out: dict = {"result": result, "operation": op}
253
+ if rewritten:
254
+ out["warnings"] = _split_warnings(rewritten, "variables")
255
+ return out
@@ -46,6 +46,7 @@ TOOL_SCHEMA = {
46
46
  "it are already protected automatically, so "
47
47
  "reach further back than you think you need).",
48
48
  "minimum": 1,
49
+ "default": 1,
49
50
  },
50
51
  },
51
52
  "required": [],
@@ -69,6 +70,7 @@ UNPIN_TOOL_SCHEMA = {
69
70
  "description": "How many recent turns to release. Defaults "
70
71
  "to 1.",
71
72
  "minimum": 1,
73
+ "default": 1,
72
74
  },
73
75
  },
74
76
  "required": [],
@@ -77,8 +79,17 @@ UNPIN_TOOL_SCHEMA = {
77
79
 
78
80
 
79
81
  def _validated_turns(params: dict) -> object:
80
- """pin/unpin's shared argument validation: the error, or the int."""
81
- last_n = params.get("last_n", 1)
82
+ """pin/unpin's shared argument validation: the error, or the int.
83
+
84
+ An explicit null is ABSENT (batch 190). The ChatGPT plan's model sends
85
+ each optional parameter at its declared default (ROADMAP_v3 §83, the
86
+ owner's live check), so the schema now declares 1; a model that sends
87
+ null instead means the same thing, and refusing it cost a turn. Every
88
+ other non-integer is still refused, never coerced.
89
+ """
90
+ last_n = params.get("last_n")
91
+ if last_n is None:
92
+ last_n = 1
82
93
  if isinstance(last_n, bool) or not isinstance(last_n, int):
83
94
  # isinstance(True, int) is True in Python, and a model emitting
84
95
  # `last_n: true` would otherwise pin exactly one turn while looking
@@ -89,19 +100,42 @@ def _validated_turns(params: dict) -> object:
89
100
  return last_n
90
101
 
91
102
 
92
- def _pinned_share(memory) -> tuple:
103
+ def _pinned_share(memory, parent_run=None) -> tuple:
93
104
  """(tokens still protected, cap) for result text -- M14's rule that a
94
- cap is stated in what the model reads, not only in a log."""
105
+ cap is stated in what the model reads, not only in a log.
106
+
107
+ `parent_run` is threaded through for the CAP, which is a fraction of
108
+ the trigger THIS model folds at (batch 148): a result sentence
109
+ naming a different number than the refusal would be worse than naming
110
+ none.
111
+ """
95
112
  from core.compaction import pin_measurements
96
113
 
97
- m = pin_measurements(memory.thread_id, 1)
114
+ m = pin_measurements(memory.thread_id, 1, *_pair(parent_run))
98
115
  return m["pinned_tokens"], m["max_tokens"]
99
116
 
100
117
 
101
- def run(params: dict, memory=None) -> dict:
118
+ def _pair(parent_run) -> tuple:
119
+ """(model, provider_name) off the enclosing run, or (None, None).
120
+
121
+ A RunInfo is built once per turn (core/loop.py) so this is available on
122
+ every path a model can call `pin` from -- chat, the CLI and a research
123
+ pass. None is not a failure: pin_measurements then measures the cap
124
+ against the configured trigger, which is what it did everywhere before
125
+ #89's cap started depending on the model.
126
+ """
127
+ if parent_run is None:
128
+ return None, None
129
+ return (getattr(parent_run, "model", None),
130
+ getattr(parent_run, "provider_name", None))
131
+
132
+
133
+ def run(params: dict, memory=None, parent_run=None) -> dict:
102
134
  # params.get, not params[]: no provider validates tool inputs against
103
- # the schema, and a bare KeyError escapes the loop's ToolCallDenied
104
- # handler and aborts the whole turn. Same reasoning as load_skill's.
135
+ # the schema. tools/base.py carries the one copy of why, under
136
+ # "WHAT A CALLABLE REGISTERED BELOW MAY RAISE": a handler's exception IS
137
+ # contained, so what this buys is an error dict the model can READ rather
138
+ # than the generic wrapper dispatch() would return (batch 146).
105
139
  last_n = _validated_turns(params)
106
140
  if isinstance(last_n, str):
107
141
  return {"error": f"pin {last_n}"}
@@ -123,7 +157,7 @@ def run(params: dict, memory=None) -> dict:
123
157
  # informed rather than blind.
124
158
  from core.compaction import pin_measurements
125
159
 
126
- m = pin_measurements(memory.thread_id, last_n)
160
+ m = pin_measurements(memory.thread_id, last_n, *_pair(parent_run))
127
161
  if m["requested_tokens"] > m["max_tokens"]:
128
162
  already = (f"{m['pinned_tokens']} tokens are already protected "
129
163
  f"({100 * m['pinned_tokens'] // max(1, m['max_tokens'])}% "
@@ -144,7 +178,7 @@ def run(params: dict, memory=None) -> dict:
144
178
  return {"result": f"Nothing to pin -- the last {last_n} turn(s) are "
145
179
  f"already protected, or the conversation has not "
146
180
  f"got that far yet."}
147
- pinned, cap = _pinned_share(memory)
181
+ pinned, cap = _pinned_share(memory, parent_run)
148
182
  return {
149
183
  "result": f"Pinned the last {last_n} turn(s) ({changed} messages). "
150
184
  f"They will be kept verbatim rather than summarized when "
@@ -153,7 +187,7 @@ def run(params: dict, memory=None) -> dict:
153
187
  }
154
188
 
155
189
 
156
- def unpin_run(params: dict, memory=None) -> dict:
190
+ def unpin_run(params: dict, memory=None, parent_run=None) -> dict:
157
191
  """The mirror of run(): releases the ordinal window instead of
158
192
  protecting it (#89). D26 called a pin reversible; until batch 16
159
193
  nothing anywhere reversed one, and `set_pinned(pinned=False)` was
@@ -171,7 +205,7 @@ def unpin_run(params: dict, memory=None) -> dict:
171
205
  if not released:
172
206
  return {"result": f"Nothing to release -- the last {last_n} "
173
207
  f"turn(s) were not pinned."}
174
- pinned, cap = _pinned_share(memory)
208
+ pinned, cap = _pinned_share(memory, parent_run)
175
209
  return {
176
210
  "result": f"Released the last {last_n} turn(s) ({released} message"
177
211
  f"{'s' if released != 1 else ''}). {pinned} tokens still "