@harborclient/team-hub-api 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) HarborClient
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @harborclient/team-hub-api
2
+
3
+ **Full documentation:** [https://harborclient.github.io/team-hub-api/](https://harborclient.github.io/team-hub-api/)
4
+
5
+ **TypeScript client for the HarborClient Team Hub API**
6
+
7
+ `@harborclient/team-hub-api` is a library for typed HTTP access to HarborClient Team Hub collections, environments, folders, and saved requests:
8
+
9
+ - **Typed HTTP client:** Zod-validated request and response shapes for Team Hub endpoints.
10
+ - **Full API coverage:** Collections, environments, folders, saved requests, admin, and session APIs.
11
+ - **Capability-aware usage:** Session capabilities guide when to call management vs. user-scoped methods.
12
+
13
+ ## Documentation
14
+
15
+ | Topic | Link |
16
+ | --------------- | ------------------------------------------------------------------------ |
17
+ | Getting started | [Introduction](https://harborclient.github.io/team-hub-api/) |
18
+ | Installation | [Install](https://harborclient.github.io/team-hub-api/install) |
19
+ | Usage | [Usage](https://harborclient.github.io/team-hub-api/usage) |
20
+ | API reference | [API coverage](https://harborclient.github.io/team-hub-api/api-coverage) |
21
+
22
+ Canonical docs live in [`docs/`](./docs/). Edit those pages directly, then run `pnpm docs:build:nav` to refresh the VitePress sidebar.
23
+
24
+ ## Development
25
+
26
+ ```bash
27
+ pnpm install
28
+ pnpm lint
29
+ pnpm format:check
30
+ pnpm typecheck
31
+ pnpm test
32
+ pnpm build
33
+ pnpm docs:serve # VitePress dev server with nav watcher
34
+ pnpm docs:build # production docs build
35
+ ```
36
+
37
+ ## License
38
+
39
+ MIT
@@ -0,0 +1,261 @@
1
+ import type { AdminEntityConfig, AdminResourceOption, CollectionRecord, CreateCollectionInput, CreateEnvironmentInput, CreateFolderInput, CreateRequestInput, EnvironmentRecord, FolderRecord, HealthResponse, HubUserRecord, MoveRequestInput, PluginSourcesResponse, RenameFolderInput, ReorderFoldersInput, ReorderRequestsInput, SavedRequestRecord, SessionResponse, TeamHubAdminResourceOptions, UpdateCollectionInput, UpdateEnvironmentInput, UpdateHubUserInput, CreateHubUserInput, HubApiTokenRecord, CreatedHubUser, CreateHubTokenInput, CreatedHubToken, UpdateRequestInput, ReloadConfigResponse } from './types.js';
2
+ import type { HubLlmModel } from './appTypes.js';
3
+ /**
4
+ * Typed HTTP client for HarborClient Server entity and health routes.
5
+ */
6
+ export interface ITeamHubClient {
7
+ /**
8
+ * Probes server availability via the public health endpoint.
9
+ */
10
+ checkHealth(): Promise<HealthResponse>;
11
+ /**
12
+ * Returns the authenticated user, token metadata, and derived API capabilities.
13
+ *
14
+ * Calls `GET /auth/session` with bearer auth. Use this to discover whether
15
+ * a token belongs to a `user` or `admin` account before gating management UI.
16
+ */
17
+ getSession(): Promise<SessionResponse>;
18
+ /**
19
+ * Lists all Team Hub user accounts visible to an admin-role token.
20
+ */
21
+ listAdminUsers(): Promise<HubUserRecord[]>;
22
+ /**
23
+ * Creates a Team Hub user account and an initial API bearer token.
24
+ *
25
+ * @param input - User fields for the new account.
26
+ */
27
+ createAdminUser(input: CreateHubUserInput): Promise<CreatedHubUser>;
28
+ /**
29
+ * Updates a Team Hub user account via the management API.
30
+ *
31
+ * @param id - User account identifier.
32
+ * @param input - Partial user fields to apply.
33
+ */
34
+ updateAdminUser(id: string, input: UpdateHubUserInput): Promise<HubUserRecord>;
35
+ /**
36
+ * Deletes a Team Hub user account and their API tokens via the management API.
37
+ *
38
+ * @param id - User account identifier.
39
+ */
40
+ deleteAdminUser(id: string): Promise<void>;
41
+ /**
42
+ * Lists all API bearer tokens visible to an admin-role token.
43
+ */
44
+ listAdminTokens(): Promise<HubApiTokenRecord[]>;
45
+ /**
46
+ * Creates an additional API bearer token for a user account.
47
+ *
48
+ * @param userId - Owning user account identifier.
49
+ * @param input - Human-readable label for the new token.
50
+ */
51
+ createAdminUserToken(userId: string, input: CreateHubTokenInput): Promise<CreatedHubToken>;
52
+ /**
53
+ * Permanently deletes an API bearer token via the management API.
54
+ *
55
+ * @param id - Token record identifier.
56
+ */
57
+ deleteAdminToken(id: string): Promise<void>;
58
+ /**
59
+ * Lists all collections as id/name metadata for admin user management.
60
+ */
61
+ listAdminCollections(): Promise<AdminResourceOption[]>;
62
+ /**
63
+ * Lists all environments as id/name metadata for admin user management.
64
+ */
65
+ listAdminEnvironments(): Promise<AdminResourceOption[]>;
66
+ /**
67
+ * Lists folders in a collection for operator inspection.
68
+ *
69
+ * @param collectionId - Parent collection UUID.
70
+ */
71
+ listAdminCollectionFolders(collectionId: string): Promise<FolderRecord[]>;
72
+ /**
73
+ * Lists saved requests in a collection for operator inspection.
74
+ *
75
+ * @param collectionId - Parent collection UUID.
76
+ */
77
+ listAdminCollectionRequests(collectionId: string): Promise<SavedRequestRecord[]>;
78
+ /**
79
+ * Deletes a collection via the admin management API.
80
+ *
81
+ * @param id - Collection UUID.
82
+ */
83
+ deleteAdminCollection(id: string): Promise<void>;
84
+ /**
85
+ * Deletes an environment via the admin management API.
86
+ *
87
+ * @param id - Environment UUID.
88
+ */
89
+ deleteAdminEnvironment(id: string): Promise<void>;
90
+ /**
91
+ * Deletes a saved request via the admin management API.
92
+ *
93
+ * @param id - Saved request UUID.
94
+ */
95
+ deleteAdminRequest(id: string): Promise<void>;
96
+ /**
97
+ * Updates whether non-admin users may delete a collection.
98
+ *
99
+ * @param id - Collection UUID.
100
+ * @param deletionLocked - When true, user-role tokens cannot delete the collection.
101
+ */
102
+ updateAdminCollectionDeletionLocked(id: string, deletionLocked: boolean): Promise<AdminEntityConfig>;
103
+ /**
104
+ * Updates whether non-admin users may delete an environment.
105
+ *
106
+ * @param id - Environment UUID.
107
+ * @param deletionLocked - When true, user-role tokens cannot delete the environment.
108
+ */
109
+ updateAdminEnvironmentDeletionLocked(id: string, deletionLocked: boolean): Promise<AdminEntityConfig>;
110
+ /**
111
+ * Lists all hub-offered LLM models for admin user management.
112
+ */
113
+ listAdminLlmModels(): Promise<HubLlmModel[]>;
114
+ /**
115
+ * Returns whether the Team Hub server has LLM support configured.
116
+ *
117
+ * @param managementApi - When true, probes `GET /admin/llm/models`.
118
+ */
119
+ probeLlmServiceEnabled(managementApi: boolean): Promise<boolean>;
120
+ /**
121
+ * Returns plugin catalog and trusted-publisher URLs configured on this Team Hub.
122
+ */
123
+ getPluginSources(): Promise<PluginSourcesResponse>;
124
+ /**
125
+ * Loads collection, environment, and LLM model options for admin user forms.
126
+ */
127
+ listAdminResourceOptions(): Promise<TeamHubAdminResourceOptions>;
128
+ /**
129
+ * Re-reads server.yaml on the Team Hub and applies reloadable config sections.
130
+ *
131
+ * Requires an admin-role bearer token. Returns a per-section report. A `400`
132
+ * response with `fatalError` is returned as a normal result, not thrown.
133
+ */
134
+ reloadConfig(): Promise<ReloadConfigResponse>;
135
+ /**
136
+ * Lists all collections visible to the authenticated token.
137
+ *
138
+ * Admin tokens receive the full catalog from `GET /collections`; create, update,
139
+ * and delete remain forbidden on the server.
140
+ */
141
+ listCollections(): Promise<CollectionRecord[]>;
142
+ /**
143
+ * Creates a new top-level collection.
144
+ *
145
+ * @param input - Display name for the collection.
146
+ */
147
+ createCollection(input: CreateCollectionInput): Promise<CollectionRecord>;
148
+ /**
149
+ * Updates an existing collection's settings.
150
+ *
151
+ * @param id - Collection UUID.
152
+ * @param input - Updated collection fields.
153
+ */
154
+ updateCollection(id: string, input: UpdateCollectionInput): Promise<CollectionRecord>;
155
+ /**
156
+ * Deletes a collection and all nested folders and requests.
157
+ *
158
+ * @param id - Collection UUID.
159
+ */
160
+ deleteCollection(id: string): Promise<void>;
161
+ /**
162
+ * Lists all environments visible to the authenticated token.
163
+ *
164
+ * Admin tokens receive the full catalog from `GET /environments`; create, update,
165
+ * and delete remain forbidden on the server.
166
+ */
167
+ listEnvironments(): Promise<EnvironmentRecord[]>;
168
+ /**
169
+ * Creates a new top-level environment.
170
+ *
171
+ * @param input - Display name for the environment.
172
+ */
173
+ createEnvironment(input: CreateEnvironmentInput): Promise<EnvironmentRecord>;
174
+ /**
175
+ * Updates an existing environment's name and variables.
176
+ *
177
+ * @param id - Environment UUID.
178
+ * @param input - Updated environment fields.
179
+ */
180
+ updateEnvironment(id: string, input: UpdateEnvironmentInput): Promise<EnvironmentRecord>;
181
+ /**
182
+ * Deletes an environment by id.
183
+ *
184
+ * @param id - Environment UUID.
185
+ */
186
+ deleteEnvironment(id: string): Promise<void>;
187
+ /**
188
+ * Lists folders in a collection ordered by sort order, then name.
189
+ *
190
+ * @param collectionId - Parent collection UUID.
191
+ */
192
+ listFolders(collectionId: string): Promise<FolderRecord[]>;
193
+ /**
194
+ * Creates a folder in the given collection.
195
+ *
196
+ * @param collectionId - Parent collection UUID.
197
+ * @param input - Display name for the folder.
198
+ */
199
+ createFolder(collectionId: string, input: CreateFolderInput): Promise<FolderRecord>;
200
+ /**
201
+ * Renames a folder by id.
202
+ *
203
+ * @param id - Folder UUID.
204
+ * @param input - Updated folder name.
205
+ */
206
+ renameFolder(id: string, input: RenameFolderInput): Promise<FolderRecord>;
207
+ /**
208
+ * Deletes a folder and all saved requests inside it.
209
+ *
210
+ * @param id - Folder UUID.
211
+ */
212
+ deleteFolder(id: string): Promise<void>;
213
+ /**
214
+ * Reorders folders within a collection.
215
+ *
216
+ * @param collectionId - Parent collection UUID.
217
+ * @param input - Folder ids in the desired order.
218
+ */
219
+ reorderFolders(collectionId: string, input: ReorderFoldersInput): Promise<void>;
220
+ /**
221
+ * Lists saved requests in a collection.
222
+ *
223
+ * @param collectionId - Parent collection UUID.
224
+ */
225
+ listRequests(collectionId: string): Promise<SavedRequestRecord[]>;
226
+ /**
227
+ * Creates a new saved request in a collection.
228
+ *
229
+ * @param collectionId - Parent collection UUID.
230
+ * @param input - Saved request fields.
231
+ */
232
+ createRequest(collectionId: string, input: CreateRequestInput): Promise<SavedRequestRecord>;
233
+ /**
234
+ * Updates an existing saved request by id.
235
+ *
236
+ * @param id - Saved request UUID.
237
+ * @param input - Updated request fields including collection id.
238
+ */
239
+ updateRequest(id: string, input: UpdateRequestInput): Promise<SavedRequestRecord>;
240
+ /**
241
+ * Deletes a saved request by id.
242
+ *
243
+ * @param id - Saved request UUID.
244
+ */
245
+ deleteRequest(id: string): Promise<void>;
246
+ /**
247
+ * Reorders saved requests within a folder or the collection root.
248
+ *
249
+ * @param collectionId - Parent collection UUID.
250
+ * @param input - Destination folder and ordered request ids.
251
+ */
252
+ reorderRequests(collectionId: string, input: ReorderRequestsInput): Promise<void>;
253
+ /**
254
+ * Moves a saved request to another folder or root index.
255
+ *
256
+ * @param id - Saved request UUID.
257
+ * @param input - Destination folder and target index.
258
+ */
259
+ moveRequest(id: string, input: MoveRequestInput): Promise<void>;
260
+ }
261
+ //# sourceMappingURL=ITeamHubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITeamHubClient.d.ts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CAAC,IAAI,CAAC,CAAC;IAExC;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhF;;;;OAIG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAElE;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE5F;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAElF;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElF;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,333 @@
1
+ import type { ITeamHubClient } from './ITeamHubClient.js';
2
+ import type { AdminResourceOption, AdminEntityConfig, CollectionRecord, CreateCollectionInput, CreateEnvironmentInput, CreateFolderInput, CreateHubTokenInput, CreateHubUserInput, CreateRequestInput, CreatedHubToken, CreatedHubUser, EnvironmentRecord, FolderRecord, HealthResponse, HubApiTokenRecord, HubUserRecord, MoveRequestInput, PluginSourcesResponse, RenameFolderInput, ReorderFoldersInput, ReorderRequestsInput, SavedRequestRecord, TeamHubClientConfig, SessionResponse, TeamHubAdminResourceOptions, UpdateCollectionInput, UpdateEnvironmentInput, UpdateHubUserInput, UpdateRequestInput, ReloadConfigResponse } from './types.js';
3
+ import type { ChatStepMessage, ChatStepResult, HubLlmModel } from './appTypes.js';
4
+ /**
5
+ * Default request timeout when {@link TeamHubClientConfig.requestTimeoutMs} is omitted.
6
+ */
7
+ export declare const DEFAULT_TEAM_HUB_REQUEST_TIMEOUT_MS = 30000;
8
+ /**
9
+ * Input for POST /llm/chat/step on Team Hub.
10
+ */
11
+ export interface HubChatStepRequest {
12
+ /**
13
+ * Provider-specific model id.
14
+ */
15
+ model: string;
16
+ /**
17
+ * Conversation messages excluding the injected system prompt.
18
+ */
19
+ messages: ChatStepMessage[];
20
+ /**
21
+ * OpenAI-compatible tool definitions forwarded to the provider.
22
+ */
23
+ tools?: Record<string, unknown>[];
24
+ /**
25
+ * System prompt injected ahead of the conversation messages.
26
+ */
27
+ systemPrompt?: string;
28
+ }
29
+ /**
30
+ * Executes typed HTTP requests against HarborClient Server.
31
+ */
32
+ export declare class TeamHubClient implements ITeamHubClient {
33
+ private readonly baseUrl;
34
+ private readonly token;
35
+ private readonly requestTimeoutMs;
36
+ /**
37
+ * Creates a client bound to a HarborClient Server instance and bearer token.
38
+ *
39
+ * @param config - Base URL, token, and optional request timeout.
40
+ */
41
+ constructor(config: TeamHubClientConfig);
42
+ /**
43
+ * Joins the configured base URL with a relative API path.
44
+ *
45
+ * @param path - Path beginning with `/`.
46
+ */
47
+ private buildUrl;
48
+ /**
49
+ * Parses a failed response body into a human-readable error message.
50
+ *
51
+ * @param response - Non-success fetch response.
52
+ * @param method - HTTP method used for the request.
53
+ * @param path - Request path relative to the base URL.
54
+ */
55
+ private parseErrorMessage;
56
+ /**
57
+ * Sends an HTTP request to HarborClient Server and validates the response.
58
+ *
59
+ * @param method - HTTP method.
60
+ * @param path - Path relative to the configured base URL.
61
+ * @param options - Optional body, response schema, and auth flag.
62
+ * @returns Parsed response body, or `undefined` for `204 No Content`.
63
+ * @throws {TeamHubClientError} When the request fails or the response is invalid.
64
+ */
65
+ private request;
66
+ /**
67
+ * Probes server availability via the public health endpoint.
68
+ */
69
+ checkHealth(): Promise<HealthResponse>;
70
+ /**
71
+ * Returns the authenticated user, token metadata, and derived API capabilities.
72
+ */
73
+ getSession(): Promise<SessionResponse>;
74
+ /**
75
+ * Lists all Team Hub user accounts visible to an admin-role token.
76
+ */
77
+ listAdminUsers(): Promise<HubUserRecord[]>;
78
+ /**
79
+ * Creates a Team Hub user account and an initial API bearer token.
80
+ *
81
+ * @param input - User fields for the new account.
82
+ */
83
+ createAdminUser(input: CreateHubUserInput): Promise<CreatedHubUser>;
84
+ /**
85
+ * Updates a Team Hub user account via the management API.
86
+ *
87
+ * @param id - User account identifier.
88
+ * @param input - Partial user fields to apply.
89
+ */
90
+ updateAdminUser(id: string, input: UpdateHubUserInput): Promise<HubUserRecord>;
91
+ /**
92
+ * Deletes a Team Hub user account and their API tokens via the management API.
93
+ *
94
+ * @param id - User account identifier.
95
+ */
96
+ deleteAdminUser(id: string): Promise<void>;
97
+ /**
98
+ * Lists all API bearer tokens visible to an admin-role token.
99
+ */
100
+ listAdminTokens(): Promise<HubApiTokenRecord[]>;
101
+ /**
102
+ * Creates an additional API bearer token for a user account.
103
+ *
104
+ * @param userId - Owning user account identifier.
105
+ * @param input - Human-readable label for the new token.
106
+ */
107
+ createAdminUserToken(userId: string, input: CreateHubTokenInput): Promise<CreatedHubToken>;
108
+ /**
109
+ * Permanently deletes an API bearer token via the management API.
110
+ *
111
+ * @param id - Token record identifier.
112
+ */
113
+ deleteAdminToken(id: string): Promise<void>;
114
+ /**
115
+ * Lists all collections as id/name metadata for admin user management.
116
+ */
117
+ listAdminCollections(): Promise<AdminResourceOption[]>;
118
+ /**
119
+ * Lists all environments as id/name metadata for admin user management.
120
+ */
121
+ listAdminEnvironments(): Promise<AdminResourceOption[]>;
122
+ /**
123
+ * Lists folders in a collection for operator inspection.
124
+ *
125
+ * @param collectionId - Parent collection UUID.
126
+ */
127
+ listAdminCollectionFolders(collectionId: string): Promise<FolderRecord[]>;
128
+ /**
129
+ * Lists saved requests in a collection for operator inspection.
130
+ *
131
+ * @param collectionId - Parent collection UUID.
132
+ */
133
+ listAdminCollectionRequests(collectionId: string): Promise<SavedRequestRecord[]>;
134
+ /**
135
+ * Deletes a collection via the admin management API.
136
+ *
137
+ * @param id - Collection UUID.
138
+ */
139
+ deleteAdminCollection(id: string): Promise<void>;
140
+ /**
141
+ * Deletes an environment via the admin management API.
142
+ *
143
+ * @param id - Environment UUID.
144
+ */
145
+ deleteAdminEnvironment(id: string): Promise<void>;
146
+ /**
147
+ * Deletes a saved request via the admin management API.
148
+ *
149
+ * @param id - Saved request UUID.
150
+ */
151
+ deleteAdminRequest(id: string): Promise<void>;
152
+ /**
153
+ * Updates whether non-admin users may delete a collection.
154
+ *
155
+ * @param id - Collection UUID.
156
+ * @param deletionLocked - When true, user-role tokens cannot delete the collection.
157
+ */
158
+ updateAdminCollectionDeletionLocked(id: string, deletionLocked: boolean): Promise<AdminEntityConfig>;
159
+ /**
160
+ * Updates whether non-admin users may delete an environment.
161
+ *
162
+ * @param id - Environment UUID.
163
+ * @param deletionLocked - When true, user-role tokens cannot delete the environment.
164
+ */
165
+ updateAdminEnvironmentDeletionLocked(id: string, deletionLocked: boolean): Promise<AdminEntityConfig>;
166
+ /**
167
+ * Lists all hub-offered LLM models for admin user management.
168
+ *
169
+ * Returns an empty list when LLM support is not configured on the hub.
170
+ */
171
+ listAdminLlmModels(): Promise<HubLlmModel[]>;
172
+ /**
173
+ * Returns whether the Team Hub server has LLM support configured.
174
+ *
175
+ * Uses the admin models route for management tokens and the user route otherwise.
176
+ * A 503 response means LLM is not configured; any other successful response means
177
+ * configured.
178
+ *
179
+ * @param managementApi - When true, probes `GET /admin/llm/models`.
180
+ */
181
+ probeLlmServiceEnabled(managementApi: boolean): Promise<boolean>;
182
+ /**
183
+ * Loads collection, environment, and LLM model options for admin user forms.
184
+ */
185
+ listAdminResourceOptions(): Promise<TeamHubAdminResourceOptions>;
186
+ /**
187
+ * Re-reads server.yaml on the Team Hub and applies reloadable config sections.
188
+ *
189
+ * Returns parsed bodies for both `200` and `400` responses. Only auth and
190
+ * transport failures throw {@link TeamHubClientError}.
191
+ */
192
+ reloadConfig(): Promise<ReloadConfigResponse>;
193
+ /**
194
+ * Lists all collections visible to the authenticated token.
195
+ *
196
+ * Admin tokens receive the full catalog from `GET /collections`; create, update,
197
+ * and delete remain forbidden on the server.
198
+ */
199
+ listCollections(): Promise<CollectionRecord[]>;
200
+ /**
201
+ * Creates a new top-level collection.
202
+ *
203
+ * @param input - Display name for the collection.
204
+ */
205
+ createCollection(input: CreateCollectionInput): Promise<CollectionRecord>;
206
+ /**
207
+ * Updates an existing collection's settings.
208
+ *
209
+ * @param id - Collection UUID.
210
+ * @param input - Updated collection fields.
211
+ */
212
+ updateCollection(id: string, input: UpdateCollectionInput): Promise<CollectionRecord>;
213
+ /**
214
+ * Deletes a collection and all nested folders and requests.
215
+ *
216
+ * @param id - Collection UUID.
217
+ */
218
+ deleteCollection(id: string): Promise<void>;
219
+ /**
220
+ * Lists all environments visible to the authenticated token.
221
+ *
222
+ * Admin tokens receive the full catalog from `GET /environments`; create, update,
223
+ * and delete remain forbidden on the server.
224
+ */
225
+ listEnvironments(): Promise<EnvironmentRecord[]>;
226
+ /**
227
+ * Creates a new top-level environment.
228
+ *
229
+ * @param input - Display name for the environment.
230
+ */
231
+ createEnvironment(input: CreateEnvironmentInput): Promise<EnvironmentRecord>;
232
+ /**
233
+ * Updates an existing environment's name and variables.
234
+ *
235
+ * @param id - Environment UUID.
236
+ * @param input - Updated environment fields.
237
+ */
238
+ updateEnvironment(id: string, input: UpdateEnvironmentInput): Promise<EnvironmentRecord>;
239
+ /**
240
+ * Deletes an environment by id.
241
+ *
242
+ * @param id - Environment UUID.
243
+ */
244
+ deleteEnvironment(id: string): Promise<void>;
245
+ /**
246
+ * Lists folders in a collection ordered by sort order, then name.
247
+ *
248
+ * @param collectionId - Parent collection UUID.
249
+ */
250
+ listFolders(collectionId: string): Promise<FolderRecord[]>;
251
+ /**
252
+ * Creates a folder in the given collection.
253
+ *
254
+ * @param collectionId - Parent collection UUID.
255
+ * @param input - Display name for the folder.
256
+ */
257
+ createFolder(collectionId: string, input: CreateFolderInput): Promise<FolderRecord>;
258
+ /**
259
+ * Renames a folder by id.
260
+ *
261
+ * @param id - Folder UUID.
262
+ * @param input - Updated folder name.
263
+ */
264
+ renameFolder(id: string, input: RenameFolderInput): Promise<FolderRecord>;
265
+ /**
266
+ * Deletes a folder and all saved requests inside it.
267
+ *
268
+ * @param id - Folder UUID.
269
+ */
270
+ deleteFolder(id: string): Promise<void>;
271
+ /**
272
+ * Reorders folders within a collection.
273
+ *
274
+ * @param collectionId - Parent collection UUID.
275
+ * @param input - Folder ids in the desired order.
276
+ */
277
+ reorderFolders(collectionId: string, input: ReorderFoldersInput): Promise<void>;
278
+ /**
279
+ * Lists saved requests in a collection.
280
+ *
281
+ * @param collectionId - Parent collection UUID.
282
+ */
283
+ listRequests(collectionId: string): Promise<SavedRequestRecord[]>;
284
+ /**
285
+ * Creates a new saved request in a collection.
286
+ *
287
+ * @param collectionId - Parent collection UUID.
288
+ * @param input - Saved request fields.
289
+ */
290
+ createRequest(collectionId: string, input: CreateRequestInput): Promise<SavedRequestRecord>;
291
+ /**
292
+ * Updates an existing saved request by id.
293
+ *
294
+ * @param id - Saved request UUID.
295
+ * @param input - Updated request fields including collection id.
296
+ */
297
+ updateRequest(id: string, input: UpdateRequestInput): Promise<SavedRequestRecord>;
298
+ /**
299
+ * Deletes a saved request by id.
300
+ *
301
+ * @param id - Saved request UUID.
302
+ */
303
+ deleteRequest(id: string): Promise<void>;
304
+ /**
305
+ * Reorders saved requests within a folder or the collection root.
306
+ *
307
+ * @param collectionId - Parent collection UUID.
308
+ * @param input - Destination folder and ordered request ids.
309
+ */
310
+ reorderRequests(collectionId: string, input: ReorderRequestsInput): Promise<void>;
311
+ /**
312
+ * Moves a saved request to another folder or root index.
313
+ *
314
+ * @param id - Saved request UUID.
315
+ * @param input - Destination folder and target index.
316
+ */
317
+ moveRequest(id: string, input: MoveRequestInput): Promise<void>;
318
+ /**
319
+ * Lists hub-offered LLM models visible to the authenticated token.
320
+ */
321
+ listLlmModels(): Promise<HubLlmModel[]>;
322
+ /**
323
+ * Returns plugin catalog and trusted-publisher URLs configured on this Team Hub.
324
+ */
325
+ getPluginSources(): Promise<PluginSourcesResponse>;
326
+ /**
327
+ * Runs one hub-proxied LLM completion step.
328
+ *
329
+ * @param input - Model, messages, tools, and system prompt for the step.
330
+ */
331
+ completeChatStep(input: HubChatStepRequest): Promise<ChatStepResult>;
332
+ }
333
+ //# sourceMappingURL=TeamHubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TeamHubClient.d.ts","sourceRoot":"","sources":["../src/TeamHubClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA2B1D,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,mCAAmC,QAAS,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAE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