@opencode/codemode 2.2.1 → 2.2.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.
|
@@ -5,7 +5,7 @@ import { checkStringLength } from "./limits.js";
|
|
|
5
5
|
import { locate, materialize } from "./errors.js";
|
|
6
6
|
import { primitivePrototype } from "./intrinsics.js";
|
|
7
7
|
import { globals } from "./globals.js";
|
|
8
|
-
import { assign, Callable, define, frozen, get, hostCursor, IteratorObj, has, hidden, hasPrototype, keys, Native, parseArrayIndex, Arguments, Arr, Fn, GeneratorObj, Obj, PromiseObj, iteratorResult, remove, set, coerceToNumber, coerceToString, } from "./objects.js";
|
|
8
|
+
import { assign, Callable, define, frozen, get, hostCursor, IteratorObj, has, hasOwn, hidden, hasPrototype, keys, Native, parseArrayIndex, Arguments, Arr, Fn, GeneratorObj, Obj, PromiseObj, iteratorResult, remove, set, coerceToNumber, coerceToString, } from "./objects.js";
|
|
9
9
|
import { preserveConsumerError, toPrimitive } from "./callback.js";
|
|
10
10
|
import { AsyncBoundary, Await, Call, Interruption, isEval, MAX_CALL_DEPTH, Runner, Slice, Task, Yield, normal, } from "./runner.js";
|
|
11
11
|
import { describeValue, isOpaque, rejectCircularInsertion, typeofValue } from "./references.js";
|
|
@@ -904,13 +904,25 @@ class Frame {
|
|
|
904
904
|
return value;
|
|
905
905
|
throw typeError(`${context} must be a function.`, node);
|
|
906
906
|
}
|
|
907
|
-
// for...in over null/undefined iterates nothing, like JS.
|
|
907
|
+
// for...in over null/undefined iterates nothing, like JS. After the own keys come each prototype's enumerable
|
|
908
|
+
// string keys, skipping any key a nearer level has, even as a non-enumerable property.
|
|
908
909
|
enumerableKeys(value, node) {
|
|
909
910
|
if (value instanceof ToolReference)
|
|
910
911
|
return [...this.ctx.tools.keys(value.path)];
|
|
911
912
|
if (value === null || value === undefined)
|
|
912
913
|
return [];
|
|
913
|
-
|
|
914
|
+
const source = enumerableSource(this.ctx, "for...in", value, node);
|
|
915
|
+
const chain = [source];
|
|
916
|
+
// A string's characters stand in an array, but its prototype is String.prototype.
|
|
917
|
+
let proto = primitivePrototype(this.ctx.builtins, value) ?? source.proto;
|
|
918
|
+
while (proto !== null) {
|
|
919
|
+
chain.push(proto);
|
|
920
|
+
proto = proto.proto;
|
|
921
|
+
}
|
|
922
|
+
return chain.flatMap((target, depth) => {
|
|
923
|
+
const nearer = chain.slice(0, depth);
|
|
924
|
+
return keys(target).filter((key) => !nearer.some((level) => hasOwn(level, key)));
|
|
925
|
+
});
|
|
914
926
|
}
|
|
915
927
|
*evaluateForInStatement(node, labels) {
|
|
916
928
|
const runner = this.ctx.runner;
|
package/dist/tool-schema.js
CHANGED
|
@@ -65,9 +65,10 @@ const docTags = (schema) => {
|
|
|
65
65
|
tags.push(`@format ${schema.format}`);
|
|
66
66
|
if (schema.type === "integer")
|
|
67
67
|
tags.push("@integer");
|
|
68
|
-
|
|
68
|
+
const integer = schema.type === "integer";
|
|
69
|
+
if (typeof schema.minimum === "number" && !(integer && schema.minimum === Number.MIN_SAFE_INTEGER))
|
|
69
70
|
tags.push(`@minimum ${schema.minimum}`);
|
|
70
|
-
if (typeof schema.maximum === "number")
|
|
71
|
+
if (typeof schema.maximum === "number" && !(integer && schema.maximum === Number.MAX_SAFE_INTEGER))
|
|
71
72
|
tags.push(`@maximum ${schema.maximum}`);
|
|
72
73
|
if (typeof schema.exclusiveMinimum === "number")
|
|
73
74
|
tags.push(`@exclusiveMinimum ${schema.exclusiveMinimum}`);
|
|
@@ -148,7 +149,10 @@ const renderSchema = (schema, ctx, depth = 0, seen = new Set()) => {
|
|
|
148
149
|
return renderLiteral(schema.const);
|
|
149
150
|
if (schema.enum)
|
|
150
151
|
return schema.enum.map(renderLiteral).join(" | ");
|
|
151
|
-
const
|
|
152
|
+
const listed = schema.anyOf ?? schema.oneOf;
|
|
153
|
+
const alternatives = listed?.some((item) => item.type === "number")
|
|
154
|
+
? listed.filter((item) => !effectNumberSentinel(item))
|
|
155
|
+
: listed;
|
|
152
156
|
if (alternatives) {
|
|
153
157
|
if (alternatives.some((item) => item.type === "number") &&
|
|
154
158
|
alternatives.every((item) => item.type === "number" || effectNumberSentinel(item)))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/codemode",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"description": "Effect-native confined code execution over schema-described tools",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"acorn": "8.15.0",
|
|
34
|
-
"effect": "4.0.
|
|
34
|
+
"effect": "4.0.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@tsconfig/bun": "1.0.9",
|