@corbits/system-one 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -6
- package/dist/adapter.d.ts +5 -2
- package/dist/adapter.js +13 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -198,13 +198,20 @@ The hub offering's `quirks` are validated and all optional:
|
|
|
198
198
|
}
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
`questions` and `state` are per-call defaults; `providerOptions.systemOne` on a call wins field by field.
|
|
201
|
+
Without `endpoint`, the adapter posts to the catalog provider's `baseURL` + `/systemone`, the host the offering's credential was issued for. A `model` quirk (top level or on `endpoint`) is the model sent on the wire, so one catalog model can be served by providers that name it differently. `questions` and `state` are per-call defaults; `providerOptions.systemOne` on a call wins field by field. Unknown keys throw. The adapter sends the bearer sentinel and the harness injects the offering's credential.
|
|
202
202
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
| Vercel AI Gateway
|
|
207
|
-
|
|
|
203
|
+
| Provider | Provider `baseURL` | `model` quirk |
|
|
204
|
+
| ----------------- | ------------------------------------------ | ----------------------------- |
|
|
205
|
+
| TypeSafe | `https://api.typesafe.ai/v1` | `jev-latest` |
|
|
206
|
+
| Vercel AI Gateway | `https://ai-gateway.vercel.sh/typesafe/v1` | `typesafe-ai/jev` |
|
|
207
|
+
| OpenRouter | `https://openrouter.ai/api/v1` | `typesafe/jev-1.13` |
|
|
208
|
+
| OpenCode Zen | `https://opencode.ai/zen/v1` | `jev-1.13` or `jev-1.13-free` |
|
|
209
|
+
|
|
210
|
+
## Upgrading to 0.3.1
|
|
211
|
+
|
|
212
|
+
- `createSystemOneAdapterFactory` without an `endpoint` quirk now posts to the catalog provider's `baseURL` + `/systemone` instead of the official TypeSafe URL. Set the provider `baseURL` to the API root (for example `https://api.typesafe.ai/v1`), or keep the old behavior with `{"endpoint":{"kind":"official"}}`. The harness sends the offering's credential to whatever URL the adapter returns, so only set an explicit `endpoint` on a host that credential belongs to.
|
|
213
|
+
- A `model` quirk now overrides the model the harness passes (the catalog canonical name).
|
|
214
|
+
- `createSystemOneAdapter` and `evaluate` are unchanged.
|
|
208
215
|
|
|
209
216
|
## Upgrading from 0.1
|
|
210
217
|
|
package/dist/adapter.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ export declare const SYSTEM_ONE_PROVIDER = "corbits-system-one";
|
|
|
5
5
|
export declare function createSystemOneAdapter(config?: EvaluateConfig): ProviderAdapter;
|
|
6
6
|
/**
|
|
7
7
|
* Interchange `AdapterFactory` for `SIDECAR_ADAPTER_MANIFEST`: validates the
|
|
8
|
-
* offering's `quirks` and
|
|
9
|
-
*
|
|
8
|
+
* offering's `quirks` and builds the same adapter `createSystemOneAdapter`
|
|
9
|
+
* does. Without an
|
|
10
|
+
* `endpoint` quirk, requests go to the catalog provider's `baseURL` +
|
|
11
|
+
* `/systemone`. A quirk `model` (on `endpoint` or top level) is the model
|
|
12
|
+
* sent on the wire, overriding the catalog's canonical name.
|
|
10
13
|
*/
|
|
11
14
|
export declare const createSystemOneAdapterFactory: AdapterFactory;
|
package/dist/adapter.js
CHANGED
|
@@ -209,36 +209,37 @@ const SystemOneFactoryQuirks = type({
|
|
|
209
209
|
"state?": State,
|
|
210
210
|
"+": "reject",
|
|
211
211
|
});
|
|
212
|
+
// Interchange joins a relative request path to the catalog provider's
|
|
213
|
+
// `baseURL`, the host the offering's credential was issued for.
|
|
214
|
+
const PROVIDER_ENDPOINT = { kind: "custom", url: "/systemone" };
|
|
212
215
|
/**
|
|
213
216
|
* Interchange `AdapterFactory` for `SIDECAR_ADAPTER_MANIFEST`: validates the
|
|
214
|
-
* offering's `quirks` and
|
|
215
|
-
*
|
|
217
|
+
* offering's `quirks` and builds the same adapter `createSystemOneAdapter`
|
|
218
|
+
* does. Without an
|
|
219
|
+
* `endpoint` quirk, requests go to the catalog provider's `baseURL` +
|
|
220
|
+
* `/systemone`. A quirk `model` (on `endpoint` or top level) is the model
|
|
221
|
+
* sent on the wire, overriding the catalog's canonical name.
|
|
216
222
|
*/
|
|
217
223
|
export const createSystemOneAdapterFactory = (source, quirks) => {
|
|
218
224
|
const parsed = SystemOneFactoryQuirks(quirks ?? {});
|
|
219
225
|
if (parsed instanceof type.errors) {
|
|
220
226
|
throw new Error(`${SYSTEM_ONE_PROVIDER} adapter: invalid quirks: ${parsed.summary}`);
|
|
221
227
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
};
|
|
226
|
-
if (parsed.model !== undefined && endpoint.model === undefined) {
|
|
227
|
-
endpoint.model = parsed.model;
|
|
228
|
+
const wireModel = parsed.endpoint?.model ?? parsed.model;
|
|
229
|
+
if (wireModel === "") {
|
|
230
|
+
throw new Error(`${SYSTEM_ONE_PROVIDER} adapter: invalid quirks: model must not be empty`);
|
|
228
231
|
}
|
|
229
|
-
const adapter = createSystemOneProviderAdapter({ endpoint }, source);
|
|
232
|
+
const adapter = createSystemOneProviderAdapter({ endpoint: parsed.endpoint ?? PROVIDER_ENDPOINT }, source);
|
|
230
233
|
const defaults = {
|
|
231
234
|
...(parsed.state !== undefined && { state: parsed.state }),
|
|
232
235
|
...(parsed.questions !== undefined && { questions: parsed.questions }),
|
|
233
236
|
};
|
|
234
|
-
if (Object.keys(defaults).length === 0)
|
|
235
|
-
return adapter;
|
|
236
237
|
return {
|
|
237
238
|
...adapter,
|
|
238
239
|
buildRequest: (messages, model, options) => {
|
|
239
240
|
const raw = options.providerOptions?.["systemOne"];
|
|
240
241
|
const call = raw === undefined ? {} : raw;
|
|
241
|
-
return adapter.buildRequest(messages, model, {
|
|
242
|
+
return adapter.buildRequest(messages, wireModel ?? model, {
|
|
242
243
|
...options,
|
|
243
244
|
providerOptions: {
|
|
244
245
|
...options.providerOptions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corbits/system-one",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Typed-decision evaluation client for System One (Jev-class) models: arktype question/decision schemas, endpoint configuration with gateway override, and timeout/fallback semantics.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"corbits",
|