Repository navigation
feat(java): add Java sample ports on SDK 0.2.5 - #3
Merged
Merged
Conversation
added 4 commits
November 3, 2026 19:16
Add standalone Maven samples for quickstart, multi-turn conversation, streaming chat, tool permissions, hooks, code review, and model selection. Each sample pins com.qoder.sdk:qoder-agent-sdk:0.2.3 from Maven Central, compiles with --release 8, and ships credential-free JUnit tests that use only the published SDK's public API. Register the modules in an aggregator POM and a Java CI job on JDK 11 and 17 that builds from an empty Maven cache. Document Java requirements in CONTRIBUTING, add a Java column to both sample indexes, record the build and runtime verification in the Java overview, and ignore Maven target directories.
Use explicit imports grouped as SDK, JDK, and test assertions, put each @test annotation on its own line, replace inline fully qualified names with imports, and remove stray blank lines. No behavior change.
Add the four Java samples that were missing against TypeScript and Python: ask user question, external session storage (Redis, PostgreSQL, and the reference in-memory store), custom tools on the SDK 0.2.4 InProcessMcpServer API, and subagents on SessionOptions.agents. Move every Java POM, README, and code comment from SDK 0.2.3 to 0.2.4; the 0.2.4 public API only adds to 0.2.3 and the managed CLI stays 1.1.80. The subagents sample exposes Read, Glob, and Grep at session level because CLI 1.1.80 builds a subagent's tool set from the session's tools and refuses an agent whose tool set resolves empty; the README records this difference from the TypeScript and Python samples. The model selection sample now validates the chosen context window and reasoning effort against the current catalog entry and sends `--tools ""` through a single empty tool name, because SDK 0.2.4 omits `--tools` for an empty list. CI starts Redis and PostgreSQL service containers for the session store contract tests. The Java README records the November 2026 verification runs: 97 credential-free tests pass from an empty Maven cache, and all eleven samples ran with real authentication.
Move every Java sample from SDK 0.2.4 to the published 0.2.5 core and adapt to its API changes: an empty tools list now disables built-in tools, strictMcpConfig(true) excludes CLI-configured MCP servers, and conversation samples read each turn's result before sending the next because send() now defaults to NEXT. External session storage also adopts the new LocalSessionHistory API to delete only host A's closed CLI-local root transcript, forwards an explicit absolute QODER_CONFIG_DIR to the CLI, fails on late mirror errors through MirrorErrorMessage.error(), and hardens PostgreSQL URL handling: raw userinfo is split before percent-decoding, '+' stays literal in database names, and connection errors no longer echo the JDBC URL. Update the Java overview with 0.2.5 runtime notes and the December 1 verification record, and pin SDK 0.2.5 in both public READMEs. TypeScript and Python content remains aligned with main. Re-verified on macOS arm64 / JDK 11 / Maven 3.9.16: the standalone external session storage build passed all 46 tests against local Redis 8.10.3 and PostgreSQL 17.11 with a fresh Central-only Maven cache, and the memory, Redis, and PostgreSQL backends each completed a real handoff with the SDK's managed CLI 1.1.80 (QODERCLI_PATH unset).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Java implementations for all eleven sample concepts, built against the
published Global SDK
com.qoder.sdk:qoder-agent-sdk:0.2.5from Maven Central.TypeScript and Python samples are unchanged.
What's included
chat, tool permissions, ask user question, hooks, code review, model
selection, custom tools, subagents, and external session storage. Each has
its own POM, README, main class, and credential-free JUnit tests, and builds
independently when copied out of the repository.
--release 8; building requires JDK 11 or later(17 recommended) and Maven 3.6.3 or later.
and PostgreSQL services for the session-store contract tests.
entry; CONTRIBUTING and a Java overview document the build and runtime
requirements.
External session storage
SessionStorecontract:append ordering, idempotent batches, version checks, UUID conflict handling,
per-transcript isolation, atomic writes, deletion seals, and non-blocking
I/O. The SDK's
InMemorySessionStoreserves as the reference backend.SessionHandoffdemonstrates cross-process resume: host A remembers amarker, host B resumes the session in a second CLI process from the external
store and returns it. The sample deletes only host A's closed CLI-local root
transcript through
LocalSessionHistoryand forwards an explicit absoluteQODER_CONFIG_DIRto the CLI.SDK 0.2.5 API usage
toolslist disables built-in tools;strictMcpConfig(true)excludes CLI-configured MCP servers.
send()now defaults toNEXT.Verification
mvn -B -ntp clean verify: 119 tests, no failures, errors, orskips, with local Redis 8.10.3 and PostgreSQL 17.11 enabling the
session-store contract cases. The SDK jar resolved from Maven Central into a
fresh local cache and matched its published SHA-1.
on December 1, 2026, including real handoffs on all three backends.
QODER_PERSONAL_ACCESS_TOKENand the SDK's managed CLI 1.1.80(
QODERCLI_PATHunset). Each external-storage backend stored the transcript,resumed it in a new CLI process, returned the marker, and deleted the
external transcript on cleanup.
redis:7-alpine,postgres:17-alpine) isconfigured but was not exercised locally; local verification used JDK 11 and
native Redis/PostgreSQL builds.