@omelhorsite/sdk 0.5.0 → 0.11.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 +455 -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/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 +2 -2
- package/dist/types/resources/admin.d.ts +0 -1841
- package/dist/types/resources/content.d.ts +0 -2775
- package/dist/types/resources/library.d.ts +0 -1433
- package/dist/types/resources/movies.d.ts +0 -1160
- package/dist/types/resources/social.d.ts +0 -1348
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) {
|
|
@@ -10656,6 +10836,10 @@ class AdminNamespace extends Resource {
|
|
|
10656
10836
|
notepads;
|
|
10657
10837
|
eventAlerts;
|
|
10658
10838
|
users;
|
|
10839
|
+
llmProviders;
|
|
10840
|
+
llmModels;
|
|
10841
|
+
llmAssignments;
|
|
10842
|
+
llmUsage;
|
|
10659
10843
|
constructor(http) {
|
|
10660
10844
|
super(http);
|
|
10661
10845
|
this.myApplications = new MyOauthApplicationsNamespace(http);
|
|
@@ -10670,6 +10854,10 @@ class AdminNamespace extends Resource {
|
|
|
10670
10854
|
this.notepads = new AdminNotepadsNamespace(http);
|
|
10671
10855
|
this.eventAlerts = new AdminEventAlertsNamespace(http);
|
|
10672
10856
|
this.users = new AdminUsersNamespace(http);
|
|
10857
|
+
this.llmProviders = new AdminLlmProvidersNamespace(http);
|
|
10858
|
+
this.llmModels = new AdminLlmModelsNamespace(http);
|
|
10859
|
+
this.llmAssignments = new AdminLlmAssignmentsNamespace(http);
|
|
10860
|
+
this.llmUsage = new AdminLlmUsageNamespace(http);
|
|
10673
10861
|
}
|
|
10674
10862
|
}
|
|
10675
10863
|
|
|
@@ -11338,6 +11526,62 @@ class JokesNamespace extends Resource {
|
|
|
11338
11526
|
|
|
11339
11527
|
// src/resources/content/notifications.ts
|
|
11340
11528
|
var NOTIFICATION_FILTER_COLUMNS = Object.freeze(["user_id"]);
|
|
11529
|
+
var NOTIFICATION_CATEGORIES = [
|
|
11530
|
+
"security",
|
|
11531
|
+
"social",
|
|
11532
|
+
"storage",
|
|
11533
|
+
"tools",
|
|
11534
|
+
"music",
|
|
11535
|
+
"library",
|
|
11536
|
+
"forms",
|
|
11537
|
+
"tickets",
|
|
11538
|
+
"intel",
|
|
11539
|
+
"oauth",
|
|
11540
|
+
"admin"
|
|
11541
|
+
];
|
|
11542
|
+
var NOTIFICATION_KINDS = [
|
|
11543
|
+
"security_new_session",
|
|
11544
|
+
"security_password_changed",
|
|
11545
|
+
"security_email_changed",
|
|
11546
|
+
"security_passkey_added",
|
|
11547
|
+
"security_app_authorized",
|
|
11548
|
+
"friendship_request",
|
|
11549
|
+
"friendship_accepted",
|
|
11550
|
+
"user_followed",
|
|
11551
|
+
"message_received",
|
|
11552
|
+
"group_chat_message",
|
|
11553
|
+
"jam_invite",
|
|
11554
|
+
"fs_grant_received",
|
|
11555
|
+
"chest_expires_soon",
|
|
11556
|
+
"vocal_separation_done",
|
|
11557
|
+
"vocal_separation_failed",
|
|
11558
|
+
"transcription_done",
|
|
11559
|
+
"transcription_failed",
|
|
11560
|
+
"upscale_done",
|
|
11561
|
+
"upscale_failed",
|
|
11562
|
+
"background_removal_done",
|
|
11563
|
+
"background_removal_failed",
|
|
11564
|
+
"caption_job_done",
|
|
11565
|
+
"caption_job_failed",
|
|
11566
|
+
"jumpstyle_job_done",
|
|
11567
|
+
"jumpstyle_job_failed",
|
|
11568
|
+
"song_import_done",
|
|
11569
|
+
"song_import_failed",
|
|
11570
|
+
"spotify_sync_done",
|
|
11571
|
+
"spotify_sync_failed",
|
|
11572
|
+
"artist_import_done",
|
|
11573
|
+
"blog_new_post",
|
|
11574
|
+
"form_submission_received",
|
|
11575
|
+
"ticket_reply",
|
|
11576
|
+
"ticket_status_changed",
|
|
11577
|
+
"intel_report_ready",
|
|
11578
|
+
"intel_source_failing",
|
|
11579
|
+
"oauth_application_approved",
|
|
11580
|
+
"oauth_application_rejected",
|
|
11581
|
+
"admin_oauth_application_submitted",
|
|
11582
|
+
"admin_ticket_created",
|
|
11583
|
+
"admin_feedback_received"
|
|
11584
|
+
];
|
|
11341
11585
|
|
|
11342
11586
|
class NotificationsNamespace extends Resource {
|
|
11343
11587
|
async list(params = {}, options = {}) {
|
|
@@ -11354,6 +11598,9 @@ class NotificationsNamespace extends Resource {
|
|
|
11354
11598
|
async dismiss(id, options = {}) {
|
|
11355
11599
|
await this.http.delete(`/notifications/${encodeURIComponent(String(id))}`, options);
|
|
11356
11600
|
}
|
|
11601
|
+
async unsubscribe(token, options = {}) {
|
|
11602
|
+
return this.http.post("/notifications/unsubscribe", { token }, options);
|
|
11603
|
+
}
|
|
11357
11604
|
}
|
|
11358
11605
|
|
|
11359
11606
|
// src/resources/content/serviceUsages.ts
|
|
@@ -11369,7 +11616,8 @@ var SERVICE_USAGE_IDS = [
|
|
|
11369
11616
|
"messages",
|
|
11370
11617
|
"blogs",
|
|
11371
11618
|
"status",
|
|
11372
|
-
"administration"
|
|
11619
|
+
"administration",
|
|
11620
|
+
"search"
|
|
11373
11621
|
];
|
|
11374
11622
|
|
|
11375
11623
|
class ServiceUsagesNamespace extends Resource {
|
|
@@ -12238,6 +12486,158 @@ class LinkTreesNamespace extends Resource {
|
|
|
12238
12486
|
}
|
|
12239
12487
|
}
|
|
12240
12488
|
|
|
12489
|
+
// src/resources/llm.ts
|
|
12490
|
+
var LLM_CAPABILITY_KEYS = Object.freeze([
|
|
12491
|
+
"vision",
|
|
12492
|
+
"audio",
|
|
12493
|
+
"tools",
|
|
12494
|
+
"json",
|
|
12495
|
+
"reasoning",
|
|
12496
|
+
"streaming"
|
|
12497
|
+
]);
|
|
12498
|
+
var LLM_LIMIT_KEYS = Object.freeze([
|
|
12499
|
+
"rpm",
|
|
12500
|
+
"requests_per_day_per_user",
|
|
12501
|
+
"tokens_per_day_per_user"
|
|
12502
|
+
]);
|
|
12503
|
+
var LLM_USAGE_MAX_DAYS = 90;
|
|
12504
|
+
var LLM_CHAT_FILTER_COLUMNS = Object.freeze(["title", "pinned", "archived", "llm_model_id", "tools_enabled", "account_tools_enabled"]);
|
|
12505
|
+
var LLM_CHAT_ROLES = Object.freeze(["user", "assistant", "system", "tool"]);
|
|
12506
|
+
var LLM_CHAT_MESSAGE_STATUSES = Object.freeze(["streaming", "done", "error"]);
|
|
12507
|
+
var LLM_TOOL_NAMES = Object.freeze(["web_search", "read_url", "search", "execute"]);
|
|
12508
|
+
var LLM_TOOL_CALL_STATUSES = Object.freeze(["running", "done", "error"]);
|
|
12509
|
+
function toEvent(frame) {
|
|
12510
|
+
if (typeof frame.error === "string") {
|
|
12511
|
+
return { type: "error", error: frame.error, message: frame.message ?? frame.error, messageId: frame.message_id ?? null };
|
|
12512
|
+
}
|
|
12513
|
+
if (frame.done === true) {
|
|
12514
|
+
return {
|
|
12515
|
+
type: "done",
|
|
12516
|
+
messageId: frame.message_id ?? "",
|
|
12517
|
+
modelId: frame.model_id ?? null,
|
|
12518
|
+
inputTokens: frame.input_tokens ?? null,
|
|
12519
|
+
outputTokens: frame.output_tokens ?? null,
|
|
12520
|
+
cost: frame.cost ?? null,
|
|
12521
|
+
durationMs: frame.duration_ms ?? null,
|
|
12522
|
+
firstTokenMs: frame.first_token_ms ?? null
|
|
12523
|
+
};
|
|
12524
|
+
}
|
|
12525
|
+
if (typeof frame.delta === "string" && frame.delta.length > 0)
|
|
12526
|
+
return { type: "delta", delta: frame.delta };
|
|
12527
|
+
if (frame.tool && typeof frame.tool.name === "string")
|
|
12528
|
+
return { type: "tool", ...frame.tool };
|
|
12529
|
+
return;
|
|
12530
|
+
}
|
|
12531
|
+
|
|
12532
|
+
class LlmChatMessagesNamespace extends Resource {
|
|
12533
|
+
send(chatId, input, options = {}) {
|
|
12534
|
+
const body = { content: input.content };
|
|
12535
|
+
if (input.llmModelId !== undefined)
|
|
12536
|
+
body["llm_model_id"] = input.llmModelId;
|
|
12537
|
+
return this.stream("POST", `/llm_chats/${encodeURIComponent(chatId)}/messages`, { ...options, body });
|
|
12538
|
+
}
|
|
12539
|
+
regenerate(chatId, messageId, options = {}) {
|
|
12540
|
+
return this.stream("POST", `/llm_chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}/regenerate`, options);
|
|
12541
|
+
}
|
|
12542
|
+
async delete(chatId, messageId, options = {}) {
|
|
12543
|
+
await this.http.delete(`/llm_chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}`, options);
|
|
12544
|
+
}
|
|
12545
|
+
async* stream(method, path, options) {
|
|
12546
|
+
let buffer = "";
|
|
12547
|
+
for await (const chunk of this.http.streamText(method, path, options)) {
|
|
12548
|
+
buffer += chunk;
|
|
12549
|
+
for (;; ) {
|
|
12550
|
+
const newline = buffer.indexOf(`
|
|
12551
|
+
`);
|
|
12552
|
+
if (newline === -1)
|
|
12553
|
+
break;
|
|
12554
|
+
const line = buffer.slice(0, newline).trim();
|
|
12555
|
+
buffer = buffer.slice(newline + 1);
|
|
12556
|
+
if (!line.startsWith("data:"))
|
|
12557
|
+
continue;
|
|
12558
|
+
const data = line.slice(5).trim();
|
|
12559
|
+
if (data.length === 0)
|
|
12560
|
+
continue;
|
|
12561
|
+
let frame;
|
|
12562
|
+
try {
|
|
12563
|
+
frame = JSON.parse(data);
|
|
12564
|
+
} catch {
|
|
12565
|
+
continue;
|
|
12566
|
+
}
|
|
12567
|
+
const event = toEvent(frame);
|
|
12568
|
+
if (event === undefined)
|
|
12569
|
+
continue;
|
|
12570
|
+
yield event;
|
|
12571
|
+
if (event.type === "done" || event.type === "error")
|
|
12572
|
+
return;
|
|
12573
|
+
}
|
|
12574
|
+
}
|
|
12575
|
+
yield { type: "error", error: "interrupted", message: "The answer was cut short.", messageId: null };
|
|
12576
|
+
}
|
|
12577
|
+
}
|
|
12578
|
+
|
|
12579
|
+
class LlmChatsNamespace extends Resource {
|
|
12580
|
+
messages;
|
|
12581
|
+
constructor(http) {
|
|
12582
|
+
super(http);
|
|
12583
|
+
this.messages = new LlmChatMessagesNamespace(http);
|
|
12584
|
+
}
|
|
12585
|
+
async list(params = {}, options = {}) {
|
|
12586
|
+
return paginate(params, 50, (at) => this.http.get("/llm_chats", { ...options, query: listQuery(params, at) }));
|
|
12587
|
+
}
|
|
12588
|
+
async get(id, options = {}) {
|
|
12589
|
+
return this.http.get(`/llm_chats/${encodeURIComponent(id)}`, options);
|
|
12590
|
+
}
|
|
12591
|
+
async create(input = {}, options = {}) {
|
|
12592
|
+
const body = {};
|
|
12593
|
+
if (input.title !== undefined)
|
|
12594
|
+
body["title"] = input.title;
|
|
12595
|
+
if (input.llmModelId !== undefined)
|
|
12596
|
+
body["llm_model_id"] = input.llmModelId;
|
|
12597
|
+
if (input.toolsEnabled !== undefined)
|
|
12598
|
+
body["tools_enabled"] = input.toolsEnabled;
|
|
12599
|
+
if (input.accountToolsEnabled !== undefined)
|
|
12600
|
+
body["account_tools_enabled"] = input.accountToolsEnabled;
|
|
12601
|
+
return this.http.post("/llm_chats", body, options);
|
|
12602
|
+
}
|
|
12603
|
+
async update(id, input, options = {}) {
|
|
12604
|
+
const body = {};
|
|
12605
|
+
if (input.title !== undefined)
|
|
12606
|
+
body["title"] = input.title;
|
|
12607
|
+
if (input.llmModelId !== undefined)
|
|
12608
|
+
body["llm_model_id"] = input.llmModelId;
|
|
12609
|
+
if (input.pinned !== undefined)
|
|
12610
|
+
body["pinned"] = input.pinned;
|
|
12611
|
+
if (input.archived !== undefined)
|
|
12612
|
+
body["archived"] = input.archived;
|
|
12613
|
+
if (input.toolsEnabled !== undefined)
|
|
12614
|
+
body["tools_enabled"] = input.toolsEnabled;
|
|
12615
|
+
if (input.accountToolsEnabled !== undefined)
|
|
12616
|
+
body["account_tools_enabled"] = input.accountToolsEnabled;
|
|
12617
|
+
return this.http.patch(`/llm_chats/${encodeURIComponent(id)}`, body, options);
|
|
12618
|
+
}
|
|
12619
|
+
async delete(id, options = {}) {
|
|
12620
|
+
await this.http.delete(`/llm_chats/${encodeURIComponent(id)}`, options);
|
|
12621
|
+
}
|
|
12622
|
+
}
|
|
12623
|
+
|
|
12624
|
+
class LlmNamespace extends Resource {
|
|
12625
|
+
chats;
|
|
12626
|
+
constructor(http) {
|
|
12627
|
+
super(http);
|
|
12628
|
+
this.chats = new LlmChatsNamespace(http);
|
|
12629
|
+
}
|
|
12630
|
+
async models(options = {}) {
|
|
12631
|
+
return this.http.get("/llm/models", options);
|
|
12632
|
+
}
|
|
12633
|
+
async usage(input = {}, options = {}) {
|
|
12634
|
+
const query = {};
|
|
12635
|
+
if (input.days !== undefined)
|
|
12636
|
+
query["days"] = input.days;
|
|
12637
|
+
return this.http.get("/llm/usage", { ...options, query });
|
|
12638
|
+
}
|
|
12639
|
+
}
|
|
12640
|
+
|
|
12241
12641
|
// src/resources/media.ts
|
|
12242
12642
|
var MEDIA_URL_TTL_MS = 6 * 60 * 60 * 1000;
|
|
12243
12643
|
var MEDIA_REDIRECT_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -14008,6 +14408,29 @@ class RealtimeNamespace extends Resource {
|
|
|
14008
14408
|
}
|
|
14009
14409
|
}
|
|
14010
14410
|
|
|
14411
|
+
// src/resources/search.ts
|
|
14412
|
+
var SEARCH_CATEGORIES = Object.freeze(["general", "images", "news", "videos"]);
|
|
14413
|
+
var SEARCH_TIME_RANGES = Object.freeze(["day", "week", "month", "year"]);
|
|
14414
|
+
var SEARCH_MAX_PAGE = 10;
|
|
14415
|
+
var SEARCH_MAX_QUERY_LENGTH = 200;
|
|
14416
|
+
|
|
14417
|
+
class SearchNamespace extends Resource {
|
|
14418
|
+
async query(input, options = {}) {
|
|
14419
|
+
const query = { q: input.q };
|
|
14420
|
+
if (input.page !== undefined)
|
|
14421
|
+
query["page"] = input.page;
|
|
14422
|
+
if (input.category !== undefined)
|
|
14423
|
+
query["category"] = input.category;
|
|
14424
|
+
if (input.timeRange !== undefined)
|
|
14425
|
+
query["time_range"] = input.timeRange;
|
|
14426
|
+
if (input.language !== undefined)
|
|
14427
|
+
query["language"] = input.language;
|
|
14428
|
+
if (input.safesearch !== undefined)
|
|
14429
|
+
query["safesearch"] = input.safesearch;
|
|
14430
|
+
return this.http.get("/search", { ...options, query });
|
|
14431
|
+
}
|
|
14432
|
+
}
|
|
14433
|
+
|
|
14011
14434
|
// src/resources/social/types.ts
|
|
14012
14435
|
var MESSAGE_ATTACHMENT_MAX_BYTES = 25 * 1024 * 1024;
|
|
14013
14436
|
var MESSAGE_EDIT_WINDOW_MS = 15 * 60 * 1000;
|
|
@@ -15501,6 +15924,8 @@ class Oms {
|
|
|
15501
15924
|
movies;
|
|
15502
15925
|
content;
|
|
15503
15926
|
admin;
|
|
15927
|
+
search;
|
|
15928
|
+
llm;
|
|
15504
15929
|
realtime;
|
|
15505
15930
|
local = local;
|
|
15506
15931
|
constructor(options = {}) {
|
|
@@ -15545,6 +15970,8 @@ class Oms {
|
|
|
15545
15970
|
this.content = new ContentNamespace(this.http);
|
|
15546
15971
|
this.admin = new AdminNamespace(this.http);
|
|
15547
15972
|
this.realtime = new RealtimeNamespace(this.http);
|
|
15973
|
+
this.search = new SearchNamespace(this.http);
|
|
15974
|
+
this.llm = new LlmNamespace(this.http);
|
|
15548
15975
|
}
|
|
15549
15976
|
get baseUrl() {
|
|
15550
15977
|
return this.http.baseUrl;
|
|
@@ -15725,6 +16152,7 @@ export {
|
|
|
15725
16152
|
ShortLinksNamespace,
|
|
15726
16153
|
ServicesStatusNamespace,
|
|
15727
16154
|
ServiceUsagesNamespace,
|
|
16155
|
+
SearchNamespace,
|
|
15728
16156
|
SRMachineNamespace,
|
|
15729
16157
|
SPOTIFY_SYNC_STALE_AFTER_MS,
|
|
15730
16158
|
SPACE_INVADERS_MAX_SESSION_SECONDS,
|
|
@@ -15750,6 +16178,10 @@ export {
|
|
|
15750
16178
|
SESSION_COOKIE_NAME,
|
|
15751
16179
|
SESSION_BEARER_PREFIX_LENGTH,
|
|
15752
16180
|
SERVICE_USAGE_IDS,
|
|
16181
|
+
SEARCH_TIME_RANGES,
|
|
16182
|
+
SEARCH_MAX_QUERY_LENGTH,
|
|
16183
|
+
SEARCH_MAX_PAGE,
|
|
16184
|
+
SEARCH_CATEGORIES,
|
|
15753
16185
|
SAFE_METHODS,
|
|
15754
16186
|
Resource,
|
|
15755
16187
|
RelationshipsNamespace,
|
|
@@ -15793,9 +16225,12 @@ export {
|
|
|
15793
16225
|
OAUTH_APP_MAX_PENDING,
|
|
15794
16226
|
OAUTH_APPROVAL_STATUSES,
|
|
15795
16227
|
NotificationsNamespace,
|
|
16228
|
+
NotificationPreferencesNamespace,
|
|
15796
16229
|
NotepadsNamespace,
|
|
15797
16230
|
NULL_SENTINEL,
|
|
16231
|
+
NOTIFICATION_KINDS,
|
|
15798
16232
|
NOTIFICATION_FILTER_COLUMNS,
|
|
16233
|
+
NOTIFICATION_CATEGORIES,
|
|
15799
16234
|
NATIVE_LOOPBACK_REDIRECT_VALUE,
|
|
15800
16235
|
NATIVE_LOOPBACK_REDIRECT_URIS,
|
|
15801
16236
|
MyOauthApplicationsNamespace,
|
|
@@ -15864,6 +16299,9 @@ export {
|
|
|
15864
16299
|
MAX_PARTS,
|
|
15865
16300
|
MAX_PAGE_SIZE,
|
|
15866
16301
|
MAX_BATCH,
|
|
16302
|
+
LlmNamespace,
|
|
16303
|
+
LlmChatsNamespace,
|
|
16304
|
+
LlmChatMessagesNamespace,
|
|
15867
16305
|
LinkedIdentitiesNamespace,
|
|
15868
16306
|
LinkTreesNamespace,
|
|
15869
16307
|
LibraryShelvesNamespace,
|
|
@@ -15871,6 +16309,15 @@ export {
|
|
|
15871
16309
|
LibraryBooksNamespace,
|
|
15872
16310
|
LibraryAnnotationsNamespace,
|
|
15873
16311
|
LYRICS_TRANSLATION_TARGETS,
|
|
16312
|
+
LLM_USAGE_MAX_DAYS,
|
|
16313
|
+
LLM_TOOL_NAMES,
|
|
16314
|
+
LLM_TOOL_CALL_STATUSES,
|
|
16315
|
+
LLM_PROVIDER_KINDS,
|
|
16316
|
+
LLM_LIMIT_KEYS,
|
|
16317
|
+
LLM_CHAT_ROLES,
|
|
16318
|
+
LLM_CHAT_MESSAGE_STATUSES,
|
|
16319
|
+
LLM_CHAT_FILTER_COLUMNS,
|
|
16320
|
+
LLM_CAPABILITY_KEYS,
|
|
15874
16321
|
LINK_TREE_SLUG_MIN_LENGTH,
|
|
15875
16322
|
LINK_TREE_SLUG_MAX_LENGTH,
|
|
15876
16323
|
LINK_TREE_NAMESPACE,
|
|
@@ -16011,6 +16458,10 @@ export {
|
|
|
16011
16458
|
AdminOauthApplicationsNamespace,
|
|
16012
16459
|
AdminNotepadsNamespace,
|
|
16013
16460
|
AdminNamespace,
|
|
16461
|
+
AdminLlmUsageNamespace,
|
|
16462
|
+
AdminLlmProvidersNamespace,
|
|
16463
|
+
AdminLlmModelsNamespace,
|
|
16464
|
+
AdminLlmAssignmentsNamespace,
|
|
16014
16465
|
AdminJobsNamespace,
|
|
16015
16466
|
AdminEventAlertsNamespace,
|
|
16016
16467
|
AdminChestsNamespace,
|
|
@@ -16026,6 +16477,9 @@ export {
|
|
|
16026
16477
|
ANALYSIS_DAILY_WINDOW_DAYS,
|
|
16027
16478
|
ALL_SERVICE_SLUGS,
|
|
16028
16479
|
ADMIN_VOCAL_SEPARATION_FILTER_COLUMNS,
|
|
16480
|
+
ADMIN_LLM_PROVIDER_FILTER_COLUMNS,
|
|
16481
|
+
ADMIN_LLM_MODEL_FILTER_COLUMNS,
|
|
16482
|
+
ADMIN_LLM_ASSIGNMENT_FILTER_COLUMNS,
|
|
16029
16483
|
ADMIN_JOB_FILTER_COLUMNS,
|
|
16030
16484
|
ACCOUNT_SESSION_FILTER_COLUMNS
|
|
16031
16485
|
};
|
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,
|