Repository navigation
Commit af4527d
Split modules into model (core), codec, contract (client) and implementations (client-*); byte[] SPIs (#35)
* Split modules into contract (core) and implementations (client-*), align names
core keeps the TypeSafeClient interface, its decorators, TypeSafeException, the
model and the JsonCodec SPI. DefaultTypeSafeClient, ApiKey and the HttpTransport
SPI move to the new client-http module, so the compiler now enforces that core
never sees the HTTP client; TypeSafeClient.builder() becomes
DefaultTypeSafeClient.builder().
Every module's directory, artifact and package share one name:
client-http-jdk, client-http-okhttp, codec-jackson2, codec-jackson3,
client-local, client-mapping, client-testkit (io.github.dfa1.typesafe.<module>,
dashes as dots). No client-* module depends on another in production.
ADR 0003 records the layout (closes #12).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* core: JsonCodec in io.github.dfa1.typesafe.core, so core holds one package
The core artifact held two packages (core, codec); every other module holds
exactly the package its name gives. JsonCodec now sits in core directly, as
HttpTransport sits in client.http.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* client: TypeSafeClient, TypeSafeException and the decorators out of core
core is now the model and JsonCodec only; the client contract (TypeSafeClient,
TypeSafeException, Retrying/DeadlineTypeSafeClient, TokenCounter) is the new
client module, which every client-* module builds on. Serializing the model
(core + a codec) no longer pulls in any client code, and a module named X-Y now
always builds on module X. ADR 0003 rewritten to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* JsonCodec and HttpTransport speak byte[]
JSON goes to and from the wire as UTF-8 bytes: writeValueAsBytes /
writeValueAsPrettyBytes / readValue(byte[], ...), and a byte[] body on
HttpTransport.post and HttpTransportResponse. No String copy on the success
path; bodies become text only for error messages. Jackson2Codec enables
COMBINE_UNICODE_SURROGATES_IN_UTF8: its UTF-8 writer otherwise escapes emoji
as surrogate pairs, which changed what a local model tokenizes (caught by
ClefEngineTest; now pinned by a codec test in both codecs).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* core: JsonCodec is now Codec
The SPI is byte[] in and out, so it isn't JSON-specific: a binary codec (#37)
can implement it. Builder.jsonCodec(...) becomes codec(...); client-http still
needs a JSON codec, since the API speaks JSON.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* client-local: Onnx.json() is now codec(), after the Codec rename
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Codec: drop writeValueAsPrettyBytes
Its one caller was the CLI's --verbose, and indentation is a JSON notion that
doesn't belong on a format-neutral Codec. --verbose now prints compact JSON;
pipe it into jq to read it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* codec: Codec in its own module, so core is pure data
core held one piece of behaviour, the Codec SPI, and the codec-* modules broke
the X-Y rule (no codec module to build on). Codec now lives in
typesafe-java-codec (package io.github.dfa1.typesafe.codec), with no
dependencies; codec-*, client-http and client-local depend on it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent b1a86bb commit af4527d
128 files changed
Lines changed: 1127 additions & 780 deletions
File tree
- .github/workflows
- acceptance
- src/test/java/io/github/dfa1/typesafe/acceptance
- adr
- bom
- client-http-jdk
- src
- main
- java/io/github/dfa1/typesafe/client/http/jdk
- resources/META-INF/services
- test/java/io/github/dfa1/typesafe/client/http/jdk
- client-http-okhttp
- src
- main
- java/io/github/dfa1/typesafe/client/http/okhttp
- resources/META-INF/services
- test/java/io/github/dfa1/typesafe/client/http/okhttp
- client-http
- src
- main/java/io/github/dfa1/typesafe/client/http
- test/java/io/github/dfa1/typesafe/client/http
- client-jdk/src/main/resources/META-INF/services
- client-local
- scripts
- clef
- laya
- tokenizer
- src
- main/java/io/github/dfa1/typesafe/client/local
- test
- java/io/github/dfa1/typesafe/client/local
- resources
- clef
- jev
- laya
- tokenizer
- client-mapping
- src
- main/java/io/github/dfa1/typesafe/client/mapping
- test/java/io/github/dfa1/typesafe/client/mapping
- client-okhttp/src/main/resources/META-INF/services
- client-testkit
- src
- main/java/io/github/dfa1/typesafe/client/testkit
- test/java/io/github/dfa1/typesafe/client/testkit
- client
- src
- main/java/io/github/dfa1/typesafe/client
- test/java/io/github/dfa1/typesafe/client
- cli
- src
- main/java/io/github/dfa1/typesafe/cli
- test/java/io/github/dfa1/typesafe/cli
- codec-jackson2
- src
- main
- java/io/github/dfa1/typesafe/codec/jackson2
- resources/META-INF/services
- test/java/io/github/dfa1/typesafe/codec/jackson2
- codec-jackson3
- src
- main
- java/io/github/dfa1/typesafe/codec/jackson3
- resources/META-INF/services
- test/java/io/github/dfa1/typesafe/codec/jackson3
- codec
- src/main/java/io/github/dfa1/typesafe/codec
- core
- src/main/java/io/github/dfa1/typesafe
- core
- json
- docs
- jackson2/src/main/resources/META-INF/services
- jackson3/src/main/resources/META-INF/services
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | | - | |
16 | | - | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
0 commit comments