Skip to content

fix(sdks)!: rewrite to match real server contract (0.2.0)#15

Merged
stevepaltridge merged 5 commits intomainfrom
fix/sdk-real-contract
Apr 24, 2026
Merged

fix(sdks)!: rewrite to match real server contract (0.2.0)#15
stevepaltridge merged 5 commits intomainfrom
fix/sdk-real-contract

Conversation

@stevepaltridge
Copy link
Copy Markdown
Contributor

Why

0.1.0 SDKs were published with a fictional API. Live smoke against the running ghcr.io/recallworks/recall:0.1.0 container caught two contract violations end-to-end:

  1. SDKs sent Authorization: Bearer <key> — server wants X-API-Key
  2. SDKs sent tags: ["a","b"] — ChromaDB rejects: Expected metadata value to be a str, int, float or bool, got [...] which is a list

Root-cause review showed the entire SDK surface was invented. Function names, parameters, return shapes — all wrong.

What

Rewrote both SDKs to match the real server, bumped to 0.2.0, marked BREAKING.

Real contract (verified against server source + live container):

  • Endpoint: POST /tool/{name} with JSON body
  • Auth header: X-API-Key
  • Response envelope (every tool): {result: str, tool: str, by: str}
  • Errors: 4xx/5xx with {error: str}
  • GET /health — no auth

Real signatures now mirrored exactly:

  • remember(content, source='agent-observation', tags='') — tags is COMMA-SEPARATED STRING
  • recall(query, n=5, type='all') — uses n, not limit
  • forget(source) — takes source LABEL, not chunk id; soft-archives
  • checkpoint(intent, established, pursuing, open_questions, session='', domain='')
  • reflect/anti_pattern/session_close — snake_case server keys
  • pulse/memory_stats/reindex/index_file/maintenance/snapshot_index

Generic escape hatch: call_tool(name, **kwargs) / callTool(name, payload) returns ToolResponse.

Killed fictional types: Hit, RememberResult, CheckpointInput.

Verification

Surface Unit Typecheck Live smoke against container
Python sync 16/16 ✅ ✅ remember/recall/stats/checkpoint/auth-error
Python async (incl above) ✅ remember/recall
TypeScript 16/16 ✅ clean ✅ ✅ health/remember/recall/checkpoint/auth-error

Test container: docker run -d -p 8799:8787 -e API_KEY=smoke-key ghcr.io/recallworks/recall:0.1.0

Both smoke_live.py and smoke_live.ts are committed and reproducible.

Migration (0.1.0 → 0.2.0)

recall() no longer returns Hit[] — returns ToolResponse whose .result is the markdown the server emits. Same for every tool. Use .result everywhere a structured field used to be.

Next

Once PYPI_API_TOKEN + NPM_TOKEN repo secrets are in place: git tag python-sdk-v0.2.0 && git push --tags (then same for ts-sdk-v0.2.0).

Steve Paltridge added 2 commits April 24, 2026 02:06
- release-python-sdk.yml: tag python-sdk-v* -> build + publish to PyPI

- release-ts-sdk.yml: tag ts-sdk-v* -> typecheck/test/build + publish to npm with provenance

- docs/releasing-sdks.md: one-time secrets setup + release runbook

Both workflows verify tag matches package version before publishing.
…r contract (0.2.0)

BREAKING CHANGE: 0.1.0 was published with a fictional API. Live smoke against ghcr.io/recallworks/recall:0.1.0 caught two server-contract violations (Authorization header instead of X-API-Key; tags as list instead of comma-separated string). Root-cause review showed the entire surface was invented. This commit rewrites both SDKs to match the real server.

Real contract:

- Auth header: X-API-Key (not Authorization: Bearer)

- Endpoint: POST /tool/{name} with JSON body

- Response envelope (ALL tools): {result: str, tool: str, by: str}

- Errors: 4xx/5xx with {error: str}

- /health: GET, no auth

Signatures now match server exactly (recall uses n+type, remember tags is comma-separated string, forget takes source label not chunk id, checkpoint/reflect/anti_pattern/session_close use snake_case body keys, etc.).

Verification:

- Python: 16/16 unit tests pass; live smoke against running container PASSED (sync+async remember/recall/memory_stats/checkpoint + auth-error path)

- TypeScript: 16/16 vitest pass; tsc --noEmit clean; live smoke PASSED (health/remember/recall/checkpoint + auth-error path)
@stevepaltridge stevepaltridge enabled auto-merge (squash) April 24, 2026 08:21
@stevepaltridge stevepaltridge merged commit e75ea75 into main Apr 24, 2026
8 of 9 checks passed
@stevepaltridge stevepaltridge deleted the fix/sdk-real-contract branch April 24, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant