@opencode/ai 0.0.0-dev-20065 → 0.0.0-dev-20066
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.
|
@@ -8,6 +8,17 @@ const tupleItemsSchema = (items) => {
|
|
|
8
8
|
return projected[0];
|
|
9
9
|
return { anyOf: projected };
|
|
10
10
|
};
|
|
11
|
+
// Moonshot rejects an `enum` without a sibling `type`. Its `type` may be one type, or one type plus "null".
|
|
12
|
+
const enumType = (values) => {
|
|
13
|
+
const types = [
|
|
14
|
+
...new Set(values.map((value) => (value === null ? "null" : Array.isArray(value) ? "array" : typeof value))),
|
|
15
|
+
];
|
|
16
|
+
if (types.length === 1)
|
|
17
|
+
return types[0];
|
|
18
|
+
if (types.length === 2 && types.includes("null"))
|
|
19
|
+
return [...types.filter((type) => type !== "null"), "null"];
|
|
20
|
+
return undefined;
|
|
21
|
+
};
|
|
11
22
|
const moonshotNode = (schema) => {
|
|
12
23
|
if (Array.isArray(schema))
|
|
13
24
|
return schema.map(moonshotNode);
|
|
@@ -15,18 +26,22 @@ const moonshotNode = (schema) => {
|
|
|
15
26
|
return schema;
|
|
16
27
|
if (typeof schema.$ref === "string")
|
|
17
28
|
return { $ref: schema.$ref };
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if ("items"
|
|
29
|
+
const type = schema.type === undefined && Array.isArray(schema.enum) ? enumType(schema.enum) : undefined;
|
|
30
|
+
return Object.fromEntries([
|
|
31
|
+
...(type === undefined ? [] : [["type", type]]),
|
|
32
|
+
...Object.entries(schema).flatMap(([key, value]) => {
|
|
33
|
+
if (key === "items" && Array.isArray(value))
|
|
34
|
+
return [[key, tupleItemsSchema(value)]];
|
|
35
|
+
if (key === "prefixItems") {
|
|
36
|
+
if ("items" in schema)
|
|
37
|
+
return [];
|
|
38
|
+
return [["items", tupleItemsSchema(Array.isArray(value) ? value : [])]];
|
|
39
|
+
}
|
|
40
|
+
if (key === "unevaluatedItems")
|
|
23
41
|
return [];
|
|
24
|
-
return [[
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return [];
|
|
28
|
-
return [[key, moonshotNode(value)]];
|
|
29
|
-
}));
|
|
42
|
+
return [[key, moonshotNode(value)]];
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
30
45
|
};
|
|
31
46
|
const moonshot = (schema) => {
|
|
32
47
|
const projected = moonshotNode(schema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20066",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20066",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20066",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.112",
|
|
50
50
|
"google-auth-library": "10.5.0"
|