liminal 0.1.0-beta.25
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/LICENSE +202 -0
- package/README.md +26 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +58 -0
- package/esm/_dnt.shims.js.map +1 -0
- package/esm/client/Adapter.d.ts +46 -0
- package/esm/client/Adapter.d.ts.map +1 -0
- package/esm/client/Adapter.js +2 -0
- package/esm/client/Adapter.js.map +1 -0
- package/esm/client/Liminal.d.ts +19 -0
- package/esm/client/Liminal.d.ts.map +1 -0
- package/esm/client/Liminal.js +154 -0
- package/esm/client/Liminal.js.map +1 -0
- package/esm/client/Tool.d.ts +15 -0
- package/esm/client/Tool.d.ts.map +1 -0
- package/esm/client/Tool.js +23 -0
- package/esm/client/Tool.js.map +1 -0
- package/esm/client/constants.d.ts +2 -0
- package/esm/client/constants.d.ts.map +1 -0
- package/esm/client/constants.js +7 -0
- package/esm/client/constants.js.map +1 -0
- package/esm/client/mod.d.ts +5 -0
- package/esm/client/mod.d.ts.map +1 -0
- package/esm/client/mod.js +6 -0
- package/esm/client/mod.js.map +1 -0
- package/esm/core/DescriptionContext.d.ts +11 -0
- package/esm/core/DescriptionContext.d.ts.map +1 -0
- package/esm/core/DescriptionContext.js +103 -0
- package/esm/core/DescriptionContext.js.map +1 -0
- package/esm/core/L.d.ts +4 -0
- package/esm/core/L.d.ts.map +1 -0
- package/esm/core/L.js +4 -0
- package/esm/core/L.js.map +1 -0
- package/esm/core/ReduceDependencies.d.ts +6 -0
- package/esm/core/ReduceDependencies.d.ts.map +1 -0
- package/esm/core/ReduceDependencies.js +2 -0
- package/esm/core/ReduceDependencies.js.map +1 -0
- package/esm/core/Type.d.ts +30 -0
- package/esm/core/Type.d.ts.map +1 -0
- package/esm/core/Type.js +2 -0
- package/esm/core/Type.js.map +1 -0
- package/esm/core/TypeVisitor.d.ts +15 -0
- package/esm/core/TypeVisitor.d.ts.map +1 -0
- package/esm/core/TypeVisitor.js +12 -0
- package/esm/core/TypeVisitor.js.map +1 -0
- package/esm/core/annotations/Annotation.d.ts +7 -0
- package/esm/core/annotations/Annotation.d.ts.map +1 -0
- package/esm/core/annotations/Annotation.js +2 -0
- package/esm/core/annotations/Annotation.js.map +1 -0
- package/esm/core/annotations/Assertion.d.ts +8 -0
- package/esm/core/annotations/Assertion.d.ts.map +1 -0
- package/esm/core/annotations/Assertion.js +8 -0
- package/esm/core/annotations/Assertion.js.map +1 -0
- package/esm/core/annotations/Description.d.ts +7 -0
- package/esm/core/annotations/Description.d.ts.map +1 -0
- package/esm/core/annotations/Description.js +8 -0
- package/esm/core/annotations/Description.js.map +1 -0
- package/esm/core/annotations/Param.d.ts +13 -0
- package/esm/core/annotations/Param.d.ts.map +1 -0
- package/esm/core/annotations/Param.js +11 -0
- package/esm/core/annotations/Param.js.map +1 -0
- package/esm/core/annotations/Template.d.ts +10 -0
- package/esm/core/annotations/Template.d.ts.map +1 -0
- package/esm/core/annotations/Template.js +2 -0
- package/esm/core/annotations/Template.js.map +1 -0
- package/esm/core/annotations/mod.d.ts +6 -0
- package/esm/core/annotations/mod.d.ts.map +1 -0
- package/esm/core/annotations/mod.js +7 -0
- package/esm/core/annotations/mod.js.map +1 -0
- package/esm/core/assert.d.ts +22 -0
- package/esm/core/assert.d.ts.map +1 -0
- package/esm/core/assert.js +155 -0
- package/esm/core/assert.js.map +1 -0
- package/esm/core/declareIntrinsic.d.ts +4 -0
- package/esm/core/declareIntrinsic.d.ts.map +1 -0
- package/esm/core/declareIntrinsic.js +26 -0
- package/esm/core/declareIntrinsic.js.map +1 -0
- package/esm/core/deserialize.d.ts +3 -0
- package/esm/core/deserialize.d.ts.map +1 -0
- package/esm/core/deserialize.js +32 -0
- package/esm/core/deserialize.js.map +1 -0
- package/esm/core/display.d.ts +3 -0
- package/esm/core/display.d.ts.map +1 -0
- package/esm/core/display.js +75 -0
- package/esm/core/display.js.map +1 -0
- package/esm/core/inspect.node.d.ts +5 -0
- package/esm/core/inspect.node.d.ts.map +1 -0
- package/esm/core/inspect.node.js +7 -0
- package/esm/core/inspect.node.js.map +1 -0
- package/esm/core/intrinsics.d.ts +19 -0
- package/esm/core/intrinsics.d.ts.map +1 -0
- package/esm/core/intrinsics.js +64 -0
- package/esm/core/intrinsics.js.map +1 -0
- package/esm/core/intrinsics_util.d.ts +6 -0
- package/esm/core/intrinsics_util.d.ts.map +1 -0
- package/esm/core/intrinsics_util.js +46 -0
- package/esm/core/intrinsics_util.js.map +1 -0
- package/esm/core/isType.d.ts +4 -0
- package/esm/core/isType.d.ts.map +1 -0
- package/esm/core/isType.js +18 -0
- package/esm/core/isType.js.map +1 -0
- package/esm/core/mod.d.ts +13 -0
- package/esm/core/mod.d.ts.map +1 -0
- package/esm/core/mod.js +14 -0
- package/esm/core/mod.js.map +1 -0
- package/esm/core/signature.d.ts +4 -0
- package/esm/core/signature.d.ts.map +1 -0
- package/esm/core/signature.js +93 -0
- package/esm/core/signature.js.map +1 -0
- package/esm/core/utility/Flatten.d.ts +8 -0
- package/esm/core/utility/Flatten.d.ts.map +1 -0
- package/esm/core/utility/Flatten.js +6 -0
- package/esm/core/utility/Flatten.js.map +1 -0
- package/esm/core/utility/Intersection.d.ts +12 -0
- package/esm/core/utility/Intersection.d.ts.map +1 -0
- package/esm/core/utility/Intersection.js +5 -0
- package/esm/core/utility/Intersection.js.map +1 -0
- package/esm/core/utility/Option.d.ts +3 -0
- package/esm/core/utility/Option.d.ts.map +1 -0
- package/esm/core/utility/Option.js +5 -0
- package/esm/core/utility/Option.js.map +1 -0
- package/esm/core/utility/Record.d.ts +3 -0
- package/esm/core/utility/Record.d.ts.map +1 -0
- package/esm/core/utility/Record.js +6 -0
- package/esm/core/utility/Record.js.map +1 -0
- package/esm/core/utility/Set.d.ts +4 -0
- package/esm/core/utility/Set.d.ts.map +1 -0
- package/esm/core/utility/Set.js +7 -0
- package/esm/core/utility/Set.js.map +1 -0
- package/esm/core/utility/TaggedUnion.d.ts +13 -0
- package/esm/core/utility/TaggedUnion.d.ts.map +1 -0
- package/esm/core/utility/TaggedUnion.js +8 -0
- package/esm/core/utility/TaggedUnion.js.map +1 -0
- package/esm/core/utility/Tuple.d.ts +9 -0
- package/esm/core/utility/Tuple.d.ts.map +1 -0
- package/esm/core/utility/Tuple.js +11 -0
- package/esm/core/utility/Tuple.js.map +1 -0
- package/esm/core/utility/mod.d.ts +8 -0
- package/esm/core/utility/mod.d.ts.map +1 -0
- package/esm/core/utility/mod.js +9 -0
- package/esm/core/utility/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts +16 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.js +31 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.js +184 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts +35 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.js +59 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.js +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.js +46 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.js +34 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.js +33 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.js +161 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts +42 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.js +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.d.ts +17 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.js +184 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts +2 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +27 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.d.ts +59 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.js +153 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.js +70 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.js +132 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.js +164 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.js +82 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts +37 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js +110 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.d.ts +22 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.js +23 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.d.ts +118 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.js +208 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +82 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +111 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +140 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +277 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +99 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +180 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts +2 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +38 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +159 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +208 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts +16 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +3 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js.map +1 -0
- package/esm/json_schema/Hydrated.d.ts +4 -0
- package/esm/json_schema/Hydrated.d.ts.map +1 -0
- package/esm/json_schema/Hydrated.js +49 -0
- package/esm/json_schema/Hydrated.js.map +1 -0
- package/esm/json_schema/JSONSchema.d.ts +50 -0
- package/esm/json_schema/JSONSchema.d.ts.map +1 -0
- package/esm/json_schema/JSONSchema.js +46 -0
- package/esm/json_schema/JSONSchema.js.map +1 -0
- package/esm/json_schema/MetaType.d.ts +4 -0
- package/esm/json_schema/MetaType.d.ts.map +1 -0
- package/esm/json_schema/MetaType.js +25 -0
- package/esm/json_schema/MetaType.js.map +1 -0
- package/esm/json_schema/MetaTypeMigration.d.ts +19 -0
- package/esm/json_schema/MetaTypeMigration.d.ts.map +1 -0
- package/esm/json_schema/MetaTypeMigration.js +15 -0
- package/esm/json_schema/MetaTypeMigration.js.map +1 -0
- package/esm/json_schema/PathLike.d.ts +4 -0
- package/esm/json_schema/PathLike.d.ts.map +1 -0
- package/esm/json_schema/PathLike.js +3 -0
- package/esm/json_schema/PathLike.js.map +1 -0
- package/esm/json_schema/mod.d.ts +7 -0
- package/esm/json_schema/mod.d.ts.map +1 -0
- package/esm/json_schema/mod.js +8 -0
- package/esm/json_schema/mod.js.map +1 -0
- package/esm/json_schema/toJSONSchema.d.ts +4 -0
- package/esm/json_schema/toJSONSchema.d.ts.map +1 -0
- package/esm/json_schema/toJSONSchema.js +117 -0
- package/esm/json_schema/toJSONSchema.js.map +1 -0
- package/esm/mod.d.ts +4 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +4 -0
- package/esm/mod.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/providers/OpenAI/OpenAIAdapter.d.ts +17 -0
- package/esm/providers/OpenAI/OpenAIAdapter.d.ts.map +1 -0
- package/esm/providers/OpenAI/OpenAIAdapter.js +56 -0
- package/esm/providers/OpenAI/OpenAIAdapter.js.map +1 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.d.ts +18 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.d.ts.map +1 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.js +26 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.js.map +1 -0
- package/esm/providers/OpenAI/TokenAllowance.d.ts +17 -0
- package/esm/providers/OpenAI/TokenAllowance.d.ts.map +1 -0
- package/esm/providers/OpenAI/TokenAllowance.js +32 -0
- package/esm/providers/OpenAI/TokenAllowance.js.map +1 -0
- package/esm/providers/OpenAI/mod.d.ts +6 -0
- package/esm/providers/OpenAI/mod.d.ts.map +1 -0
- package/esm/providers/OpenAI/mod.js +7 -0
- package/esm/providers/OpenAI/mod.js.map +1 -0
- package/esm/providers/OpenAI/openai_util.d.ts +4 -0
- package/esm/providers/OpenAI/openai_util.d.ts.map +1 -0
- package/esm/providers/OpenAI/openai_util.js +14 -0
- package/esm/providers/OpenAI/openai_util.js.map +1 -0
- package/esm/providers/OpenAI/refine.d.ts +2 -0
- package/esm/providers/OpenAI/refine.d.ts.map +1 -0
- package/esm/providers/OpenAI/refine.js +166 -0
- package/esm/providers/OpenAI/refine.js.map +1 -0
- package/esm/util/ArrayOfLength.d.ts +2 -0
- package/esm/util/ArrayOfLength.d.ts.map +1 -0
- package/esm/util/ArrayOfLength.js +2 -0
- package/esm/util/ArrayOfLength.js.map +1 -0
- package/esm/util/PromiseOr.d.ts +2 -0
- package/esm/util/PromiseOr.d.ts.map +1 -0
- package/esm/util/PromiseOr.js +2 -0
- package/esm/util/PromiseOr.js.map +1 -0
- package/esm/util/WeakMemo.d.ts +7 -0
- package/esm/util/WeakMemo.d.ts.map +1 -0
- package/esm/util/WeakMemo.js +32 -0
- package/esm/util/WeakMemo.js.map +1 -0
- package/esm/util/collect.d.ts +2 -0
- package/esm/util/collect.d.ts.map +1 -0
- package/esm/util/collect.js +8 -0
- package/esm/util/collect.js.map +1 -0
- package/esm/util/isPromise.d.ts +2 -0
- package/esm/util/isPromise.d.ts.map +1 -0
- package/esm/util/isPromise.js +7 -0
- package/esm/util/isPromise.js.map +1 -0
- package/esm/util/isTemplateStringsArray.d.ts +2 -0
- package/esm/util/isTemplateStringsArray.d.ts.map +1 -0
- package/esm/util/isTemplateStringsArray.js +4 -0
- package/esm/util/isTemplateStringsArray.js.map +1 -0
- package/esm/util/mod.d.ts +10 -0
- package/esm/util/mod.d.ts.map +1 -0
- package/esm/util/mod.js +11 -0
- package/esm/util/mod.js.map +1 -0
- package/esm/util/recombine.d.ts +2 -0
- package/esm/util/recombine.d.ts.map +1 -0
- package/esm/util/recombine.js +11 -0
- package/esm/util/recombine.js.map +1 -0
- package/esm/util/splitLast.d.ts +2 -0
- package/esm/util/splitLast.d.ts.map +1 -0
- package/esm/util/splitLast.js +8 -0
- package/esm/util/splitLast.js.map +1 -0
- package/esm/util/type_util.d.ts +5 -0
- package/esm/util/type_util.d.ts.map +1 -0
- package/esm/util/type_util.js +2 -0
- package/esm/util/type_util.js.map +1 -0
- package/package.json +22 -0
- package/src/_dnt.shims.ts +60 -0
- package/src/client/Adapter.ts +50 -0
- package/src/client/Liminal.ts +113 -0
- package/src/client/Tool.ts +17 -0
- package/src/client/constants.ts +6 -0
- package/src/client/mod.ts +6 -0
- package/src/core/DescriptionContext.ts +89 -0
- package/src/core/L.ts +3 -0
- package/src/core/ReduceDependencies.ts +9 -0
- package/src/core/Type.ts +45 -0
- package/src/core/TypeVisitor.ts +44 -0
- package/src/core/annotations/Annotation.ts +14 -0
- package/src/core/annotations/Assertion.ts +18 -0
- package/src/core/annotations/Description.ts +16 -0
- package/src/core/annotations/Param.ts +30 -0
- package/src/core/annotations/Template.ts +11 -0
- package/src/core/annotations/mod.ts +7 -0
- package/src/core/assert.ts +145 -0
- package/src/core/declareIntrinsic.ts +45 -0
- package/src/core/deserialize.ts +36 -0
- package/src/core/display.ts +68 -0
- package/src/core/inspect.node.ts +13 -0
- package/src/core/intrinsics.ts +86 -0
- package/src/core/intrinsics_util.ts +50 -0
- package/src/core/isType.ts +20 -0
- package/src/core/mod.ts +15 -0
- package/src/core/signature.ts +90 -0
- package/src/core/utility/Flatten.ts +14 -0
- package/src/core/utility/Intersection.ts +24 -0
- package/src/core/utility/Option.ts +6 -0
- package/src/core/utility/Record.ts +7 -0
- package/src/core/utility/Set.ts +8 -0
- package/src/core/utility/TaggedUnion.ts +23 -0
- package/src/core/utility/Tuple.ts +24 -0
- package/src/core/utility/mod.ts +9 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/almost_equals.ts +55 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/array_includes.ts +57 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/assert.ts +23 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/assertion_error.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/equal.ts +210 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/equals.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/exists.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/fail.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/false.ts +26 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/greater.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/instance_of.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/is_error.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/less.ts +29 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/less_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/mod.ts +47 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_equals.ts +37 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_instance_of.ts +33 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.ts +42 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/object_match.ts +203 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/rejects.ts +123 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/strict_equals.ts +67 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/string_includes.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/throws.ts +111 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/unimplemented.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/unreachable.ts +21 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/_base32_common.ts +218 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.ts +29 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/ascii85.ts +203 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base32.ts +73 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base58.ts +173 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base64.ts +174 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base64url.ts +88 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/hex.ts +120 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/mod.ts +24 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/varint.ts +242 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +134 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +317 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +204 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +39 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +233 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +18 -0
- package/src/json_schema/Hydrated.ts +52 -0
- package/src/json_schema/JSONSchema.ts +95 -0
- package/src/json_schema/MetaType.ts +32 -0
- package/src/json_schema/MetaTypeMigration.ts +31 -0
- package/src/json_schema/PathLike.ts +9 -0
- package/src/json_schema/mod.ts +8 -0
- package/src/json_schema/toJSONSchema.ts +114 -0
- package/src/mod.ts +3 -0
- package/src/providers/OpenAI/OpenAIAdapter.ts +89 -0
- package/src/providers/OpenAI/OpenAIResponseFormat.ts +54 -0
- package/src/providers/OpenAI/TokenAllowance.ts +29 -0
- package/src/providers/OpenAI/mod.ts +7 -0
- package/src/providers/OpenAI/openai_util.ts +19 -0
- package/src/providers/OpenAI/refine.ts +171 -0
- package/src/util/ArrayOfLength.ts +5 -0
- package/src/util/PromiseOr.ts +1 -0
- package/src/util/WeakMemo.ts +13 -0
- package/src/util/collect.ts +7 -0
- package/src/util/isPromise.ts +8 -0
- package/src/util/isTemplateStringsArray.ts +3 -0
- package/src/util/mod.ts +11 -0
- package/src/util/recombine.ts +10 -0
- package/src/util/splitLast.ts +7 -0
- package/src/util/type_util.ts +3 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
|
|
4
|
+
// on npm.
|
|
5
|
+
|
|
6
|
+
// This code is vendored from `fmt/colors.ts`.
|
|
7
|
+
|
|
8
|
+
// deno-lint-ignore no-explicit-any
|
|
9
|
+
import * as dntShim from "../../../../../_dnt.shims.js";
|
|
10
|
+
|
|
11
|
+
const { Deno } = dntShim.dntGlobalThis as any;
|
|
12
|
+
const noColor = typeof Deno?.noColor === "boolean"
|
|
13
|
+
? Deno.noColor as boolean
|
|
14
|
+
: false;
|
|
15
|
+
|
|
16
|
+
interface Code {
|
|
17
|
+
open: string;
|
|
18
|
+
close: string;
|
|
19
|
+
regexp: RegExp;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const enabled = !noColor;
|
|
23
|
+
|
|
24
|
+
function code(open: number[], close: number): Code {
|
|
25
|
+
return {
|
|
26
|
+
open: `\x1b[${open.join(";")}m`,
|
|
27
|
+
close: `\x1b[${close}m`,
|
|
28
|
+
regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function run(str: string, code: Code): string {
|
|
33
|
+
return enabled
|
|
34
|
+
? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
|
|
35
|
+
: str;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sets the style of text to be printed to bold.
|
|
40
|
+
*
|
|
41
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
|
42
|
+
*
|
|
43
|
+
* @param str Text to make bold
|
|
44
|
+
*
|
|
45
|
+
* @returns Bold text for printing
|
|
46
|
+
*
|
|
47
|
+
* @example Usage
|
|
48
|
+
* ```ts no-assert
|
|
49
|
+
* import { bold } from "@std/internal/styles";
|
|
50
|
+
*
|
|
51
|
+
* console.log(bold("Hello, world!")); // Prints "Hello, world!" in bold
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function bold(str: string): string {
|
|
55
|
+
return run(str, code([1], 22));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Sets the color of text to be printed to red.
|
|
60
|
+
*
|
|
61
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
|
62
|
+
*
|
|
63
|
+
* @param str Text to make red
|
|
64
|
+
*
|
|
65
|
+
* @returns Red text for printing
|
|
66
|
+
*
|
|
67
|
+
* @example Usage
|
|
68
|
+
* ```ts no-assert
|
|
69
|
+
* import { red } from "@std/internal/styles";
|
|
70
|
+
*
|
|
71
|
+
* console.log(red("Hello, world!")); // Prints "Hello, world!" in red
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export function red(str: string): string {
|
|
75
|
+
return run(str, code([31], 39));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Sets the color of text to be printed to green.
|
|
80
|
+
*
|
|
81
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
|
82
|
+
*
|
|
83
|
+
* @param str Text to make green
|
|
84
|
+
*
|
|
85
|
+
* @returns Green text for print
|
|
86
|
+
*
|
|
87
|
+
* @example Usage
|
|
88
|
+
* ```ts no-assert
|
|
89
|
+
* import { green } from "@std/internal/styles";
|
|
90
|
+
*
|
|
91
|
+
* console.log(green("Hello, world!")); // Prints "Hello, world!" in green
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function green(str: string): string {
|
|
95
|
+
return run(str, code([32], 39));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Sets the color of text to be printed to yellow.
|
|
100
|
+
*
|
|
101
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
|
102
|
+
*
|
|
103
|
+
* @param str Text to make yellow
|
|
104
|
+
*
|
|
105
|
+
* @returns Yellow text for print
|
|
106
|
+
*
|
|
107
|
+
* @example Usage
|
|
108
|
+
* ```ts no-assert
|
|
109
|
+
* import { yellow } from "@std/internal/styles";
|
|
110
|
+
*
|
|
111
|
+
* console.log(yellow("Hello, world!")); // Prints "Hello, world!" in yellow
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export function yellow(str: string): string {
|
|
115
|
+
return run(str, code([33], 39));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Sets the color of text to be printed to white.
|
|
120
|
+
*
|
|
121
|
+
* @param str Text to make white
|
|
122
|
+
*
|
|
123
|
+
* @returns White text for print
|
|
124
|
+
*
|
|
125
|
+
* @example Usage
|
|
126
|
+
* ```ts no-assert
|
|
127
|
+
* import { white } from "@std/internal/styles";
|
|
128
|
+
*
|
|
129
|
+
* console.log(white("Hello, world!")); // Prints "Hello, world!" in white
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export function white(str: string): string {
|
|
133
|
+
return run(str, code([37], 39));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Sets the color of text to be printed to gray.
|
|
138
|
+
*
|
|
139
|
+
* @param str Text to make gray
|
|
140
|
+
*
|
|
141
|
+
* @returns Gray text for print
|
|
142
|
+
*
|
|
143
|
+
* @example Usage
|
|
144
|
+
* ```ts no-assert
|
|
145
|
+
* import { gray } from "@std/internal/styles";
|
|
146
|
+
*
|
|
147
|
+
* console.log(gray("Hello, world!")); // Prints "Hello, world!" in gray
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export function gray(str: string): string {
|
|
151
|
+
return brightBlack(str);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Sets the color of text to be printed to bright-black.
|
|
156
|
+
*
|
|
157
|
+
* @param str Text to make bright-black
|
|
158
|
+
*
|
|
159
|
+
* @returns Bright-black text for print
|
|
160
|
+
*
|
|
161
|
+
* @example Usage
|
|
162
|
+
* ```ts no-assert
|
|
163
|
+
* import { brightBlack } from "@std/internal/styles";
|
|
164
|
+
*
|
|
165
|
+
* console.log(brightBlack("Hello, world!")); // Prints "Hello, world!" in bright-black
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export function brightBlack(str: string): string {
|
|
169
|
+
return run(str, code([90], 39));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Sets the background color of text to be printed to red.
|
|
174
|
+
*
|
|
175
|
+
* @param str Text to make its background red
|
|
176
|
+
*
|
|
177
|
+
* @returns Red background text for print
|
|
178
|
+
*
|
|
179
|
+
* @example Usage
|
|
180
|
+
* ```ts no-assert
|
|
181
|
+
* import { bgRed } from "@std/internal/styles";
|
|
182
|
+
*
|
|
183
|
+
* console.log(bgRed("Hello, world!")); // Prints "Hello, world!" with red background
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export function bgRed(str: string): string {
|
|
187
|
+
return run(str, code([41], 49));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Sets the background color of text to be printed to green.
|
|
192
|
+
*
|
|
193
|
+
* @param str Text to make its background green
|
|
194
|
+
*
|
|
195
|
+
* @returns Green background text for print
|
|
196
|
+
*
|
|
197
|
+
* @example Usage
|
|
198
|
+
* ```ts no-assert
|
|
199
|
+
* import { bgGreen } from "@std/internal/styles";
|
|
200
|
+
*
|
|
201
|
+
* console.log(bgGreen("Hello, world!")); // Prints "Hello, world!" with green background
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export function bgGreen(str: string): string {
|
|
205
|
+
return run(str, code([42], 49));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
|
209
|
+
const ANSI_PATTERN = new RegExp(
|
|
210
|
+
[
|
|
211
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
212
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
|
|
213
|
+
].join("|"),
|
|
214
|
+
"g",
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Remove ANSI escape codes from the string.
|
|
219
|
+
*
|
|
220
|
+
* @param string Text to remove ANSI escape codes from
|
|
221
|
+
*
|
|
222
|
+
* @returns Text without ANSI escape codes
|
|
223
|
+
*
|
|
224
|
+
* @example Usage
|
|
225
|
+
* ```ts no-assert
|
|
226
|
+
* import { red, stripAnsiCode } from "@std/internal/styles";
|
|
227
|
+
*
|
|
228
|
+
* console.log(stripAnsiCode(red("Hello, world!"))); // Prints "Hello, world!"
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export function stripAnsiCode(string: string): string {
|
|
232
|
+
return string.replace(ANSI_PATTERN, "");
|
|
233
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
|
|
3
|
+
/** Ways that lines in a diff can be different. */
|
|
4
|
+
export type DiffType = "removed" | "common" | "added";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the result of a diff operation.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam T The type of the value in the diff result.
|
|
10
|
+
*/
|
|
11
|
+
export interface DiffResult<T> {
|
|
12
|
+
/** The type of the diff. */
|
|
13
|
+
type: DiffType;
|
|
14
|
+
/** The value of the diff. */
|
|
15
|
+
value: T;
|
|
16
|
+
/** The details of the diff. */
|
|
17
|
+
details?: DiffResult<T>[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { L, type Type } from "../core/mod.js"
|
|
2
|
+
import type { JSONType } from "./JSONSchema.js"
|
|
3
|
+
|
|
4
|
+
export function Hydrated(type: JSONType): Type<unknown> {
|
|
5
|
+
const types: Record<string, undefined | Type<unknown>> = {}
|
|
6
|
+
return visit(type) as never
|
|
7
|
+
|
|
8
|
+
function visit(type: JSONType) {
|
|
9
|
+
const initial = ((): Type<unknown> => {
|
|
10
|
+
if ("$defs" in type && type.$defs) {
|
|
11
|
+
Object.entries(type.$defs).forEach(([id, jsonType]) => {
|
|
12
|
+
if (!(id in types)) {
|
|
13
|
+
types[id] = undefined
|
|
14
|
+
types[id] = visit(jsonType)
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
if ("$ref" in type) {
|
|
19
|
+
const id = type.$ref.split("#/$defs/").pop()!
|
|
20
|
+
return L.ref(() => types[id]!)
|
|
21
|
+
} else if ("anyOf" in type) {
|
|
22
|
+
return L.union(...type.anyOf.map(visit))
|
|
23
|
+
}
|
|
24
|
+
switch (type.type) {
|
|
25
|
+
case "null": {
|
|
26
|
+
return L.null
|
|
27
|
+
}
|
|
28
|
+
case "boolean": {
|
|
29
|
+
return L.boolean
|
|
30
|
+
}
|
|
31
|
+
case "integer": {
|
|
32
|
+
return L.integer
|
|
33
|
+
}
|
|
34
|
+
case "number": {
|
|
35
|
+
return L.number
|
|
36
|
+
}
|
|
37
|
+
case "string": {
|
|
38
|
+
return type.enum ? L.enum(...type.enum) : L.string
|
|
39
|
+
}
|
|
40
|
+
case "array": {
|
|
41
|
+
return L.array(visit(type.items))
|
|
42
|
+
}
|
|
43
|
+
case "object": {
|
|
44
|
+
return L.object(
|
|
45
|
+
Object.fromEntries(Object.entries(type.properties).map(([k, v]) => [k, visit(v)])),
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})()(type.description)
|
|
50
|
+
return type.const ? L.const(initial, type.const) : initial
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { unreachable } from "../deps/jsr.io/@std/assert/1.0.10/mod.js"
|
|
2
|
+
import { L, type PartialType } from "../core/mod.js"
|
|
3
|
+
import type { Expand } from "../util/mod.js"
|
|
4
|
+
|
|
5
|
+
export type JSONType = JSONTypes[JSONTypeName]
|
|
6
|
+
export type JSONTypeName = keyof JSONTypes
|
|
7
|
+
export type JSONTypes = JSONTypes.Make<{
|
|
8
|
+
null: {
|
|
9
|
+
type: "null"
|
|
10
|
+
}
|
|
11
|
+
boolean: {
|
|
12
|
+
type: "boolean"
|
|
13
|
+
}
|
|
14
|
+
integer: {
|
|
15
|
+
type: "integer"
|
|
16
|
+
}
|
|
17
|
+
number: {
|
|
18
|
+
type: "number"
|
|
19
|
+
}
|
|
20
|
+
string: {
|
|
21
|
+
type: "string"
|
|
22
|
+
enum?: Array<string>
|
|
23
|
+
}
|
|
24
|
+
array: {
|
|
25
|
+
type: "array"
|
|
26
|
+
items: JSONType
|
|
27
|
+
}
|
|
28
|
+
object: {
|
|
29
|
+
type: "object"
|
|
30
|
+
properties: Record<string, JSONType>
|
|
31
|
+
additionalProperties: false
|
|
32
|
+
required: Array<string>
|
|
33
|
+
$defs?: Record<string, JSONType>
|
|
34
|
+
}
|
|
35
|
+
union: {
|
|
36
|
+
anyOf: Array<JSONType>
|
|
37
|
+
}
|
|
38
|
+
ref: {
|
|
39
|
+
$ref: string
|
|
40
|
+
}
|
|
41
|
+
}>
|
|
42
|
+
namespace JSONTypes {
|
|
43
|
+
export type Make<T> = {
|
|
44
|
+
[K in keyof T]: Expand<
|
|
45
|
+
T[K] & {
|
|
46
|
+
description?: string
|
|
47
|
+
const?: unknown
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function jsonTypeName(type: PartialType): JSONTypeName {
|
|
54
|
+
switch (type.declaration.getAtom?.()) {
|
|
55
|
+
case L.null: {
|
|
56
|
+
return "null"
|
|
57
|
+
}
|
|
58
|
+
case L.boolean: {
|
|
59
|
+
return "boolean"
|
|
60
|
+
}
|
|
61
|
+
case L.number: {
|
|
62
|
+
return "number"
|
|
63
|
+
}
|
|
64
|
+
case L.integer: {
|
|
65
|
+
return "integer"
|
|
66
|
+
}
|
|
67
|
+
case L.string: {
|
|
68
|
+
return "string"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
switch (type.declaration.factory) {
|
|
72
|
+
case L.const: {
|
|
73
|
+
return jsonTypeName(type.declaration.args[0] as PartialType)
|
|
74
|
+
}
|
|
75
|
+
case L.array: {
|
|
76
|
+
return "array"
|
|
77
|
+
}
|
|
78
|
+
case L.object: {
|
|
79
|
+
return "object"
|
|
80
|
+
}
|
|
81
|
+
case L.enum: {
|
|
82
|
+
return "string"
|
|
83
|
+
}
|
|
84
|
+
case L.union: {
|
|
85
|
+
return "union"
|
|
86
|
+
}
|
|
87
|
+
case L.ref: {
|
|
88
|
+
return "ref"
|
|
89
|
+
}
|
|
90
|
+
case L.transform: {
|
|
91
|
+
return jsonTypeName(type.declaration.args[0] as PartialType)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
unreachable()
|
|
95
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { L, type PartialType, type Type } from "../core/mod.js"
|
|
2
|
+
import { Hydrated } from "./Hydrated.js"
|
|
3
|
+
import type { JSONType } from "./JSONSchema.js"
|
|
4
|
+
|
|
5
|
+
const JSONType_: Type<JSONType> = L.transform(
|
|
6
|
+
L.TaggedUnion({
|
|
7
|
+
null: null,
|
|
8
|
+
boolean: null,
|
|
9
|
+
integer: null,
|
|
10
|
+
number: null,
|
|
11
|
+
string: null,
|
|
12
|
+
array: L.object({
|
|
13
|
+
items: L.ref((): PartialType => JSONType_),
|
|
14
|
+
}),
|
|
15
|
+
object: L.transform(L.Record(L.ref((): PartialType => JSONType_)), (properties) => ({
|
|
16
|
+
properties,
|
|
17
|
+
required: Object.keys(properties),
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
})),
|
|
20
|
+
union: L.object({
|
|
21
|
+
anyOf: L.ref(() => JSONType_),
|
|
22
|
+
}),
|
|
23
|
+
}),
|
|
24
|
+
({ type, value }) => ({
|
|
25
|
+
...type === "union" ? {} : { type },
|
|
26
|
+
...value ? value : {},
|
|
27
|
+
}),
|
|
28
|
+
) as never
|
|
29
|
+
|
|
30
|
+
export type MetaType<P extends symbol> = Type<Type<unknown>, P>
|
|
31
|
+
|
|
32
|
+
export const MetaType: MetaType<never> = L.transform(JSONType_, Hydrated)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { L, type Type } from "../core/mod.js"
|
|
2
|
+
import { MetaType } from "./MetaType.js"
|
|
3
|
+
import { PathLike } from "./PathLike.js"
|
|
4
|
+
|
|
5
|
+
export type MetaTypeMigration<P extends symbol> = Type<{
|
|
6
|
+
id: string
|
|
7
|
+
defId: string
|
|
8
|
+
path: PathLike
|
|
9
|
+
change: {
|
|
10
|
+
type: "Create"
|
|
11
|
+
value: Type<unknown>
|
|
12
|
+
} | {
|
|
13
|
+
type: "Update"
|
|
14
|
+
value: Type<unknown>
|
|
15
|
+
} | {
|
|
16
|
+
type: "Delete"
|
|
17
|
+
}
|
|
18
|
+
rationale: string
|
|
19
|
+
}, P>
|
|
20
|
+
|
|
21
|
+
export const MetaTypeMigration: MetaTypeMigration<never> = L.object({
|
|
22
|
+
id: L.string,
|
|
23
|
+
defId: L.string,
|
|
24
|
+
path: PathLike,
|
|
25
|
+
change: L.TaggedUnion({
|
|
26
|
+
Create: MetaType,
|
|
27
|
+
Update: MetaType,
|
|
28
|
+
Delete: null,
|
|
29
|
+
}),
|
|
30
|
+
rationale: L.string,
|
|
31
|
+
})
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DescriptionContext,
|
|
3
|
+
isType,
|
|
4
|
+
type PartialType,
|
|
5
|
+
type Type,
|
|
6
|
+
TypeVisitor,
|
|
7
|
+
} from "../core/mod.js"
|
|
8
|
+
import type { JSONType } from "./JSONSchema.js"
|
|
9
|
+
|
|
10
|
+
export function toJSONSchema(type: Type<unknown, any>): JSONType {
|
|
11
|
+
const ctx = new VisitorContext(
|
|
12
|
+
new Map(),
|
|
13
|
+
{},
|
|
14
|
+
new DescriptionContext(new Map(), {}),
|
|
15
|
+
)
|
|
16
|
+
const root = visit(ctx, type)
|
|
17
|
+
const { "0": _root, ...$defs } = ctx.defs
|
|
18
|
+
return { ...root, $defs } as never
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class VisitorContext {
|
|
22
|
+
constructor(
|
|
23
|
+
readonly ids: Map<PartialType, string>,
|
|
24
|
+
readonly defs: Record<string, undefined | JSONType>,
|
|
25
|
+
readonly descriptionCtx: DescriptionContext,
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
id(type: PartialType): string {
|
|
29
|
+
let id = this.ids.get(type)
|
|
30
|
+
if (id === undefined) {
|
|
31
|
+
id = this.ids.size.toString()
|
|
32
|
+
this.ids.set(type, id)
|
|
33
|
+
}
|
|
34
|
+
return id
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const visit = TypeVisitor<VisitorContext, JSONType>({
|
|
39
|
+
hook(next, { descriptionCtx: { args, pins }, ids, defs }, type) {
|
|
40
|
+
let jsonType: JSONType
|
|
41
|
+
args = { ...args }
|
|
42
|
+
const descriptionCtx = new DescriptionContext(pins, args)
|
|
43
|
+
const description = descriptionCtx.format(type as never)
|
|
44
|
+
const ctx = new VisitorContext(ids, defs, descriptionCtx)
|
|
45
|
+
if (isType(type, "array", "object", "union")) {
|
|
46
|
+
const id = ctx.id(type)
|
|
47
|
+
if (id in defs) {
|
|
48
|
+
return defs[id] ?? {
|
|
49
|
+
$ref: id === "0" ? "#" : `#/$defs/${id}`,
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
defs[id] = undefined
|
|
53
|
+
jsonType = next(ctx, type)
|
|
54
|
+
defs[id] = jsonType
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
jsonType = next(ctx, type)
|
|
58
|
+
}
|
|
59
|
+
return { description, ...jsonType }
|
|
60
|
+
},
|
|
61
|
+
null() {
|
|
62
|
+
return { type: "null" }
|
|
63
|
+
},
|
|
64
|
+
boolean() {
|
|
65
|
+
return { type: "boolean" }
|
|
66
|
+
},
|
|
67
|
+
integer() {
|
|
68
|
+
return { type: "integer" }
|
|
69
|
+
},
|
|
70
|
+
number() {
|
|
71
|
+
return { type: "number" }
|
|
72
|
+
},
|
|
73
|
+
string() {
|
|
74
|
+
return { type: "string" }
|
|
75
|
+
},
|
|
76
|
+
const(ctx, _1, valueType, value): JSONType {
|
|
77
|
+
return {
|
|
78
|
+
...visit(ctx, valueType),
|
|
79
|
+
const: value,
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
array(ctx, _1, element): JSONType {
|
|
83
|
+
return {
|
|
84
|
+
type: "array",
|
|
85
|
+
items: visit(ctx, element),
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
object(ctx, _1, fields): JSONType {
|
|
89
|
+
const required = Object.keys(fields)
|
|
90
|
+
return {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: Object.fromEntries(required.map((k) => [k, visit(ctx, fields[k]!)])),
|
|
93
|
+
required,
|
|
94
|
+
additionalProperties: false,
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
enum(_0, _1, ...values) {
|
|
98
|
+
return {
|
|
99
|
+
type: "string",
|
|
100
|
+
enum: values,
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
union(ctx, _1, ...members): JSONType {
|
|
104
|
+
return {
|
|
105
|
+
anyOf: members.map((member) => visit(ctx, member)),
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
ref(ctx, _1, get): JSONType {
|
|
109
|
+
return visit(ctx, get())
|
|
110
|
+
},
|
|
111
|
+
transform(ctx, _1, from): JSONType {
|
|
112
|
+
return visit(ctx, from)
|
|
113
|
+
},
|
|
114
|
+
})
|
package/src/mod.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type Openai from "openai"
|
|
2
|
+
import type { ChatModel } from "openai/resources/chat/chat"
|
|
3
|
+
import type {
|
|
4
|
+
ChatCompletion,
|
|
5
|
+
ChatCompletionMessage,
|
|
6
|
+
ChatCompletionMessageParam,
|
|
7
|
+
} from "openai/resources/chat/completions"
|
|
8
|
+
import {
|
|
9
|
+
type Adapter,
|
|
10
|
+
DEFAULT_INSTRUCTIONS,
|
|
11
|
+
DescriptionContext,
|
|
12
|
+
L,
|
|
13
|
+
signatureHash,
|
|
14
|
+
toJSONSchema,
|
|
15
|
+
} from "../../mod.js"
|
|
16
|
+
import { unwrapOutput, unwrapRaw } from "./openai_util.js"
|
|
17
|
+
|
|
18
|
+
export type OpenAIAdapter = Adapter<{
|
|
19
|
+
role: "system" | "user"
|
|
20
|
+
model: (string & {}) | ChatModel
|
|
21
|
+
completion: ChatCompletion
|
|
22
|
+
I: ChatCompletionMessageParam
|
|
23
|
+
O: ChatCompletionMessage
|
|
24
|
+
}>
|
|
25
|
+
|
|
26
|
+
export function OpenAIAdapter({
|
|
27
|
+
openai,
|
|
28
|
+
defaultModel = "gpt-4o-mini",
|
|
29
|
+
defaultInstructions = DEFAULT_INSTRUCTIONS,
|
|
30
|
+
}: {
|
|
31
|
+
openai: Openai
|
|
32
|
+
defaultModel?: (string & {}) | ChatModel
|
|
33
|
+
defaultInstructions?: string
|
|
34
|
+
}): OpenAIAdapter {
|
|
35
|
+
const formatInput: OpenAIAdapter["formatInput"] = (texts, role) => ({
|
|
36
|
+
role: role ?? "system",
|
|
37
|
+
content: texts.filter((v): v is string => !!v).map((text) => ({
|
|
38
|
+
type: "text",
|
|
39
|
+
text,
|
|
40
|
+
})),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const text: OpenAIAdapter["text"] = (messages, config) =>
|
|
44
|
+
openai.chat.completions.create({
|
|
45
|
+
model: config?.model ?? defaultModel,
|
|
46
|
+
messages,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
defaults: {
|
|
51
|
+
model: defaultModel,
|
|
52
|
+
role: "user",
|
|
53
|
+
opening: {
|
|
54
|
+
role: "system",
|
|
55
|
+
content: defaultInstructions,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
formatInput,
|
|
59
|
+
unwrapOutput,
|
|
60
|
+
unwrapRaw,
|
|
61
|
+
text,
|
|
62
|
+
value: async (type, { messages, name, description, model }) => {
|
|
63
|
+
messages ??= []
|
|
64
|
+
const descriptionCtx = new DescriptionContext()
|
|
65
|
+
if (type.declaration.factory === L.string) {
|
|
66
|
+
return text([
|
|
67
|
+
...messages ?? [],
|
|
68
|
+
formatInput([description, descriptionCtx.format(type)], "system"),
|
|
69
|
+
])
|
|
70
|
+
}
|
|
71
|
+
if (!name) {
|
|
72
|
+
name = await signatureHash(type)
|
|
73
|
+
}
|
|
74
|
+
return openai.chat.completions.create({
|
|
75
|
+
model: model ?? defaultModel,
|
|
76
|
+
messages,
|
|
77
|
+
response_format: {
|
|
78
|
+
type: "json_schema",
|
|
79
|
+
json_schema: {
|
|
80
|
+
name,
|
|
81
|
+
description,
|
|
82
|
+
schema: toJSONSchema(type),
|
|
83
|
+
strict: true,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
}
|