@ai2aim.ai/hivemind-sdk 1.0.14 → 2.0.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/dist/client.d.ts CHANGED
@@ -1,25 +1,18 @@
1
- import type { AdminLoginParams, AdminLoginResponse, AdminAuditResponse, AgentCreateParams, AgentCreateResponse, AgentQueryParams, AgentQueryResponse, AudioSynthesizeParams, AudioSynthesizeResponse, AudioTranscribeParams, AuditLogResponse, CacheStatsResponse, ChangeOrgStatusResponse, CreateOrganizationOptions, ContentItemCreateParams, ContentItemListResponse, ContentItemResponse, ContentItemUpdateParams, ContentProject, ContentProjectListResponse, ConfigOverview, DataChatParams, DataChatResponse, DocumentGenerateResponse, DocumentGenerateSectionParams, DocumentProcessedWebhook, DocumentUploadResponse, FeatureFlag, FeatureFlagUpdate, ForecastParams, ForecastResponse, GenerateImageParams, GenerateMusicParams, GenerateVideoParams, HealthResponse, InboundTrafficStats, InvoiceResponse, JiraConnectRequest, JiraConnectResponse, JiraDisconnectResponse, JiraIntegrationStatusResponse, JiraSyncRequest, JiraSyncResponse, JiraWebhookAckResponse, BlueprintCreateParams, BlueprintUpdateParams, BlueprintResponse, BlueprintListResponse, DocumentCreateFromBlueprintParams, DocumentUpdateSectionParams, DocumentWorkflowActionParams, ManagedDocumentResponse, ManagedDocumentListResponse, JobAcceptedResponse, JobListResponse, JobStatusResponse, LogLevelRequest, LogLevelResponse, LoggerInfo, MaintenanceModeRequest, MaintenanceModeResponse, OrgBootstrapResponse, OrgCreateParams, OrgEnsureResponse, OrgListResponse, Organization, OutboundStatusResponse, PredictParams, PredictResponse, PricingResponse, ProjectChatHistoryResponse, ProjectChatParams, ProjectCreateParams, ProjectSourceCreateParams, ProjectSourceListResponse, ProjectSourceResponse, ProjectSourceScrapeParams, ProjectSourceUpdateParams, ProjectUpdateParams, QueryParams, QueryResponse, SearchParams, SearchResponse, RateLimitEntry, RootResponse, RotateApiKeyResponse, ScrapeParams, ScrapeResponse, ScrapeStatusResponse, ScrapingConfigResponse, ScheduleRunResultResponse, TierConfigResponse, TrainModelParams, TrainModelResponse, UpdateSettingRequest, UpdateSettingResponse, UsageSummaryResponse, WebhookAckResponse, PublishScheduleCreateParams, PublishScheduleListResponse, PublishScheduleResponse, PublishScheduleUpdateParams, HivemindClientConfigInput, RequestOptions, VideoCompleteWebhook } from "./types";
1
+ import type { AdminAuditResponse, AdminLoginParams, AdminLoginResponse, AgentCreateParams, AgentCreateResponse, AgentQueryParams, AgentQueryResponse, ApiKeyBootstrapResponse, ApiKeyIssueParams, ApiKeyRotateResponse, ApiKeyScope, AudioSynthesizeParams, AudioSynthesizeResponse, AudioTranscribeParams, AudioTranscriptionResponse, AuditLogResponse, BlueprintCreateParams, BlueprintListResponse, BlueprintResponse, BlueprintUpdateParams, CacheStatsResponse, ChatStreamEvent, ConfigOverview, ContentItemCreateParams, ContentItemListResponse, ContentItemResponse, ContentItemUpdateParams, ContentProject, ContentProjectListResponse, DataChatParams, DataChatResponse, DocumentCreateFromBlueprintParams, DocumentGenerateResponse, DocumentGenerateSectionParams, DocumentProcessedWebhook, DocumentUpdateSectionParams, DocumentUploadResponse, DocumentWorkflowActionParams, FeatureFlag, FeatureFlagUpdate, ForecastParams, ForecastResponse, GenerateImageParams, GenerateMusicParams, GenerateVideoParams, HealthResponse, HivemindClientConfigInput, InboundTrafficStats, JiraConnectRequest, JiraConnectResponse, JiraDisconnectResponse, JiraIntegrationStatusResponse, JiraSyncRequest, JiraSyncResponse, JiraWebhookAckResponse, JobAcceptedResponse, JobListResponse, JobStatusResponse, LogLevelRequest, LogLevelResponse, LoggerInfo, MaintenanceModeRequest, MaintenanceModeResponse, ManagedDocumentListResponse, ManagedDocumentResponse, OutboundStatusResponse, PredictParams, PredictResponse, ProjectChatHistoryResponse, ProjectChatParams, ProjectCreateParams, ProjectSourceCreateParams, ProjectSourceListResponse, ProjectSourceResponse, ProjectSourceScrapeParams, ProjectSourceUpdateParams, ProjectUpdateParams, PublishScheduleCreateParams, PublishScheduleListResponse, PublishScheduleResponse, PublishScheduleUpdateParams, QueryParams, QueryResponse, RateLimitEntry, RequestOptions, RootResponse, ScheduleRunResultResponse, ScrapeParams, ScrapeResponse, ScrapeStatusResponse, ScrapingConfigResponse, SearchParams, SearchResponse, TrainModelParams, TrainModelResponse, UpdateSettingRequest, UpdateSettingResponse, VideoCompleteWebhook, WebhookAckResponse, WsChatCommand } from "./types";
2
2
  export * from "./types";
3
- /**
4
- * Error thrown when an API request fails.
5
- * Contains the HTTP status code and the raw response body for inspection.
6
- *
7
- * @example
8
- * ```typescript
9
- * try {
10
- * await client.query("my-org", { query: "hello" });
11
- * } catch (err) {
12
- * if (err instanceof HivemindError) {
13
- * console.error(`HTTP ${err.statusCode}:`, err.detail);
14
- * }
15
- * }
16
- * ```
17
- */
18
3
  export declare class HivemindError extends Error {
19
4
  statusCode: number;
20
5
  detail: unknown;
21
6
  constructor(statusCode: number, detail: unknown, message?: string);
22
7
  }
