Skip to content

feat(sdk): session.ledger() + session.issue() wrappers + two_header api-type - #72

Merged
fabianocruz merged 4 commits into
mainfrom
feat/sdk-ledger-issue-wrappers
Jun 5, 2026
Merged

feat(sdk): session.ledger() + session.issue() wrappers + two_header api-type#72
fabianocruz merged 4 commits into
mainfrom
feat/sdk-ledger-issue-wrappers

Conversation

@fabianocruz

Copy link
Copy Markdown
Member

session.ledger() + session.issue() SDK wrappers + two_header api-type

Typed SDK surface for the two new backend meta-tools (paired with codespar-enterprise feat/latam-catalog-ledger-issue).

TypeScript

  • packages/types: LedgerArgs/LedgerResult, IssueArgs/IssueResult/IssueAction, Session.ledger() / Session.issue().
  • packages/core: session.ledger() (→ codespar_ledger) + session.issue() (→ codespar_issue), plus testing mocks.
  • packages/api-types: add "two_header" to the ServerAuthSchemaResponse auth_type enum so the dashboard connect modal can render the Cielo / Transbank / Kushki / Payway credential form.

Python

  • types.py: LedgerArgs/LedgerResult + IssueArgs/IssueResult/IssueAction.
  • _async_session.py + _sync_client.py: ledger() / issue() (async + sync).
  • __init__.py: exports.

Gates

  • types + api-types build clean; tsc core clean.
  • Python ruff + mypy + pytest green.

Follow-up (not blocking merge)

  • Publish @codespar/api-types so the web connect-modal 1-liner gate for two_header can land.
  • SDK publish via publish.sh (TS 2FA + PyPI OIDC) when cutting a release.

🤖 Generated with Claude Code

fabianocruz and others added 3 commits June 4, 2026 21:25
Hermes Agent (Nous Research) is an open-source autonomous agent runtime
with MCP-server + plugin support and zero commerce tooling — exactly where
CodeSpar's LatAm commerce meta-tools add value (see
codespar-web/docs/research/hermes-agent-privy-2026-06.md).

New package `@codespar/hermes` (0.4.0, peerDep @codespar/sdk@^0.10.0)
mirroring the crewai/langchain adapter scaffold:
- `HermesTool { name, description, inputSchema, call() }` — the MCP-aligned
  tool shape (name/description/JSON-schema + async call → string), the most
  portable contract since Hermes ingests tools via MCP servers + plugins.
- `getTools(session)`, `toHermesTool(tool, session)`,
  `handleToolCall(session, name, args)` — thin transforms wrapping
  `session.execute()`, same idiom as the sibling adapters.
- README documents both the npm adapter (in-process typed tools) AND the
  lower-friction MCP-server paste-URL path via @codespar/mcp.
- 4 conformance tests; tsc clean.
- Added the Hermes row to the monorepo README adapters list.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…pi-type

Typed SDK wrappers for the two new backend meta-tools (codespar-enterprise):
- session.ledger() (codespar_ledger) + session.issue() (codespar_issue),
  across TS (types + core session + testing mock) and Python (async + sync
  client + exports).
- @codespar/api-types: add "two_header" to the ServerAuthSchemaResponse
  auth_type enum so the dashboard connect modal can render the Cielo /
  Transbank / Kushki / Payway credential form.

Gates: types + api-types build clean; tsc core clean; python ruff + mypy
+ pytest green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…pters

Adding session.ledger()/issue() to the Session interface (@codespar/types)
left every adapter's inline mock Session missing the two new methods —
tsc TS2739 across camel, autogen, crewai, google-genai, letta, hermes,
llama-index, langchain, mastra, openai, mcp. Mirror the existing
charge()/ship() stub shape (hermes already had ledger; deduped).

Gate: turbo build 18/18 packages green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fabianocruz fabianocruz closed this Jun 5, 2026
@fabianocruz fabianocruz reopened this Jun 5, 2026
…-wrappers

# Conflicts:
#	packages/hermes/src/__tests__/hermes.test.ts
@fabianocruz
fabianocruz merged commit c586a0c into main Jun 5, 2026
5 checks passed
fabianocruz added a commit that referenced this pull request Jun 5, 2026
…s billing) (#73)

## Run core CI on the self-hosted runner

GitHub-hosted (`ubuntu-latest`) workflow runs no longer trigger on this
repo while the org's Actions billing is blocked — core PRs get **no CI
at all** (this is why #72 had to be validated locally and merged on
`MERGEABLE/UNSTABLE`). `codespar-enterprise` is unaffected because it
already runs on the org self-hosted runner.

This points all 4 jobs (`ci`, `validate-example-skeleton`,
`validate-example-nfse-from-natural-language`,
`validate-example-whatsapp-installment-negotiation`) at `runs-on:
[self-hosted, Linux, X64]` — the same label enterprise uses. CI then
runs free and records real PR checks again.

### ⚠️ Operator (org admin) — one-time, required before this works
1. **Runner group access**: allow `codespar-core` in the self-hosted
runner group's repository access (the runner is registered at the org
level; core currently has 0 runners of its own).
2. **Secret**: set `ANTHROPIC_API_KEY` in `codespar-core` repo secrets —
the three `validate-example` jobs call it via `npm run validate`.

### Note
This is a workflow-file change, so it can't be CI-validated here (CI is
exactly what's blocked). It takes effect on the **next** PR after merge.
The current `main` was validated locally and is green: `turbo run build
typecheck test` → build 18/18, typecheck clean, test 35/35 (after the
one-time macOS `npm i @rollup/rollup-darwin-arm64 --no-save` for the npm
optional-deps bug).

### Alternative if you'd rather not touch the runner
Fix the GitHub Actions billing and revert this — `ubuntu-latest` resumes
on its own.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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