Skip to content

fix: align Juplend borrow debt mapping#117

Closed
imbingox wants to merge 7 commits into
mainfrom
feat/juplend-borrow-api-reader
Closed

fix: align Juplend borrow debt mapping#117
imbingox wants to merge 7 commits into
mainfrom
feat/juplend-borrow-api-reader

Conversation

@imbingox

@imbingox imbingox commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • derive Juplend borrowed balances and risk debt from the Borrow REST borrow field only
  • stop accepting fallback Juplend token price fields and use the position response token price directly
  • add a patch changeset and update Juplend venue spec/test expectations

Tests

  • bun run lint
  • bun run type-check
  • bun run test

Summary by CodeRabbit

  • New Features

    • Added support for Trae IDE across planning, hooks, and platform detection.
    • Juplend accounts now use the Borrow REST flow with wallet-based reads and optional vault/position filtering.
  • Bug Fixes

    • Improved hook input handling to avoid hangs when stdin is left open.
    • Tightened Juplend balance and risk calculations, including decimal handling and zero-value fallbacks.
  • Documentation

    • Updated platform and Juplend docs to reflect the new configuration and account setup requirements.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f6bfb727-f6ea-4d9a-9888-0b7aa40a9e35

📥 Commits

Reviewing files that changed from the base of the PR and between f9e44d8 and d007f07.

