4 Commits

Author SHA1 Message Date
Nicolò Boschi 2bf10435d5 fix(python-client): add the missing async twins to the convenience wrapper (#4221) (#4228)
* fix(python-client): add the missing async twins to the convenience wrapper (#4221)

The class docstring promises an `a`-prefixed variant for every convenience
method, but 27 of them had none. That is not just inconvenient: the sync
methods go through `_run_async` -> `loop.run_until_complete`, which raises
`RuntimeError: This event loop is already running` inside a live loop. So
mental models, knowledge pages, directives and bank config were unreachable
through the wrapper from exactly the contexts the docstring points at
(FastAPI, LangGraph, CrewAI), and callers had to drop to the generated SDK
for a whole feature area.

Each of the 27 now has its implementation on `a<name>` with the sync method
forwarding to it via `_run_async`, so there is one body per operation rather
than two that can drift.

`tests/test_async_sync_parity.py` guards the family: every public convenience
method must have an async twin, the twins must actually be sync/async, and
their signatures must match argument for argument (a twin that quietly drops a
parameter is the #2975/#3042 failure mode). Plus the issue's repro as a
regression test — the async twin called from inside a running event loop.

* fix(dev): read the bank-config updates dict from aupdate_bank_config

The client-coverage check anchored on the sync update_bank_config to find the
enumerated updates dict. That body now lives on the async twin, with the sync
method forwarding to it, so the check saw a forwarder and reported all 48
fields as accepted-but-never-forwarded.
2026-09-08 18:15:09 +02:00
Nicolò Boschi e8518c392f fix(clients): close the bank-config drift between the wrapper SDKs and the server (#4030)
The wrappers (hindsight_client.py / src/index.ts) are hand-written layers over
the generated SDKs, and they build the config PATCH body by enumerating fields.
The endpoint takes a free-form `updates: dict[str, Any]`, so nothing regenerates
that list and nothing checked it. It had drifted three ways:

- 22 of the server's 47 _CONFIGURABLE_FIELDS were reachable from neither
  wrapper, including the whole recall-budget group and memory_defense.
- 8 more were in Python but not TypeScript.
- reflect.apply_all_directives was missing from both.

Both wrappers now cover all 47, plus apply_all_directives.

Two wrong type hints went with it. llm_gemini_safety_settings was declared
dict[str, str] in Python, but the server, the Gemini provider and the control
plane all take a list of {category, threshold} — a caller following the hint
sent a shape the provider rejects.

client-coverage-check existed to catch exactly this and was wired into no
workflow, so it sat red on main with apply_all_directives missing from both
wrappers. It now runs in CI next to check-cli-coverage, and it can see bank
config: the OpenAPI walk it already did reports updateBankConfig as covered by
its single `updates` property, so the check reads _CONFIGURABLE_FIELDS from
config.py directly.

The bank-config check verifies forwarding, not just acceptance. Declaring the
keyword is not enough — a field accepted and never written into the request body
is silently dropped, which is how this class of bug presents: the caller gets a
200 and no change.

Refs #4029
2026-09-02 14:24:59 +02:00
Sanderhoff-alt feac397324 chore(repo): remove unused code (#3007)
* chore(api): remove unused code

Remove confirmed unreferenced helpers from the API and engine.

Delete tests only where they cover superseded internal paths. Keep
active test helpers and public memory operations unchanged.

* chore(cli): remove unused code

Remove dead CLI configuration, client, and output helpers.

Drop the parser implementation and tests used only by the retired
output path.

* chore(control-plane): remove unused code

Remove unused ControlPlaneClient methods and unreachable directive
detail state from the think view.

* chore(dev): remove unused code

Remove unreferenced benchmark and repository maintenance helpers.

* chore(embed): remove unused code

Remove the unused daemon port lookup helper while preserving current
profile-based daemon discovery.

* chore(integrations): remove unused code

Remove unreferenced helpers across supported integrations.

Drop tests only for retired internal paths and retain active test and
lifecycle infrastructure.

* test(consolidation): port prompt regression tests to split builders

The dead-code cleanup removed build_batch_consolidation_prompt and its tests,
but those tests guarded behaviors that are still live in the current
build_consolidation_system_prompt / build_consolidation_input path:

- brace-safety of a mission / capacity note containing literal { } (a lone
  brace would raise KeyError in the internal str.format() and crash
  consolidation)
- output-language directive injection into the cached system prompt
- the built-in default mission when none is supplied

Re-add these as regression tests against the current builders instead of
dropping the coverage. Also fix a stale comment referencing the removed
utils.extract_facts module.

---------

Co-authored-by: Nicolò Boschi <boschi1997@gmail.com>
2026-07-29 11:18:30 +02:00
Nicolò Boschi 641b39120f fix(typescript-client): expose missing recall/reflect params (#1362)
* fix(typescript-client): expose missing recall/reflect params (tag_groups, responseSchema, factTypes, excludeMentalModels)

Add client-coverage-check tool that validates Python and TypeScript
wrapper clients expose all OpenAPI request body parameters, similar to
the existing cli-coverage-check for the Rust CLI.

The check caught 6 missing fields in the TypeScript wrapper:
- recall: tag_groups
- reflect: tag_groups, response_schema, fact_types, exclude_mental_models, exclude_mental_model_ids

Closes #1348

* refactor(typescript-client): make retain() delegate to retainBatch()

Mirrors the Python client pattern where retain() is a thin wrapper
around retain_batch(). Also exposes observationScopes and strategy
which were previously only available via retainBatch().
2026-05-04 11:54:41 +02:00