8
+ type QueryMap = Record<string, string | number | boolean | undefined | null>;
9
+ type RequestConfig = {
10
+ body?: unknown;
11
+ headers?: Record<string, string>;
12
+ query?: QueryMap;
13
+ formData?: FormData;
14
+ apiKey?: string;
15
+ };
23
16
  export declare class HivemindClient {
24
17
  private readonly baseUrl;
25
18
  private readonly prefix;
@@ -28,1163 +21,143 @@ export declare class HivemindClient {
28
21
  private request;
29
22
  private requestUnprefixed;
30
23
  private performRequest;
31
- private unwrapResponseData;
24
+ requestEnvelope<T>(method: string, path: string, opts?: Omit<RequestConfig, "formData">): Promise<import("./types").ApiEnvelope<T>>;
25
+ private asEnvelope;
32
26
  private extractErrorMessage;
33
- private isOrganizationAlreadyExistsError;
34
27
  private get;
35
28
  private post;
36
- private del;
37
29
  private put;
38
30
  private patch;
39
- /**
40
- * Fetch the unauthenticated service root metadata payload.
41
- *
42
- * @returns Service name plus relative health/docs entrypoints.
43
- *
44
- * **Endpoint:** `GET /`
45
- */
31
+ private del;
46
32
  root(): Promise<RootResponse>;
47
- /**
48
- * Check service health status. No authentication required.
49
- *
50
- * @returns Service name, version, status, and aggregate statistics.
51
- *
52
- * **Endpoint:** `GET /v1/health`
53
- *
54
- * @example
55
- * ```typescript
56
- * const health = await client.health();
57
- * console.log(health.status); // "ok"
58
- * console.log(health.stats); // { organizations: 12, documents: 450, total_chunks: 3200 }
59
- * ```
60
- */
61
33
  health(): Promise<HealthResponse>;
62
- /**
63
- * Exchange the bootstrap admin key for a signed session token.
64
- * The token can be used as `Authorization: Bearer <token>` for admin endpoints
65
- * instead of sending the raw admin key on every request.
66
- *
67
- * @param params - Object containing the `admin_key`.
68
- * @returns Signed session token with type and expiry.
69
- * @throws {@link HivemindError} 400 if admin key is not configured on the server.
70
- * @throws {@link HivemindError} 401 if the admin key is invalid.
71
- *
72
- * **Endpoint:** `POST /v1/admin/login`
73
- *
74
- * @example
75
- * ```typescript
76
- * const { access_token, expires_in_seconds } = await client.adminLogin({
77
- * admin_key: "your-bootstrap-admin-key",
78
- * });
79
- * // Use access_token as Bearer token for subsequent admin requests
80
- * ```
81
- */
82
34
  adminLogin(params: AdminLoginParams): Promise<AdminLoginResponse>;
83
- /**
84
- * Create a new organization. Returns the organization details and a generated API key.
85
- *
86
- * **Auth:** Requires `adminKey` in client config (sends `X-Admin-Key` header).
87
- *
88
- * @param params - Organization creation parameters (org_id, name, tier, settings).
89
- * @param options - Optional behavior flags. By default, duplicate-organization
90
- * responses are treated as a successful lookup instead of throwing. Pass
91
- * `{ allowExisting: false }` for strict create-only behavior.
92
- * @returns The created organization and its API key, or the existing organization
93
- * when the org has already been provisioned.
94
- * @throws {@link HivemindError} 400 if validation fails, or if the org already exists
95
- * and you passed `{ allowExisting: false }`.
96
- * @throws {@link HivemindError} 401 if admin credentials are invalid.
97
- *
98
- * **Endpoint:** `POST /v1/organizations`
99
- *
100
- * @example
101
- * ```typescript
102
- * const { organization, api_key } = await admin.createOrganization({
103
- * org_id: "acme-corp",
104
- * name: "Acme Corporation",
105
- * tier: "premium",
106
- * });
107
- * console.log("API Key:", api_key); // Store securely — shown only once
108
- * ```
109
- */
110
- createOrganization(params: OrgCreateParams): Promise<OrgEnsureResponse>;
111
- createOrganization(params: OrgCreateParams, options: CreateOrganizationOptions & {
112
- allowExisting: false;
113
- }): Promise<OrgBootstrapResponse>;
114
- createOrganization(params: OrgCreateParams, options: CreateOrganizationOptions & {
115
- allowExisting: true;
116
- }): Promise<OrgEnsureResponse>;
117
- /**
118
- * Ensure an organization exists without throwing when it has already been provisioned.
119
- *
120
- * **Auth:** Requires `adminKey` in client config.
121
- *
122
- * @param params - Organization creation parameters.
123
- * @returns A discriminated result describing whether the org was created or already existed.
124
- */
125
- ensureOrganization(params: OrgCreateParams): Promise<OrgEnsureResponse>;
126
- /**
127
- * Retrieve organization details including tier, status, and settings.
128
- *
129
- * **Auth:** Requires org-scoped API key (via config or `options.apiKey`).
130
- *
131
- * @param orgId - Organization identifier.
132
- * @param options - Optional per-request overrides (e.g. `{ apiKey }`).
133
- * @returns Full organization entity.
134
- * @throws {@link HivemindError} 401 if API key is missing or invalid.
135
- * @throws {@link HivemindError} 403 if the API key belongs to a different org.
136
- * @throws {@link HivemindError} 404 if the organization does not exist.
137
- *
138
- * **Endpoint:** `GET /v1/organizations/{orgId}`
139
- */
140
- getOrganization(orgId: string, options?: RequestOptions): Promise<Organization>;
141
- /**
142
- * Rotate the API key for an organization. The previous key remains valid
143
- * for a 24-hour grace period.
144
- *
145
- * **Auth:** Requires `adminKey` in client config.
146
- *
147
- * @param orgId - Organization identifier.
148
- * @param options - Optional per-request overrides.
149
- * @returns New API key and grace period expiry for the previous key.
150
- * @throws {@link HivemindError} 401 if admin credentials are invalid.
151
- * @throws {@link HivemindError} 404 if the organization does not exist.
152
- *
153
- * **Endpoint:** `POST /v1/organizations/{orgId}/api-keys/rotate`
154
- */
155
- rotateApiKey(orgId: string, options?: RequestOptions): Promise<RotateApiKeyResponse>;
156
- /**
157
- * Suspend an organization, blocking all API key access until reactivated.
158
- *
159
- * **Auth:** Requires `adminKey` in client config.
160
- *
161
- * @param orgId - Organization identifier.
162
- * @param options - Optional per-request overrides.
163
- * @returns Updated organization status.
164
- * @throws {@link HivemindError} 401 if admin credentials are invalid.
165
- * @throws {@link HivemindError} 404 if the organization does not exist.
166
- *
167
- * **Endpoint:** `POST /v1/organizations/{orgId}/suspend`
168
- */
169
- suspendOrganization(orgId: string, options?: RequestOptions): Promise<ChangeOrgStatusResponse>;
170
- /**
171
- * Reactivate a suspended organization, restoring API key access.
172
- *
173
- * **Auth:** Requires `adminKey` in client config.
174
- *
175
- * @param orgId - Organization identifier.
176
- * @param options - Optional per-request overrides.
177
- * @returns Updated organization status.
178
- * @throws {@link HivemindError} 401 if admin credentials are invalid.
179
- * @throws {@link HivemindError} 404 if the organization does not exist.
180
- *
181
- * **Endpoint:** `POST /v1/organizations/{orgId}/reactivate`
182
- */
183
- reactivateOrganization(orgId: string, options?: RequestOptions): Promise<ChangeOrgStatusResponse>;
184
- /**
185
- * Permanently delete an organization and all associated data.
186
- * This action is irreversible.
187
- *
188
- * **Auth:** Requires `adminKey` in client config.
189
- *
190
- * @param orgId - Organization identifier.
191
- * @param options - Optional per-request overrides.
192
- * @throws {@link HivemindError} 401 if admin credentials are invalid.
193
- * @throws {@link HivemindError} 404 if the organization does not exist.
194
- *
195
- * **Endpoint:** `DELETE /v1/organizations/{orgId}`
196
- */
197
- deleteOrganization(orgId: string, options?: RequestOptions): Promise<void>;
198
- /**
199
- * Upload and ingest a document file (PDF, TXT, DOCX, etc.).
200
- * The document is stored in GCS, split into chunks, and embedded for RAG retrieval.
201
- *
202
- * **Auth:** Requires org-scoped API key.
203
- *
204
- * @param orgId - Organization identifier.
205
- * @param file - Document content as a `Blob` or `Buffer`.
206
- * @param filename - Original filename (e.g. `"report.pdf"`).
207
- * @param options - Optional per-request overrides (e.g. `{ apiKey }`).
208
- * @returns Upload result with document ID, chunk count, and status.
209
- * @throws {@link HivemindError} 400 if the file exceeds the maximum upload size (default 25 MB).
210
- * @throws {@link HivemindError} 401 if API key is missing or invalid.
211
- * @throws {@link HivemindError} 429 if rate limit is exceeded.
212
- *
213
- * **Endpoint:** `POST /v1/organizations/{orgId}/documents/upload`
214
- * **Content-Type:** `multipart/form-data`
215
- *
216
- * @example
217
- * ```typescript
218
- * import { readFileSync } from "fs";
219
- * const file = readFileSync("./report.pdf");
220
- * const result = await client.uploadDocument("acme-corp", file, "report.pdf");
221
- * console.log(`Uploaded: ${result.document_id}, ${result.chunks} chunks`);
222
- * ```
223
- */
224
- uploadDocument(orgId: string, file: Blob | Buffer, filename: string, options?: RequestOptions): Promise<DocumentUploadResponse>;
225
- /**
226
- * Query the organization's document knowledge base using RAG
227
- * (Retrieval-Augmented Generation). Retrieves relevant document chunks,
228
- * then generates a response with citations.
229
- *
230
- * **Auth:** Requires org-scoped API key.
231
- *
232
- * @param orgId - Organization identifier.
233
- * @param params - Query parameters (query text, model, temperature, strategy).
234
- * @param options - Optional per-request overrides (e.g. `{ apiKey }`).
235
- * @returns Generated answer with source citations, confidence, and processing time.
236
- * @throws {@link HivemindError} 401 if API key is missing or invalid.
237
- * @throws {@link HivemindError} 403 if cross-organization access is attempted.
238
- * @throws {@link HivemindError} 429 if rate limit or token quota is exceeded.
239
- *
240
- * **Endpoint:** `POST /v1/organizations/{orgId}/query`
241
- *
242
- * @example
243
- * ```typescript
244
- * const result = await client.query("acme-corp", {
245
- * query: "What are the key findings in Q4?",
246
- * temperature: 0.2,
247
- * retrieval_strategy: "hybrid",
248
- * });
249
- * console.log(result.answer);
250
- * console.log(result.sources); // citations with doc_id, chunk_id, score, snippet
251
- * ```
252
- */
253
- query(orgId: string, params: QueryParams, options?: RequestOptions): Promise<QueryResponse>;
254
- /**
255
- * Search indexed sources for source discovery.
256
- *
257
- * **Auth:** Requires org-scoped API key.
258
- *
259
- * **Endpoint:** `POST /v1/organizations/{orgId}/search`
260
- */
261
- search(orgId: string, params: SearchParams, options?: RequestOptions): Promise<SearchResponse>;
262
- createProject(orgId: string, params: ProjectCreateParams, options?: RequestOptions): Promise<ContentProject>;
263
- listProjects(orgId: string, options?: RequestOptions): Promise<ContentProjectListResponse>;
264
- getProject(orgId: string, projectId: string, options?: RequestOptions): Promise<ContentProject>;
265
- updateProject(orgId: string, projectId: string, params: ProjectUpdateParams, options?: RequestOptions): Promise<ContentProject>;
266
- deleteProject(orgId: string, projectId: string, options?: RequestOptions): Promise<void>;
267
- chatProject(orgId: string, projectId: string, params: ProjectChatParams, options?: RequestOptions): Promise<QueryResponse>;
268
- getProjectChatHistory(orgId: string, projectId: string, userId: string, options?: RequestOptions): Promise<ProjectChatHistoryResponse>;
269
- createContentItem(orgId: string, projectId: string, params: ContentItemCreateParams, options?: RequestOptions): Promise<ContentItemResponse>;
270
- listContentItems(orgId: string, projectId: string, options?: RequestOptions): Promise<ContentItemListResponse>;
271
- getContentItem(orgId: string, projectId: string, contentId: string, options?: RequestOptions): Promise<ContentItemResponse>;
272
- updateContentItem(orgId: string, projectId: string, contentId: string, params: ContentItemUpdateParams, options?: RequestOptions): Promise<ContentItemResponse>;
273
- deleteContentItem(orgId: string, projectId: string, contentId: string, options?: RequestOptions): Promise<void>;
274
- createProjectSource(orgId: string, projectId: string, params: ProjectSourceCreateParams, options?: RequestOptions): Promise<ProjectSourceResponse>;
275
- /**
276
- * Scrape external URLs and save the normalized results as project sources.
277
- *
278
- * **Auth:** Requires org-scoped API key.
279
- *
280
- * **Endpoint:** `POST /v1/organizations/{orgId}/projects/{projectId}/sources/scrape`
281
- */
282
- scrapeProjectSources(orgId: string, projectId: string, params: ProjectSourceScrapeParams, options?: RequestOptions): Promise<ProjectSourceListResponse>;
283
- listProjectSources(orgId: string, projectId: string, options?: RequestOptions): Promise<ProjectSourceListResponse>;
284
- getProjectSource(orgId: string, projectId: string, sourceId: string, options?: RequestOptions): Promise<ProjectSourceResponse>;
285
- updateProjectSource(orgId: string, projectId: string, sourceId: string, params: ProjectSourceUpdateParams, options?: RequestOptions): Promise<ProjectSourceResponse>;
286
- deleteProjectSource(orgId: string, projectId: string, sourceId: string, options?: RequestOptions): Promise<void>;
287
- /**
288
- * Create a publish schedule for an existing content item.
289
- *
290
- * **Auth:** Requires org-scoped API key.
291
- *
292
- * **Endpoint:** `POST /v1/organizations/{orgId}/projects/{projectId}/schedules`
293
- */
294
- createPublishSchedule(orgId: string, projectId: string, params: PublishScheduleCreateParams, options?: RequestOptions): Promise<PublishScheduleResponse>;
295
- /**
296
- * List publish schedules for a project.
297
- *
298
- * **Auth:** Requires org-scoped API key.
299
- *
300
- * **Endpoint:** `GET /v1/organizations/{orgId}/projects/{projectId}/schedules`
301
- */
302
- listPublishSchedules(orgId: string, projectId: string, options?: RequestOptions): Promise<PublishScheduleListResponse>;
303
- /**
304
- * Get a single publish schedule.
305
- *
306
- * **Auth:** Requires org-scoped API key.
307
- *
308
- * **Endpoint:** `GET /v1/organizations/{orgId}/projects/{projectId}/schedules/{scheduleId}`
309
- */
310
- getPublishSchedule(orgId: string, projectId: string, scheduleId: string, options?: RequestOptions): Promise<PublishScheduleResponse>;
311
- /**
312
- * Update a publish schedule.
313
- *
314
- * **Auth:** Requires org-scoped API key.
315
- *
316
- * **Endpoint:** `PATCH /v1/organizations/{orgId}/projects/{projectId}/schedules/{scheduleId}`
317
- */
318
- updatePublishSchedule(orgId: string, projectId: string, scheduleId: string, params: PublishScheduleUpdateParams, options?: RequestOptions): Promise<PublishScheduleResponse>;
319
- /**
320
- * Delete a publish schedule.
321
- *
322
- * **Auth:** Requires org-scoped API key.
323
- *
324
- * **Endpoint:** `DELETE /v1/organizations/{orgId}/projects/{projectId}/schedules/{scheduleId}`
325
- */
326
- deletePublishSchedule(orgId: string, projectId: string, scheduleId: string, options?: RequestOptions): Promise<void>;
327
- /**
328
- * Manually run due Content Creator schedules immediately.
329
- *
330
- * This is primarily an admin fallback or operational tool. In normal
331
- * deployments, due schedules are processed automatically by the backend's
332
- * background content schedule runner.
333
- *
334
- * **Auth:** Requires admin key.
335
- *
336
- * **Endpoint:** `POST /v1/admin/content-creator/schedules/run-due`
337
- */
35
+ issueApiKey(params?: ApiKeyIssueParams): Promise<ApiKeyBootstrapResponse>;
36
+ getCurrentScope(options?: RequestOptions): Promise<ApiKeyScope>;
37
+ rotateApiKey(options?: RequestOptions): Promise<ApiKeyRotateResponse>;
38
+ uploadDocument(file: Blob | Buffer, filename: string, options?: RequestOptions): Promise<DocumentUploadResponse>;
39
+ query(params: QueryParams, options?: RequestOptions): Promise<QueryResponse>;
40
+ search(params: SearchParams, options?: RequestOptions): Promise<SearchResponse>;
41
+ createProject(params: ProjectCreateParams, options?: RequestOptions): Promise<ContentProject>;
42
+ listProjects(options?: RequestOptions): Promise<ContentProjectListResponse>;
43
+ getProject(projectId: string, options?: RequestOptions): Promise<ContentProject>;
44
+ updateProject(projectId: string, params: ProjectUpdateParams, options?: RequestOptions): Promise<ContentProject>;
45
+ deleteProject(projectId: string, options?: RequestOptions): Promise<void>;
46
+ chatProject(projectId: string, params: ProjectChatParams, options?: RequestOptions): Promise<QueryResponse>;
47
+ getProjectChatHistory(projectId: string, userId: string, options?: RequestOptions): Promise<ProjectChatHistoryResponse>;
48
+ createContentItem(projectId: string, params: ContentItemCreateParams, options?: RequestOptions): Promise<ContentItemResponse>;
49
+ listContentItems(projectId: string, options?: RequestOptions): Promise<ContentItemListResponse>;
50
+ getContentItem(projectId: string, contentId: string, options?: RequestOptions): Promise<ContentItemResponse>;
51
+ updateContentItem(projectId: string, contentId: string, params: ContentItemUpdateParams, options?: RequestOptions): Promise<ContentItemResponse>;
52
+ deleteContentItem(projectId: string, contentId: string, options?: RequestOptions): Promise<void>;
53
+ createProjectSource(projectId: string, params: ProjectSourceCreateParams, options?: RequestOptions): Promise<ProjectSourceResponse>;
54
+ scrapeProjectSources(projectId: string, params: ProjectSourceScrapeParams, options?: RequestOptions): Promise<ProjectSourceListResponse>;
55
+ listProjectSources(projectId: string, options?: RequestOptions): Promise<ProjectSourceListResponse>;
56
+ getProjectSource(projectId: string, sourceId: string, options?: RequestOptions): Promise<ProjectSourceResponse>;
57
+ updateProjectSource(projectId: string, sourceId: string, params: ProjectSourceUpdateParams, options?: RequestOptions): Promise<ProjectSourceResponse>;
58
+ deleteProjectSource(projectId: string, sourceId: string, options?: RequestOptions): Promise<void>;
59
+ createPublishSchedule(projectId: string, params: PublishScheduleCreateParams, options?: RequestOptions): Promise<PublishScheduleResponse>;
60
+ listPublishSchedules(projectId: string, options?: RequestOptions): Promise<PublishScheduleListResponse>;
61
+ getPublishSchedule(projectId: string, scheduleId: string, options?: RequestOptions): Promise<PublishScheduleResponse>;
62
+ updatePublishSchedule(projectId: string, scheduleId: string, params: PublishScheduleUpdateParams, options?: RequestOptions): Promise<PublishScheduleResponse>;
63
+ deletePublishSchedule(projectId: string, scheduleId: string, options?: RequestOptions): Promise<void>;
338
64
  runDueSchedules(): Promise<ScheduleRunResultResponse>;
339
- /**
340
- * Start an asynchronous video generation job using Vertex AI Veo.
341
- * Returns a job ID — poll with `getJob()` or `waitForJob()` for results.
342
- *
343
- * **Auth:** Requires org-scoped API key.
344
- *
345
- * @param orgId - Organization identifier.
346
- * @param params - Video generation parameters (prompt, duration, aspect_ratio, style).
347
- * @param options - Optional per-request overrides.
348
- * @returns Job ID and estimated processing time (HTTP 202).
349
- * @throws {@link HivemindError} 429 if rate limit, video quota, or concurrent job limit is exceeded.
350
- *
351
- * **Endpoint:** `POST /v1/organizations/{orgId}/generate/video`
352
- *
353
- * @example
354
- * ```typescript
355
- * const job = await client.generateVideo("acme-corp", {
356
- * prompt: "A drone flyover of a mountain lake at sunset",
357
- * duration: 8,
358
- * aspect_ratio: "16:9",
359
- * style: "cinematic",
360
- * });
361
- * const result = await client.waitForJob("acme-corp", job.job_id);
362
- * console.log(result.result); // { output_url, signed_url }
363
- * ```
364
- */
365
- generateVideo(orgId: string, params: GenerateVideoParams, options?: RequestOptions): Promise<JobAcceptedResponse>;
366
- /**
367
- * Start an asynchronous image generation job using Vertex AI Imagen.
368
- * Returns a job ID — poll with `getJob()` or `waitForJob()` for results.
369
- *
370
- * **Auth:** Requires org-scoped API key.
371
- *
372
- * @param orgId - Organization identifier.
373
- * @param params - Image generation parameters (prompt, aspect_ratio, style, num_images).
374
- * @param options - Optional per-request overrides.
375
- * @returns Job ID and estimated processing time (HTTP 202).
376
- * @throws {@link HivemindError} 429 if rate limit, image quota, or concurrent job limit is exceeded.
377
- *
378
- * **Endpoint:** `POST /v1/organizations/{orgId}/generate/image`
379
- *
380
- * @example
381
- * ```typescript
382
- * const job = await client.generateImage("acme-corp", {
383
- * prompt: "A futuristic city skyline at dusk",
384
- * aspect_ratio: "16:9",
385
- * style: "digital art",
386
- * num_images: 4,
387
- * });
388
- * const result = await client.waitForJob("acme-corp", job.job_id);
389
- * ```
390
- */
391
- generateImage(orgId: string, params: GenerateImageParams, options?: RequestOptions): Promise<JobAcceptedResponse>;
392
- /**
393
- * Start an asynchronous music generation job.
394
- * Returns a job ID — poll with `getJob()` or `waitForJob()` for results.
395
- *
396
- * **Auth:** Requires org-scoped API key.
397
- *
398
- * **Endpoint:** `POST /v1/organizations/{orgId}/generate/music`
399
- */
400
- generateMusic(orgId: string, params: GenerateMusicParams, options?: RequestOptions): Promise<JobAcceptedResponse>;
401
- /**
402
- * Check the status of an asynchronous job (video or image generation).
403
- *
404
- * **Auth:** Requires org-scoped API key.
405
- *
406
- * @param orgId - Organization identifier.
407
- * @param jobId - Job identifier (from `generateVideo()` or `generateImage()`).
408
- * @param options - Optional per-request overrides.
409
- * @returns Job status, result URLs (when completed), or error details (when failed).
410
- * @throws {@link HivemindError} 404 if the job does not exist.
411
- *
412
- * **Endpoint:** `GET /v1/organizations/{orgId}/jobs/{jobId}`
413
- */
414
- getJob(orgId: string, jobId: string, options?: RequestOptions): Promise<JobStatusResponse>;
415
- /**
416
- * Poll a job until it reaches a terminal status (`completed`, `failed`, or `cancelled`).
417
- *
418
- * @param orgId - Organization identifier.
419
- * @param jobId - Job identifier.
420
- * @param intervalMs - Polling interval in milliseconds. @default 2000
421
- * @param maxWaitMs - Maximum wait time in milliseconds. @default 300000 (5 min)
422
- * @param options - Optional per-request overrides.
423
- * @returns Final job status with result or error.
424
- * @throws Error if the job does not complete within `maxWaitMs`.
425
- *
426
- * @example
427
- * ```typescript
428
- * const job = await client.generateVideo("acme-corp", { prompt: "..." });
429
- * const result = await client.waitForJob("acme-corp", job.job_id, 3000, 600_000);
430
- * if (result.status === "completed") console.log(result.result);
431
- * ```
432
- */
433
- waitForJob(orgId: string, jobId: string, intervalMs?: number, maxWaitMs?: number, options?: RequestOptions): Promise<JobStatusResponse>;
434
- /**
435
- * Ask a natural-language question over BigQuery datasets.
436
- * Gemini generates SQL from the question, executes it, and returns formatted results.
437
- *
438
- * **Auth:** Requires org-scoped API key.
439
- *
440
- * @param orgId - Organization identifier.
441
- * @param params - Question and optional user ID.
442
- * @param options - Optional per-request overrides.
443
- * @returns Generated SQL, natural-language answer, and result rows.
444
- * @throws {@link HivemindError} 429 if rate limit or token quota is exceeded.
445
- *
446
- * **Endpoint:** `POST /v1/organizations/{orgId}/data-chat`
447
- *
448
- * @example
449
- * ```typescript
450
- * const result = await client.dataChat("acme-corp", {
451
- * question: "How many active users this month?",
452
- * });
453
- * console.log(result.answer); // "There are 1,247 active users this month."
454
- * console.log(result.sql); // Generated SQL
455
- * console.log(result.rows); // [{ active_users: 1247 }]
456
- * ```
457
- */
458
- dataChat(orgId: string, params: DataChatParams, options?: RequestOptions): Promise<DataChatResponse>;
459
- /**
460
- * Create a custom AI agent template with system instructions and optional tool bindings.
461
- *
462
- * **Auth:** Requires org-scoped API key.
463
- *
464
- * @param orgId - Organization identifier.
465
- * @param params - Agent name, instructions, and optional tools.
466
- * @param options - Optional per-request overrides.
467
- * @returns Created agent with ID, name, and enabled tools.
468
- *
469
- * **Endpoint:** `POST /v1/organizations/{orgId}/agents/custom`
470
- *
471
- * @example
472
- * ```typescript
473
- * const agent = await client.createAgent("acme-corp", {
474
- * name: "Support Bot",
475
- * instructions: "You are a helpful customer support agent.",
476
- * tools: ["rag_search", "ticket_create"],
477
- * });
478
- * console.log(agent.agent_id);
479
- * ```
480
- */
481
- createAgent(orgId: string, params: AgentCreateParams, options?: RequestOptions): Promise<AgentCreateResponse>;
482
- /**
483
- * Send a query to an AI agent. Routes to the specified agent type or auto-selects.
484
- *
485
- * **Auth:** Requires org-scoped API key.
486
- *
487
- * @param orgId - Organization identifier.
488
- * @param params - Query text, user ID, and optional agent type.
489
- * @param options - Optional per-request overrides.
490
- * @returns Agent response text, agent type, and any tool calls made.
491
- * @throws {@link HivemindError} 429 if rate limit or token quota is exceeded.
492
- *
493
- * **Endpoint:** `POST /v1/organizations/{orgId}/agents/query`
494
- */
495
- queryAgent(orgId: string, params: AgentQueryParams, options?: RequestOptions): Promise<AgentQueryResponse>;
496
- /**
497
- * Transcribe audio content to text (speech-to-text).
498
- *
499
- * **Auth:** Requires org-scoped API key.
500
- *
501
- * @param orgId - Organization identifier.
502
- * @param params - Audio content and optional BCP-47 language code.
503
- * @param options - Optional per-request overrides.
504
- * @returns Transcription result with transcript text, confidence, and language.
505
- * @throws {@link HivemindError} 429 if rate limit is exceeded.
506
- *
507
- * **Endpoint:** `POST /v1/organizations/{orgId}/audio/transcribe`
508
- */
509
- transcribeAudio(orgId: string, params: AudioTranscribeParams, options?: RequestOptions): Promise<Record<string, unknown>>;
510
- /**
511
- * Convert text to speech (text-to-speech synthesis).
512
- * Returns a signed URL to the generated audio file.
513
- *
514
- * **Auth:** Requires org-scoped API key.
515
- *
516
- * @param orgId - Organization identifier.
517
- * @param params - Text to synthesize and optional voice name.
518
- * @param options - Optional per-request overrides.
519
- * @returns Audio URL, duration, and voice used.
520
- * @throws {@link HivemindError} 429 if rate limit is exceeded.
521
- *
522
- * **Endpoint:** `POST /v1/organizations/{orgId}/audio/synthesize`
523
- */
524
- synthesizeAudio(orgId: string, params: AudioSynthesizeParams, options?: RequestOptions): Promise<AudioSynthesizeResponse>;
525
- /**
526
- * Train a predictive model on tabular data.
527
- *
528
- * **Auth:** Requires org-scoped API key.
529
- *
530
- * @param orgId - Organization identifier.
531
- * @param params - Target column, feature columns, and training data rows.
532
- * @param options - Optional per-request overrides.
533
- * @returns Deployed model ID and status.
534
- *
535
- * **Endpoint:** `POST /v1/organizations/{orgId}/analytics/train`
536
- *
537
- * @example
538
- * ```typescript
539
- * const model = await client.trainModel("acme-corp", {
540
- * target_column: "churn",
541
- * feature_columns: ["tenure", "monthly_charges", "total_charges"],
542
- * rows: [
543
- * { tenure: 12, monthly_charges: 50, total_charges: 600, churn: 0 },
544
- * { tenure: 2, monthly_charges: 80, total_charges: 160, churn: 1 },
545
- * ],
546
- * });
547
- * console.log(model.model_id); // Use with predict()
548
- * ```
549
- */
550
- trainModel(orgId: string, params: TrainModelParams, options?: RequestOptions): Promise<TrainModelResponse>;
551
- /**
552
- * Run predictions using a previously trained model.
553
- *
554
- * **Auth:** Requires org-scoped API key.
555
- *
556
- * @param orgId - Organization identifier.
557
- * @param params - Model ID and data instances to predict on.
558
- * @param options - Optional per-request overrides.
559
- * @returns Predictions for each input instance.
560
- * @throws {@link HivemindError} 404 if the model does not exist.
561
- *
562
- * **Endpoint:** `POST /v1/organizations/{orgId}/analytics/predict`
563
- */
564
- predict(orgId: string, params: PredictParams, options?: RequestOptions): Promise<PredictResponse>;
565
- /**
566
- * Generate a time-series forecast from historical data using ARIMA-based modeling.
567
- *
568
- * **Auth:** Requires org-scoped API key.
569
- *
570
- * @param orgId - Organization identifier.
571
- * @param params - Historical series values and optional forecast horizon (1–365).
572
- * @param options - Optional per-request overrides.
573
- * @returns Predicted future values.
574
- *
575
- * **Endpoint:** `POST /v1/organizations/{orgId}/analytics/forecast`
576
- */
577
- forecast(orgId: string, params: ForecastParams, options?: RequestOptions): Promise<ForecastResponse>;
578
- /**
579
- * Get the monthly usage summary for an organization.
580
- * Includes token, image, video, storage, and compute usage against tier limits.
581
- *
582
- * **Auth:** Requires org-scoped API key.
583
- *
584
- * @param orgId - Organization identifier.
585
- * @param month - Month in `YYYY-MM` format. Defaults to current month.
586
- * @param options - Optional per-request overrides.
587
- * @returns Usage counters, tier limits, and quota status.
588
- *
589
- * **Endpoint:** `GET /v1/organizations/{orgId}/usage?month={month}`
590
- */
591
- getUsage(orgId: string, month?: string, options?: RequestOptions): Promise<UsageSummaryResponse>;
592
- /**
593
- * Get the monthly invoice with detailed cost breakdown by resource type.
594
- *
595
- * **Auth:** Requires org-scoped API key.
596
- *
597
- * @param orgId - Organization identifier.
598
- * @param month - Month in `YYYY-MM` format. Defaults to current month.
599
- * @param options - Optional per-request overrides.
600
- * @returns Invoice with itemized costs and total in USD.
601
- *
602
- * **Endpoint:** `GET /v1/organizations/{orgId}/invoice?month={month}`
603
- */
604
- getInvoice(orgId: string, month?: string, options?: RequestOptions): Promise<InvoiceResponse>;
605
- /**
606
- * Retrieve audit log records for an organization.
607
- *
608
- * **Auth:** Requires org-scoped API key.
609
- *
610
- * @param orgId - Organization identifier.
611
- * @param options - Optional per-request overrides.
612
- * @returns Audit log entries with timestamps, actions, and metadata.
613
- *
614
- * **Endpoint:** `GET /v1/organizations/{orgId}/audit`
615
- */
616
- getAuditLogs(orgId: string, options?: RequestOptions): Promise<AuditLogResponse>;
617
- /**
618
- * Get the current scraping runtime configuration.
619
- *
620
- * **Auth:** None required.
621
- *
622
- * @returns Execution mode, Cloud Run status, and cache statistics.
623
- *
624
- * **Endpoint:** `GET /v1/scraping/config`
625
- */
65
+ generateVideo(params: GenerateVideoParams, options?: RequestOptions): Promise<JobAcceptedResponse>;
66
+ generateImage(params: GenerateImageParams, options?: RequestOptions): Promise<JobAcceptedResponse>;
67
+ generateMusic(params: GenerateMusicParams, options?: RequestOptions): Promise<JobAcceptedResponse>;
68
+ getJob(jobId: string, options?: RequestOptions): Promise<JobStatusResponse>;
69
+ waitForJob(jobId: string, intervalMs?: number, maxWaitMs?: number, options?: RequestOptions): Promise<JobStatusResponse>;
70
+ dataChat(params: DataChatParams, options?: RequestOptions): Promise<DataChatResponse>;
71
+ createAgent(params: AgentCreateParams, options?: RequestOptions): Promise<AgentCreateResponse>;
72
+ queryAgent(params: AgentQueryParams, options?: RequestOptions): Promise<AgentQueryResponse>;
73
+ transcribeAudio(params: AudioTranscribeParams, options?: RequestOptions): Promise<AudioTranscriptionResponse>;
74
+ synthesizeAudio(params: AudioSynthesizeParams, options?: RequestOptions): Promise<AudioSynthesizeResponse>;
75
+ trainModel(params: TrainModelParams, options?: RequestOptions): Promise<TrainModelResponse>;
76
+ predict(params: PredictParams, options?: RequestOptions): Promise<PredictResponse>;
77
+ forecast(params: ForecastParams, options?: RequestOptions): Promise<ForecastResponse>;
78
+ getAuditLogs(options?: RequestOptions): Promise<AuditLogResponse>;
626
79
  getScrapingConfig(): Promise<ScrapingConfigResponse>;
627
- /**
628
- * Submit URLs for scraping. JS-heavy sites (Reddit, Twitter, LinkedIn)
629
- * are auto-routed to Selenium.
630
- *
631
- * **Auth:** None required.
632
- *
633
- * @param params - Object containing the `urls` array.
634
- * @returns Task ID and submission status.
635
- *
636
- * **Endpoint:** `POST /v1/scraping/scrape`
637
- */
638
80
  scrape(params: ScrapeParams): Promise<ScrapeResponse>;
639
- /**
640
- * Check the status and results of a scrape task.
641
- *
642
- * **Auth:** None required.
643
- *
644
- * @param taskId - Task identifier (from `scrape()`).
645
- * @returns Task status and scraped results (empty while pending).
646
- *
647
- * **Endpoint:** `GET /v1/scraping/status/{taskId}`
648
- */
649
81
  getScrapeStatus(taskId: string): Promise<ScrapeStatusResponse>;
650
- /**
651
- * Submit a scrape job and poll until results are ready.
652
- *
653
- * @param urls - URLs to scrape.
654
- * @param intervalMs - Polling interval in milliseconds. @default 2000
655
- * @param maxWaitMs - Maximum wait time in milliseconds. @default 120000 (2 min)
656
- * @returns Final scrape status with results.
657
- * @throws Error if the task does not complete within `maxWaitMs`.
658
- *
659
- * @example
660
- * ```typescript
661
- * const result = await client.scrapeAndWait(
662
- * ["https://example.com", "https://example.org"],
663
- * 2000,
664
- * 60_000,
665
- * );
666
- * for (const item of result.result) {
667
- * console.log(item.title, item.full_text?.substring(0, 200));
668
- * }
669
- * ```
670
- */
671
82
  scrapeAndWait(urls: string[], intervalMs?: number, maxWaitMs?: number): Promise<ScrapeStatusResponse>;
672
- /**
673
- * Send a video generation completion webhook notification.
674
- *
675
- * **Auth:** Requires `webhookSecret` in client config (sends `X-Webhook-Secret` header).
676
- *
677
- * @param payload - Webhook payload with job_id, org_id, status, and optional metadata.
678
- * @returns `{ received: true }` on success.
679
- * @throws {@link HivemindError} 401 if the webhook secret is invalid.
680
- *
681
- * **Endpoint:** `POST /v1/webhook/video-complete`
682
- */
683
83
  sendVideoCompleteWebhook(payload: VideoCompleteWebhook): Promise<WebhookAckResponse>;
684
- /**
685
- * Send a document processing completion webhook notification.
686
- *
687
- * **Auth:** Requires `webhookSecret` in client config (sends `X-Webhook-Secret` header).
688
- *
689
- * @param payload - Webhook payload with document_id, org_id, status, and optional metadata.
690
- * @returns `{ received: true }` on success.
691
- * @throws {@link HivemindError} 401 if the webhook secret is invalid.
692
- *
693
- * **Endpoint:** `POST /v1/webhook/document-processed`
694
- */
695
84
  sendDocumentProcessedWebhook(payload: DocumentProcessedWebhook): Promise<WebhookAckResponse>;
696
- /**
697
- * Get full service configuration overview.
698
- *
699
- * **Auth:** Requires `adminKey` in client config.
700
- *
701
- * **Endpoint:** `GET /v1/admin/config`
702
- */
703
85
  getAdminConfig(): Promise<ConfigOverview>;
704
- /**
705
- * Get runtime setting overrides.
706
- *
707
- * **Auth:** Requires `adminKey` in client config.
708
- *
709
- * **Endpoint:** `GET /v1/admin/config/overrides`
710
- */
711
86
  getAdminConfigOverrides(): Promise<{
712
87
  overrides: Record<string, unknown>;
713
88
  }>;
714
- /**
715
- * Update a mutable runtime setting (e.g. log_level, debug, cors_allow_origins).
716
- *
717
- * **Auth:** Requires `adminKey` in client config.
718
- *
719
- * @param params - Setting key and new value.
720
- *
721
- * **Endpoint:** `PUT /v1/admin/settings`
722
- */
723
89
  updateAdminSetting(params: UpdateSettingRequest): Promise<UpdateSettingResponse>;
724
- /**
725
- * Get the current application log level.
726
- *
727
- * **Auth:** Requires `adminKey` in client config.
728
- *
729
- * **Endpoint:** `GET /v1/admin/logging/level`
730
- */
731
90
  getLogLevel(): Promise<LogLevelResponse>;
732
- /**
733
- * Change the application log level.
734
- *
735
- * **Auth:** Requires `adminKey` in client config.
736
- *
737
- * @param params - The new log level (DEBUG, INFO, WARNING, ERROR, CRITICAL).
738
- *
739
- * **Endpoint:** `PUT /v1/admin/logging/level`
740
- */
741
91
  setLogLevel(params: LogLevelRequest): Promise<LogLevelResponse>;
742
- /**
743
- * List all loggers with their levels and handlers.
744
- *
745
- * **Auth:** Requires `adminKey` in client config.
746
- *
747
- * **Endpoint:** `GET /v1/admin/logging/loggers`
748
- */
749
92
  getLoggers(): Promise<{
750
93
  loggers: LoggerInfo[];
751
94
  }>;
752
- /**
753
- * Get inbound traffic statistics.
754
- *
755
- * **Auth:** Requires `adminKey` in client config.
756
- *
757
- * **Endpoint:** `GET /v1/admin/traffic/inbound`
758
- */
759
95
  getInboundTraffic(): Promise<InboundTrafficStats>;
760
- /**
761
- * Reset inbound traffic counters.
762
- *
763
- * **Auth:** Requires `adminKey` in client config.
764
- *
765
- * **Endpoint:** `POST /v1/admin/traffic/inbound/reset`
766
- */
767
96
  resetInboundTraffic(): Promise<{
768
97
  status: string;
769
98
  timestamp: string;
770
99
  }>;
771
- /**
772
- * Check health of outbound dependencies (GCP, Vertex, BigQuery, Redis).
773
- *
774
- * **Auth:** Requires `adminKey` in client config.
775
- *
776
- * **Endpoint:** `GET /v1/admin/traffic/outbound`
777
- */
778
100
  getOutboundStatus(): Promise<OutboundStatusResponse>;
779
- /**
780
- * Get the current CORS allowed origins.
781
- *
782
- * **Auth:** Requires `adminKey` in client config.
783
- *
784
- * **Endpoint:** `GET /v1/admin/cors`
785
- */
786
101
  getCors(): Promise<{
787
102
  allow_origins: string[];
788
103
  }>;
789
- /**
790
- * Update the CORS allowed origins.
791
- *
792
- * **Auth:** Requires `adminKey` in client config.
793
- *
794
- * @param allowOrigins - Comma-separated origins or `"*"`.
795
- *
796
- * **Endpoint:** `PUT /v1/admin/cors`
797
- */
798
104
  setCors(allowOrigins: string): Promise<{
799
105
  previous: string;
800
106
  new: string;
801
107
  note: string;
802
108
  }>;
803
- /**
804
- * List all rate-limit entries.
805
- *
806
- * **Auth:** Requires `adminKey` in client config.
807
- *
808
- * **Endpoint:** `GET /v1/admin/rate-limits`
809
- */
810
109
  getRateLimits(): Promise<{
811
110
  rate_limits: RateLimitEntry[];
812
111
  }>;
813
- /**
814
- * Reset the rate-limit counter for an organization.
815
- *
816
- * **Auth:** Requires `adminKey` in client config.
817
- *
818
- * @param orgId - Organization identifier.
819
- *
820
- * **Endpoint:** `POST /v1/admin/rate-limits/reset/{orgId}`
821
- */
822
- resetRateLimit(orgId: string): Promise<{
823
- org_id: string;
112
+ resetRateLimit(scopeId: string): Promise<{
113
+ scope_id: string;
824
114
  status: string;
825
115
  }>;
826
- /**
827
- * List all organizations (admin view).
828
- *
829
- * **Auth:** Requires `adminKey` in client config.
830
- *
831
- * @param limit - Maximum number of organizations to return (1–1000, default 100).
832
- *
833
- * **Endpoint:** `GET /v1/admin/organizations`
834
- */
835
- listOrganizations(limit?: number): Promise<OrgListResponse>;
836
- /**
837
- * Get a single organization (admin view).
838
- *
839
- * **Auth:** Requires `adminKey` in client config.
840
- *
841
- * @param orgId - Organization identifier.
842
- *
843
- * **Endpoint:** `GET /v1/admin/organizations/{orgId}`
844
- */
845
- getAdminOrganization(orgId: string): Promise<Organization>;
846
- /**
847
- * List recent jobs across all organizations (admin view).
848
- *
849
- * **Auth:** Requires `adminKey` in client config.
850
- *
851
- * @param limit - Maximum number of jobs to return (1–500, default 50).
852
- *
853
- * **Endpoint:** `GET /v1/admin/jobs`
854
- */
855
116
  listJobs(limit?: number): Promise<JobListResponse>;
856
- /**
857
- * Get all feature flags.
858
- *
859
- * **Auth:** Requires `adminKey` in client config.
860
- *
861
- * **Endpoint:** `GET /v1/admin/feature-flags`
862
- */
863
117
  getFeatureFlags(): Promise<{
864
118
  flags: Record<string, unknown>;
865
119
  }>;
866
- /**
867
- * Get a single feature flag by key.
868
- *
869
- * **Auth:** Requires `adminKey` in client config.
870
- *
871
- * @param key - Feature flag key.
872
- *
873
- * **Endpoint:** `GET /v1/admin/feature-flags/{key}`
874
- */
875
120
  getFeatureFlag(key: string): Promise<FeatureFlag>;
876
- /**
877
- * Create or update a feature flag.
878
- *
879
- * **Auth:** Requires `adminKey` in client config.
880
- *
881
- * @param params - Flag key and enabled status.
882
- *
883
- * **Endpoint:** `PUT /v1/admin/feature-flags`
884
- */
885
121
  setFeatureFlag(params: FeatureFlagUpdate): Promise<FeatureFlag>;
886
- /**
887
- * Delete a feature flag.
888
- *
889
- * **Auth:** Requires `adminKey` in client config.
890
- *
891
- * @param key - Feature flag key to delete.
892
- *
893
- * **Endpoint:** `DELETE /v1/admin/feature-flags/{key}`
894
- */
895
122
  deleteFeatureFlag(key: string): Promise<{
896
123
  key: string;
897
124
  deleted: boolean;
898
125
  }>;
899
- /**
900
- * Get current maintenance mode state.
901
- *
902
- * **Auth:** Requires `adminKey` in client config.
903
- *
904
- * **Endpoint:** `GET /v1/admin/maintenance`
905
- */
906
126
  getMaintenanceMode(): Promise<MaintenanceModeResponse>;
907
- /**
908
- * Enable or disable maintenance mode.
909
- *
910
- * **Auth:** Requires `adminKey` in client config.
911
- *
912
- * @param params - Enabled flag and optional message.
913
- *
914
- * **Endpoint:** `PUT /v1/admin/maintenance`
915
- */
916
127
  setMaintenanceMode(params: MaintenanceModeRequest): Promise<MaintenanceModeResponse>;
917
- /**
918
- * Get cache statistics.
919
- *
920
- * **Auth:** Requires `adminKey` in client config.
921
- *
922
- * **Endpoint:** `GET /v1/admin/cache`
923
- */
924
128
  getCacheStats(): Promise<CacheStatsResponse>;
925
- /**
926
- * Flush all caches.
927
- *
928
- * **Auth:** Requires `adminKey` in client config.
929
- *
930
- * **Endpoint:** `POST /v1/admin/cache/flush`
931
- */
932
129
  flushCache(): Promise<{
933
130
  status: string;
934
131
  backend: string;
935
132
  }>;
936
- /**
937
- * Get all tier configurations.
938
- *
939
- * **Auth:** Requires `adminKey` in client config.
940
- *
941
- * **Endpoint:** `GET /v1/admin/tiers`
942
- */
943
- getTiers(): Promise<{
944
- tiers: TierConfigResponse[];
945
- }>;
946
- /**
947
- * Get current pricing configuration.
948
- *
949
- * **Auth:** Requires `adminKey` in client config.
950
- *
951
- * **Endpoint:** `GET /v1/admin/pricing`
952
- */
953
- getPricing(): Promise<PricingResponse>;
954
- /**
955
- * Get admin-level audit log entries.
956
- *
957
- * **Auth:** Requires `adminKey` in client config.
958
- *
959
- * @param limit - Maximum entries to return (1–1000, default 100).
960
- *
961
- * **Endpoint:** `GET /v1/admin/audit`
962
- */
963
133
  getAdminAudit(limit?: number): Promise<AdminAuditResponse>;
964
- /**
965
- * Get system information (Python version, platform, architecture, PID, etc.).
966
- *
967
- * **Auth:** Requires `adminKey` in client config.
968
- *
969
- * **Endpoint:** `GET /v1/admin/system`
970
- */
971
134
  getSystemInfo(): Promise<Record<string, unknown>>;
972
- /**
973
- * Connect a Jira Cloud site using an API token.
974
- * Validates credentials, registers a webhook, and stores the encrypted token.
975
- *
976
- * **Auth:** Requires org-scoped API key.
977
- *
978
- * @param orgId - Organization identifier.
979
- * @param params - Jira connection details (site_url, email, api_token).
980
- * @param options - Optional per-request overrides.
981
- *
982
- * **Endpoint:** `POST /v1/organizations/{orgId}/integrations/jira/connect`
983
- */
984
- connectJira(orgId: string, params: JiraConnectRequest, options?: RequestOptions): Promise<JiraConnectResponse>;
985
- /**
986
- * Get the current Jira integration status for an organization.
987
- *
988
- * **Auth:** Requires org-scoped API key.
989
- *
990
- * @param orgId - Organization identifier.
991
- * @param options - Optional per-request overrides.
992
- *
993
- * **Endpoint:** `GET /v1/organizations/{orgId}/integrations/jira/status`
994
- */
995
- getJiraStatus(orgId: string, options?: RequestOptions): Promise<JiraIntegrationStatusResponse>;
996
- /**
997
- * Disconnect (unlink) an organization's Jira integration.
998
- * Deregisters the webhook and deletes stored credentials.
999
- *
1000
- * **Auth:** Requires org-scoped API key.
1001
- *
1002
- * @param orgId - Organization identifier.
1003
- * @param options - Optional per-request overrides.
1004
- *
1005
- * **Endpoint:** `DELETE /v1/organizations/{orgId}/integrations/jira`
1006
- */
1007
- disconnectJira(orgId: string, options?: RequestOptions): Promise<JiraDisconnectResponse>;
1008
- /**
1009
- * Trigger a bulk sync of Jira issues from specified projects into the
1010
- * document store for RAG retrieval.
1011
- *
1012
- * **Auth:** Requires org-scoped API key.
1013
- *
1014
- * @param orgId - Organization identifier.
1015
- * @param params - Object containing `project_keys` array.
1016
- * @param options - Optional per-request overrides.
1017
- *
1018
- * **Endpoint:** `POST /v1/organizations/{orgId}/integrations/jira/sync`
1019
- */
1020
- syncJira(orgId: string, params: JiraSyncRequest, options?: RequestOptions): Promise<JiraSyncResponse>;
1021
- /**
1022
- * Send a Jira webhook event manually.
1023
- *
1024
- * **Auth:** Requires `webhookSecret` in client config.
1025
- *
1026
- * @param payload - Jira webhook payload (issue, webhookEvent, etc.).
1027
- *
1028
- * **Endpoint:** `POST /v1/webhook/jira`
1029
- */
135
+ connectJira(params: JiraConnectRequest, options?: RequestOptions): Promise<JiraConnectResponse>;
136
+ getJiraStatus(options?: RequestOptions): Promise<JiraIntegrationStatusResponse>;
137
+ disconnectJira(options?: RequestOptions): Promise<JiraDisconnectResponse>;
138
+ syncJira(params: JiraSyncRequest, options?: RequestOptions): Promise<JiraSyncResponse>;
1030
139
  sendJiraWebhook(payload: Record<string, unknown>): Promise<JiraWebhookAckResponse>;
1031
- /**
1032
- * Create a new document blueprint (template).
1033
- *
1034
- * **Auth:** Requires org-scoped API key.
1035
- *
1036
- * @param orgId - Organization ID.
1037
- * @param params - Blueprint details (name, sections, workflow_config, etc.).
1038
- *
1039
- * **Endpoint:** `POST /v1/organizations/{orgId}/blueprints`
1040
- */
1041
- createBlueprint(orgId: string, params: BlueprintCreateParams, options?: RequestOptions): Promise<BlueprintResponse>;
1042
- /**
1043
- * List all blueprints for an organization.
1044
- *
1045
- * **Auth:** Requires org-scoped API key.
1046
- *
1047
- * @param orgId - Organization ID.
1048
- *
1049
- * **Endpoint:** `GET /v1/organizations/{orgId}/blueprints`
1050
- */
1051
- listBlueprints(orgId: string, options?: RequestOptions): Promise<BlueprintListResponse>;
1052
- /**
1053
- * Get a single blueprint by ID.
1054
- *
1055
- * **Auth:** Requires org-scoped API key.
1056
- *
1057
- * @param orgId - Organization ID.
1058
- * @param blueprintId - Blueprint ID.
1059
- *
1060
- * **Endpoint:** `GET /v1/organizations/{orgId}/blueprints/{blueprintId}`
1061
- */
1062
- getBlueprint(orgId: string, blueprintId: string, options?: RequestOptions): Promise<BlueprintResponse>;
1063
- /**
1064
- * Update an existing blueprint. Only provided fields are changed.
1065
- *
1066
- * **Auth:** Requires org-scoped API key.
1067
- *
1068
- * @param orgId - Organization ID.
1069
- * @param blueprintId - Blueprint ID.
1070
- * @param params - Fields to update.
1071
- *
1072
- * **Endpoint:** `PUT /v1/organizations/{orgId}/blueprints/{blueprintId}`
1073
- */
1074
- updateBlueprint(orgId: string, blueprintId: string, params: BlueprintUpdateParams, options?: RequestOptions): Promise<BlueprintResponse>;
1075
- /**
1076
- * Publish a blueprint, making it available for document creation.
1077
- *
1078
- * **Auth:** Requires org-scoped API key.
1079
- *
1080
- * @param orgId - Organization ID.
1081
- * @param blueprintId - Blueprint ID.
1082
- *
1083
- * **Endpoint:** `POST /v1/organizations/{orgId}/blueprints/{blueprintId}/publish`
1084
- */
1085
- publishBlueprint(orgId: string, blueprintId: string, options?: RequestOptions): Promise<BlueprintResponse>;
1086
- /**
1087
- * Archive a blueprint, preventing new documents from being created from it.
1088
- *
1089
- * **Auth:** Requires org-scoped API key.
1090
- *
1091
- * @param orgId - Organization ID.
1092
- * @param blueprintId - Blueprint ID.
1093
- *
1094
- * **Endpoint:** `POST /v1/organizations/{orgId}/blueprints/{blueprintId}/archive`
1095
- */
1096
- archiveBlueprint(orgId: string, blueprintId: string, options?: RequestOptions): Promise<BlueprintResponse>;
1097
- /**
1098
- * Permanently delete a blueprint.
1099
- *
1100
- * **Auth:** Requires org-scoped API key.
1101
- *
1102
- * @param orgId - Organization ID.
1103
- * @param blueprintId - Blueprint ID.
1104
- *
1105
- * **Endpoint:** `DELETE /v1/organizations/{orgId}/blueprints/{blueprintId}`
1106
- */
1107
- deleteBlueprint(orgId: string, blueprintId: string, options?: RequestOptions): Promise<void>;
1108
- /**
1109
- * Create a new managed document from a published blueprint.
1110
- *
1111
- * **Auth:** Requires org-scoped API key.
1112
- *
1113
- * @param orgId - Organization ID.
1114
- * @param params - Document details (blueprint_id, title, sections, etc.).
1115
- *
1116
- * **Endpoint:** `POST /v1/organizations/{orgId}/documents/create`
1117
- */
1118
- createDocumentFromBlueprint(orgId: string, params: DocumentCreateFromBlueprintParams, options?: RequestOptions): Promise<ManagedDocumentResponse>;
1119
- /**
1120
- * List all managed documents for an organization.
1121
- *
1122
- * **Auth:** Requires org-scoped API key.
1123
- *
1124
- * @param orgId - Organization ID.
1125
- *
1126
- * **Endpoint:** `GET /v1/organizations/{orgId}/documents/managed`
1127
- */
1128
- listManagedDocuments(orgId: string, options?: RequestOptions): Promise<ManagedDocumentListResponse>;
1129
- /**
1130
- * Get a single managed document by ID.
1131
- *
1132
- * **Auth:** Requires org-scoped API key.
1133
- *
1134
- * @param orgId - Organization ID.
1135
- * @param documentId - Document ID.
1136
- *
1137
- * **Endpoint:** `GET /v1/organizations/{orgId}/documents/managed/{documentId}`
1138
- */
1139
- getManagedDocument(orgId: string, documentId: string, options?: RequestOptions): Promise<ManagedDocumentResponse>;
1140
- /**
1141
- * Update the content of a document section. Only allowed in draft/revision status.
1142
- *
1143
- * **Auth:** Requires org-scoped API key.
1144
- *
1145
- * @param orgId - Organization ID.
1146
- * @param documentId - Document ID.
1147
- * @param params - Section ID and new content.
1148
- *
1149
- * **Endpoint:** `PATCH /v1/organizations/{orgId}/documents/managed/{documentId}/sections`
1150
- */
1151
- updateDocumentSection(orgId: string, documentId: string, params: DocumentUpdateSectionParams, options?: RequestOptions): Promise<ManagedDocumentResponse>;
1152
- /**
1153
- * Perform a workflow action on a managed document.
1154
- *
1155
- * Actions: submit, approve, reject, request_changes, seal.
1156
- *
1157
- * **Auth:** Requires org-scoped API key.
1158
- *
1159
- * @param orgId - Organization ID.
1160
- * @param documentId - Document ID.
1161
- * @param params - Action type and optional comment.
1162
- *
1163
- * **Endpoint:** `POST /v1/organizations/{orgId}/documents/managed/{documentId}/workflow`
1164
- */
1165
- performDocumentWorkflow(orgId: string, documentId: string, params: DocumentWorkflowActionParams, options?: RequestOptions): Promise<ManagedDocumentResponse>;
1166
- /**
1167
- * Permanently delete a managed document.
1168
- *
1169
- * **Auth:** Requires org-scoped API key.
1170
- *
1171
- * @param orgId - Organization ID.
1172
- * @param documentId - Document ID.
1173
- *
1174
- * **Endpoint:** `DELETE /v1/organizations/{orgId}/documents/managed/{documentId}`
1175
- */
1176
- deleteManagedDocument(orgId: string, documentId: string, options?: RequestOptions): Promise<void>;
1177
- /**
1178
- * AI-generate content for a document section using the blueprint's AI rules.
1179
- *
1180
- * **Auth:** Requires org-scoped API key.
1181
- *
1182
- * @param orgId - Organization ID.
1183
- * @param documentId - Document ID.
1184
- * @param params - Section ID and optional context for generation.
1185
- *
1186
- * **Endpoint:** `POST /v1/organizations/{orgId}/documents/managed/{documentId}/generate`
1187
- */
1188
- generateDocumentSection(orgId: string, documentId: string, params: DocumentGenerateSectionParams, options?: RequestOptions): Promise<DocumentGenerateResponse>;
140
+ createBlueprint(params: BlueprintCreateParams, options?: RequestOptions): Promise<BlueprintResponse>;
141
+ listBlueprints(options?: RequestOptions): Promise<BlueprintListResponse>;
142
+ getBlueprint(blueprintId: string, options?: RequestOptions): Promise<BlueprintResponse>;
143
+ updateBlueprint(blueprintId: string, params: BlueprintUpdateParams, options?: RequestOptions): Promise<BlueprintResponse>;
144
+ publishBlueprint(blueprintId: string, options?: RequestOptions): Promise<BlueprintResponse>;
145
+ archiveBlueprint(blueprintId: string, options?: RequestOptions): Promise<BlueprintResponse>;
146
+ deleteBlueprint(blueprintId: string, options?: RequestOptions): Promise<void>;
147
+ createDocumentFromBlueprint(params: DocumentCreateFromBlueprintParams, options?: RequestOptions): Promise<ManagedDocumentResponse>;
148
+ listManagedDocuments(options?: RequestOptions): Promise<ManagedDocumentListResponse>;
149
+ getManagedDocument(documentId: string, options?: RequestOptions): Promise<ManagedDocumentResponse>;
150
+ updateDocumentSection(documentId: string, params: DocumentUpdateSectionParams, options?: RequestOptions): Promise<ManagedDocumentResponse>;
151
+ performDocumentWorkflow(documentId: string, params: DocumentWorkflowActionParams, options?: RequestOptions): Promise<ManagedDocumentResponse>;
152
+ deleteManagedDocument(documentId: string, options?: RequestOptions): Promise<void>;
153
+ generateDocumentSection(documentId: string, params: DocumentGenerateSectionParams, options?: RequestOptions): Promise<DocumentGenerateResponse>;
154
+ chatProjectSse(projectId: string, params: ProjectChatParams, options?: RequestOptions): AsyncGenerator<ChatStreamEvent, void, undefined>;
155
+ chatProjectWebSocket(projectId: string, options?: RequestOptions & {
156
+ signal?: AbortSignal;
157
+ }): Promise<{
158
+ raw: WebSocket;
159
+ chat(params: Omit<WsChatCommand, "type">): Promise<import("./types").WsChatFrame>;
160
+ close(code?: number, reason?: string): void;
161
+ }>;
1189
162
  }
1190
163
  //# sourceMappingURL=client.d.ts.map