@coffeexdev/openclaw-sentinel 0.4.0 → 0.4.1
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/dist/templateValueSchema.d.ts +2 -0
- package/dist/templateValueSchema.js +10 -0
- package/dist/toolSchema.js +1 -8
- package/dist/validator.d.ts +40 -0
- package/dist/validator.js +2 -9
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
export const TEMPLATE_VALUE_SCHEMA_ID = "https://schemas.coffeexcoin.dev/openclaw-sentinel/template-value.json";
|
|
3
|
+
export const TemplateValueSchema = Type.Recursive((Self) => Type.Union([
|
|
4
|
+
Type.String(),
|
|
5
|
+
Type.Number(),
|
|
6
|
+
Type.Boolean(),
|
|
7
|
+
Type.Null(),
|
|
8
|
+
Type.Array(Self),
|
|
9
|
+
Type.Record(Type.String(), Self),
|
|
10
|
+
]), { $id: TEMPLATE_VALUE_SCHEMA_ID });
|
package/dist/toolSchema.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
-
|
|
3
|
-
Type.String(),
|
|
4
|
-
Type.Number(),
|
|
5
|
-
Type.Boolean(),
|
|
6
|
-
Type.Null(),
|
|
7
|
-
Type.Array(Self),
|
|
8
|
-
Type.Record(Type.String(), Self),
|
|
9
|
-
]));
|
|
2
|
+
import { TemplateValueSchema } from "./templateValueSchema.js";
|
|
10
3
|
const ConditionSchema = Type.Object({
|
|
11
4
|
path: Type.String({ description: "JSONPath expression to evaluate against the response" }),
|
|
12
5
|
op: Type.Union([
|
package/dist/validator.d.ts
CHANGED
|
@@ -1,2 +1,42 @@
|
|
|
1
1
|
import { WatcherDefinition } from "./types.js";
|
|
2
|
+
export declare const WatcherSchema: import("@sinclair/typebox").TObject<{
|
|
3
|
+
id: import("@sinclair/typebox").TString;
|
|
4
|
+
skillId: import("@sinclair/typebox").TString;
|
|
5
|
+
enabled: import("@sinclair/typebox").TBoolean;
|
|
6
|
+
strategy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"http-poll">, import("@sinclair/typebox").TLiteral<"websocket">, import("@sinclair/typebox").TLiteral<"sse">, import("@sinclair/typebox").TLiteral<"http-long-poll">]>;
|
|
7
|
+
endpoint: import("@sinclair/typebox").TString;
|
|
8
|
+
method: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"GET">, import("@sinclair/typebox").TLiteral<"POST">]>>;
|
|
9
|
+
headers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>>;
|
|
10
|
+
body: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
+
intervalMs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
12
|
+
timeoutMs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
13
|
+
match: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"all">, import("@sinclair/typebox").TLiteral<"any">]>;
|
|
14
|
+
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
15
|
+
path: import("@sinclair/typebox").TString;
|
|
16
|
+
op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"eq">, import("@sinclair/typebox").TLiteral<"neq">, import("@sinclair/typebox").TLiteral<"gt">, import("@sinclair/typebox").TLiteral<"gte">, import("@sinclair/typebox").TLiteral<"lt">, import("@sinclair/typebox").TLiteral<"lte">, import("@sinclair/typebox").TLiteral<"exists">, import("@sinclair/typebox").TLiteral<"absent">, import("@sinclair/typebox").TLiteral<"contains">, import("@sinclair/typebox").TLiteral<"matches">, import("@sinclair/typebox").TLiteral<"changed">]>;
|
|
17
|
+
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnknown>;
|
|
18
|
+
}>>;
|
|
19
|
+
fire: import("@sinclair/typebox").TObject<{
|
|
20
|
+
webhookPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
|
+
eventName: import("@sinclair/typebox").TString;
|
|
22
|
+
payloadTemplate: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, any>;
|
|
23
|
+
intent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
24
|
+
contextTemplate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, any>>;
|
|
25
|
+
priority: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"critical">]>>;
|
|
26
|
+
deadlineTemplate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
27
|
+
dedupeKeyTemplate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
28
|
+
}>;
|
|
29
|
+
retry: import("@sinclair/typebox").TObject<{
|
|
30
|
+
maxRetries: import("@sinclair/typebox").TInteger;
|
|
31
|
+
baseMs: import("@sinclair/typebox").TInteger;
|
|
32
|
+
maxMs: import("@sinclair/typebox").TInteger;
|
|
33
|
+
}>;
|
|
34
|
+
fireOnce: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
35
|
+
deliveryTargets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
36
|
+
channel: import("@sinclair/typebox").TString;
|
|
37
|
+
to: import("@sinclair/typebox").TString;
|
|
38
|
+
accountId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
+
}>>>;
|
|
40
|
+
metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>>;
|
|
41
|
+
}>;
|
|
2
42
|
export declare function validateWatcherDefinition(input: unknown): WatcherDefinition;
|
package/dist/validator.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
2
|
import { Value } from "@sinclair/typebox/value";
|
|
3
|
+
import { TemplateValueSchema } from "./templateValueSchema.js";
|
|
3
4
|
import { DEFAULT_SENTINEL_WEBHOOK_PATH } from "./types.js";
|
|
4
5
|
const codeyKeyPattern = /(script|code|eval|handler|function|import|require)/i;
|
|
5
6
|
const codeyValuePattern = /(=>|\bfunction\b|\bimport\s+|\brequire\s*\(|\beval\s*\()/i;
|
|
6
|
-
const TemplateValueSchema = Type.Recursive((Self) => Type.Union([
|
|
7
|
-
Type.String(),
|
|
8
|
-
Type.Number(),
|
|
9
|
-
Type.Boolean(),
|
|
10
|
-
Type.Null(),
|
|
11
|
-
Type.Array(Self),
|
|
12
|
-
Type.Record(Type.String(), Self),
|
|
13
|
-
]));
|
|
14
7
|
const ConditionSchema = Type.Object({
|
|
15
8
|
path: Type.String({ minLength: 1 }),
|
|
16
9
|
op: Type.Union([
|
|
@@ -28,7 +21,7 @@ const ConditionSchema = Type.Object({
|
|
|
28
21
|
]),
|
|
29
22
|
value: Type.Optional(Type.Unknown()),
|
|
30
23
|
}, { additionalProperties: false });
|
|
31
|
-
const WatcherSchema = Type.Object({
|
|
24
|
+
export const WatcherSchema = Type.Object({
|
|
32
25
|
id: Type.String({ minLength: 1 }),
|
|
33
26
|
skillId: Type.String({ minLength: 1 }),
|
|
34
27
|
enabled: Type.Boolean(),
|