@corbits/system-one 0.3.0 → 0.3.2
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 +23 -6
- package/dist/adapter.d.ts +5 -2
- package/dist/adapter.js +13 -12
- package/dist/evaluate.js +2 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -18,6 +18,16 @@ bun add @corbits/system-one @intx/inference@^0.4.0 @intx/types@^0.4.0
|
|
|
18
18
|
|
|
19
19
|
Runs on Bun >= 1.2 or Node >= 24.
|
|
20
20
|
|
|
21
|
+
To consume an exact Git commit before it is published, enable the package's
|
|
22
|
+
source condition because Git dependencies do not run `prepack`:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun add github:corbitsdev/corbits-system-one#<commit>
|
|
26
|
+
bun --conditions=corbits-system-one-src your-script.ts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Published consumers continue to use the built `dist` entry by default.
|
|
30
|
+
|
|
21
31
|
## Quickstart
|
|
22
32
|
|
|
23
33
|
Needs `TYPESAFE_API_KEY` set.
|
|
@@ -198,13 +208,20 @@ The hub offering's `quirks` are validated and all optional:
|
|
|
198
208
|
}
|
|
199
209
|
```
|
|
200
210
|
|
|
201
|
-
`questions` and `state` are per-call defaults; `providerOptions.systemOne` on a call wins field by field.
|
|
211
|
+
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.
|
|
212
|
+
|
|
213
|
+
| Provider | Provider `baseURL` | `model` quirk |
|
|
214
|
+
| ----------------- | ------------------------------------------ | ----------------------------- |
|
|
215
|
+
| TypeSafe | `https://api.typesafe.ai/v1` | `jev-latest` |
|
|
216
|
+
| Vercel AI Gateway | `https://ai-gateway.vercel.sh/typesafe/v1` | `typesafe-ai/jev` |
|
|
217
|
+
| OpenRouter | `https://openrouter.ai/api/v1` | `typesafe/jev-1.13` |
|
|
218
|
+
| OpenCode Zen | `https://opencode.ai/zen/v1` | `jev-1.13` or `jev-1.13-free` |
|
|
219
|
+
|
|
220
|
+
## Upgrading to 0.3.1
|
|
202
221
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
| Vercel AI Gateway | `{"kind":"gateway"}` | `typesafe-ai/jev` |
|
|
207
|
-
| OpenCode Zen | `{"kind":"custom","url":"https://opencode.ai/zen/v1/systemone"}` | `jev-1.13` or `jev-1.13-free` |
|
|
222
|
+
- `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.
|
|
223
|
+
- A `model` quirk now overrides the model the harness passes (the catalog canonical name).
|
|
224
|
+
- `createSystemOneAdapter` and `evaluate` are unchanged.
|
|
208
225
|
|
|
209
226
|
## Upgrading from 0.1
|
|
210
227
|
|
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/dist/evaluate.js
CHANGED
|
@@ -195,7 +195,8 @@ function envKey(name) {
|
|
|
195
195
|
*/
|
|
196
196
|
export async function evaluate(input, options) {
|
|
197
197
|
const deps = options?.deps ?? {
|
|
198
|
-
fetch
|
|
198
|
+
// Browsers reject fetch called as a method of another object.
|
|
199
|
+
fetch: (input, init) => fetch(input, init),
|
|
199
200
|
scheduler: createDefaultScheduler(),
|
|
200
201
|
};
|
|
201
202
|
const start = deps.scheduler.now();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corbits/system-one",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
+
"corbits-system-one-src": "./src/index.ts",
|
|
32
33
|
"types": "./dist/index.d.ts",
|
|
33
34
|
"default": "./dist/index.js"
|
|
34
35
|
}
|
|
@@ -51,17 +52,17 @@
|
|
|
51
52
|
"arktype": "2.2.3"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@intx/inference": "0.
|
|
55
|
-
"@intx/inference-testing": "0.
|
|
56
|
-
"@intx/types": "0.
|
|
55
|
+
"@intx/inference": "0.5.0",
|
|
56
|
+
"@intx/inference-testing": "0.5.0",
|
|
57
|
+
"@intx/types": "0.5.0",
|
|
57
58
|
"@types/bun": "1.3.14",
|
|
58
59
|
"oxfmt": "0.70.0",
|
|
59
60
|
"oxlint": "1.85.0",
|
|
60
61
|
"typescript": "6.0.3"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
|
-
"@intx/inference": "^0.
|
|
64
|
-
"@intx/types": "^0.
|
|
64
|
+
"@intx/inference": "^0.5.0",
|
|
65
|
+
"@intx/types": "^0.5.0"
|
|
65
66
|
},
|
|
66
67
|
"engines": {
|
|
67
68
|
"bun": ">=1.2.0",
|