@omelhorsite/sdk 0.5.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -238
- package/dist/index.js +461 -1
- package/dist/types/client.d.ts +6 -0
- package/dist/types/resources/account.d.ts +68 -2
- package/dist/types/resources/admin/index.d.ts +10 -0
- package/dist/types/resources/admin/llm.d.ts +247 -0
- package/dist/types/resources/admin/myOauthApplications.d.ts +2 -2
- package/dist/types/resources/admin/oauthApplications.d.ts +11 -0
- package/dist/types/resources/admin/types.d.ts +9 -0
- package/dist/types/resources/content/notifications.d.ts +41 -8
- package/dist/types/resources/content/serviceUsages.d.ts +1 -1
- package/dist/types/resources/index.d.ts +2 -0
- package/dist/types/resources/llm.d.ts +296 -0
- package/dist/types/resources/search.d.ts +116 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10245,11 +10245,22 @@ class AccountSessionsNamespace extends Resource {
|
|
|
10245
10245
|
}
|
|
10246
10246
|
}
|
|
10247
10247
|
|
|
10248
|
+
class NotificationPreferencesNamespace extends Resource {
|
|
10249
|
+
async get(options = {}) {
|
|
10250
|
+
return this.http.get("/notification_preferences", options);
|
|
10251
|
+
}
|
|
10252
|
+
async update(input, options = {}) {
|
|
10253
|
+
return this.http.patch("/notification_preferences", preferencesBody(input), options);
|
|
10254
|
+
}
|
|
10255
|
+
}
|
|
10256
|
+
|
|
10248
10257
|
class AccountNamespace extends Resource {
|
|
10249
10258
|
sessions;
|
|
10259
|
+
notificationPreferences;
|
|
10250
10260
|
constructor(http) {
|
|
10251
10261
|
super(http);
|
|
10252
10262
|
this.sessions = new AccountSessionsNamespace(http);
|
|
10263
|
+
this.notificationPreferences = new NotificationPreferencesNamespace(http);
|
|
10253
10264
|
}
|
|
10254
10265
|
async me(options = {}) {
|
|
10255
10266
|
return this.http.get("/account", options);
|
|
@@ -10320,6 +10331,10 @@ function updateBody(input) {
|
|
|
10320
10331
|
share_listening: input.shareListening
|
|
10321
10332
|
};
|
|
10322
10333
|
}
|
|
10334
|
+
function preferencesBody(input) {
|
|
10335
|
+
const kinds = input.kinds === undefined ? undefined : Object.fromEntries(Object.entries(input.kinds).map(([kind, entry]) => [kind, { in_app: entry?.inApp, email: entry?.email }]));
|
|
10336
|
+
return { emails_enabled: input.emailsEnabled, kinds };
|
|
10337
|
+
}
|
|
10323
10338
|
|
|
10324
10339
|
// src/resources/admin/authorizedApplications.ts
|
|
10325
10340
|
class AuthorizedApplicationsNamespace extends Resource {
|
|
@@ -10388,6 +10403,171 @@ class AdminJobsNamespace extends Resource {
|
|
|
10388
10403
|
}
|
|
10389
10404
|
}
|
|
10390
10405
|
|
|
10406
|
+
// src/resources/admin/llm.ts
|
|
10407
|
+
var LLM_PROVIDER_KINDS = Object.freeze(["openai_compatible", "openrouter", "ollama"]);
|
|
10408
|
+
var ADMIN_LLM_PROVIDER_FILTER_COLUMNS = Object.freeze([
|
|
10409
|
+
"slug",
|
|
10410
|
+
"name",
|
|
10411
|
+
"kind",
|
|
10412
|
+
"enabled"
|
|
10413
|
+
]);
|
|
10414
|
+
var ADMIN_LLM_MODEL_FILTER_COLUMNS = Object.freeze([
|
|
10415
|
+
"llm_provider_id",
|
|
10416
|
+
"model_id",
|
|
10417
|
+
"name",
|
|
10418
|
+
"enabled",
|
|
10419
|
+
"visible_in_chat",
|
|
10420
|
+
"free"
|
|
10421
|
+
]);
|
|
10422
|
+
var ADMIN_LLM_ASSIGNMENT_FILTER_COLUMNS = Object.freeze(["feature"]);
|
|
10423
|
+
function providerBody(input) {
|
|
10424
|
+
const body = {};
|
|
10425
|
+
if (input.slug !== undefined)
|
|
10426
|
+
body["slug"] = input.slug;
|
|
10427
|
+
if (input.name !== undefined)
|
|
10428
|
+
body["name"] = input.name;
|
|
10429
|
+
if (input.baseUrl !== undefined)
|
|
10430
|
+
body["base_url"] = input.baseUrl;
|
|
10431
|
+
if (input.apiKey !== undefined)
|
|
10432
|
+
body["api_key"] = input.apiKey;
|
|
10433
|
+
if (input.kind !== undefined)
|
|
10434
|
+
body["kind"] = input.kind;
|
|
10435
|
+
if (input.headers !== undefined)
|
|
10436
|
+
body["headers"] = { ...input.headers };
|
|
10437
|
+
if (input.options !== undefined)
|
|
10438
|
+
body["options"] = { ...input.options };
|
|
10439
|
+
if (input.enabled !== undefined)
|
|
10440
|
+
body["enabled"] = input.enabled;
|
|
10441
|
+
if (input.maxConcurrency !== undefined)
|
|
10442
|
+
body["max_concurrency"] = input.maxConcurrency;
|
|
10443
|
+
if (input.openTimeout !== undefined)
|
|
10444
|
+
body["open_timeout"] = input.openTimeout;
|
|
10445
|
+
if (input.readTimeout !== undefined)
|
|
10446
|
+
body["read_timeout"] = input.readTimeout;
|
|
10447
|
+
return body;
|
|
10448
|
+
}
|
|
10449
|
+
function modelBody(input) {
|
|
10450
|
+
const body = {};
|
|
10451
|
+
if (input.llmProviderId !== undefined)
|
|
10452
|
+
body["llm_provider_id"] = input.llmProviderId;
|
|
10453
|
+
if (input.modelId !== undefined)
|
|
10454
|
+
body["model_id"] = input.modelId;
|
|
10455
|
+
if (input.name !== undefined)
|
|
10456
|
+
body["name"] = input.name;
|
|
10457
|
+
if (input.enabled !== undefined)
|
|
10458
|
+
body["enabled"] = input.enabled;
|
|
10459
|
+
if (input.visibleInChat !== undefined)
|
|
10460
|
+
body["visible_in_chat"] = input.visibleInChat;
|
|
10461
|
+
if (input.contextWindow !== undefined)
|
|
10462
|
+
body["context_window"] = input.contextWindow;
|
|
10463
|
+
if (input.maxOutputTokens !== undefined)
|
|
10464
|
+
body["max_output_tokens"] = input.maxOutputTokens;
|
|
10465
|
+
if (input.inputPricePerMillion !== undefined)
|
|
10466
|
+
body["input_price_per_million"] = input.inputPricePerMillion;
|
|
10467
|
+
if (input.outputPricePerMillion !== undefined)
|
|
10468
|
+
body["output_price_per_million"] = input.outputPricePerMillion;
|
|
10469
|
+
if (input.free !== undefined)
|
|
10470
|
+
body["free"] = input.free;
|
|
10471
|
+
if (input.capabilities !== undefined)
|
|
10472
|
+
body["capabilities"] = { ...input.capabilities };
|
|
10473
|
+
if (input.limits !== undefined)
|
|
10474
|
+
body["limits"] = { ...input.limits };
|
|
10475
|
+
return body;
|
|
10476
|
+
}
|
|
10477
|
+
function assignmentBody(input) {
|
|
10478
|
+
const body = {};
|
|
10479
|
+
if (input.feature !== undefined)
|
|
10480
|
+
body["feature"] = input.feature;
|
|
10481
|
+
if (input.llmModelIds !== undefined)
|
|
10482
|
+
body["llm_model_ids"] = [...input.llmModelIds];
|
|
10483
|
+
if (input.options !== undefined)
|
|
10484
|
+
body["options"] = { ...input.options };
|
|
10485
|
+
return body;
|
|
10486
|
+
}
|
|
10487
|
+
|
|
10488
|
+
class AdminLlmProvidersNamespace extends Resource {
|
|
10489
|
+
async list(params = {}, options = {}) {
|
|
10490
|
+
const base = { order: "name:asc" };
|
|
10491
|
+
return paginate(params, 100, (at) => this.http.get("/admin/llm_providers", { ...options, query: listQuery(params, at, base) }));
|
|
10492
|
+
}
|
|
10493
|
+
async get(id, options = {}) {
|
|
10494
|
+
return this.http.get(`/admin/llm_providers/${encodeURIComponent(id)}`, options);
|
|
10495
|
+
}
|
|
10496
|
+
async create(input, options = {}) {
|
|
10497
|
+
return this.http.post("/admin/llm_providers", providerBody(input), { retry: false, ...options });
|
|
10498
|
+
}
|
|
10499
|
+
async update(id, input, options = {}) {
|
|
10500
|
+
return this.http.patch(`/admin/llm_providers/${encodeURIComponent(id)}`, providerBody(input), { retry: false, ...options });
|
|
10501
|
+
}
|
|
10502
|
+
async delete(id, options = {}) {
|
|
10503
|
+
await this.http.delete(`/admin/llm_providers/${encodeURIComponent(id)}`, options);
|
|
10504
|
+
}
|
|
10505
|
+
async availableModels(id, input = {}, options = {}) {
|
|
10506
|
+
return this.http.get(`/admin/llm_providers/${encodeURIComponent(id)}/available_models`, { ...input.fresh ? { query: { fresh: 1 } } : {}, ...options });
|
|
10507
|
+
}
|
|
10508
|
+
async test(id, input = {}, options = {}) {
|
|
10509
|
+
const body = {};
|
|
10510
|
+
if (input.modelId !== undefined)
|
|
10511
|
+
body["model_id"] = input.modelId;
|
|
10512
|
+
return this.http.post(`/admin/llm_providers/${encodeURIComponent(id)}/test`, body, { retry: false, ...options });
|
|
10513
|
+
}
|
|
10514
|
+
}
|
|
10515
|
+
|
|
10516
|
+
class AdminLlmModelsNamespace extends Resource {
|
|
10517
|
+
async list(params = {}, options = {}) {
|
|
10518
|
+
const base = { order: "name:asc" };
|
|
10519
|
+
return paginate(params, 100, (at) => this.http.get("/admin/llm_models", { ...options, query: listQuery(params, at, base) }));
|
|
10520
|
+
}
|
|
10521
|
+
async get(id, options = {}) {
|
|
10522
|
+
return this.http.get(`/admin/llm_models/${encodeURIComponent(id)}`, options);
|
|
10523
|
+
}
|
|
10524
|
+
async create(input, options = {}) {
|
|
10525
|
+
return this.http.post("/admin/llm_models", modelBody(input), { retry: false, ...options });
|
|
10526
|
+
}
|
|
10527
|
+
async update(id, input, options = {}) {
|
|
10528
|
+
return this.http.patch(`/admin/llm_models/${encodeURIComponent(id)}`, modelBody(input), {
|
|
10529
|
+
retry: false,
|
|
10530
|
+
...options
|
|
10531
|
+
});
|
|
10532
|
+
}
|
|
10533
|
+
async delete(id, options = {}) {
|
|
10534
|
+
await this.http.delete(`/admin/llm_models/${encodeURIComponent(id)}`, options);
|
|
10535
|
+
}
|
|
10536
|
+
}
|
|
10537
|
+
|
|
10538
|
+
class AdminLlmAssignmentsNamespace extends Resource {
|
|
10539
|
+
async list(params = {}, options = {}) {
|
|
10540
|
+
return paginate(params, 100, (at) => this.http.get("/admin/llm_assignments", { ...options, query: listQuery(params, at) }));
|
|
10541
|
+
}
|
|
10542
|
+
async get(id, options = {}) {
|
|
10543
|
+
return this.http.get(`/admin/llm_assignments/${encodeURIComponent(id)}`, options);
|
|
10544
|
+
}
|
|
10545
|
+
async create(input, options = {}) {
|
|
10546
|
+
return this.http.post("/admin/llm_assignments", assignmentBody(input), {
|
|
10547
|
+
retry: false,
|
|
10548
|
+
...options
|
|
10549
|
+
});
|
|
10550
|
+
}
|
|
10551
|
+
async update(id, input, options = {}) {
|
|
10552
|
+
return this.http.patch(`/admin/llm_assignments/${encodeURIComponent(id)}`, assignmentBody(input), { retry: false, ...options });
|
|
10553
|
+
}
|
|
10554
|
+
async delete(id, options = {}) {
|
|
10555
|
+
await this.http.delete(`/admin/llm_assignments/${encodeURIComponent(id)}`, options);
|
|
10556
|
+
}
|
|
10557
|
+
async features(options = {}) {
|
|
10558
|
+
return this.http.get("/admin/llm_assignments/features", options);
|
|
10559
|
+
}
|
|
10560
|
+
}
|
|
10561
|
+
|
|
10562
|
+
class AdminLlmUsageNamespace extends Resource {
|
|
10563
|
+
async summary(input = {}, options = {}) {
|
|
10564
|
+
const query = {};
|
|
10565
|
+
if (input.days !== undefined)
|
|
10566
|
+
query["days"] = input.days;
|
|
10567
|
+
return this.http.get("/admin/llm_usage", { ...options, query });
|
|
10568
|
+
}
|
|
10569
|
+
}
|
|
10570
|
+
|
|
10391
10571
|
// src/internal/helpers.ts
|
|
10392
10572
|
function assertPresent(field, value) {
|
|
10393
10573
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -10477,6 +10657,12 @@ class AdminOauthApplicationsNamespace extends Resource {
|
|
|
10477
10657
|
async approve(id, options = {}) {
|
|
10478
10658
|
return this.http.post(`/admin/oauth_applications/${encodeURIComponent(String(id))}/approve`, undefined, options);
|
|
10479
10659
|
}
|
|
10660
|
+
async verify(id, options = {}) {
|
|
10661
|
+
return this.http.post(`/admin/oauth_applications/${encodeURIComponent(String(id))}/verify`, undefined, options);
|
|
10662
|
+
}
|
|
10663
|
+
async unverify(id, options = {}) {
|
|
10664
|
+
return this.http.post(`/admin/oauth_applications/${encodeURIComponent(String(id))}/unverify`, undefined, options);
|
|
10665
|
+
}
|
|
10480
10666
|
async reject(id, input, options = {}) {
|
|
10481
10667
|
return this.http.post(`/admin/oauth_applications/${encodeURIComponent(String(id))}/reject`, {
|
|
10482
10668
|
reason: input.reason,
|
|
@@ -10656,6 +10842,10 @@ class AdminNamespace extends Resource {
|
|
|
10656
10842
|
notepads;
|
|
10657
10843
|
eventAlerts;
|
|
10658
10844
|
users;
|
|
10845
|
+
llmProviders;
|
|
10846
|
+
llmModels;
|
|
10847
|
+
llmAssignments;
|
|
10848
|
+
llmUsage;
|
|
10659
10849
|
constructor(http) {
|
|
10660
10850
|
super(http);
|
|
10661
10851
|
this.myApplications = new MyOauthApplicationsNamespace(http);
|
|
@@ -10670,6 +10860,10 @@ class AdminNamespace extends Resource {
|
|
|
10670
10860
|
this.notepads = new AdminNotepadsNamespace(http);
|
|
10671
10861
|
this.eventAlerts = new AdminEventAlertsNamespace(http);
|
|
10672
10862
|
this.users = new AdminUsersNamespace(http);
|
|
10863
|
+
this.llmProviders = new AdminLlmProvidersNamespace(http);
|
|
10864
|
+
this.llmModels = new AdminLlmModelsNamespace(http);
|
|
10865
|
+
this.llmAssignments = new AdminLlmAssignmentsNamespace(http);
|
|
10866
|
+
this.llmUsage = new AdminLlmUsageNamespace(http);
|
|
10673
10867
|
}
|
|
10674
10868
|
}
|
|
10675
10869
|
|
|
@@ -11338,6 +11532,62 @@ class JokesNamespace extends Resource {
|
|
|
11338
11532
|
|
|
11339
11533
|
// src/resources/content/notifications.ts
|
|
11340
11534
|
var NOTIFICATION_FILTER_COLUMNS = Object.freeze(["user_id"]);
|
|
11535
|
+
var NOTIFICATION_CATEGORIES = [
|
|
11536
|
+
"security",
|
|
11537
|
+
"social",
|
|
11538
|
+
"storage",
|
|
11539
|
+
"tools",
|
|
11540
|
+
"music",
|
|
11541
|
+
"library",
|
|
11542
|
+
"forms",
|
|
11543
|
+
"tickets",
|
|
11544
|
+
"intel",
|
|
11545
|
+
"oauth",
|
|
11546
|
+
"admin"
|
|
11547
|
+
];
|
|
11548
|
+
var NOTIFICATION_KINDS = [
|
|
11549
|
+
"security_new_session",
|
|
11550
|
+
"security_password_changed",
|
|
11551
|
+
"security_email_changed",
|
|
11552
|
+
"security_passkey_added",
|
|
11553
|
+
"security_app_authorized",
|
|
11554
|
+
"friendship_request",
|
|
11555
|
+
"friendship_accepted",
|
|
11556
|
+
"user_followed",
|
|
11557
|
+
"message_received",
|
|
11558
|
+
"group_chat_message",
|
|
11559
|
+
"jam_invite",
|
|
11560
|
+
"fs_grant_received",
|
|
11561
|
+
"chest_expires_soon",
|
|
11562
|
+
"vocal_separation_done",
|
|
11563
|
+
"vocal_separation_failed",
|
|
11564
|
+
"transcription_done",
|
|
11565
|
+
"transcription_failed",
|
|
11566
|
+
"upscale_done",
|
|
11567
|
+
"upscale_failed",
|
|
11568
|
+
"background_removal_done",
|
|
11569
|
+
"background_removal_failed",
|
|
11570
|
+
"caption_job_done",
|
|
11571
|
+
"caption_job_failed",
|
|
11572
|
+
"jumpstyle_job_done",
|
|
11573
|
+
"jumpstyle_job_failed",
|
|
11574
|
+
"song_import_done",
|
|
11575
|
+
"song_import_failed",
|
|
11576
|
+
"spotify_sync_done",
|
|
11577
|
+
"spotify_sync_failed",
|
|
11578
|
+
"artist_import_done",
|
|
11579
|
+
"blog_new_post",
|
|
11580
|
+
"form_submission_received",
|
|
11581
|
+
"ticket_reply",
|
|
11582
|
+
"ticket_status_changed",
|
|
11583
|
+
"intel_report_ready",
|
|
11584
|
+
"intel_source_failing",
|
|
11585
|
+
"oauth_application_approved",
|
|
11586
|
+
"oauth_application_rejected",
|
|
11587
|
+
"admin_oauth_application_submitted",
|
|
11588
|
+
"admin_ticket_created",
|
|
11589
|
+
"admin_feedback_received"
|
|
11590
|
+
];
|
|
11341
11591
|
|
|
11342
11592
|
class NotificationsNamespace extends Resource {
|
|
11343
11593
|
async list(params = {}, options = {}) {
|
|
@@ -11354,6 +11604,9 @@ class NotificationsNamespace extends Resource {
|
|
|
11354
11604
|
async dismiss(id, options = {}) {
|
|
11355
11605
|
await this.http.delete(`/notifications/${encodeURIComponent(String(id))}`, options);
|
|
11356
11606
|
}
|
|
11607
|
+
async unsubscribe(token, options = {}) {
|
|
11608
|
+
return this.http.post("/notifications/unsubscribe", { token }, options);
|
|
11609
|
+
}
|
|
11357
11610
|
}
|
|
11358
11611
|
|
|
11359
11612
|
// src/resources/content/serviceUsages.ts
|
|
@@ -11369,7 +11622,8 @@ var SERVICE_USAGE_IDS = [
|
|
|
11369
11622
|
"messages",
|
|
11370
11623
|
"blogs",
|
|
11371
11624
|
"status",
|
|
11372
|
-
"administration"
|
|
11625
|
+
"administration",
|
|
11626
|
+
"search"
|
|
11373
11627
|
];
|
|
11374
11628
|
|
|
11375
11629
|
class ServiceUsagesNamespace extends Resource {
|
|
@@ -12238,6 +12492,158 @@ class LinkTreesNamespace extends Resource {
|
|
|
12238
12492
|
}
|
|
12239
12493
|
}
|
|
12240
12494
|
|
|
12495
|
+
// src/resources/llm.ts
|
|
12496
|
+
var LLM_CAPABILITY_KEYS = Object.freeze([
|
|
12497
|
+
"vision",
|
|
12498
|
+
"audio",
|
|
12499
|
+
"tools",
|
|
12500
|
+
"json",
|
|
12501
|
+
"reasoning",
|
|
12502
|
+
"streaming"
|
|
12503
|
+
]);
|
|
12504
|
+
var LLM_LIMIT_KEYS = Object.freeze([
|
|
12505
|
+
"rpm",
|
|
12506
|
+
"requests_per_day_per_user",
|
|
12507
|
+
"tokens_per_day_per_user"
|
|
12508
|
+
]);
|
|
12509
|
+
var LLM_USAGE_MAX_DAYS = 90;
|
|
12510
|
+
var LLM_CHAT_FILTER_COLUMNS = Object.freeze(["title", "pinned", "archived", "llm_model_id", "tools_enabled", "account_tools_enabled"]);
|
|
12511
|
+
var LLM_CHAT_ROLES = Object.freeze(["user", "assistant", "system", "tool"]);
|
|
12512
|
+
var LLM_CHAT_MESSAGE_STATUSES = Object.freeze(["streaming", "done", "error"]);
|
|
12513
|
+
var LLM_TOOL_NAMES = Object.freeze(["web_search", "read_url", "search", "execute"]);
|
|
12514
|
+
var LLM_TOOL_CALL_STATUSES = Object.freeze(["running", "done", "error"]);
|
|
12515
|
+
function toEvent(frame) {
|
|
12516
|
+
if (typeof frame.error === "string") {
|
|
12517
|
+
return { type: "error", error: frame.error, message: frame.message ?? frame.error, messageId: frame.message_id ?? null };
|
|
12518
|
+
}
|
|
12519
|
+
if (frame.done === true) {
|
|
12520
|
+
return {
|
|
12521
|
+
type: "done",
|
|
12522
|
+
messageId: frame.message_id ?? "",
|
|
12523
|
+
modelId: frame.model_id ?? null,
|
|
12524
|
+
inputTokens: frame.input_tokens ?? null,
|
|
12525
|
+
outputTokens: frame.output_tokens ?? null,
|
|
12526
|
+
cost: frame.cost ?? null,
|
|
12527
|
+
durationMs: frame.duration_ms ?? null,
|
|
12528
|
+
firstTokenMs: frame.first_token_ms ?? null
|
|
12529
|
+
};
|
|
12530
|
+
}
|
|
12531
|
+
if (typeof frame.delta === "string" && frame.delta.length > 0)
|
|
12532
|
+
return { type: "delta", delta: frame.delta };
|
|
12533
|
+
if (frame.tool && typeof frame.tool.name === "string")
|
|
12534
|
+
return { type: "tool", ...frame.tool };
|
|
12535
|
+
return;
|
|
12536
|
+
}
|
|
12537
|
+
|
|
12538
|
+
class LlmChatMessagesNamespace extends Resource {
|
|
12539
|
+
send(chatId, input, options = {}) {
|
|
12540
|
+
const body = { content: input.content };
|
|
12541
|
+
if (input.llmModelId !== undefined)
|
|
12542
|
+
body["llm_model_id"] = input.llmModelId;
|
|
12543
|
+
return this.stream("POST", `/llm_chats/${encodeURIComponent(chatId)}/messages`, { ...options, body });
|
|
12544
|
+
}
|
|
12545
|
+
regenerate(chatId, messageId, options = {}) {
|
|
12546
|
+
return this.stream("POST", `/llm_chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}/regenerate`, options);
|
|
12547
|
+
}
|
|
12548
|
+
async delete(chatId, messageId, options = {}) {
|
|
12549
|
+
await this.http.delete(`/llm_chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}`, options);
|
|
12550
|
+
}
|
|
12551
|
+
async* stream(method, path, options) {
|
|
12552
|
+
let buffer = "";
|
|
12553
|
+
for await (const chunk of this.http.streamText(method, path, options)) {
|
|
12554
|
+
buffer += chunk;
|
|
12555
|
+
for (;; ) {
|
|
12556
|
+
const newline = buffer.indexOf(`
|
|
12557
|
+
`);
|
|
12558
|
+
if (newline === -1)
|
|
12559
|
+
break;
|
|
12560
|
+
const line = buffer.slice(0, newline).trim();
|
|
12561
|
+
buffer = buffer.slice(newline + 1);
|
|
12562
|
+
if (!line.startsWith("data:"))
|
|
12563
|
+
continue;
|
|
12564
|
+
const data = line.slice(5).trim();
|
|
12565
|
+
if (data.length === 0)
|
|
12566
|
+
continue;
|
|
12567
|
+
let frame;
|
|
12568
|
+
try {
|
|
12569
|
+
frame = JSON.parse(data);
|
|
12570
|
+
} catch {
|
|
12571
|
+
continue;
|
|
12572
|
+
}
|
|
12573
|
+
const event = toEvent(frame);
|
|
12574
|
+
if (event === undefined)
|
|
12575
|
+
continue;
|
|
12576
|
+
yield event;
|
|
12577
|
+
if (event.type === "done" || event.type === "error")
|
|
12578
|
+
return;
|
|
12579
|
+
}
|
|
12580
|
+
}
|
|
12581
|
+
yield { type: "error", error: "interrupted", message: "The answer was cut short.", messageId: null };
|
|
12582
|
+
}
|
|
12583
|
+
}
|
|
12584
|
+
|
|
12585
|
+
class LlmChatsNamespace extends Resource {
|
|
12586
|
+
messages;
|
|
12587
|
+
constructor(http) {
|
|
12588
|
+
super(http);
|
|
12589
|
+
this.messages = new LlmChatMessagesNamespace(http);
|
|
12590
|
+
}
|
|
12591
|
+
async list(params = {}, options = {}) {
|
|
12592
|
+
return paginate(params, 50, (at) => this.http.get("/llm_chats", { ...options, query: listQuery(params, at) }));
|
|
12593
|
+
}
|
|
12594
|
+
async get(id, options = {}) {
|
|
12595
|
+
return this.http.get(`/llm_chats/${encodeURIComponent(id)}`, options);
|
|
12596
|
+
}
|
|
12597
|
+
async create(input = {}, options = {}) {
|
|
12598
|
+
const body = {};
|
|
12599
|
+
if (input.title !== undefined)
|
|
12600
|
+
body["title"] = input.title;
|
|
12601
|
+
if (input.llmModelId !== undefined)
|
|
12602
|
+
body["llm_model_id"] = input.llmModelId;
|
|
12603
|
+
if (input.toolsEnabled !== undefined)
|
|
12604
|
+
body["tools_enabled"] = input.toolsEnabled;
|
|
12605
|
+
if (input.accountToolsEnabled !== undefined)
|
|
12606
|
+
body["account_tools_enabled"] = input.accountToolsEnabled;
|
|
12607
|
+
return this.http.post("/llm_chats", body, options);
|
|
12608
|
+
}
|
|
12609
|
+
async update(id, input, options = {}) {
|
|
12610
|
+
const body = {};
|
|
12611
|
+
if (input.title !== undefined)
|
|
12612
|
+
body["title"] = input.title;
|
|
12613
|
+
if (input.llmModelId !== undefined)
|
|
12614
|
+
body["llm_model_id"] = input.llmModelId;
|
|
12615
|
+
if (input.pinned !== undefined)
|
|
12616
|
+
body["pinned"] = input.pinned;
|
|
12617
|
+
if (input.archived !== undefined)
|
|
12618
|
+
body["archived"] = input.archived;
|
|
12619
|
+
if (input.toolsEnabled !== undefined)
|
|
12620
|
+
body["tools_enabled"] = input.toolsEnabled;
|
|
12621
|
+
if (input.accountToolsEnabled !== undefined)
|
|
12622
|
+
body["account_tools_enabled"] = input.accountToolsEnabled;
|
|
12623
|
+
return this.http.patch(`/llm_chats/${encodeURIComponent(id)}`, body, options);
|
|
12624
|
+
}
|
|
12625
|
+
async delete(id, options = {}) {
|
|
12626
|
+
await this.http.delete(`/llm_chats/${encodeURIComponent(id)}`, options);
|
|
12627
|
+
}
|
|
12628
|
+
}
|
|
12629
|
+
|
|
12630
|
+
class LlmNamespace extends Resource {
|
|
12631
|
+
chats;
|
|
12632
|
+
constructor(http) {
|
|
12633
|
+
super(http);
|
|
12634
|
+
this.chats = new LlmChatsNamespace(http);
|
|
12635
|
+
}
|
|
12636
|
+
async models(options = {}) {
|
|
12637
|
+
return this.http.get("/llm/models", options);
|
|
12638
|
+
}
|
|
12639
|
+
async usage(input = {}, options = {}) {
|
|
12640
|
+
const query = {};
|
|
12641
|
+
if (input.days !== undefined)
|
|
12642
|
+
query["days"] = input.days;
|
|
12643
|
+
return this.http.get("/llm/usage", { ...options, query });
|
|
12644
|
+
}
|
|
12645
|
+
}
|
|
12646
|
+
|
|
12241
12647
|
// src/resources/media.ts
|
|
12242
12648
|
var MEDIA_URL_TTL_MS = 6 * 60 * 60 * 1000;
|
|
12243
12649
|
var MEDIA_REDIRECT_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -14008,6 +14414,29 @@ class RealtimeNamespace extends Resource {
|
|
|
14008
14414
|
}
|
|
14009
14415
|
}
|
|
14010
14416
|
|
|
14417
|
+
// src/resources/search.ts
|
|
14418
|
+
var SEARCH_CATEGORIES = Object.freeze(["general", "images", "news", "videos"]);
|
|
14419
|
+
var SEARCH_TIME_RANGES = Object.freeze(["day", "week", "month", "year"]);
|
|
14420
|
+
var SEARCH_MAX_PAGE = 10;
|
|
14421
|
+
var SEARCH_MAX_QUERY_LENGTH = 200;
|
|
14422
|
+
|
|
14423
|
+
class SearchNamespace extends Resource {
|
|
14424
|
+
async query(input, options = {}) {
|
|
14425
|
+
const query = { q: input.q };
|
|
14426
|
+
if (input.page !== undefined)
|
|
14427
|
+
query["page"] = input.page;
|
|
14428
|
+
if (input.category !== undefined)
|
|
14429
|
+
query["category"] = input.category;
|
|
14430
|
+
if (input.timeRange !== undefined)
|
|
14431
|
+
query["time_range"] = input.timeRange;
|
|
14432
|
+
if (input.language !== undefined)
|
|
14433
|
+
query["language"] = input.language;
|
|
14434
|
+
if (input.safesearch !== undefined)
|
|
14435
|
+
query["safesearch"] = input.safesearch;
|
|
14436
|
+
return this.http.get("/search", { ...options, query });
|
|
14437
|
+
}
|
|
14438
|
+
}
|
|
14439
|
+
|
|
14011
14440
|
// src/resources/social/types.ts
|
|
14012
14441
|
var MESSAGE_ATTACHMENT_MAX_BYTES = 25 * 1024 * 1024;
|
|
14013
14442
|
var MESSAGE_EDIT_WINDOW_MS = 15 * 60 * 1000;
|
|
@@ -15501,6 +15930,8 @@ class Oms {
|
|
|
15501
15930
|
movies;
|
|
15502
15931
|
content;
|
|
15503
15932
|
admin;
|
|
15933
|
+
search;
|
|
15934
|
+
llm;
|
|
15504
15935
|
realtime;
|
|
15505
15936
|
local = local;
|
|
15506
15937
|
constructor(options = {}) {
|
|
@@ -15545,6 +15976,8 @@ class Oms {
|
|
|
15545
15976
|
this.content = new ContentNamespace(this.http);
|
|
15546
15977
|
this.admin = new AdminNamespace(this.http);
|
|
15547
15978
|
this.realtime = new RealtimeNamespace(this.http);
|
|
15979
|
+
this.search = new SearchNamespace(this.http);
|
|
15980
|
+
this.llm = new LlmNamespace(this.http);
|
|
15548
15981
|
}
|
|
15549
15982
|
get baseUrl() {
|
|
15550
15983
|
return this.http.baseUrl;
|
|
@@ -15725,6 +16158,7 @@ export {
|
|
|
15725
16158
|
ShortLinksNamespace,
|
|
15726
16159
|
ServicesStatusNamespace,
|
|
15727
16160
|
ServiceUsagesNamespace,
|
|
16161
|
+
SearchNamespace,
|
|
15728
16162
|
SRMachineNamespace,
|
|
15729
16163
|
SPOTIFY_SYNC_STALE_AFTER_MS,
|
|
15730
16164
|
SPACE_INVADERS_MAX_SESSION_SECONDS,
|
|
@@ -15750,6 +16184,10 @@ export {
|
|
|
15750
16184
|
SESSION_COOKIE_NAME,
|
|
15751
16185
|
SESSION_BEARER_PREFIX_LENGTH,
|
|
15752
16186
|
SERVICE_USAGE_IDS,
|
|
16187
|
+
SEARCH_TIME_RANGES,
|
|
16188
|
+
SEARCH_MAX_QUERY_LENGTH,
|
|
16189
|
+
SEARCH_MAX_PAGE,
|
|
16190
|
+
SEARCH_CATEGORIES,
|
|
15753
16191
|
SAFE_METHODS,
|
|
15754
16192
|
Resource,
|
|
15755
16193
|
RelationshipsNamespace,
|
|
@@ -15793,9 +16231,12 @@ export {
|
|
|
15793
16231
|
OAUTH_APP_MAX_PENDING,
|
|
15794
16232
|
OAUTH_APPROVAL_STATUSES,
|
|
15795
16233
|
NotificationsNamespace,
|
|
16234
|
+
NotificationPreferencesNamespace,
|
|
15796
16235
|
NotepadsNamespace,
|
|
15797
16236
|
NULL_SENTINEL,
|
|
16237
|
+
NOTIFICATION_KINDS,
|
|
15798
16238
|
NOTIFICATION_FILTER_COLUMNS,
|
|
16239
|
+
NOTIFICATION_CATEGORIES,
|
|
15799
16240
|
NATIVE_LOOPBACK_REDIRECT_VALUE,
|
|
15800
16241
|
NATIVE_LOOPBACK_REDIRECT_URIS,
|
|
15801
16242
|
MyOauthApplicationsNamespace,
|
|
@@ -15864,6 +16305,9 @@ export {
|
|
|
15864
16305
|
MAX_PARTS,
|
|
15865
16306
|
MAX_PAGE_SIZE,
|
|
15866
16307
|
MAX_BATCH,
|
|
16308
|
+
LlmNamespace,
|
|
16309
|
+
LlmChatsNamespace,
|
|
16310
|
+
LlmChatMessagesNamespace,
|
|
15867
16311
|
LinkedIdentitiesNamespace,
|
|
15868
16312
|
LinkTreesNamespace,
|
|
15869
16313
|
LibraryShelvesNamespace,
|
|
@@ -15871,6 +16315,15 @@ export {
|
|
|
15871
16315
|
LibraryBooksNamespace,
|
|
15872
16316
|
LibraryAnnotationsNamespace,
|
|
15873
16317
|
LYRICS_TRANSLATION_TARGETS,
|
|
16318
|
+
LLM_USAGE_MAX_DAYS,
|
|
16319
|
+
LLM_TOOL_NAMES,
|
|
16320
|
+
LLM_TOOL_CALL_STATUSES,
|
|
16321
|
+
LLM_PROVIDER_KINDS,
|
|
16322
|
+
LLM_LIMIT_KEYS,
|
|
16323
|
+
LLM_CHAT_ROLES,
|
|
16324
|
+
LLM_CHAT_MESSAGE_STATUSES,
|
|
16325
|
+
LLM_CHAT_FILTER_COLUMNS,
|
|
16326
|
+
LLM_CAPABILITY_KEYS,
|
|
15874
16327
|
LINK_TREE_SLUG_MIN_LENGTH,
|
|
15875
16328
|
LINK_TREE_SLUG_MAX_LENGTH,
|
|
15876
16329
|
LINK_TREE_NAMESPACE,
|
|
@@ -16011,6 +16464,10 @@ export {
|
|
|
16011
16464
|
AdminOauthApplicationsNamespace,
|
|
16012
16465
|
AdminNotepadsNamespace,
|
|
16013
16466
|
AdminNamespace,
|
|
16467
|
+
AdminLlmUsageNamespace,
|
|
16468
|
+
AdminLlmProvidersNamespace,
|
|
16469
|
+
AdminLlmModelsNamespace,
|
|
16470
|
+
AdminLlmAssignmentsNamespace,
|
|
16014
16471
|
AdminJobsNamespace,
|
|
16015
16472
|
AdminEventAlertsNamespace,
|
|
16016
16473
|
AdminChestsNamespace,
|
|
@@ -16026,6 +16483,9 @@ export {
|
|
|
16026
16483
|
ANALYSIS_DAILY_WINDOW_DAYS,
|
|
16027
16484
|
ALL_SERVICE_SLUGS,
|
|
16028
16485
|
ADMIN_VOCAL_SEPARATION_FILTER_COLUMNS,
|
|
16486
|
+
ADMIN_LLM_PROVIDER_FILTER_COLUMNS,
|
|
16487
|
+
ADMIN_LLM_MODEL_FILTER_COLUMNS,
|
|
16488
|
+
ADMIN_LLM_ASSIGNMENT_FILTER_COLUMNS,
|
|
16029
16489
|
ADMIN_JOB_FILTER_COLUMNS,
|
|
16030
16490
|
ACCOUNT_SESSION_FILTER_COLUMNS
|
|
16031
16491
|
};
|
package/dist/types/client.d.ts
CHANGED
|
@@ -25,12 +25,14 @@ import { IpLookupNamespace } from "./resources/ipLookup";
|
|
|
25
25
|
import { JobsNamespace } from "./resources/jobs";
|
|
26
26
|
import { LibraryNamespace } from "./resources/library";
|
|
27
27
|
import { LinkTreesNamespace } from "./resources/linkTrees";
|
|
28
|
+
import { LlmNamespace } from "./resources/llm";
|
|
28
29
|
import { MediaNamespace } from "./resources/media";
|
|
29
30
|
import { MoviesNamespace } from "./resources/movies";
|
|
30
31
|
import { MusicNamespace } from "./resources/music/index";
|
|
31
32
|
import { NotepadsNamespace } from "./resources/notepads";
|
|
32
33
|
import { QuotasNamespace } from "./resources/quotas";
|
|
33
34
|
import { RealtimeNamespace } from "./resources/realtime";
|
|
35
|
+
import { SearchNamespace } from "./resources/search";
|
|
34
36
|
import { ShortLinksNamespace } from "./resources/shortLinks";
|
|
35
37
|
import { SocialNamespace } from "./resources/social";
|
|
36
38
|
import { StorageNamespace } from "./resources/storage";
|
|
@@ -177,6 +179,10 @@ export declare class Oms {
|
|
|
177
179
|
readonly content: ContentNamespace;
|
|
178
180
|
/** OAuth client registration for anyone, plus the `/admin/*` routes. */
|
|
179
181
|
readonly admin: AdminNamespace;
|
|
182
|
+
/** Web search: web, images, news and videos through the site's own engine. */
|
|
183
|
+
readonly search: SearchNamespace;
|
|
184
|
+
/** The language models the signed-in person may pick, and their own usage. */
|
|
185
|
+
readonly llm: LlmNamespace;
|
|
180
186
|
/**
|
|
181
187
|
* The WebSocket connection: playback handoff, jams, notifications, job
|
|
182
188
|
* progress. Opens nothing until {@link RealtimeNamespace.connect} is called,
|