@1claw/openclaw-plugin 0.1.0

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/src/types.ts ADDED
@@ -0,0 +1,186 @@
1
+ export const SECRET_TYPES = [
2
+ "api_key",
3
+ "password",
4
+ "private_key",
5
+ "certificate",
6
+ "file",
7
+ "note",
8
+ "ssh_key",
9
+ "env_bundle",
10
+ ] as const;
11
+
12
+ export type SecretType = (typeof SECRET_TYPES)[number];
13
+
14
+ export interface SecretMetadata {
15
+ id: string;
16
+ path: string;
17
+ type: SecretType;
18
+ version: number;
19
+ metadata: Record<string, unknown>;
20
+ created_at: string;
21
+ expires_at: string | null;
22
+ }
23
+
24
+ export interface SecretWithValue extends SecretMetadata {
25
+ value: string;
26
+ }
27
+
28
+ export interface SecretListResponse {
29
+ secrets: SecretMetadata[];
30
+ }
31
+
32
+ export interface VaultResponse {
33
+ id: string;
34
+ name: string;
35
+ description: string;
36
+ created_by: string;
37
+ created_by_type: string;
38
+ created_at: string;
39
+ }
40
+
41
+ export interface VaultListResponse {
42
+ vaults: VaultResponse[];
43
+ }
44
+
45
+ export interface PolicyResponse {
46
+ id: string;
47
+ vault_id: string;
48
+ secret_path_pattern: string;
49
+ principal_type: string;
50
+ principal_id: string;
51
+ permissions: string[];
52
+ conditions: Record<string, unknown>;
53
+ expires_at: string | null;
54
+ created_by: string;
55
+ created_by_type: string;
56
+ created_at: string;
57
+ }
58
+
59
+ export interface ShareLinkResponse {
60
+ id: string;
61
+ share_url: string;
62
+ recipient_type: string;
63
+ recipient_email?: string;
64
+ expires_at: string;
65
+ max_access_count: number;
66
+ }
67
+
68
+ export interface BalanceChange {
69
+ address: string;
70
+ token?: string;
71
+ token_symbol?: string;
72
+ before?: string;
73
+ after?: string;
74
+ change?: string;
75
+ }
76
+
77
+ export interface SimulationResponse {
78
+ simulation_id: string;
79
+ status: "success" | "reverted" | "error";
80
+ gas_used: number;
81
+ gas_estimate_usd?: string;
82
+ balance_changes: BalanceChange[];
83
+ error?: string;
84
+ error_code?: string;
85
+ error_human_readable?: string;
86
+ revert_reason?: string;
87
+ tenderly_dashboard_url?: string;
88
+ simulated_at: string;
89
+ }
90
+
91
+ export interface BundleSimulationResponse {
92
+ simulations: SimulationResponse[];
93
+ }
94
+
95
+ export interface TransactionResponse {
96
+ id: string;
97
+ agent_id: string;
98
+ chain: string;
99
+ chain_id: number;
100
+ to: string;
101
+ value_wei: string;
102
+ status: string;
103
+ signed_tx?: string;
104
+ tx_hash?: string;
105
+ error_message?: string;
106
+ created_at: string;
107
+ signed_at?: string;
108
+ simulation_id?: string;
109
+ simulation_status?: string;
110
+ }
111
+
112
+ export interface AgentProfile {
113
+ id: string;
114
+ name: string;
115
+ org_id: string;
116
+ is_active: boolean;
117
+ shroud_enabled?: boolean;
118
+ shroud_config?: Record<string, unknown>;
119
+ intents_api_enabled?: boolean;
120
+ created_by?: string;
121
+ }
122
+
123
+ export interface ApiErrorBody {
124
+ type: string;
125
+ title: string;
126
+ status: number;
127
+ detail: string;
128
+ }
129
+
130
+ /** OpenClaw plugin API surface (subset used by this plugin). */
131
+ export interface PluginApi {
132
+ logger: {
133
+ info: (msg: string) => void;
134
+ warn: (msg: string) => void;
135
+ error: (msg: string) => void;
136
+ };
137
+ config: Record<string, unknown>;
138
+ registerTool: (tool: PluginTool) => void;
139
+ registerHook: (
140
+ event: string,
141
+ handler: (...args: unknown[]) => unknown,
142
+ meta?: { name?: string; description?: string },
143
+ ) => void;
144
+ on: (
145
+ event: string,
146
+ handler: (event: unknown, ctx: unknown) => unknown,
147
+ opts?: { priority?: number },
148
+ ) => void;
149
+ registerService: (service: {
150
+ id: string;
151
+ start: () => void | Promise<void>;
152
+ stop: () => void | Promise<void>;
153
+ }) => void;
154
+ registerCommand: (cmd: {
155
+ name: string;
156
+ description: string;
157
+ acceptsArgs?: boolean;
158
+ requireAuth?: boolean;
159
+ handler: (ctx: CommandContext) => { text: string } | Promise<{ text: string }>;
160
+ }) => void;
161
+ registerGatewayMethod: (
162
+ method: string,
163
+ handler: (ctx: { respond: (ok: boolean, data: unknown) => void }) => void | Promise<void>,
164
+ ) => void;
165
+ }
166
+
167
+ export interface PluginTool {
168
+ name: string;
169
+ description: string;
170
+ parameters: unknown;
171
+ optional?: boolean;
172
+ execute: (id: unknown, params: Record<string, unknown>) => Promise<ToolResult>;
173
+ }
174
+
175
+ export interface ToolResult {
176
+ content: Array<{ type: string; text: string }>;
177
+ }
178
+
179
+ export interface CommandContext {
180
+ senderId?: string;
181
+ channel: string;
182
+ isAuthorizedSender: boolean;
183
+ args?: string;
184
+ commandBody: string;
185
+ config: Record<string, unknown>;
186
+ }