⛔ Files ignored due to path filters (10)
  • .trellis/tasks/archive/2026-07/07-03-ws-periodic-business-liveness/check.jsonl is excluded by !.trellis/tasks/**
  • .trellis/tasks/archive/2026-07/07-03-ws-periodic-business-liveness/design.md is excluded by !.trellis/tasks/**
  • .trellis/tasks/archive/2026-07/07-03-ws-periodic-business-liveness/implement.jsonl is excluded by !.trellis/tasks/**
  • .trellis/tasks/archive/2026-07/07-03-ws-periodic-business-liveness/implement.md is excluded by !.trellis/tasks/**
  • .trellis/tasks/archive/2026-07/07-03-ws-periodic-business-liveness/prd.md is excluded by !.trellis/tasks/**
  • .trellis/tasks/archive/2026-07/07-03-ws-periodic-business-liveness/task.json is excluded by !.trellis/tasks/**
  • .trellis/workspace/codex-agent/index.md is excluded by !.trellis/workspace/**
  • .trellis/workspace/codex-agent/journal-2.md is excluded by !.trellis/workspace/**
  • bun.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (39)
  • .agents/skills/trellis-brainstorm/SKILL.md
  • .agents/skills/trellis-meta/references/customize-local/change-hooks.md
  • .agents/skills/trellis-meta/references/local-architecture/generated-files.md
  • .agents/skills/trellis-meta/references/platform-files/hooks-and-settings.md
  • .agents/skills/trellis-meta/references/platform-files/overview.md
  • .agents/skills/trellis-meta/references/platform-files/platform-map.md
  • .changeset/juplend-borrow-api-reader.md
  • .changeset/juplend-borrow-field-only.md
  • .claude/hooks/inject-workflow-state.py
  • .claude/hooks/session-start.py
  • .claude/skills/trellis-brainstorm/SKILL.md
  • .claude/skills/trellis-meta/references/customize-local/change-hooks.md
  • .claude/skills/trellis-meta/references/local-architecture/generated-files.md
  • .claude/skills/trellis-meta/references/platform-files/hooks-and-settings.md
  • .claude/skills/trellis-meta/references/platform-files/overview.md
  • .claude/skills/trellis-meta/references/platform-files/platform-map.md
  • .codex/hooks/inject-workflow-state.py
  • .trellis/.template-hashes.json
  • .trellis/.version
  • .trellis/scripts/common/active_task.py
  • .trellis/scripts/common/cli_adapter.py
  • .trellis/scripts/common/task_store.py
  • .trellis/spec/sdk/adapters.md
  • .trellis/spec/sdk/architecture.md
  • .trellis/spec/sdk/venues/juplend.md
  • .trellis/workflow.md
  • docs/managers.md
  • docs/quickstart.md
  • docs/types.md
  • package.json
  • scripts/live-juplend-account-smoke.ts
  • src/adapters/juplend/borrow-api.ts
  • src/adapters/juplend/lend-read.ts
  • src/adapters/juplend/private-adapter.ts
  • src/client/runtime.ts
  • src/types/shared.ts
  • tests/integration/account.test.ts
  • tests/support/exchanges/juplend.ts
  • tests/type/register-account-input.ts

📝 Walkthrough

Walkthrough

This PR migrates the Juplend adapter from a Solana RPC-based lend-read implementation to a new Jupiter Borrow REST API adapter, updating types, tests, docs, and changesets accordingly. Separately, it adds Trae IDE platform support and Kiro plain-text breadcrumb output across Trellis hooks/scripts/docs, adds a PRD convergence pass and JSONL readiness gate to skill documentation, and bumps the Trellis version.

Changes

Juplend Borrow REST API Migration

Layer / File(s) Summary
Account options type contract
src/types/shared.ts, tests/type/register-account-input.ts
JuplendAccountOptions now requires walletAddress and drops rpcUrl; type tests updated to expect errors for missing wallet.
New borrow-api adapter
src/adapters/juplend/borrow-api.ts
New module fetches and normalizes positions from the Jup Borrow REST endpoint, exposing readJuplendPositions and getJupApiKey.
Private adapter rewrite
src/adapters/juplend/private-adapter.ts, src/adapters/juplend/lend-read.ts
JuplendPrivateAdapter now uses readJuplendPositions, requires walletAddress, adds decimal-based amount conversion, and the legacy RPC-based lend-read.ts is deleted.
Client wiring
src/client/runtime.ts
createJuplendAdapterGroup passes jupApiKey instead of rpcUrl.
Tests and fixtures
tests/support/exchanges/juplend.ts, tests/integration/account.test.ts
Test harness mocks the Borrow REST endpoint; integration tests cover wallet validation, local filtering, null amounts, and malformed decimals.
Docs, spec, changesets, smoke script
docs/*.md, .trellis/spec/sdk/*, .changeset/*.md, scripts/live-juplend-account-smoke.ts
Documentation, SDK spec, changesets, and the smoke CLI are updated to reflect the required walletAddress and removed rpcUrl.

Trellis Platform Tooling Updates

Layer / File(s) Summary
Trae platform core recognition
.trellis/scripts/common/active_task.py, cli_adapter.py, task_store.py
Adds trae platform detection, IDE-only CLI restrictions, and sub-agent config directory support.
Hook stdin hardening and Kiro output
.claude/hooks/inject-workflow-state.py, .codex/hooks/inject-workflow-state.py, .claude/hooks/session-start.py
Adds async stdin reading with timeout, Trae detection, and a Kiro plain-text breadcrumb output path.
PRD convergence pass and JSONL gate
.agents/skills/trellis-brainstorm/SKILL.md, .claude/skills/trellis-brainstorm/SKILL.md, .trellis/workflow.md
Adds a mandatory PRD convergence pass and a JSONL readiness gate before task.py start.
Trae docs and version bump
.agents/skills/trellis-meta/..., .claude/skills/trellis-meta/..., .trellis/.template-hashes.json, .trellis/.version, package.json
Documents Trae IDE paths, refreshes template hashes, and bumps Trellis version from 0.6.3 to 0.6.5.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • imbingox/acex#28: Both PRs modify the same Juplend integration files (private-adapter.ts, runtime.ts, shared.ts, account.test.ts).
  • imbingox/acex#36: Both PRs touch Juplend read adapter HTTP request/error handling logic in private-adapter.ts.
  • imbingox/acex#97: Both PRs modify the same Trellis hook files (session-start.py, inject-workflow-state.py) for context/breadcrumb output.

Poem

A rabbit hops through vaults and wires,
Swaps RPC calls for REST desires,
Trae joins the hutch of platforms known,
Kiro whispers breadcrumbs, plain, alone,
🥕 hop, hop — the burrow's code review done!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/juplend-borrow-api-reader

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@imbingox

imbingox commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Closing in favor of the clean cherry-pick PR #118.

@imbingox imbingox closed this Jul 7, 2026
@imbingox
imbingox deleted the feat/juplend-borrow-api-reader branch July 7, 2026 15:08
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