forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
97 lines (83 loc) · 3.21 KB
/
Copy pathtypes.ts
File metadata and controls
97 lines (83 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
export type JsonPrimitive = string | number | boolean | null;
export type JsonValue =
| JsonPrimitive
| readonly JsonValue[]
| { readonly [key: string]: JsonValue };
export type JsonObject = { readonly [key: string]: JsonValue };
export type ToolOwnerRef =
| { readonly kind: "core" }
| { readonly kind: "plugin"; readonly pluginId: string }
| { readonly kind: "channel"; readonly channelId: string; readonly pluginId?: string }
| { readonly kind: "mcp"; readonly serverId: string };
export type ToolExecutorRef =
| { readonly kind: "core"; readonly executorId: string }
| { readonly kind: "plugin"; readonly pluginId: string; readonly toolName: string }
| { readonly kind: "channel"; readonly channelId: string; readonly actionId: string }
| { readonly kind: "mcp"; readonly serverId: string; readonly toolName: string };
export type ToolAvailabilitySignal =
| { readonly kind: "always" }
| { readonly kind: "auth"; readonly providerId: string }
| {
readonly kind: "config";
readonly path: readonly string[];
readonly check?: "exists" | "non-empty" | "available";
}
| { readonly kind: "env"; readonly name: string }
| { readonly kind: "plugin-enabled"; readonly pluginId: string }
| { readonly kind: "context"; readonly key: string; readonly equals?: JsonPrimitive };
export type ToolAvailabilityExpression =
| ToolAvailabilitySignal
| { readonly allOf: readonly ToolAvailabilityExpression[] }
| { readonly anyOf: readonly ToolAvailabilityExpression[] };
export type ToolDescriptor = {
readonly name: string;
readonly title?: string;
readonly description: string;
readonly inputSchema: JsonObject;
readonly outputSchema?: JsonObject;
readonly owner: ToolOwnerRef;
readonly executor?: ToolExecutorRef;
readonly availability?: ToolAvailabilityExpression;
readonly annotations?: JsonObject;
readonly sortKey?: string;
};
export type ToolAvailabilityContext = {
readonly authProviderIds?: ReadonlySet<string>;
readonly config?: JsonObject;
readonly isConfigValueAvailable?: (params: {
readonly value: JsonValue;
readonly path: readonly string[];
readonly signal: Extract<ToolAvailabilitySignal, { readonly kind: "config" }>;
}) => boolean;
readonly env?: Readonly<Record<string, string | undefined>>;
readonly enabledPluginIds?: ReadonlySet<string>;
readonly values?: Readonly<Record<string, JsonPrimitive | undefined>>;
};
export type ToolUnavailableReason =
| "auth-missing"
| "config-missing"
| "context-mismatch"
| "env-missing"
| "plugin-disabled"
| "unsupported-signal";
export type ToolAvailabilityDiagnostic = {
readonly reason: ToolUnavailableReason;
readonly signal?: ToolAvailabilitySignal;
readonly message: string;
};
export type ToolPlanEntry = {
readonly descriptor: ToolDescriptor;
readonly executor: ToolExecutorRef;
};
export type HiddenToolPlanEntry = {
readonly descriptor: ToolDescriptor;
readonly diagnostics: readonly ToolAvailabilityDiagnostic[];
};
export type ToolPlan = {
readonly visible: readonly ToolPlanEntry[];
readonly hidden: readonly HiddenToolPlanEntry[];
};
export type BuildToolPlanOptions = {
readonly descriptors: readonly ToolDescriptor[];
readonly availability?: ToolAvailabilityContext;
};