@openclaw/typesafe 2026.9.6 → 2026.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/assets/icon.png +0 -0
- package/dist/.setup/client-CRLm45hB.mjs +395 -0
- package/dist/.setup/errors-BdIwQubl.mjs +83 -0
- package/dist/index.js +8 -506
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/openclaw.plugin.json +37 -26
- package/package.json +7 -8
- package/skills/typesafe-evaluate/SKILL.md +0 -48
- package/skills/typesafe-evaluate/references/request-example.json +0 -65
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -1,106 +1,89 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import { Guard } from '../../guard/index.mjs';
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
|
-
//
|
|
4
|
+
// Throw
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
throw Error('Cannot set root');
|
|
6
|
+
function Throw(message) {
|
|
7
|
+
throw Error(message);
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
throw Error('Cannot set value');
|
|
9
|
+
function ThrowUnsafePropertyKey() {
|
|
10
|
+
Throw('Pointer contains unsafe property key');
|
|
13
11
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
throw Error('Pointer contains unsafe property key');
|
|
17
|
-
}
|
|
18
|
-
function AssertIndices(indices) {
|
|
19
|
-
for (const index of indices)
|
|
20
|
-
AssertIndex(index);
|
|
21
|
-
}
|
|
22
|
-
// ------------------------------------------------------------------
|
|
23
|
-
// Indices
|
|
24
|
-
// ------------------------------------------------------------------
|
|
25
|
-
function IsNumericIndex(index) {
|
|
26
|
-
return /^(0|[1-9]\d*)$/.test(index);
|
|
27
|
-
}
|
|
28
|
-
function TakeIndexRight(indices) {
|
|
29
|
-
return [
|
|
30
|
-
indices.slice(0, indices.length - 1),
|
|
31
|
-
indices.slice(indices.length - 1)[0]
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
function HasIndex(index, value) {
|
|
35
|
-
return Guard.IsObject(value) && Guard.HasPropertyKey(value, index);
|
|
36
|
-
}
|
|
37
|
-
function GetIndex(index, value) {
|
|
38
|
-
return Guard.IsObject(value) && !Guard.IsUnsafePropertyKey(index) ? value[index] : undefined;
|
|
39
|
-
}
|
|
40
|
-
function GetIndices(indices, value) {
|
|
41
|
-
return indices.reduce((value, index) => GetIndex(index, value), value);
|
|
12
|
+
function ThrowCannotSetRoot() {
|
|
13
|
+
Throw('Cannot set value');
|
|
42
14
|
}
|
|
43
15
|
// ------------------------------------------------------------------
|
|
44
16
|
// Indices
|
|
45
17
|
// ------------------------------------------------------------------
|
|
46
|
-
/** Returns an array of path indices for the given pointer */
|
|
47
18
|
export function Indices(pointer) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const indices = pointer.split("/").map(index => index.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
51
|
-
return (indices.length > 0 && indices[0] === '') ? indices.slice(1) : indices;
|
|
19
|
+
const indices = pointer.split('/').map(index => index.replace(/~1/g, '/').replace(/~0/g, '~'));
|
|
20
|
+
return indices[0] === '' ? indices.slice(1) : indices;
|
|
52
21
|
}
|
|
53
22
|
// ------------------------------------------------------------------
|
|
54
23
|
// Has
|
|
55
24
|
// ------------------------------------------------------------------
|
|
56
|
-
/** Returns true if a value exists at the current pointer */
|
|
57
25
|
export function Has(value, pointer) {
|
|
58
26
|
let current = value;
|
|
59
|
-
|
|
60
|
-
if (!
|
|
27
|
+
for (const index of Indices(pointer)) {
|
|
28
|
+
if (!Guard.IsObject(current) || !Guard.HasPropertyKey(current, index))
|
|
61
29
|
return false;
|
|
62
30
|
current = current[index];
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
65
33
|
}
|
|
66
34
|
// ------------------------------------------------------------------
|
|
67
35
|
// Get
|
|
68
36
|
// ------------------------------------------------------------------
|
|
69
|
-
/** Gets a value at the pointer, or undefined if not exists */
|
|
70
37
|
export function Get(value, pointer) {
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
let current = value;
|
|
39
|
+
for (const index of Indices(pointer)) {
|
|
40
|
+
if (!Guard.IsObject(current) || Guard.IsUnsafePropertyKey(index))
|
|
41
|
+
return undefined;
|
|
42
|
+
current = current[index];
|
|
43
|
+
}
|
|
44
|
+
return current;
|
|
45
|
+
}
|
|
46
|
+
// ------------------------------------------------------------------
|
|
47
|
+
// Get
|
|
48
|
+
// ------------------------------------------------------------------
|
|
49
|
+
function Parent(value, indices, last) {
|
|
50
|
+
let current = value;
|
|
51
|
+
for (const index of indices) {
|
|
52
|
+
if (Guard.IsUnsafePropertyKey(index))
|
|
53
|
+
ThrowUnsafePropertyKey();
|
|
54
|
+
current = Guard.IsObject(current) ? current[index] : undefined;
|
|
55
|
+
}
|
|
56
|
+
if (Guard.IsUnsafePropertyKey(last))
|
|
57
|
+
ThrowUnsafePropertyKey();
|
|
58
|
+
if (!Guard.IsObject(current))
|
|
59
|
+
ThrowCannotSetRoot();
|
|
60
|
+
return current;
|
|
73
61
|
}
|
|
74
62
|
// ------------------------------------------------------------------
|
|
75
63
|
// Set
|
|
76
64
|
// ------------------------------------------------------------------
|
|
77
|
-
/** Sets a value at the given pointer. May throw if the target value is not indexable */
|
|
78
65
|
export function Set(value, pointer, next) {
|
|
79
66
|
const indices = Indices(pointer);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
AssertCanSet(parent);
|
|
85
|
-
parent[index] = next;
|
|
67
|
+
const last = indices.pop();
|
|
68
|
+
if (Guard.IsUndefined(last))
|
|
69
|
+
ThrowCannotSetRoot();
|
|
70
|
+
Parent(value, indices, last)[last] = next;
|
|
86
71
|
return value;
|
|
87
72
|
}
|
|
88
73
|
// ------------------------------------------------------------------
|
|
89
74
|
// Delete
|
|
90
75
|
// ------------------------------------------------------------------
|
|
91
|
-
/** Deletes the value at the given pointer. May throw if the target value is not indexable */
|
|
92
76
|
export function Delete(value, pointer) {
|
|
93
77
|
const indices = Indices(pointer);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const parent =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
parent.splice(+index, 1);
|
|
78
|
+
const last = indices.pop();
|
|
79
|
+
if (Guard.IsUndefined(last))
|
|
80
|
+
ThrowCannotSetRoot();
|
|
81
|
+
const parent = Parent(value, indices, last);
|
|
82
|
+
if (Guard.IsArray(parent) && /^(0|[1-9]\d*)$/.test(last)) {
|
|
83
|
+
parent.splice(Number(last), 1);
|
|
101
84
|
}
|
|
102
85
|
else {
|
|
103
|
-
delete parent[
|
|
86
|
+
delete parent[last];
|
|
104
87
|
}
|
|
105
88
|
return value;
|
|
106
89
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Get } from './settings.mjs';
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// TempMaxErrors
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
let TempMaxErrors = 0;
|
|
6
|
+
// ------------------------------------------------------------------
|
|
7
|
+
// [Internal] EnableParseErrors
|
|
8
|
+
// ------------------------------------------------------------------
|
|
9
|
+
export function EnableParseErrors() {
|
|
10
|
+
const settings = Get();
|
|
11
|
+
TempMaxErrors = settings.maxErrors;
|
|
12
|
+
settings.maxErrors = settings.maxParseErrors;
|
|
13
|
+
}
|
|
14
|
+
// ------------------------------------------------------------------
|
|
15
|
+
// [Internal] DisableParseErrors
|
|
16
|
+
// ------------------------------------------------------------------
|
|
17
|
+
export function DisableParseErrors() {
|
|
18
|
+
const settings = Get();
|
|
19
|
+
settings.maxErrors = TempMaxErrors;
|
|
20
|
+
}
|
|
@@ -16,6 +16,17 @@ export interface TSettings {
|
|
|
16
16
|
* @default 8
|
|
17
17
|
*/
|
|
18
18
|
maxErrors: number;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the maximum number of errors to gather for failed Parse operations. TypeBox will
|
|
21
|
+
* automatically run an error-gathering pass on failed Parses to attach diagnostics to the
|
|
22
|
+
* thrown exception. This setting controls the number of errors gathered in that pass. Higher
|
|
23
|
+
* values will reduce throughput on failure cases, so a maximum of 4 is recommended if more
|
|
24
|
+
* errors are needed. The default setting of 1 will terminate on the first error, while a
|
|
25
|
+
* setting of 0 will skip error gathering entirely.
|
|
26
|
+
*
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
maxParseErrors: number;
|
|
19
30
|
/**
|
|
20
31
|
* Specifies the maximum number of instantiations allowed within a top-level generic instantiation
|
|
21
32
|
* context. This setting can be used to bound generic calls to a fixed count, which can be useful if
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Guard } from '../../guard/index.mjs';
|
|
2
|
+
// -------------------------------------------------------------------
|
|
3
|
+
// State
|
|
4
|
+
// -------------------------------------------------------------------
|
|
2
5
|
// Internal mutable state
|
|
3
6
|
const settings = {
|
|
4
7
|
immutableTypes: false,
|
|
5
8
|
maxErrors: 8,
|
|
9
|
+
maxParseErrors: 1,
|
|
6
10
|
maxInstantiationCount: 128,
|
|
7
11
|
useAcceleration: true,
|
|
8
12
|
exactOptionalPropertyTypes: false,
|
|
@@ -10,10 +14,14 @@ const settings = {
|
|
|
10
14
|
correctiveParse: false,
|
|
11
15
|
unionPrioritySort: true
|
|
12
16
|
};
|
|
17
|
+
// -------------------------------------------------------------------
|
|
18
|
+
// Reset
|
|
19
|
+
// -------------------------------------------------------------------
|
|
13
20
|
/** Resets system settings to defaults */
|
|
14
21
|
export function Reset() {
|
|
15
22
|
settings.immutableTypes = false;
|
|
16
23
|
settings.maxErrors = 8;
|
|
24
|
+
settings.maxParseErrors = 1;
|
|
17
25
|
settings.maxInstantiationCount = 128;
|
|
18
26
|
settings.useAcceleration = true;
|
|
19
27
|
settings.exactOptionalPropertyTypes = false;
|
|
@@ -21,6 +29,9 @@ export function Reset() {
|
|
|
21
29
|
settings.correctiveParse = false;
|
|
22
30
|
settings.unionPrioritySort = true;
|
|
23
31
|
}
|
|
32
|
+
// -------------------------------------------------------------------
|
|
33
|
+
// Set
|
|
34
|
+
// -------------------------------------------------------------------
|
|
24
35
|
/** Sets system settings */
|
|
25
36
|
export function Set(options) {
|
|
26
37
|
for (const key of Guard.Keys(options)) {
|
|
@@ -30,6 +41,9 @@ export function Set(options) {
|
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
}
|
|
44
|
+
// -------------------------------------------------------------------
|
|
45
|
+
// Get
|
|
46
|
+
// -------------------------------------------------------------------
|
|
33
47
|
/** Gets current system settings */
|
|
34
48
|
export function Get() {
|
|
35
49
|
return settings;
|
|
@@ -22,7 +22,7 @@ export declare function TryRestInferable<Type extends TSchema>(type: Type): TTry
|
|
|
22
22
|
export type TTryInferable<Type extends TSchema, Result extends TInferable | undefined = (Type extends TInfer<infer Name extends string, infer Type extends TSchema> ? TInferable<Name, Type> : undefined)> = Result;
|
|
23
23
|
export declare function TryInferable<Type extends TSchema>(type: Type): TTryInferable<Type>;
|
|
24
24
|
type TryInferResults<Rest extends TSchema[], Right extends TSchema, Result extends TSchema[] = []> = (Rest extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExtendsLeft<{}, Head, Right> extends Result.TExtendsTrueLike ? TryInferResults<Tail, Right, [...Result, Head]> : undefined : Result);
|
|
25
|
-
declare function TryInferResults<Rest extends TSchema[], Right extends TSchema>(rest: [...Rest], right: Right
|
|
25
|
+
declare function TryInferResults<Rest extends TSchema[], Right extends TSchema>(rest: [...Rest], right: Right): TryInferResults<Rest, Right>;
|
|
26
26
|
export type TInferTupleResult<Inferred extends TProperties, Name extends string, Left extends TSchema[], Right extends TSchema, Results extends TSchema[] | undefined = TryInferResults<Left, Right>> = (Results extends [...infer Results extends TSchema[]] ? Result.TExtendsTrue<Memory.TAssign<Inferred, {
|
|
27
27
|
[_ in Name]: TTuple<Results>;
|
|
28
28
|
}>> : Result.TExtendsFalse);
|
|
@@ -45,8 +45,21 @@ export function TryInferable(type) {
|
|
|
45
45
|
return (IsInfer(type) ? Inferrable(type.name, type.extends) :
|
|
46
46
|
undefined);
|
|
47
47
|
}
|
|
48
|
-
function TryInferResults(rest, right, result = []) {
|
|
49
|
-
|
|
48
|
+
// function TryInferResults<Rest extends TSchema[], Right extends TSchema>(rest: [...Rest], right: Right, result: TSchema[] = []): TryInferResults<Rest, Right> {
|
|
49
|
+
// return Guard.ShiftLeft(rest, (head, tail) =>
|
|
50
|
+
// Result.Match(ExtendsLeft({}, head, right),
|
|
51
|
+
// () => TryInferResults(tail, right, [...result, head]), // Stack Overflow Here (Large Rest)
|
|
52
|
+
// () => undefined),
|
|
53
|
+
// () => result) as never
|
|
54
|
+
// }
|
|
55
|
+
function TryInferResults(rest, right) {
|
|
56
|
+
const result = [];
|
|
57
|
+
for (const head of rest) {
|
|
58
|
+
if (!Result.IsExtendsTrueLike(ExtendsLeft({}, head, right)))
|
|
59
|
+
return undefined;
|
|
60
|
+
result.push(head);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
50
63
|
}
|
|
51
64
|
export function InferTupleResult(inferred, name, left, right) {
|
|
52
65
|
const results = TryInferResults(left, right);
|
|
@@ -16,7 +16,8 @@ type TElementsLeft<Inferred extends TProperties, Reversed extends boolean, LeftR
|
|
|
16
16
|
type TElementsRight<Inferred extends TProperties, Reversed extends boolean, LeftRest extends TSchema[], RightRest extends TSchema[]> = (RightRest extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TElementsLeft<Inferred, Reversed, LeftRest, Head, Tail> : LeftRest['length'] extends 0 ? Result.TExtendsTrue<Inferred> : Result.TExtendsFalse);
|
|
17
17
|
type TElements<Inferred extends TProperties, Reversed extends boolean, LeftRest extends TSchema[], RightRest extends TSchema[]> = TElementsRight<Inferred, Reversed, LeftRest, RightRest>;
|
|
18
18
|
type TExtendsTupleToTuple<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema[], InstantiatedRight extends TSchema[] = TInstantiateElements<Inferred, TState<[], []>, Right>, Reversed extends boolean = TReversed<InstantiatedRight>> = TElements<Inferred, Reversed, TApplyReverse<Left, Reversed>, TApplyReverse<InstantiatedRight, Reversed>>;
|
|
19
|
-
type
|
|
19
|
+
type TExtendsTupleToArrayReduce<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema> = (Left extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExtendsLeft<Inferred, Head, Right> extends Result.TExtendsTrueLike<infer Inferred extends TProperties> ? TExtendsTupleToArrayReduce<Inferred, Tail, Right> : Result.TExtendsFalse : Result.TExtendsTrue<Inferred>);
|
|
20
|
+
type TExtendsTupleToArray<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema, Inferrable extends TInferable | undefined = TTryInferable<Right>> = (Inferrable extends TInferable ? TInferUnionResult<Inferred, Inferrable['name'], Left, Inferrable['type']> : TExtendsTupleToArrayReduce<Inferred, Left, Right>);
|
|
20
21
|
export type TExtendsTuple<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema, InstantiatedLeft extends TSchema[] = TInstantiateElements<Inferred, TState<[], []>, Left>> = (Right extends TTuple<infer Types extends TSchema[]> ? TExtendsTupleToTuple<Inferred, InstantiatedLeft, Types> : Right extends TArray<infer Type extends TSchema> ? TExtendsTupleToArray<Inferred, InstantiatedLeft, Type> : TExtendsRight<Inferred, TTuple<InstantiatedLeft>, Right>);
|
|
21
22
|
export declare function ExtendsTuple<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema>(inferred: Inferred, left: Left, right: Right): TExtendsTuple<Inferred, Left, Right>;
|
|
22
23
|
export {};
|
|
@@ -47,11 +47,31 @@ function ExtendsTupleToTuple(inferred, left, right) {
|
|
|
47
47
|
const reversed = Reversed(instantiatedRight);
|
|
48
48
|
return Elements(inferred, reversed, ApplyReverse(left, reversed), ApplyReverse(instantiatedRight, reversed));
|
|
49
49
|
}
|
|
50
|
+
// function ExtendsTupleToArrayReduce<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema>
|
|
51
|
+
// (inferred: Inferred, left: [...Left], right: Right):
|
|
52
|
+
// TExtendsTupleToArrayReduce<Inferred, Left, Right> {
|
|
53
|
+
// return (
|
|
54
|
+
// Guard.ShiftLeft(left, (head, tail) =>
|
|
55
|
+
// Result.Match(ExtendsLeft(inferred, head, right), inferred =>
|
|
56
|
+
// ExtendsTupleToArrayReduce(inferred, tail, right), // Stack Overflow Here (Large Left)
|
|
57
|
+
// () => Result.ExtendsFalse()),
|
|
58
|
+
// () => Result.ExtendsTrue(inferred))
|
|
59
|
+
// ) as never
|
|
60
|
+
// }
|
|
61
|
+
function ExtendsTupleToArrayReduce(inferred, left, right) {
|
|
62
|
+
for (const head of left) {
|
|
63
|
+
const result = ExtendsLeft(inferred, head, right);
|
|
64
|
+
if (!Result.IsExtendsTrueLike(result))
|
|
65
|
+
return result;
|
|
66
|
+
inferred = result.inferred; // (review-assign-to-argument)
|
|
67
|
+
}
|
|
68
|
+
return Result.ExtendsTrue(inferred);
|
|
69
|
+
}
|
|
50
70
|
function ExtendsTupleToArray(inferred, left, right) {
|
|
51
71
|
const inferrable = TryInferable(right);
|
|
52
72
|
return (IsInferable(inferrable)
|
|
53
73
|
? InferUnionResult(inferred, inferrable['name'], left, inferrable['type'])
|
|
54
|
-
:
|
|
74
|
+
: ExtendsTupleToArrayReduce(inferred, left, right));
|
|
55
75
|
}
|
|
56
76
|
export function ExtendsTuple(inferred, left, right) {
|
|
57
77
|
const instantiatedLeft = InstantiateElements(inferred, State([], []), left);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import {
|
|
3
|
-
import { Arguments } from '../../system/
|
|
2
|
+
import { EnableParseErrors, DisableParseErrors } from '../../system/settings/internal.mjs';
|
|
3
|
+
import { Arguments, Settings } from '../../system/index.mjs';
|
|
4
4
|
import { AssertError } from '../assert/index.mjs';
|
|
5
5
|
import { Check } from '../check/index.mjs';
|
|
6
6
|
import { Errors } from '../errors/index.mjs';
|
|
@@ -18,8 +18,11 @@ export class ParseError extends AssertError {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
function Assert(context, type, value) {
|
|
21
|
+
EnableParseErrors();
|
|
22
|
+
const errors = Errors(context, type, value);
|
|
23
|
+
DisableParseErrors();
|
|
21
24
|
if (!Check(context, type, value))
|
|
22
|
-
throw new ParseError(value,
|
|
25
|
+
throw new ParseError(value, errors);
|
|
23
26
|
return value;
|
|
24
27
|
}
|
|
25
28
|
// ------------------------------------------------------------------
|
|
@@ -43,5 +46,8 @@ export function Parse(...args) {
|
|
|
43
46
|
return value;
|
|
44
47
|
if (Settings.Get().correctiveParse)
|
|
45
48
|
return Parser(context, type, value);
|
|
46
|
-
|
|
49
|
+
EnableParseErrors();
|
|
50
|
+
const errors = Errors(context, type, value);
|
|
51
|
+
DisableParseErrors();
|
|
52
|
+
throw new ParseError(value, errors);
|
|
47
53
|
}
|
|
@@ -166,9 +166,11 @@ import Schema from 'typebox/schema'
|
|
|
166
166
|
|
|
167
167
|
### Compile
|
|
168
168
|
|
|
169
|
-
The compiler accepts
|
|
169
|
+
The compiler accepts TypeBox types as well as plain JSON Schema objects, and returns a Validator instance which can be used to check values. The following compiles a Vector type.
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
+
import Schema from 'typebox/schema'
|
|
173
|
+
|
|
172
174
|
// Compile
|
|
173
175
|
|
|
174
176
|
const Vector = Schema.Compile(Type.Script(`{
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "typesafe",
|
|
3
3
|
"name": "TypeSafe AI",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Typed decision provider for hosted Jev and local System One models.",
|
|
5
5
|
"categories": [
|
|
6
6
|
"developer-tools"
|
|
7
7
|
],
|
|
@@ -10,18 +10,10 @@
|
|
|
10
10
|
"onStartup": true
|
|
11
11
|
},
|
|
12
12
|
"contracts": {
|
|
13
|
-
"tools": [
|
|
14
|
-
"typesafe_evaluate"
|
|
15
|
-
],
|
|
16
13
|
"decisionProviders": [
|
|
17
14
|
"typesafe"
|
|
18
15
|
]
|
|
19
16
|
},
|
|
20
|
-
"toolMetadata": {
|
|
21
|
-
"typesafe_evaluate": {
|
|
22
|
-
"optional": true
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
17
|
"configContracts": {
|
|
26
18
|
"secretInputs": {
|
|
27
19
|
"bundledDefaultEnabled": false,
|
|
@@ -40,10 +32,6 @@
|
|
|
40
32
|
"help": "Hosted Jev only. Select a SecretRef in Settings \u2192 Secrets. Ignored for a local baseUrl. Never paste credentials in chat.",
|
|
41
33
|
"sensitive": true
|
|
42
34
|
},
|
|
43
|
-
"model": {
|
|
44
|
-
"label": "Evaluation tool default model",
|
|
45
|
-
"help": "Default only for typesafe_evaluate: jev-latest for hosted Jev, kev-latest for local System One. Local model labels do not load checkpoints. Native decisions use the agent decisionModel selection."
|
|
46
|
-
},
|
|
47
35
|
"timeoutMs": {
|
|
48
36
|
"label": "Request timeout (ms)",
|
|
49
37
|
"advanced": true
|
|
@@ -97,13 +85,6 @@
|
|
|
97
85
|
},
|
|
98
86
|
"additionalProperties": false
|
|
99
87
|
},
|
|
100
|
-
"model": {
|
|
101
|
-
"type": "string",
|
|
102
|
-
"minLength": 1,
|
|
103
|
-
"maxLength": 128,
|
|
104
|
-
"pattern": "^[a-zA-Z0-9._/-]+$",
|
|
105
|
-
"description": "Tool default: jev-latest for hosted Jev, kev-latest for a local endpoint."
|
|
106
|
-
},
|
|
107
88
|
"timeoutMs": {
|
|
108
89
|
"type": "integer",
|
|
109
90
|
"minimum": 1000,
|
|
@@ -118,24 +99,54 @@
|
|
|
118
99
|
},
|
|
119
100
|
"additionalProperties": false
|
|
120
101
|
},
|
|
121
|
-
"skills": [
|
|
122
|
-
"./skills/typesafe-evaluate"
|
|
123
|
-
],
|
|
124
102
|
"decisionModels": [
|
|
125
103
|
{
|
|
126
104
|
"provider": "typesafe",
|
|
127
105
|
"id": "jev-latest",
|
|
128
|
-
"name": "Jev"
|
|
106
|
+
"name": "Jev",
|
|
107
|
+
"capabilities": {
|
|
108
|
+
"questionTypes": [
|
|
109
|
+
"boolean",
|
|
110
|
+
"choice",
|
|
111
|
+
"score"
|
|
112
|
+
],
|
|
113
|
+
"maxQuestions": 256,
|
|
114
|
+
"maxChoiceAlternatives": 255,
|
|
115
|
+
"maxScoreLevels": 10,
|
|
116
|
+
"confidence": "provider-specific"
|
|
117
|
+
}
|
|
129
118
|
},
|
|
130
119
|
{
|
|
131
120
|
"provider": "typesafe",
|
|
132
121
|
"id": "jev-1.13.0",
|
|
133
|
-
"name": "Jev 1.13.0"
|
|
122
|
+
"name": "Jev 1.13.0",
|
|
123
|
+
"capabilities": {
|
|
124
|
+
"questionTypes": [
|
|
125
|
+
"boolean",
|
|
126
|
+
"choice",
|
|
127
|
+
"score"
|
|
128
|
+
],
|
|
129
|
+
"maxQuestions": 256,
|
|
130
|
+
"maxChoiceAlternatives": 255,
|
|
131
|
+
"maxScoreLevels": 10,
|
|
132
|
+
"confidence": "provider-specific"
|
|
133
|
+
}
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
"provider": "typesafe",
|
|
137
137
|
"id": "kev-latest",
|
|
138
|
-
"name": "Kev (local server)"
|
|
138
|
+
"name": "Kev (local server)",
|
|
139
|
+
"capabilities": {
|
|
140
|
+
"questionTypes": [
|
|
141
|
+
"boolean",
|
|
142
|
+
"choice",
|
|
143
|
+
"score"
|
|
144
|
+
],
|
|
145
|
+
"maxQuestions": 256,
|
|
146
|
+
"maxChoiceAlternatives": 255,
|
|
147
|
+
"maxScoreLevels": 10,
|
|
148
|
+
"confidence": "provider-specific"
|
|
149
|
+
}
|
|
139
150
|
}
|
|
140
151
|
]
|
|
141
152
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/typesafe",
|
|
3
|
-
"version": "2026.9.
|
|
4
|
-
"description": "OpenClaw TypeSafe typed
|
|
3
|
+
"version": "2026.9.8",
|
|
4
|
+
"description": "OpenClaw TypeSafe typed decision provider",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/openclaw/openclaw"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"typebox": "1.3.
|
|
11
|
+
"typebox": "1.3.34"
|
|
12
12
|
},
|
|
13
13
|
"openclaw": {
|
|
14
14
|
"extensions": [
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"minHostVersion": ">=2026.9.6"
|
|
22
22
|
},
|
|
23
23
|
"compat": {
|
|
24
|
-
"pluginApi": ">=2026.9.
|
|
24
|
+
"pluginApi": ">=2026.9.8"
|
|
25
25
|
},
|
|
26
26
|
"build": {
|
|
27
27
|
"bundledDist": false,
|
|
28
|
-
"openclawVersion": "2026.9.
|
|
28
|
+
"openclawVersion": "2026.9.8"
|
|
29
29
|
},
|
|
30
30
|
"release": {
|
|
31
31
|
"publishToClawHub": true,
|
|
@@ -40,11 +40,10 @@
|
|
|
40
40
|
"openclaw.plugin.json",
|
|
41
41
|
"README.md",
|
|
42
42
|
"assets/icon.png",
|
|
43
|
-
"assets/activity.svg"
|
|
44
|
-
"skills/**"
|
|
43
|
+
"assets/activity.svg"
|
|
45
44
|
],
|
|
46
45
|
"peerDependencies": {
|
|
47
|
-
"openclaw": ">=2026.9.
|
|
46
|
+
"openclaw": ">=2026.9.8"
|
|
48
47
|
},
|
|
49
48
|
"peerDependenciesMeta": {
|
|
50
49
|
"openclaw": {
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: typesafe-evaluate
|
|
3
|
-
description: Make explicit typed hosted Jev or local Kev decisions with the typesafe_evaluate tool.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# TypeSafe evaluations
|
|
7
|
-
|
|
8
|
-
Use `typesafe_evaluate` for semantic decisions over explicit supplied state. It
|
|
9
|
-
returns typed decisions, not generated explanations or permission to act. If the
|
|
10
|
-
tool is unavailable, report that; do not substitute shell/HTTP calls or ask for a
|
|
11
|
-
credential in chat. Hosted calls send the supplied data to TypeSafe and may incur
|
|
12
|
-
charges. With a configured local System One origin, calls go to that server
|
|
13
|
-
without a hosted credential.
|
|
14
|
-
|
|
15
|
-
Supply `{state, questions}`; see [mixed request example](references/request-example.json).
|
|
16
|
-
State and descriptions accept text, JSON objects/arrays, or null. Each question
|
|
17
|
-
sees the same state and is independent: it cannot read another answer in the batch.
|
|
18
|
-
Put meaning in instructions and criteria, not just the question ID.
|
|
19
|
-
|
|
20
|
-
- **Choice:** choose one of 2–255 named alternatives. Include a no-match alternative
|
|
21
|
-
if appropriate. Preserve the selected label, full distribution, and confidence.
|
|
22
|
-
- **Score:** rate against 2–10 ordered descriptions. The answer is the fractional
|
|
23
|
-
probability-weighted zero-based position, not a normalized score or integer.
|
|
24
|
-
- **Noul:** probability of yes, from 0 to 1, with optional `criteria.true` and
|
|
25
|
-
`criteria.false` descriptions. This is not intensity and has no confidence field.
|
|
26
|
-
|
|
27
|
-
Only send necessary evidence authorized for sharing. Never include credentials.
|
|
28
|
-
Do not silently truncate evidence or split competing Choice options to fit a
|
|
29
|
-
request. The plugin bounds JSON to 4 MiB, 262144 nodes, and depth 64; vendor token
|
|
30
|
-
limits are separate. A model override is optional; pin a version when comparing runs.
|
|
31
|
-
For local Kev, the server's loaded checkpoint determines the model; an override
|
|
32
|
-
only labels the request and does not change the checkpoint.
|
|
33
|
-
|
|
34
|
-
Reported probabilities may be rounded and need not sum exactly to one. Preserve the
|
|
35
|
-
vendor-selected label and score; normalization or selecting the largest reported
|
|
36
|
-
probability is an explicit consumer policy, not an adapter repair.
|
|
37
|
-
|
|
38
|
-
Batch independent questions. Use a later call when its state or options depend on
|
|
39
|
-
an earlier result. Validate judgment quality on representative cases before using
|
|
40
|
-
probabilities as thresholds; confidence is not the probability that a whole
|
|
41
|
-
workflow is correct. Preserve uncertainty and verify deterministic rules, current
|
|
42
|
-
evidence, and authorization separately. A service/validation error is not a
|
|
43
|
-
negative judgment; do not retry automatically or fabricate an answer.
|
|
44
|
-
|
|
45
|
-
The optional tool is distinct from the background decision-provider API. Enabling
|
|
46
|
-
the plugin/tool does not itself select a decision model or schedule consumer work.
|
|
47
|
-
Native consumers use the global or per-agent `decisionModel` role. Plugin `model`
|
|
48
|
-
configuration is only the optional tool’s default.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"state": {
|
|
3
|
-
"ticket": {
|
|
4
|
-
"text": "Please explain the duplicate charge on my invoice."
|
|
5
|
-
}
|
|
6
|
-
},
|
|
7
|
-
"questions": {
|
|
8
|
-
"category": {
|
|
9
|
-
"type": "choice",
|
|
10
|
-
"instructions": {
|
|
11
|
-
"question": "Which team should handle ticket.text?",
|
|
12
|
-
"focus": "Primary request only"
|
|
13
|
-
},
|
|
14
|
-
"criteria": {
|
|
15
|
-
"Billing & payments": {
|
|
16
|
-
"includes": [
|
|
17
|
-
"invoices",
|
|
18
|
-
"charges"
|
|
19
|
-
],
|
|
20
|
-
"excludes": [
|
|
21
|
-
"delivery tracking"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"Other": null
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"urgency": {
|
|
28
|
-
"type": "score",
|
|
29
|
-
"instructions": [
|
|
30
|
-
"Rate urgency in ticket.text.",
|
|
31
|
-
"Use only stated time pressure."
|
|
32
|
-
],
|
|
33
|
-
"criteria": [
|
|
34
|
-
{
|
|
35
|
-
"level": "Routine",
|
|
36
|
-
"examples": [
|
|
37
|
-
"No deadline stated"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"level": "Urgent",
|
|
42
|
-
"examples": [
|
|
43
|
-
"Immediate action explicitly requested"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"actionable": {
|
|
49
|
-
"type": "noul",
|
|
50
|
-
"instructions": "Does ticket.text request a concrete action or answer?",
|
|
51
|
-
"criteria": {
|
|
52
|
-
"true": {
|
|
53
|
-
"includes": [
|
|
54
|
-
"Request for explanation",
|
|
55
|
-
"Request for action"
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
"false": [
|
|
59
|
-
"Information only",
|
|
60
|
-
"No answer requested"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
File without changes
|