@troykelly/openclaw-projects 0.0.29 → 0.0.31

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.
Files changed (71) hide show
  1. package/dist/api-client.d.ts +2 -0
  2. package/dist/api-client.d.ts.map +1 -1
  3. package/dist/api-client.js +4 -0
  4. package/dist/api-client.js.map +1 -1
  5. package/dist/register-openclaw.d.ts.map +1 -1
  6. package/dist/register-openclaw.js +243 -12
  7. package/dist/register-openclaw.js.map +1 -1
  8. package/dist/services/api-source-service.d.ts +181 -0
  9. package/dist/services/api-source-service.d.ts.map +1 -0
  10. package/dist/services/api-source-service.js +120 -0
  11. package/dist/services/api-source-service.js.map +1 -0
  12. package/dist/tools/api-credential-manage.d.ts +83 -0
  13. package/dist/tools/api-credential-manage.d.ts.map +1 -0
  14. package/dist/tools/api-credential-manage.js +71 -0
  15. package/dist/tools/api-credential-manage.js.map +1 -0
  16. package/dist/tools/api-get.d.ts +47 -0
  17. package/dist/tools/api-get.d.ts.map +1 -0
  18. package/dist/tools/api-get.js +41 -0
  19. package/dist/tools/api-get.js.map +1 -0
  20. package/dist/tools/api-list.d.ts +54 -0
  21. package/dist/tools/api-list.d.ts.map +1 -0
  22. package/dist/tools/api-list.js +46 -0
  23. package/dist/tools/api-list.js.map +1 -0
  24. package/dist/tools/api-onboard.d.ts +134 -0
  25. package/dist/tools/api-onboard.d.ts.map +1 -0
  26. package/dist/tools/api-onboard.js +109 -0
  27. package/dist/tools/api-onboard.js.map +1 -0
  28. package/dist/tools/api-recall.d.ts +69 -0
  29. package/dist/tools/api-recall.d.ts.map +1 -0
  30. package/dist/tools/api-recall.js +101 -0
  31. package/dist/tools/api-recall.js.map +1 -0
  32. package/dist/tools/api-refresh.d.ts +50 -0
  33. package/dist/tools/api-refresh.d.ts.map +1 -0
  34. package/dist/tools/api-refresh.js +55 -0
  35. package/dist/tools/api-refresh.js.map +1 -0
  36. package/dist/tools/api-remove.d.ts +46 -0
  37. package/dist/tools/api-remove.d.ts.map +1 -0
  38. package/dist/tools/api-remove.js +45 -0
  39. package/dist/tools/api-remove.js.map +1 -0
  40. package/dist/tools/api-restore.d.ts +45 -0
  41. package/dist/tools/api-restore.d.ts.map +1 -0
  42. package/dist/tools/api-restore.js +41 -0
  43. package/dist/tools/api-restore.js.map +1 -0
  44. package/dist/tools/api-update.d.ts +57 -0
  45. package/dist/tools/api-update.d.ts.map +1 -0
  46. package/dist/tools/api-update.js +46 -0
  47. package/dist/tools/api-update.js.map +1 -0
  48. package/dist/tools/index.d.ts +13 -0
  49. package/dist/tools/index.d.ts.map +1 -1
  50. package/dist/tools/index.js +18 -0
  51. package/dist/tools/index.js.map +1 -1
  52. package/dist/tools/terminal-connections.d.ts +387 -0
  53. package/dist/tools/terminal-connections.d.ts.map +1 -0
  54. package/dist/tools/terminal-connections.js +631 -0
  55. package/dist/tools/terminal-connections.js.map +1 -0
  56. package/dist/tools/terminal-search.d.ts +139 -0
  57. package/dist/tools/terminal-search.d.ts.map +1 -0
  58. package/dist/tools/terminal-search.js +248 -0
  59. package/dist/tools/terminal-search.js.map +1 -0
  60. package/dist/tools/terminal-sessions.d.ts +344 -0
  61. package/dist/tools/terminal-sessions.d.ts.map +1 -0
  62. package/dist/tools/terminal-sessions.js +586 -0
  63. package/dist/tools/terminal-sessions.js.map +1 -0
  64. package/dist/tools/terminal-tunnels.d.ts +156 -0
  65. package/dist/tools/terminal-tunnels.d.ts.map +1 -0
  66. package/dist/tools/terminal-tunnels.js +266 -0
  67. package/dist/tools/terminal-tunnels.js.map +1 -0
  68. package/dist/types/openclaw-api.d.ts +1 -0
  69. package/dist/types/openclaw-api.d.ts.map +1 -1
  70. package/openclaw.plugin.json +1 -1
  71. package/package.json +1 -1
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Plugin API source service client.
3
+ * HTTP client for calling api-sources API endpoints from the plugin.
4
+ * Part of API Onboarding feature (#1783).
5
+ */
6
+ import type { ApiClient, ApiResponse, RequestOptions } from '../api-client.js';
7
+ /** API source from the backend */
8
+ export interface ApiSourceResponse {
9
+ [key: string]: unknown;
10
+ id: string;
11
+ namespace: string;
12
+ name: string;
13
+ description: string | null;
14
+ spec_url: string | null;
15
+ servers: Array<{
16
+ url: string;
17
+ description?: string;
18
+ }>;
19
+ spec_version: string | null;
20
+ spec_hash: string | null;
21
+ tags: string[];
22
+ refresh_interval_seconds: number | null;
23
+ last_fetched_at: string | null;
24
+ status: string;
25
+ error_message: string | null;
26
+ created_by_agent: string | null;
27
+ deleted_at: string | null;
28
+ created_at: string;
29
+ updated_at: string;
30
+ }
31
+ /** Credential from the backend */
32
+ export interface ApiCredentialResponse {
33
+ [key: string]: unknown;
34
+ id: string;
35
+ api_source_id: string;
36
+ purpose: string;
37
+ header_name: string;
38
+ header_prefix: string | null;
39
+ resolve_strategy: string;
40
+ resolve_reference: string;
41
+ created_at: string;
42
+ updated_at: string;
43
+ }
44
+ /** Onboard result from the backend */
45
+ export interface OnboardResultResponse {
46
+ api_source: ApiSourceResponse;
47
+ memories_created: number;
48
+ memories_updated: number;
49
+ memories_deleted: number;
50
+ }
51
+ /** Refresh result from the backend */
52
+ export interface RefreshResultResponse {
53
+ api_source: ApiSourceResponse;
54
+ memories_created: number;
55
+ memories_updated: number;
56
+ memories_deleted: number;
57
+ spec_changed: boolean;
58
+ }
59
+ /** API memory search result from the backend */
60
+ export interface ApiMemorySearchResultResponse {
61
+ id: string;
62
+ api_source_id: string;
63
+ memory_kind: string;
64
+ operation_key: string;
65
+ title: string;
66
+ content: string;
67
+ metadata: Record<string, unknown>;
68
+ tags: string[];
69
+ score: number;
70
+ credentials?: ApiCredentialResponse[];
71
+ }
72
+ export interface OnboardParams {
73
+ spec_url?: string;
74
+ spec_content?: string;
75
+ name?: string;
76
+ description?: string;
77
+ tags?: string[];
78
+ credentials?: Array<{
79
+ header_name: string;
80
+ header_prefix?: string;
81
+ resolve_strategy: string;
82
+ resolve_reference: string;
83
+ purpose?: string;
84
+ }>;
85
+ spec_auth_headers?: Record<string, string>;
86
+ }
87
+ export interface SearchParams {
88
+ q: string;
89
+ limit?: number;
90
+ offset?: number;
91
+ memory_kind?: string;
92
+ api_source_id?: string;
93
+ tags?: string[];
94
+ }
95
+ export interface UpdateApiSourceParams {
96
+ name?: string;
97
+ description?: string | null;
98
+ tags?: string[];
99
+ status?: string;
100
+ }
101
+ export interface CredentialManageParams {
102
+ /** Action to perform: 'add', 'update', or 'remove' */
103
+ action: 'add' | 'update' | 'remove';
104
+ /** Credential ID (required for update/remove) */
105
+ credential_id?: string;
106
+ /** Credential fields (required for add/update) */
107
+ header_name?: string;
108
+ header_prefix?: string;
109
+ resolve_strategy?: string;
110
+ resolve_reference?: string;
111
+ purpose?: string;
112
+ }
113
+ /**
114
+ * HTTP client wrapper for the api-sources API.
115
+ * Follows the same pattern as notification-service.ts.
116
+ */
117
+ export declare class ApiSourceService {
118
+ private client;
119
+ constructor(client: ApiClient);
120
+ /**
121
+ * Onboard a new API source from an OpenAPI spec URL or inline content.
122
+ */
123
+ onboard(params: OnboardParams, options?: RequestOptions): Promise<ApiResponse<{
124
+ data: OnboardResultResponse;
125
+ }>>;
126
+ /**
127
+ * Search API memories using hybrid search.
128
+ */
129
+ search(params: SearchParams, options?: RequestOptions): Promise<ApiResponse<{
130
+ data: ApiMemorySearchResultResponse[];
131
+ limit: number;
132
+ offset: number;
133
+ }>>;
134
+ /**
135
+ * Get a single API source by ID.
136
+ */
137
+ get(id: string, options?: RequestOptions): Promise<ApiResponse<{
138
+ data: ApiSourceResponse;
139
+ }>>;
140
+ /**
141
+ * List API sources.
142
+ */
143
+ list(params?: {
144
+ limit?: number;
145
+ offset?: number;
146
+ status?: string;
147
+ }, options?: RequestOptions): Promise<ApiResponse<{
148
+ data: ApiSourceResponse[];
149
+ limit: number;
150
+ offset: number;
151
+ }>>;
152
+ /**
153
+ * Update an API source.
154
+ */
155
+ update(id: string, params: UpdateApiSourceParams, options?: RequestOptions): Promise<ApiResponse<{
156
+ data: ApiSourceResponse;
157
+ }>>;
158
+ /**
159
+ * Manage credentials for an API source (add/update/remove).
160
+ */
161
+ manageCredential(sourceId: string, params: CredentialManageParams, options?: RequestOptions): Promise<ApiResponse<{
162
+ data: ApiCredentialResponse;
163
+ } | void>>;
164
+ /**
165
+ * Refresh an API source from its spec URL.
166
+ */
167
+ refresh(id: string, options?: RequestOptions): Promise<ApiResponse<{
168
+ data: RefreshResultResponse;
169
+ }>>;
170
+ /**
171
+ * Soft-delete an API source.
172
+ */
173
+ remove(id: string, options?: RequestOptions): Promise<ApiResponse<void>>;
174
+ /**
175
+ * Restore a soft-deleted API source.
176
+ */
177
+ restore(id: string, options?: RequestOptions): Promise<ApiResponse<{
178
+ data: ApiSourceResponse;
179
+ }>>;
180
+ }
181
+ //# sourceMappingURL=api-source-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-source-service.d.ts","sourceRoot":"","sources":["../../src/services/api-source-service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAI/E,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,wBAAwB,EAAE,MAAM,GAAG,IAA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CAAC;IAerF;;OAEG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAC;IAQpD;;OAEG;IACG,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC;QAAE,IAAI,EAAE,qBAAqB,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IA2C/D;;OAEG;IACG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC;QAAE,IAAI,EAAE,qBAAqB,CAAA;KAAE,CAAC,CAAC;IAQxD;;OAEG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAO7B;;OAEG;IACG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAC;CAOrD"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Plugin API source service client.
3
+ * HTTP client for calling api-sources API endpoints from the plugin.
4
+ * Part of API Onboarding feature (#1783).
5
+ */
6
+ // ── Service ─────────────────────────────────────────────────────────────────
7
+ /**
8
+ * HTTP client wrapper for the api-sources API.
9
+ * Follows the same pattern as notification-service.ts.
10
+ */
11
+ export class ApiSourceService {
12
+ client;
13
+ constructor(client) {
14
+ this.client = client;
15
+ }
16
+ /**
17
+ * Onboard a new API source from an OpenAPI spec URL or inline content.
18
+ */
19
+ async onboard(params, options) {
20
+ return this.client.post('/api/api-sources', params, options);
21
+ }
22
+ /**
23
+ * Search API memories using hybrid search.
24
+ */
25
+ async search(params, options) {
26
+ const searchParams = new URLSearchParams();
27
+ searchParams.set('q', params.q);
28
+ if (params.limit !== undefined)
29
+ searchParams.set('limit', String(params.limit));
30
+ if (params.offset !== undefined)
31
+ searchParams.set('offset', String(params.offset));
32
+ if (params.memory_kind)
33
+ searchParams.set('memory_kind', params.memory_kind);
34
+ if (params.api_source_id)
35
+ searchParams.set('api_source_id', params.api_source_id);
36
+ if (params.tags && params.tags.length > 0)
37
+ searchParams.set('tags', params.tags.join(','));
38
+ return this.client.get(`/api/api-memories/search?${searchParams}`, options);
39
+ }
40
+ /**
41
+ * Get a single API source by ID.
42
+ */
43
+ async get(id, options) {
44
+ return this.client.get(`/api/api-sources/${encodeURIComponent(id)}`, options);
45
+ }
46
+ /**
47
+ * List API sources.
48
+ */
49
+ async list(params, options) {
50
+ const searchParams = new URLSearchParams();
51
+ if (params?.limit !== undefined)
52
+ searchParams.set('limit', String(params.limit));
53
+ if (params?.offset !== undefined)
54
+ searchParams.set('offset', String(params.offset));
55
+ if (params?.status)
56
+ searchParams.set('status', params.status);
57
+ const qs = searchParams.toString();
58
+ const path = qs ? `/api/api-sources?${qs}` : '/api/api-sources';
59
+ return this.client.get(path, options);
60
+ }
61
+ /**
62
+ * Update an API source.
63
+ */
64
+ async update(id, params, options) {
65
+ return this.client.patch(`/api/api-sources/${encodeURIComponent(id)}`, params, options);
66
+ }
67
+ /**
68
+ * Manage credentials for an API source (add/update/remove).
69
+ */
70
+ async manageCredential(sourceId, params, options) {
71
+ const basePath = `/api/api-sources/${encodeURIComponent(sourceId)}/credentials`;
72
+ if (params.action === 'add') {
73
+ return this.client.post(basePath, {
74
+ header_name: params.header_name,
75
+ header_prefix: params.header_prefix,
76
+ resolve_strategy: params.resolve_strategy,
77
+ resolve_reference: params.resolve_reference,
78
+ purpose: params.purpose,
79
+ }, options);
80
+ }
81
+ if (params.action === 'update' && params.credential_id) {
82
+ return this.client.patch(`${basePath}/${encodeURIComponent(params.credential_id)}`, {
83
+ header_name: params.header_name,
84
+ header_prefix: params.header_prefix,
85
+ resolve_strategy: params.resolve_strategy,
86
+ resolve_reference: params.resolve_reference,
87
+ purpose: params.purpose,
88
+ }, options);
89
+ }
90
+ if (params.action === 'remove' && params.credential_id) {
91
+ return this.client.delete(`${basePath}/${encodeURIComponent(params.credential_id)}`, options);
92
+ }
93
+ return {
94
+ success: false,
95
+ error: {
96
+ status: 400,
97
+ message: 'Invalid credential management action or missing credential_id',
98
+ },
99
+ };
100
+ }
101
+ /**
102
+ * Refresh an API source from its spec URL.
103
+ */
104
+ async refresh(id, options) {
105
+ return this.client.post(`/api/api-sources/${encodeURIComponent(id)}/refresh`, undefined, options);
106
+ }
107
+ /**
108
+ * Soft-delete an API source.
109
+ */
110
+ async remove(id, options) {
111
+ return this.client.delete(`/api/api-sources/${encodeURIComponent(id)}`, options);
112
+ }
113
+ /**
114
+ * Restore a soft-deleted API source.
115
+ */
116
+ async restore(id, options) {
117
+ return this.client.post(`/api/api-sources/${encodeURIComponent(id)}/restore`, undefined, options);
118
+ }
119
+ }
120
+ //# sourceMappingURL=api-source-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-source-service.js","sourceRoot":"","sources":["../../src/services/api-source-service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwHH,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAEzC;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,OAAwB;QAExB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,kBAAkB,EAClB,MAAM,EACN,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,MAAoB,EACpB,OAAwB;QAExB,MAAM,YAAY,GAAG,IAAI,eAAe,EAAE,CAAC;QAC3C,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C,MAAM,CAAC,IAAI,CACrB,oBAAoB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EACpD,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * api_credential_manage tool implementation.
3
+ * Add, update, or remove credentials for an onboarded API source.
4
+ * Part of API Onboarding feature (#1785).
5
+ */
6
+ import { z } from 'zod';
7
+ import type { ApiClient } from '../api-client.js';
8
+ import type { Logger } from '../logger.js';
9
+ import type { PluginConfig } from '../config.js';
10
+ /** Parameters for api_credential_manage tool */
11
+ export declare const ApiCredentialManageParamsSchema: z.ZodEffects<z.ZodObject<{
12
+ api_source_id: z.ZodString;
13
+ action: z.ZodEnum<["add", "update", "remove"]>;
14
+ credential_id: z.ZodOptional<z.ZodString>;
15
+ header_name: z.ZodOptional<z.ZodString>;
16
+ header_prefix: z.ZodOptional<z.ZodString>;
17
+ resolve_strategy: z.ZodOptional<z.ZodEnum<["literal", "env", "file", "command"]>>;
18
+ resolve_reference: z.ZodOptional<z.ZodString>;
19
+ purpose: z.ZodOptional<z.ZodEnum<["api_call", "spec_fetch"]>>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ api_source_id: string;
22
+ action: "add" | "update" | "remove";
23
+ credential_id?: string | undefined;
24
+ purpose?: "api_call" | "spec_fetch" | undefined;
25
+ header_name?: string | undefined;
26
+ header_prefix?: string | undefined;
27
+ resolve_strategy?: "file" | "command" | "literal" | "env" | undefined;
28
+ resolve_reference?: string | undefined;
29
+ }, {
30
+ api_source_id: string;
31
+ action: "add" | "update" | "remove";
32
+ credential_id?: string | undefined;
33
+ purpose?: "api_call" | "spec_fetch" | undefined;
34
+ header_name?: string | undefined;
35
+ header_prefix?: string | undefined;
36
+ resolve_strategy?: "file" | "command" | "literal" | "env" | undefined;
37
+ resolve_reference?: string | undefined;
38
+ }>, {
39
+ api_source_id: string;
40
+ action: "add" | "update" | "remove";
41
+ credential_id?: string | undefined;
42
+ purpose?: "api_call" | "spec_fetch" | undefined;
43
+ header_name?: string | undefined;
44
+ header_prefix?: string | undefined;
45
+ resolve_strategy?: "file" | "command" | "literal" | "env" | undefined;
46
+ resolve_reference?: string | undefined;
47
+ }, {
48
+ api_source_id: string;
49
+ action: "add" | "update" | "remove";
50
+ credential_id?: string | undefined;
51
+ purpose?: "api_call" | "spec_fetch" | undefined;
52
+ header_name?: string | undefined;
53
+ header_prefix?: string | undefined;
54
+ resolve_strategy?: "file" | "command" | "literal" | "env" | undefined;
55
+ resolve_reference?: string | undefined;
56
+ }>;
57
+ export type ApiCredentialManageParams = z.infer<typeof ApiCredentialManageParamsSchema>;
58
+ export interface ApiCredentialManageSuccess {
59
+ success: true;
60
+ data: {
61
+ content: string;
62
+ details: Record<string, unknown>;
63
+ };
64
+ }
65
+ export interface ApiCredentialManageFailure {
66
+ success: false;
67
+ error: string;
68
+ }
69
+ export type ApiCredentialManageResult = ApiCredentialManageSuccess | ApiCredentialManageFailure;
70
+ export interface ApiCredentialManageToolOptions {
71
+ client: ApiClient;
72
+ logger: Logger;
73
+ config: PluginConfig;
74
+ user_id: string;
75
+ }
76
+ export interface ApiCredentialManageTool {
77
+ name: string;
78
+ description: string;
79
+ parameters: typeof ApiCredentialManageParamsSchema;
80
+ execute: (params: ApiCredentialManageParams) => Promise<ApiCredentialManageResult>;
81
+ }
82
+ export declare function createApiCredentialManageTool(options: ApiCredentialManageToolOptions): ApiCredentialManageTool;
83
+ //# sourceMappingURL=api-credential-manage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-credential-manage.d.ts","sourceRoot":"","sources":["../../src/tools/api-credential-manage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,gDAAgD;AAChD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,CAAC;CACH;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,yBAAyB,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAEhG,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,+BAA+B,CAAC;IACnD,OAAO,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACpF;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,uBAAuB,CAqD9G"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * api_credential_manage tool implementation.
3
+ * Add, update, or remove credentials for an onboarded API source.
4
+ * Part of API Onboarding feature (#1785).
5
+ */
6
+ import { z } from 'zod';
7
+ import { ApiSourceService } from '../services/api-source-service.js';
8
+ import { sanitizeErrorMessage } from '../utils/sanitize.js';
9
+ /** Parameters for api_credential_manage tool */
10
+ export const ApiCredentialManageParamsSchema = z.object({
11
+ api_source_id: z.string().uuid('api_source_id must be a valid UUID'),
12
+ action: z.enum(['add', 'update', 'remove']),
13
+ credential_id: z.string().uuid('credential_id must be a valid UUID').optional(),
14
+ header_name: z.string().min(1).optional(),
15
+ header_prefix: z.string().optional(),
16
+ resolve_strategy: z.enum(['literal', 'env', 'file', 'command']).optional(),
17
+ resolve_reference: z.string().min(1).optional(),
18
+ purpose: z.enum(['api_call', 'spec_fetch']).optional(),
19
+ }).refine((data) => {
20
+ if (data.action === 'add') {
21
+ return !!data.header_name && !!data.resolve_strategy && !!data.resolve_reference;
22
+ }
23
+ if (data.action === 'update' || data.action === 'remove') {
24
+ return !!data.credential_id;
25
+ }
26
+ return true;
27
+ }, {
28
+ message: 'add requires header_name, resolve_strategy, resolve_reference; update/remove requires credential_id',
29
+ });
30
+ export function createApiCredentialManageTool(options) {
31
+ const { client, logger, user_id } = options;
32
+ const service = new ApiSourceService(client);
33
+ return {
34
+ name: 'api_credential_manage',
35
+ description: 'Manage credentials for an onboarded API source. ' +
36
+ 'Actions: add (new credential), update (change existing), remove (delete). ' +
37
+ 'Credentials define how to authenticate API calls (header name, prefix, resolve strategy).',
38
+ parameters: ApiCredentialManageParamsSchema,
39
+ async execute(params) {
40
+ const parseResult = ApiCredentialManageParamsSchema.safeParse(params);
41
+ if (!parseResult.success) {
42
+ return { success: false, error: parseResult.error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ') };
43
+ }
44
+ const { api_source_id, action, credential_id, header_name, header_prefix, resolve_strategy, resolve_reference, purpose } = parseResult.data;
45
+ logger.info('api_credential_manage invoked', { user_id, api_source_id, action });
46
+ try {
47
+ const response = await service.manageCredential(api_source_id, { action, credential_id, header_name, header_prefix, resolve_strategy, resolve_reference, purpose }, { user_id });
48
+ if (!response.success) {
49
+ return { success: false, error: response.error.message || `Failed to ${action} credential` };
50
+ }
51
+ const content = action === 'add' ? `Added credential "${header_name}" to API source.` :
52
+ action === 'update' ? `Updated credential ${credential_id}.` :
53
+ `Removed credential ${credential_id}.`;
54
+ return {
55
+ success: true,
56
+ data: {
57
+ content,
58
+ details: response.data && typeof response.data === 'object' && 'data' in response.data
59
+ ? response.data.data
60
+ : {},
61
+ },
62
+ };
63
+ }
64
+ catch (error) {
65
+ logger.error('api_credential_manage failed', { user_id, error: error instanceof Error ? error.message : String(error) });
66
+ return { success: false, error: sanitizeErrorMessage(error) };
67
+ }
68
+ },
69
+ };
70
+ }
71
+ //# sourceMappingURL=api-credential-manage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-credential-manage.js","sourceRoot":"","sources":["../../src/tools/api-credential-manage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,oCAAoC,CAAC;IACpE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,QAAQ,EAAE;IAC/E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1E,iBAAiB,EAAE,CAA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AAC,IAA0C,CAAC,IAAI;4BAC3D,CAAC,CAAC,EAAE;qBACP;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACzH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * api_get tool implementation.
3
+ * Retrieve details about a specific onboarded API source.
4
+ * Part of API Onboarding feature (#1785).
5
+ */
6
+ import { z } from 'zod';
7
+ import type { ApiClient } from '../api-client.js';
8
+ import type { Logger } from '../logger.js';
9
+ import type { PluginConfig } from '../config.js';
10
+ import { type ApiSourceResponse } from '../services/api-source-service.js';
11
+ /** Parameters for api_get tool */
12
+ export declare const ApiGetParamsSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ id: string;
16
+ }, {
17
+ id: string;
18
+ }>;
19
+ export type ApiGetParams = z.infer<typeof ApiGetParamsSchema>;
20
+ /** Successful tool result */
21
+ export interface ApiGetSuccess {
22
+ success: true;
23
+ data: {
24
+ content: string;
25
+ details: ApiSourceResponse;
26
+ };
27
+ }
28
+ /** Failed tool result */
29
+ export interface ApiGetFailure {
30
+ success: false;
31
+ error: string;
32
+ }
33
+ export type ApiGetResult = ApiGetSuccess | ApiGetFailure;
34
+ export interface ApiGetToolOptions {
35
+ client: ApiClient;
36
+ logger: Logger;
37
+ config: PluginConfig;
38
+ user_id: string;
39
+ }
40
+ export interface ApiGetTool {
41
+ name: string;
42
+ description: string;
43
+ parameters: typeof ApiGetParamsSchema;
44
+ execute: (params: ApiGetParams) => Promise<ApiGetResult>;
45
+ }
46
+ export declare function createApiGetTool(options: ApiGetToolOptions): ApiGetTool;
47
+ //# sourceMappingURL=api-get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-get.d.ts","sourceRoot":"","sources":["../../src/tools/api-get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG7F,kCAAkC;AAClC,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,6BAA6B;AAC7B,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,iBAAiB,CAAC;KAC5B,CAAC;CACH;AAED,yBAAyB;AACzB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,aAAa,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,kBAAkB,CAAC;IACtC,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAgCvE"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * api_get tool implementation.
3
+ * Retrieve details about a specific onboarded API source.
4
+ * Part of API Onboarding feature (#1785).
5
+ */
6
+ import { z } from 'zod';
7
+ import { ApiSourceService } from '../services/api-source-service.js';
8
+ import { sanitizeErrorMessage } from '../utils/sanitize.js';
9
+ /** Parameters for api_get tool */
10
+ export const ApiGetParamsSchema = z.object({
11
+ id: z.string().uuid('id must be a valid UUID'),
12
+ });
13
+ export function createApiGetTool(options) {
14
+ const { client, logger, user_id } = options;
15
+ const service = new ApiSourceService(client);
16
+ return {
17
+ name: 'api_get',
18
+ description: 'Get details about a specific onboarded API source including its status, spec version, and tags.',
19
+ parameters: ApiGetParamsSchema,
20
+ async execute(params) {
21
+ const parseResult = ApiGetParamsSchema.safeParse(params);
22
+ if (!parseResult.success) {
23
+ return { success: false, error: parseResult.error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ') };
24
+ }
25
+ try {
26
+ const response = await service.get(parseResult.data.id, { user_id });
27
+ if (!response.success) {
28
+ return { success: false, error: response.error.message || 'Failed to get API source' };
29
+ }
30
+ const source = response.data.data;
31
+ const content = `API Source: ${source.name} (${source.status}) — ${source.spec_version ?? 'unknown version'}`;
32
+ return { success: true, data: { content, details: source } };
33
+ }
34
+ catch (error) {
35
+ logger.error('api_get failed', { user_id, error: error instanceof Error ? error.message : String(error) });
36
+ return { success: false, error: sanitizeErrorMessage(error) };
37
+ }
38
+ },
39
+ };
40
+ }
41
+ //# sourceMappingURL=api-get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-get.js","sourceRoot":"","sources":["../../src/tools/api-get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,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AAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,IAAI,0BAA0B,EAAE,CAAC;gBACzF,CAAC;gBAED,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAClC,MAAM,OAAO,GAAG,eAAe,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,YAAY,IAAI,iBAAiB,EAAE,CAAC;gBAE9G,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;YAC/D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBAC3G,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * api_list tool implementation.
3
+ * List all onboarded API sources.
4
+ * Part of API Onboarding feature (#1785).
5
+ */
6
+ import { z } from 'zod';
7
+ import type { ApiClient } from '../api-client.js';
8
+ import type { Logger } from '../logger.js';
9
+ import type { PluginConfig } from '../config.js';
10
+ import { type ApiSourceResponse } from '../services/api-source-service.js';
11
+ /** Parameters for api_list tool */
12
+ export declare const ApiListParamsSchema: z.ZodObject<{
13
+ limit: z.ZodOptional<z.ZodNumber>;
14
+ offset: z.ZodOptional<z.ZodNumber>;
15
+ status: z.ZodOptional<z.ZodEnum<["active", "error", "disabled"]>>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ status?: "error" | "active" | "disabled" | undefined;
18
+ limit?: number | undefined;
19
+ offset?: number | undefined;
20
+ }, {
21
+ status?: "error" | "active" | "disabled" | undefined;
22
+ limit?: number | undefined;
23
+ offset?: number | undefined;
24
+ }>;
25
+ export type ApiListParams = z.infer<typeof ApiListParamsSchema>;
26
+ export interface ApiListSuccess {
27
+ success: true;
28
+ data: {
29
+ content: string;
30
+ details: {
31
+ count: number;
32
+ sources: ApiSourceResponse[];
33
+ };
34
+ };
35
+ }
36
+ export interface ApiListFailure {
37
+ success: false;
38
+ error: string;
39
+ }
40
+ export type ApiListResult = ApiListSuccess | ApiListFailure;
41
+ export interface ApiListToolOptions {
42
+ client: ApiClient;
43
+ logger: Logger;
44
+ config: PluginConfig;
45
+ user_id: string;
46
+ }
47
+ export interface ApiListTool {
48
+ name: string;
49
+ description: string;
50
+ parameters: typeof ApiListParamsSchema;
51
+ execute: (params: ApiListParams) => Promise<ApiListResult>;
52
+ }
53
+ export declare function createApiListTool(options: ApiListToolOptions): ApiListTool;
54
+ //# sourceMappingURL=api-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-list.d.ts","sourceRoot":"","sources":["../../src/tools/api-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG7F,mCAAmC;AACnC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,IAAI,CAAC;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