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,54 @@
|
|
|
1
|
+
import type { ChatCompletion } from "openai/resources/chat/completions"
|
|
2
|
+
import type { Type } from "../../core/mod.js"
|
|
3
|
+
import { deserialize, L, toJSONSchema } from "../../mod.js"
|
|
4
|
+
import { recombine } from "../../util/mod.js"
|
|
5
|
+
import { unwrapOutput, unwrapRaw } from "./openai_util.js"
|
|
6
|
+
|
|
7
|
+
export interface OpenAIResponseFormat<T> extends OpenAIFinalResponseFormat<T> {
|
|
8
|
+
(template: TemplateStringsArray, ...values: Array<number | string>): OpenAIFinalResponseFormat<T>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface OpenAIFinalResponseFormat<T> {
|
|
12
|
+
type: "json_schema"
|
|
13
|
+
json_schema: {
|
|
14
|
+
name: string
|
|
15
|
+
description?: string
|
|
16
|
+
schema: Record<string, unknown>
|
|
17
|
+
strict: true
|
|
18
|
+
}
|
|
19
|
+
deserialize: (completion: ChatCompletion) => T
|
|
20
|
+
toJSON(): Pick<OpenAIFinalResponseFormat<T>, "type" | "json_schema">
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function OpenAIResponseFormat<T>(name: string, type: Type<T>): OpenAIResponseFormat<T> {
|
|
24
|
+
return Object.assign(
|
|
25
|
+
(template: TemplateStringsArray, ...values: Array<number | string>) =>
|
|
26
|
+
OpenAIFinalResponseFormat(name, type, recombine(template, values)),
|
|
27
|
+
OpenAIFinalResponseFormat(name, type),
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function OpenAIFinalResponseFormat<T>(
|
|
32
|
+
name: string,
|
|
33
|
+
type: Type<T>,
|
|
34
|
+
description?: string,
|
|
35
|
+
): OpenAIFinalResponseFormat<T> {
|
|
36
|
+
if (type.declaration.factory !== L.object) {
|
|
37
|
+
type = L.transform(L.Tuple(type), ([value]) => value)
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
type: "json_schema",
|
|
41
|
+
json_schema: {
|
|
42
|
+
name,
|
|
43
|
+
description,
|
|
44
|
+
schema: toJSONSchema(type),
|
|
45
|
+
strict: true,
|
|
46
|
+
},
|
|
47
|
+
deserialize: (completion: ChatCompletion): T =>
|
|
48
|
+
deserialize(type, unwrapRaw(unwrapOutput(completion))),
|
|
49
|
+
toJSON() {
|
|
50
|
+
const { type, json_schema } = this
|
|
51
|
+
return { type, json_schema }
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ChatCompletion } from "openai/resources/chat/completions"
|
|
2
|
+
import type { PromiseOr } from "../../util/mod.js"
|
|
3
|
+
|
|
4
|
+
export interface TokenAllowanceOptions {
|
|
5
|
+
/** Number of tokens in the generated completion. */
|
|
6
|
+
completion_tokens?: number
|
|
7
|
+
/** Number of tokens in the prompt. */
|
|
8
|
+
prompt_tokens?: number
|
|
9
|
+
/** Total number of tokens used in the request (prompt + completion). */
|
|
10
|
+
total_tokens?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class TokenAllowance {
|
|
14
|
+
constructor(
|
|
15
|
+
readonly allowances: TokenAllowanceOptions,
|
|
16
|
+
readonly onExceeded?: (self: TokenAllowance) => PromiseOr<void>,
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
ingest = (completion: ChatCompletion): void => {
|
|
20
|
+
const { usage } = completion
|
|
21
|
+
if (usage) {
|
|
22
|
+
Object.keys(this.allowances).forEach((key) => {
|
|
23
|
+
if (!(this.allowances[key as keyof TokenAllowanceOptions]! -= usage[key as never])) {
|
|
24
|
+
this.onExceeded?.(this)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { assert } from "../../deps/jsr.io/@std/assert/1.0.10/mod.js"
|
|
2
|
+
import type { ChatCompletion, ChatCompletionMessage } from "openai/resources/chat/completions"
|
|
3
|
+
|
|
4
|
+
export function unwrapOutput({ choices: [choice] }: ChatCompletion): ChatCompletionMessage {
|
|
5
|
+
assert(choice, "No choices contained within the completion response.")
|
|
6
|
+
const { finish_reason, message } = choice
|
|
7
|
+
assert(
|
|
8
|
+
finish_reason === "stop",
|
|
9
|
+
`Completion responded with "${finish_reason}" as finish reason; ${message}.`,
|
|
10
|
+
)
|
|
11
|
+
const { refusal } = message
|
|
12
|
+
assert(!refusal, `Openai refused to fulfill completion request; ${refusal}.`)
|
|
13
|
+
return message
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function unwrapRaw({ content }: ChatCompletionMessage): string {
|
|
17
|
+
assert(typeof content === "string")
|
|
18
|
+
return content
|
|
19
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export {}
|
|
2
|
+
|
|
3
|
+
// import { assert } from "@std/assert"
|
|
4
|
+
// import type Openai from "openai"
|
|
5
|
+
// import type {
|
|
6
|
+
// ChatCompletionCreateParamsNonStreaming,
|
|
7
|
+
// ChatCompletionMessageParam,
|
|
8
|
+
// } from "openai/resources/chat/completions"
|
|
9
|
+
// import { deserialize, Diagnostic, T, type Type } from "../../../core/mod.ts"
|
|
10
|
+
// import { tap } from "../../../util/mod.ts"
|
|
11
|
+
// import { parseChoice, unwrapChoice } from "./oai_util.ts"
|
|
12
|
+
// import { Prompt } from "./Prompt.ts"
|
|
13
|
+
// import { ResponseFormat } from "./ResponseFormat.ts"
|
|
14
|
+
// import type { TokenAllowance } from "./TokenAllowance.ts"
|
|
15
|
+
|
|
16
|
+
// export interface RefineParams<T = any> extends
|
|
17
|
+
// Omit<
|
|
18
|
+
// ChatCompletionCreateParamsNonStreaming,
|
|
19
|
+
// "audio" | "modalities" | "response_format" | "stream" | "stream_options"
|
|
20
|
+
// >
|
|
21
|
+
// {
|
|
22
|
+
// response_format: ResponseFormat<T>
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
// export interface RefineOptions {
|
|
26
|
+
// signal?: AbortSignal
|
|
27
|
+
// max?: number
|
|
28
|
+
// allowance?: TokenAllowance
|
|
29
|
+
// }
|
|
30
|
+
|
|
31
|
+
// /** Get the completion and then loop refinement assertions and resubmission until all assertions pass. */
|
|
32
|
+
// export async function refine<T>(
|
|
33
|
+
// client: Openai,
|
|
34
|
+
// params: RefineParams<T>,
|
|
35
|
+
// options?: RefineOptions,
|
|
36
|
+
// ): Promise<T> {
|
|
37
|
+
// const { signal, max, allowance } = options ?? {}
|
|
38
|
+
// assert(
|
|
39
|
+
// max === undefined || (max >= 1 && Number.isInteger(max)),
|
|
40
|
+
// "`CheckedOptions.maxRefinements` must be an integer greater than 1.",
|
|
41
|
+
// )
|
|
42
|
+
// const completion = await client.chat.completions
|
|
43
|
+
// .create(params)
|
|
44
|
+
// .then(tap(allowance?.ingest))
|
|
45
|
+
// let diagnosticsPending: Array<Promise<Diagnostic | undefined>> = []
|
|
46
|
+
// const content = unwrapChoice(completion)
|
|
47
|
+
// const messages: ChatCompletionMessageParam[] = [...params.messages, {
|
|
48
|
+
// role: "assistant",
|
|
49
|
+
// content,
|
|
50
|
+
// }]
|
|
51
|
+
// const root = deserialize(
|
|
52
|
+
// params.response_format[""],
|
|
53
|
+
// parseChoice(content),
|
|
54
|
+
// diagnosticsPending,
|
|
55
|
+
// )
|
|
56
|
+
// let correctionsRemaining = max ?? Infinity
|
|
57
|
+
// let initialCorrection = true
|
|
58
|
+
// while (
|
|
59
|
+
// correctionsRemaining-- && !signal?.aborted && !allowance?.stop
|
|
60
|
+
// && diagnosticsPending.length
|
|
61
|
+
// ) {
|
|
62
|
+
// const diagnostics = await Promise
|
|
63
|
+
// .all(diagnosticsPending)
|
|
64
|
+
// .then((v) => v.filter((v) => v !== undefined))
|
|
65
|
+
// diagnosticsPending = []
|
|
66
|
+
// if (!diagnostics.length) {
|
|
67
|
+
// break
|
|
68
|
+
// }
|
|
69
|
+
// const CurrentCorrections = Corrections(diagnostics)
|
|
70
|
+
// const response_format = ResponseFormat("corrections", CurrentCorrections)
|
|
71
|
+
// messages.push({
|
|
72
|
+
// role: "user",
|
|
73
|
+
// content: initialCorrection
|
|
74
|
+
// ? prompt(params, diagnostics)
|
|
75
|
+
// : diagnostics.map(Diagnostic.toString).join("\n\n"),
|
|
76
|
+
// })
|
|
77
|
+
// initialCorrection = false
|
|
78
|
+
// messages.forEach((message) => console.log(message.content))
|
|
79
|
+
// const correctionsCompletion = await client.chat.completions.create({
|
|
80
|
+
// ...params,
|
|
81
|
+
// messages,
|
|
82
|
+
// response_format,
|
|
83
|
+
// }).then(tap(allowance?.ingest))
|
|
84
|
+
// const choice = unwrapChoice(correctionsCompletion)
|
|
85
|
+
// messages.push({
|
|
86
|
+
// role: "assistant",
|
|
87
|
+
// content: choice,
|
|
88
|
+
// })
|
|
89
|
+
// const corrections = deserialize(CurrentCorrections, parseChoice(choice))
|
|
90
|
+
// while (diagnostics.length) {
|
|
91
|
+
// const { setValue, valuePath, type } = diagnostics.shift()!
|
|
92
|
+
// setValue(
|
|
93
|
+
// deserialize(
|
|
94
|
+
// type as never,
|
|
95
|
+
// corrections[valuePath],
|
|
96
|
+
// (!correctionsRemaining || (signal && signal.aborted)) ? undefined : diagnosticsPending,
|
|
97
|
+
// ),
|
|
98
|
+
// )
|
|
99
|
+
// }
|
|
100
|
+
// }
|
|
101
|
+
// return root
|
|
102
|
+
// }
|
|
103
|
+
|
|
104
|
+
// function Corrections(diagnostics: Array<Diagnostic>): Type<any> {
|
|
105
|
+
// return T.object(
|
|
106
|
+
// Object.fromEntries(
|
|
107
|
+
// diagnostics.map(({ valuePath, type }) => [valuePath, type]),
|
|
108
|
+
// ),
|
|
109
|
+
// )`The corrections to be applied to a previously-generated structured output.`.widen()
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
// function prompt(
|
|
113
|
+
// params: RefineParams,
|
|
114
|
+
// diagnostics: Array<Diagnostic>,
|
|
115
|
+
// ): string {
|
|
116
|
+
// const prompt = new Prompt()
|
|
117
|
+
// prompt.h(1, "Overview")
|
|
118
|
+
// prompt.lineBreak(2)
|
|
119
|
+
// prompt.span`
|
|
120
|
+
// A chat completion request was submitted with a JSON schema describing structured
|
|
121
|
+
// output requirements. In the following sections, we'll cover the following.
|
|
122
|
+
// `
|
|
123
|
+
// prompt.lineBreak(2)
|
|
124
|
+
// const hasMessages = !!params.messages.length
|
|
125
|
+
// && params.messages.every((message) => {
|
|
126
|
+
// const { content } = message
|
|
127
|
+
// return (typeof content === "string" && !!content) || (
|
|
128
|
+
// Array.isArray(content) && !!content.length
|
|
129
|
+
// && content.every((part) => part.type === "text" && !!part.text)
|
|
130
|
+
// )
|
|
131
|
+
// })
|
|
132
|
+
// prompt.list([
|
|
133
|
+
// hasMessages && "The initial messages passed along to the completions endpoint.",
|
|
134
|
+
// "The JSON schema of the initially-requested structured output.",
|
|
135
|
+
// "The unmet constraints.",
|
|
136
|
+
// ])
|
|
137
|
+
// prompt.lineBreak(2)
|
|
138
|
+
// prompt.span`Offer new and correct values for each of the specified diagnostics.`
|
|
139
|
+
// prompt.lineBreak(2)
|
|
140
|
+
// if (hasMessages) {
|
|
141
|
+
// prompt.h(2, "Messages")
|
|
142
|
+
// prompt.lineBreak(2)
|
|
143
|
+
// params.messages.forEach((message, i) => {
|
|
144
|
+
// prompt.h(3, `Message ${i} (${message.role})`)
|
|
145
|
+
// const { content } = message
|
|
146
|
+
// if (typeof content === "string") {
|
|
147
|
+
// prompt.span(content)
|
|
148
|
+
// } else if (Array.isArray(content)) {
|
|
149
|
+
// content.forEach((part, i) => {
|
|
150
|
+
// if (i !== 0) {
|
|
151
|
+
// prompt.span(" ")
|
|
152
|
+
// }
|
|
153
|
+
// assert(
|
|
154
|
+
// part.type === "text",
|
|
155
|
+
// `${part.type} message content parts cannot be used in conjunction with structured outputs.`,
|
|
156
|
+
// )
|
|
157
|
+
// prompt.span(part.text)
|
|
158
|
+
// })
|
|
159
|
+
// }
|
|
160
|
+
// })
|
|
161
|
+
// prompt.lineBreak(2)
|
|
162
|
+
// }
|
|
163
|
+
// prompt.h(2, "Initial JSON Schema")
|
|
164
|
+
// prompt.lineBreak(2)
|
|
165
|
+
// prompt.json(params.response_format.json_schema)
|
|
166
|
+
// prompt.lineBreak(2)
|
|
167
|
+
// prompt.h(2, "Diagnostics")
|
|
168
|
+
// prompt.lineBreak(2)
|
|
169
|
+
// prompt.list(diagnostics.map(Diagnostic.toString))
|
|
170
|
+
// return prompt.toString()
|
|
171
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PromiseOr<T> = T | Promise<T>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class WeakMemo<K extends WeakKey, T> {
|
|
2
|
+
#cache = new WeakMap<K, T>()
|
|
3
|
+
constructor(private f: (key: K) => T) {}
|
|
4
|
+
|
|
5
|
+
getOrInit = (key: K): T => {
|
|
6
|
+
if (this.#cache.has(key)) {
|
|
7
|
+
return this.#cache.get(key)!
|
|
8
|
+
}
|
|
9
|
+
const value = this.f(key)
|
|
10
|
+
this.#cache.set(key, value)
|
|
11
|
+
return value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function isPromise(value: unknown): value is Promise<unknown> {
|
|
2
|
+
return (
|
|
3
|
+
value !== null
|
|
4
|
+
&& (typeof value === "object" || typeof value === "function")
|
|
5
|
+
&& "then" in value && typeof value.then === "function"
|
|
6
|
+
&& "catch" in value && typeof value.catch === "function"
|
|
7
|
+
)
|
|
8
|
+
}
|
package/src/util/mod.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// moderate
|
|
2
|
+
|
|
3
|
+
export * from "./ArrayOfLength.js"
|
|
4
|
+
export * from "./collect.js"
|
|
5
|
+
export * from "./isPromise.js"
|
|
6
|
+
export * from "./isTemplateStringsArray.js"
|
|
7
|
+
export * from "./PromiseOr.js"
|
|
8
|
+
export * from "./recombine.js"
|
|
9
|
+
export * from "./splitLast.js"
|
|
10
|
+
export * from "./type_util.js"
|
|
11
|
+
export * from "./WeakMemo.js"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function recombine(template: TemplateStringsArray, values: Array<unknown>): string {
|
|
2
|
+
const segments = []
|
|
3
|
+
for (let i = 0; i < template.length; i++) {
|
|
4
|
+
segments.push(template[i])
|
|
5
|
+
if (i < values.length) {
|
|
6
|
+
segments.push(String(values[i]))
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return segments.join("")
|
|
10
|
+
}
|