@troykelly/openclaw-projects 0.0.1 → 0.0.3

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.
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Skill Store tools for OpenClaw plugin (Issue #800).
3
+ *
4
+ * Provides CRUD operations for skill-scoped persistent storage:
5
+ * - skill_store_put: Create or upsert items
6
+ * - skill_store_get: Get by ID or composite key
7
+ * - skill_store_list: List/filter/paginate items
8
+ * - skill_store_delete: Soft delete by ID or composite key
9
+ */
10
+ import { z } from 'zod';
11
+ import type { ApiClient } from '../api-client.js';
12
+ import type { Logger } from '../logger.js';
13
+ import type { PluginConfig } from '../config.js';
14
+ /** Zod schema for skill_store_put parameters */
15
+ export declare const SkillStorePutParamsSchema: z.ZodObject<{
16
+ skill_id: z.ZodString;
17
+ collection: z.ZodOptional<z.ZodString>;
18
+ key: z.ZodOptional<z.ZodString>;
19
+ title: z.ZodOptional<z.ZodString>;
20
+ summary: z.ZodOptional<z.ZodString>;
21
+ content: z.ZodOptional<z.ZodString>;
22
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23
+ media_url: z.ZodOptional<z.ZodString>;
24
+ media_type: z.ZodOptional<z.ZodString>;
25
+ source_url: z.ZodOptional<z.ZodString>;
26
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ priority: z.ZodOptional<z.ZodNumber>;
28
+ expires_at: z.ZodOptional<z.ZodString>;
29
+ pinned: z.ZodOptional<z.ZodBoolean>;
30
+ user_email: z.ZodOptional<z.ZodString>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ skill_id: string;
33
+ key?: string | undefined;
34
+ data?: Record<string, unknown> | undefined;
35
+ tags?: string[] | undefined;
36
+ content?: string | undefined;
37
+ title?: string | undefined;
38
+ summary?: string | undefined;
39
+ user_email?: string | undefined;
40
+ collection?: string | undefined;
41
+ media_url?: string | undefined;
42
+ media_type?: string | undefined;
43
+ source_url?: string | undefined;
44
+ priority?: number | undefined;
45
+ expires_at?: string | undefined;
46
+ pinned?: boolean | undefined;
47
+ }, {
48
+ skill_id: string;
49
+ key?: string | undefined;
50
+ data?: Record<string, unknown> | undefined;
51
+ tags?: string[] | undefined;
52
+ content?: string | undefined;
53
+ title?: string | undefined;
54
+ summary?: string | undefined;
55
+ user_email?: string | undefined;
56
+ collection?: string | undefined;
57
+ media_url?: string | undefined;
58
+ media_type?: string | undefined;
59
+ source_url?: string | undefined;
60
+ priority?: number | undefined;
61
+ expires_at?: string | undefined;
62
+ pinned?: boolean | undefined;
63
+ }>;
64
+ export type SkillStorePutParams = z.infer<typeof SkillStorePutParamsSchema>;
65
+ /** Zod schema for skill_store_get parameters */
66
+ export declare const SkillStoreGetParamsSchema: z.ZodObject<{
67
+ id: z.ZodOptional<z.ZodString>;
68
+ skill_id: z.ZodOptional<z.ZodString>;
69
+ collection: z.ZodOptional<z.ZodString>;
70
+ key: z.ZodOptional<z.ZodString>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ key?: string | undefined;
73
+ id?: string | undefined;
74
+ skill_id?: string | undefined;
75
+ collection?: string | undefined;
76
+ }, {
77
+ key?: string | undefined;
78
+ id?: string | undefined;
79
+ skill_id?: string | undefined;
80
+ collection?: string | undefined;
81
+ }>;
82
+ export type SkillStoreGetParams = z.infer<typeof SkillStoreGetParamsSchema>;
83
+ /** Zod schema for skill_store_list parameters */
84
+ export declare const SkillStoreListParamsSchema: z.ZodObject<{
85
+ skill_id: z.ZodString;
86
+ collection: z.ZodOptional<z.ZodString>;
87
+ status: z.ZodOptional<z.ZodEnum<["active", "archived", "processing"]>>;
88
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
89
+ since: z.ZodOptional<z.ZodString>;
90
+ limit: z.ZodOptional<z.ZodNumber>;
91
+ offset: z.ZodOptional<z.ZodNumber>;
92
+ order_by: z.ZodOptional<z.ZodEnum<["created_at", "updated_at", "title", "priority"]>>;
93
+ user_email: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ skill_id: string;
96
+ status?: "active" | "archived" | "processing" | undefined;
97
+ limit?: number | undefined;
98
+ tags?: string[] | undefined;
99
+ offset?: number | undefined;
100
+ user_email?: string | undefined;
101
+ collection?: string | undefined;
102
+ since?: string | undefined;
103
+ order_by?: "title" | "priority" | "created_at" | "updated_at" | undefined;
104
+ }, {
105
+ skill_id: string;
106
+ status?: "active" | "archived" | "processing" | undefined;
107
+ limit?: number | undefined;
108
+ tags?: string[] | undefined;
109
+ offset?: number | undefined;
110
+ user_email?: string | undefined;
111
+ collection?: string | undefined;
112
+ since?: string | undefined;
113
+ order_by?: "title" | "priority" | "created_at" | "updated_at" | undefined;
114
+ }>;
115
+ export type SkillStoreListParams = z.infer<typeof SkillStoreListParamsSchema>;
116
+ /** Zod schema for skill_store_delete parameters */
117
+ export declare const SkillStoreDeleteParamsSchema: z.ZodObject<{
118
+ id: z.ZodOptional<z.ZodString>;
119
+ skill_id: z.ZodOptional<z.ZodString>;
120
+ collection: z.ZodOptional<z.ZodString>;
121
+ key: z.ZodOptional<z.ZodString>;
122
+ }, "strip", z.ZodTypeAny, {
123
+ key?: string | undefined;
124
+ id?: string | undefined;
125
+ skill_id?: string | undefined;
126
+ collection?: string | undefined;
127
+ }, {
128
+ key?: string | undefined;
129
+ id?: string | undefined;
130
+ skill_id?: string | undefined;
131
+ collection?: string | undefined;
132
+ }>;
133
+ export type SkillStoreDeleteParams = z.infer<typeof SkillStoreDeleteParamsSchema>;
134
+ /** Skill store item response from API */
135
+ export interface SkillStoreItem {
136
+ id: string;
137
+ skill_id: string;
138
+ collection: string;
139
+ key: string | null;
140
+ title: string | null;
141
+ summary: string | null;
142
+ content: string | null;
143
+ data: Record<string, unknown>;
144
+ media_url: string | null;
145
+ media_type: string | null;
146
+ source_url: string | null;
147
+ status: string;
148
+ tags: string[];
149
+ priority: number | null;
150
+ expires_at: string | null;
151
+ pinned: boolean;
152
+ user_email: string | null;
153
+ created_at: string;
154
+ updated_at: string;
155
+ }
156
+ /** Tool result types */
157
+ export interface SkillStoreToolSuccess {
158
+ success: true;
159
+ data: {
160
+ content: string;
161
+ details: Record<string, unknown>;
162
+ };
163
+ }
164
+ export interface SkillStoreToolFailure {
165
+ success: false;
166
+ error: string;
167
+ }
168
+ export type SkillStoreToolResult = SkillStoreToolSuccess | SkillStoreToolFailure;
169
+ /** Tool options */
170
+ export interface SkillStoreToolOptions {
171
+ client: ApiClient;
172
+ logger: Logger;
173
+ config?: PluginConfig;
174
+ userId: string;
175
+ }
176
+ /** Tool definition interface */
177
+ export interface SkillStoreTool {
178
+ name: string;
179
+ description: string;
180
+ parameters: z.ZodType;
181
+ execute: (params: Record<string, unknown>) => Promise<SkillStoreToolResult>;
182
+ }
183
+ /**
184
+ * Create the skill_store_put tool.
185
+ */
186
+ export declare function createSkillStorePutTool(options: SkillStoreToolOptions): SkillStoreTool;
187
+ /**
188
+ * Create the skill_store_get tool.
189
+ */
190
+ export declare function createSkillStoreGetTool(options: SkillStoreToolOptions): SkillStoreTool;
191
+ /**
192
+ * Create the skill_store_list tool.
193
+ */
194
+ export declare function createSkillStoreListTool(options: SkillStoreToolOptions): SkillStoreTool;
195
+ /**
196
+ * Create the skill_store_delete tool.
197
+ */
198
+ export declare function createSkillStoreDeleteTool(options: SkillStoreToolOptions): SkillStoreTool;
199
+ /** Zod schema for skill_store_search parameters */
200
+ export declare const SkillStoreSearchParamsSchema: z.ZodObject<{
201
+ skill_id: z.ZodString;
202
+ query: z.ZodString;
203
+ collection: z.ZodOptional<z.ZodString>;
204
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
205
+ semantic: z.ZodOptional<z.ZodBoolean>;
206
+ min_similarity: z.ZodOptional<z.ZodNumber>;
207
+ limit: z.ZodOptional<z.ZodNumber>;
208
+ user_email: z.ZodOptional<z.ZodString>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ query: string;
211
+ skill_id: string;
212
+ limit?: number | undefined;
213
+ tags?: string[] | undefined;
214
+ semantic?: boolean | undefined;
215
+ user_email?: string | undefined;
216
+ collection?: string | undefined;
217
+ min_similarity?: number | undefined;
218
+ }, {
219
+ query: string;
220
+ skill_id: string;
221
+ limit?: number | undefined;
222
+ tags?: string[] | undefined;
223
+ semantic?: boolean | undefined;
224
+ user_email?: string | undefined;
225
+ collection?: string | undefined;
226
+ min_similarity?: number | undefined;
227
+ }>;
228
+ export type SkillStoreSearchParams = z.infer<typeof SkillStoreSearchParamsSchema>;
229
+ /** Zod schema for skill_store_collections parameters */
230
+ export declare const SkillStoreCollectionsParamsSchema: z.ZodObject<{
231
+ skill_id: z.ZodString;
232
+ user_email: z.ZodOptional<z.ZodString>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ skill_id: string;
235
+ user_email?: string | undefined;
236
+ }, {
237
+ skill_id: string;
238
+ user_email?: string | undefined;
239
+ }>;
240
+ export type SkillStoreCollectionsParams = z.infer<typeof SkillStoreCollectionsParamsSchema>;
241
+ /** Zod schema for skill_store_aggregate parameters */
242
+ export declare const SkillStoreAggregateParamsSchema: z.ZodObject<{
243
+ skill_id: z.ZodString;
244
+ collection: z.ZodOptional<z.ZodString>;
245
+ operation: z.ZodEnum<["count", "count_by_tag", "count_by_status", "latest", "oldest"]>;
246
+ since: z.ZodOptional<z.ZodString>;
247
+ until: z.ZodOptional<z.ZodString>;
248
+ user_email: z.ZodOptional<z.ZodString>;
249
+ }, "strip", z.ZodTypeAny, {
250
+ skill_id: string;
251
+ operation: "count" | "count_by_tag" | "count_by_status" | "latest" | "oldest";
252
+ user_email?: string | undefined;
253
+ collection?: string | undefined;
254
+ since?: string | undefined;
255
+ until?: string | undefined;
256
+ }, {
257
+ skill_id: string;
258
+ operation: "count" | "count_by_tag" | "count_by_status" | "latest" | "oldest";
259
+ user_email?: string | undefined;
260
+ collection?: string | undefined;
261
+ since?: string | undefined;
262
+ until?: string | undefined;
263
+ }>;
264
+ export type SkillStoreAggregateParams = z.infer<typeof SkillStoreAggregateParamsSchema>;
265
+ /**
266
+ * Create the skill_store_search tool.
267
+ */
268
+ export declare function createSkillStoreSearchTool(options: SkillStoreToolOptions): SkillStoreTool;
269
+ /**
270
+ * Create the skill_store_collections tool.
271
+ */
272
+ export declare function createSkillStoreCollectionsTool(options: SkillStoreToolOptions): SkillStoreTool;
273
+ /**
274
+ * Create the skill_store_aggregate tool.
275
+ */
276
+ export declare function createSkillStoreAggregateTool(options: SkillStoreToolOptions): SkillStoreTool;
277
+ //# sourceMappingURL=skill-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-store.d.ts","sourceRoot":"","sources":["../../src/tools/skill-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAyChD,gDAAgD;AAChD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,gDAAgD;AAChD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;EAKpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,iDAAiD;AACjD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,mDAAmD;AACnD,eAAO,MAAM,4BAA4B;;;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