@omelhorsite/sdk 0.13.0 → 0.16.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.
Files changed (29) hide show
  1. package/README.md +26 -3
  2. package/dist/index.js +399 -170
  3. package/dist/types/auth/tokens.d.ts +1 -1
  4. package/dist/types/client.d.ts +3 -0
  5. package/dist/types/resources/admin/llm.d.ts +9 -1
  6. package/dist/types/resources/admin/quotas.d.ts +14 -0
  7. package/dist/types/resources/content/blogs.d.ts +111 -31
  8. package/dist/types/resources/content/index.d.ts +4 -4
  9. package/dist/types/resources/content/news/feeds.d.ts +56 -0
  10. package/dist/types/resources/content/news/index.d.ts +36 -0
  11. package/dist/types/resources/content/news/items.d.ts +115 -0
  12. package/dist/types/resources/content/{intel → news}/scripts.d.ts +35 -35
  13. package/dist/types/resources/content/{intel → news}/sources.d.ts +62 -59
  14. package/dist/types/resources/content/notifications.d.ts +2 -2
  15. package/dist/types/resources/cron.d.ts +209 -0
  16. package/dist/types/resources/index.d.ts +1 -0
  17. package/dist/types/resources/llm.d.ts +71 -0
  18. package/dist/types/resources/music/social.d.ts +121 -81
  19. package/dist/types/resources/music/songs.d.ts +39 -1
  20. package/dist/types/resources/quotas.d.ts +8 -5
  21. package/dist/types/resources/search.d.ts +36 -0
  22. package/package.json +1 -1
  23. package/dist/types/resources/content/intel/articles.d.ts +0 -230
  24. package/dist/types/resources/content/intel/config.d.ts +0 -135
  25. package/dist/types/resources/content/intel/index.d.ts +0 -53
  26. package/dist/types/resources/content/intel/items.d.ts +0 -91
  27. package/dist/types/resources/content/intel/reports.d.ts +0 -108
  28. package/dist/types/resources/content/intel/stats.d.ts +0 -105
  29. package/dist/types/resources/content/intel/types.d.ts +0 -86
package/dist/index.js CHANGED
@@ -944,7 +944,14 @@ var OMS_SCOPES = [
944
944
  "tools:write",
945
945
  "storage:read",
946
946
  "storage:write",
947
- "tickets:write"
947
+ "tickets:write",
948
+ "llm",
949
+ "blogs:read",
950
+ "blogs:write",
951
+ "news:read",
952
+ "news:write",
953
+ "cron:read",
954
+ "cron:write"
948
955
  ];
949
956
  var DEFAULT_REFRESH_SKEW_MS = 60000;
950
957
  var REFRESH_REUSE_WINDOW_MS = 5000;
@@ -10418,6 +10425,7 @@ var ADMIN_LLM_MODEL_FILTER_COLUMNS = Object.freeze([
10418
10425
  "name",
10419
10426
  "enabled",
10420
10427
  "visible_in_chat",
10428
+ "tier",
10421
10429
  "free"
10422
10430
  ]);
10423
10431
  var ADMIN_LLM_ASSIGNMENT_FILTER_COLUMNS = Object.freeze(["feature"]);
@@ -10459,6 +10467,8 @@ function modelBody(input) {
10459
10467
  body["enabled"] = input.enabled;
10460
10468
  if (input.visibleInChat !== undefined)
10461
10469
  body["visible_in_chat"] = input.visibleInChat;
10470
+ if (input.tier !== undefined)
10471
+ body["tier"] = input.tier;
10462
10472
  if (input.contextWindow !== undefined)
10463
10473
  body["context_window"] = input.contextWindow;
10464
10474
  if (input.maxOutputTokens !== undefined)
@@ -10692,6 +10702,9 @@ class AdminQuotasNamespace extends Resource {
10692
10702
  }))
10693
10703
  }, options);
10694
10704
  }
10705
+ async setLlmTier(user, tier, options = {}) {
10706
+ return this.http.put(`/admin/users/${encodeURIComponent(user)}/quotas`, { overrides: [], llm_tier: tier }, options);
10707
+ }
10695
10708
  }
10696
10709
 
10697
10710
  // src/resources/admin/shortLinks.ts
@@ -11234,11 +11247,55 @@ class AnalysisNamespace extends Resource {
11234
11247
  }
11235
11248
 
11236
11249
  // src/resources/content/blogs.ts
11250
+ var BLOG_VISIBILITIES = Object.freeze(["public", "unlisted", "private"]);
11251
+ var BLOGS_PER_ACCOUNT = 20;
11252
+
11253
+ class OwnBlogsNamespace extends Resource {
11254
+ async list(options = {}) {
11255
+ return this.http.get("/my_blogs", options);
11256
+ }
11257
+ async get(idOrSlug, options = {}) {
11258
+ return this.http.get(`/my_blogs/${encodeURIComponent(String(idOrSlug))}`, options);
11259
+ }
11260
+ async create(input = {}, options = {}) {
11261
+ return this.http.post("/my_blogs", blogBody(input), options);
11262
+ }
11263
+ async update(idOrSlug, input, options = {}) {
11264
+ return this.http.patch(`/my_blogs/${encodeURIComponent(String(idOrSlug))}`, blogBody(input), options);
11265
+ }
11266
+ async delete(idOrSlug, options = {}) {
11267
+ await this.http.delete(`/my_blogs/${encodeURIComponent(String(idOrSlug))}`, options);
11268
+ }
11269
+ async members(idOrSlug, options = {}) {
11270
+ return this.http.get(`/my_blogs/${encodeURIComponent(String(idOrSlug))}/members`, options);
11271
+ }
11272
+ async addMember(idOrSlug, handle, options = {}) {
11273
+ return this.http.post(`/my_blogs/${encodeURIComponent(String(idOrSlug))}/members`, { handle }, options);
11274
+ }
11275
+ async removeMember(idOrSlug, memberOrUserId, options = {}) {
11276
+ await this.http.delete(`/my_blogs/${encodeURIComponent(String(idOrSlug))}/members/${encodeURIComponent(String(memberOrUserId))}`, options);
11277
+ }
11278
+ }
11279
+ function blogBody(input) {
11280
+ const body = {};
11281
+ if (input.slug !== undefined)
11282
+ body["slug"] = input.slug;
11283
+ if (input.name !== undefined)
11284
+ body["name"] = input.name;
11285
+ if (input.description !== undefined)
11286
+ body["description"] = input.description;
11287
+ if (input.visibility !== undefined)
11288
+ body["visibility"] = input.visibility;
11289
+ return body;
11290
+ }
11291
+
11237
11292
  class BlogsNamespace extends Resource {
11238
11293
  posts;
11294
+ own;
11239
11295
  constructor(http) {
11240
11296
  super(http);
11241
11297
  this.posts = new BlogPostsNamespace(http);
11298
+ this.own = new OwnBlogsNamespace(http);
11242
11299
  }
11243
11300
  async discover(options = {}) {
11244
11301
  const body = await this.http.get("/blogs", options);
@@ -11276,7 +11333,15 @@ class BlogPostsNamespace extends Resource {
11276
11333
  return this.http.get(`/blogs/${encodeURIComponent(blogSlug)}/posts/${encodeURIComponent(slug)}`, options);
11277
11334
  }
11278
11335
  async create(input, options = {}) {
11279
- return this.http.post("/blog_posts", input, options);
11336
+ const { blogId, blogSlug, publish, ...fields } = input;
11337
+ const body = { ...fields };
11338
+ if (blogId !== undefined)
11339
+ body["blog_id"] = blogId;
11340
+ if (blogSlug !== undefined)
11341
+ body["blog_slug"] = blogSlug;
11342
+ if (publish !== undefined)
11343
+ body["publish"] = publish;
11344
+ return this.http.post("/blog_posts", body, options);
11280
11345
  }
11281
11346
  async update(id, input, options = {}) {
11282
11347
  return this.http.patch(`/blog_posts/${encodeURIComponent(String(id))}`, input, options);
@@ -11324,141 +11389,146 @@ class FeedbacksNamespace extends Resource {
11324
11389
  }
11325
11390
  }
11326
11391
 
11327
- // src/resources/content/intel/articles.ts
11328
- var INTEL_ARTICLE_FILTER_COLUMNS = Object.freeze(["title", "summary", "category", "importance", "enriched"]);
11392
+ // src/resources/content/news/feeds.ts
11393
+ var NEWS_FEEDS_PER_ACCOUNT = 10;
11394
+ var NEWS_FEED_MIN_RETENTION_DAYS = 7;
11395
+ var NEWS_FEED_MAX_RETENTION_DAYS = 3650;
11396
+ var NEWS_FEED_FILTER_COLUMNS = Object.freeze(["name", "enabled"]);
11329
11397
 
11330
- class IntelArticlesNamespace extends Resource {
11398
+ class NewsFeedsNamespace extends Resource {
11331
11399
  async list(params = {}, options = {}) {
11332
- const top = {};
11333
- if (params.q !== undefined)
11334
- top["q"] = params.q;
11335
- if (params.minImportance !== undefined)
11336
- top["min_importance"] = params.minImportance;
11337
- if (params.sort !== undefined)
11338
- top["sort"] = params.sort;
11339
- return paginate(params, 50, (at) => this.http.get("/intel_articles", { ...options, query: listQuery(params, at, { top }) }));
11400
+ const base = { order: "created_at:asc" };
11401
+ return paginate(params, 50, (at) => this.http.get("/news_feeds", { ...options, query: listQuery(params, at, base) }));
11340
11402
  }
11341
11403
  async get(id, options = {}) {
11342
- return this.http.get(`/intel_articles/${encodeURIComponent(id)}`, options);
11343
- }
11344
- async delete(id, options = {}) {
11345
- await this.http.delete(`/intel_articles/${encodeURIComponent(id)}`, options);
11346
- }
11347
- }
11348
-
11349
- // src/resources/content/intel/config.ts
11350
- var INTEL_PROMPT_KEYS = ["build", "enrich_plan", "enrich_actors", "enrich_synth", "report"];
11351
-
11352
- class IntelConfigNamespace extends Resource {
11353
- async get(options = {}) {
11354
- return this.http.get("/intel_config", options);
11355
- }
11356
- async update(input, options = {}) {
11357
- return this.http.patch("/intel_config", {
11358
- ...input.rubric === undefined ? {} : { rubric: input.rubric },
11359
- ...input.prompts === undefined ? {} : { prompts: input.prompts },
11360
- ...input.buildModel === undefined ? {} : { build_model: input.buildModel },
11361
- ...input.reportModel === undefined ? {} : { report_model: input.reportModel },
11362
- ...input.reportMinImportance === undefined ? {} : { report_min_importance: input.reportMinImportance },
11363
- ...input.enrichMinImportance === undefined ? {} : { enrich_min_importance: input.enrichMinImportance },
11364
- ...input.webSearch === undefined ? {} : { web_search: input.webSearch },
11365
- ...input.maxSources === undefined ? {} : { max_sources: input.maxSources }
11366
- }, options);
11404
+ return this.http.get(`/news_feeds/${encodeURIComponent(id)}`, options);
11367
11405
  }
11368
- }
11369
-
11370
- // src/resources/content/intel/items.ts
11371
- var INTEL_ITEM_FILTER_COLUMNS = Object.freeze(["intel_source_id", "external_id", "title", "content", "url"]);
11372
-
11373
- class IntelItemsNamespace extends Resource {
11374
- async list(params = {}, options = {}) {
11375
- const base = { order: "created_at:desc", exactSearch: { intel_source_id: params.sourceId } };
11376
- return paginate(params, 25, (at) => this.http.get("/intel_items", { ...options, query: listQuery(params, at, base) }));
11406
+ async create(input, options = {}) {
11407
+ return this.http.post("/news_feeds", feedBody(input), { retry: false, ...options });
11377
11408
  }
11378
- async get(id, options = {}) {
11379
- return this.http.get(`/intel_items/${encodeURIComponent(id)}`, options);
11409
+ async update(id, input, options = {}) {
11410
+ return this.http.patch(`/news_feeds/${encodeURIComponent(id)}`, feedBody(input), options);
11380
11411
  }
11381
11412
  async delete(id, options = {}) {
11382
- await this.http.delete(`/intel_items/${encodeURIComponent(id)}`, options);
11413
+ await this.http.delete(`/news_feeds/${encodeURIComponent(id)}`, options);
11383
11414
  }
11384
11415
  }
11416
+ function feedBody(input) {
11417
+ const body = {};
11418
+ if (input.name !== undefined)
11419
+ body["name"] = input.name;
11420
+ if (input.description !== undefined)
11421
+ body["description"] = input.description;
11422
+ if (input.retentionDays !== undefined)
11423
+ body["retention_days"] = input.retentionDays;
11424
+ if (input.enabled !== undefined)
11425
+ body["enabled"] = input.enabled;
11426
+ return body;
11427
+ }
11385
11428
 
11386
- // src/resources/content/intel/reports.ts
11387
- var INTEL_REPORT_FILTER_COLUMNS = Object.freeze(["kind"]);
11429
+ // src/resources/content/news/items.ts
11430
+ var NEWS_ITEM_FILTER_COLUMNS = Object.freeze([
11431
+ "news_feed_id",
11432
+ "news_source_id",
11433
+ "external_id",
11434
+ "title",
11435
+ "content",
11436
+ "url",
11437
+ "media_status",
11438
+ "parent_id"
11439
+ ]);
11388
11440
 
11389
- class IntelReportsNamespace extends Resource {
11441
+ class NewsItemsNamespace extends Resource {
11390
11442
  async list(params = {}, options = {}) {
11391
- const base = { exactSearch: { kind: params.kind } };
11392
- return paginate(params, 50, (at) => this.http.get("/intel_reports", { ...options, query: listQuery(params, at, base) }));
11443
+ const top = {};
11444
+ if (params.query !== undefined)
11445
+ top["query"] = params.query;
11446
+ if (params.since !== undefined)
11447
+ top["since"] = params.since;
11448
+ if (params.until !== undefined)
11449
+ top["until"] = params.until;
11450
+ const base = {
11451
+ order: "created_at:desc",
11452
+ exactSearch: { news_feed_id: params.feedId, news_source_id: params.sourceId },
11453
+ top
11454
+ };
11455
+ return paginate(params, 25, (at) => this.http.get("/news_items", { ...options, query: listQuery(params, at, base) }));
11393
11456
  }
11394
11457
  async get(id, options = {}) {
11395
- return this.http.get(`/intel_reports/${encodeURIComponent(id)}`, options);
11458
+ return this.http.get(`/news_items/${encodeURIComponent(id)}`, options);
11396
11459
  }
11397
11460
  async delete(id, options = {}) {
11398
- await this.http.delete(`/intel_reports/${encodeURIComponent(id)}`, options);
11461
+ await this.http.delete(`/news_items/${encodeURIComponent(id)}`, options);
11399
11462
  }
11400
11463
  }
11401
11464
 
11402
- // src/resources/content/intel/scripts.ts
11403
- var INTEL_SCRIPT_MAX_CODE_BYTES = 64 * 1024;
11404
- var INTEL_SCRIPT_FILTER_COLUMNS = Object.freeze(["name", "builtin", "slug"]);
11465
+ // src/resources/content/news/scripts.ts
11466
+ var NEWS_SCRIPT_MAX_CODE_BYTES = 64 * 1024;
11467
+ var NEWS_SCRIPT_FILTER_COLUMNS = Object.freeze(["name", "builtin", "slug"]);
11405
11468
 
11406
- class IntelScriptsNamespace extends Resource {
11469
+ class NewsScriptsNamespace extends Resource {
11407
11470
  async list(params = {}, options = {}) {
11408
11471
  const base = { order: "created_at:desc", exactSearch: { builtin: params.builtin } };
11409
- return paginate(params, 100, (at) => this.http.get("/intel_scripts", { ...options, query: listQuery(params, at, base) }));
11472
+ return paginate(params, 100, (at) => this.http.get("/news_scripts", { ...options, query: listQuery(params, at, base) }));
11410
11473
  }
11411
11474
  async get(id, options = {}) {
11412
- return this.http.get(`/intel_scripts/${encodeURIComponent(id)}`, options);
11475
+ return this.http.get(`/news_scripts/${encodeURIComponent(id)}`, options);
11413
11476
  }
11414
11477
  async create(input, options = {}) {
11415
- return this.http.post("/intel_scripts", {
11478
+ return this.http.post("/news_scripts", {
11416
11479
  name: input.name,
11417
11480
  code: input.code,
11418
11481
  ...input.description === undefined ? {} : { description: input.description }
11419
11482
  }, { retry: false, ...options });
11420
11483
  }
11421
11484
  async update(id, input, options = {}) {
11422
- return this.http.patch(`/intel_scripts/${encodeURIComponent(id)}`, {
11485
+ return this.http.patch(`/news_scripts/${encodeURIComponent(id)}`, {
11423
11486
  ...input.name === undefined ? {} : { name: input.name },
11424
11487
  ...input.code === undefined ? {} : { code: input.code },
11425
11488
  ...input.description === undefined ? {} : { description: input.description }
11426
11489
  }, options);
11427
11490
  }
11428
11491
  async delete(id, options = {}) {
11429
- await this.http.delete(`/intel_scripts/${encodeURIComponent(id)}`, options);
11492
+ await this.http.delete(`/news_scripts/${encodeURIComponent(id)}`, options);
11430
11493
  }
11431
11494
  }
11432
11495
 
11433
- // src/resources/content/intel/sources.ts
11434
- var INTEL_SOURCE_HEALTHS = ["unknown", "ok", "error"];
11435
- var INTEL_SOURCE_DISABLE_AFTER_FAILURES = 20;
11436
- var INTEL_SOURCE_FILTER_COLUMNS = Object.freeze(["name", "health", "enabled", "intel_script_id"]);
11496
+ // src/resources/content/news/sources.ts
11497
+ var NEWS_SOURCE_HEALTHS = ["unknown", "ok", "error"];
11498
+ var NEWS_SOURCE_DISABLE_AFTER_FAILURES = 20;
11499
+ var NEWS_SOURCE_FILTER_COLUMNS = Object.freeze(["name", "health", "enabled", "news_feed_id", "news_script_id"]);
11437
11500
 
11438
- class IntelSourcesNamespace extends Resource {
11501
+ class NewsSourcesNamespace extends Resource {
11439
11502
  async list(params = {}, options = {}) {
11440
11503
  const base = {
11441
11504
  order: "created_at:desc",
11442
- exactSearch: { health: params.health, enabled: params.enabled, intel_script_id: params.scriptId }
11505
+ exactSearch: {
11506
+ health: params.health,
11507
+ enabled: params.enabled,
11508
+ news_feed_id: params.feedId,
11509
+ news_script_id: params.scriptId
11510
+ }
11443
11511
  };
11444
- return paginate(params, 100, (at) => this.http.get("/intel_sources", { ...options, query: listQuery(params, at, base) }));
11512
+ return paginate(params, 100, (at) => this.http.get("/news_sources", { ...options, query: listQuery(params, at, base) }));
11445
11513
  }
11446
11514
  async get(id, options = {}) {
11447
- return this.http.get(`/intel_sources/${encodeURIComponent(id)}`, options);
11515
+ return this.http.get(`/news_sources/${encodeURIComponent(id)}`, options);
11448
11516
  }
11449
11517
  async create(input, options = {}) {
11450
- return this.http.post("/intel_sources", {
11518
+ return this.http.post("/news_sources", {
11451
11519
  name: input.name,
11452
- intel_script_id: input.intelScriptId,
11520
+ news_script_id: input.scriptId,
11521
+ ...input.newsFeedId === undefined ? {} : { news_feed_id: input.newsFeedId },
11453
11522
  ...input.config === undefined ? {} : { config: input.config },
11454
11523
  ...input.pollIntervalMinutes === undefined ? {} : { poll_interval_minutes: input.pollIntervalMinutes },
11455
11524
  ...input.enabled === undefined ? {} : { enabled: input.enabled }
11456
11525
  }, { retry: false, ...options });
11457
11526
  }
11458
11527
  async update(id, input, options = {}) {
11459
- return this.http.patch(`/intel_sources/${encodeURIComponent(id)}`, {
11528
+ return this.http.patch(`/news_sources/${encodeURIComponent(id)}`, {
11460
11529
  ...input.name === undefined ? {} : { name: input.name },
11461
- ...input.intelScriptId === undefined ? {} : { intel_script_id: input.intelScriptId },
11530
+ ...input.newsFeedId === undefined ? {} : { news_feed_id: input.newsFeedId },
11531
+ ...input.scriptId === undefined ? {} : { news_script_id: input.scriptId },
11462
11532
  ...input.config === undefined ? {} : { config: input.config },
11463
11533
  ...input.pollIntervalMinutes === undefined ? {} : { poll_interval_minutes: input.pollIntervalMinutes },
11464
11534
  ...input.enabled === undefined ? {} : { enabled: input.enabled },
@@ -11466,57 +11536,25 @@ class IntelSourcesNamespace extends Resource {
11466
11536
  }, options);
11467
11537
  }
11468
11538
  async delete(id, options = {}) {
11469
- await this.http.delete(`/intel_sources/${encodeURIComponent(id)}`, options);
11539
+ await this.http.delete(`/news_sources/${encodeURIComponent(id)}`, options);
11470
11540
  }
11471
11541
  async run(id, options = {}) {
11472
- return this.http.post(`/intel_sources/${encodeURIComponent(id)}/run`, undefined, { retry: false, ...options });
11542
+ return this.http.post(`/news_sources/${encodeURIComponent(id)}/run`, undefined, { retry: false, ...options });
11473
11543
  }
11474
11544
  }
11475
11545
 
11476
- // src/resources/content/intel/stats.ts
11477
- class IntelStatsNamespace extends Resource {
11478
- async get(options = {}) {
11479
- return this.http.get("/intel_stats", options);
11480
- }
11481
- }
11482
- // src/resources/content/intel/types.ts
11483
- var INTEL_ARTICLE_CATEGORIES = [
11484
- "incidente",
11485
- "politica",
11486
- "comunidade",
11487
- "sociedade",
11488
- "internacional",
11489
- "economia",
11490
- "outro"
11491
- ];
11492
- var INTEL_REPORT_KINDS = ["6h", "day", "week", "month"];
11493
- var INTEL_IMAGE_PROXY_BASE_URL = "https://wsrv.nl/";
11494
- function intelArticleImageUrl(imageUrl, options = {}) {
11495
- if (!imageUrl)
11496
- return "";
11497
- const width = options.width ?? 480;
11498
- const quality = options.quality ?? 45;
11499
- return `${INTEL_IMAGE_PROXY_BASE_URL}?url=${encodeURIComponent(imageUrl)}&w=${width}&q=${quality}&output=webp&we`;
11500
- }
11501
-
11502
- // src/resources/content/intel/index.ts
11503
- class IntelNamespace extends Resource {
11504
- articles;
11505
- reports;
11546
+ // src/resources/content/news/index.ts
11547
+ class NewsNamespace extends Resource {
11548
+ feeds;
11506
11549
  sources;
11507
11550
  scripts;
11508
11551
  items;
11509
- config;
11510
- stats;
11511
11552
  constructor(http) {
11512
11553
  super(http);
11513
- this.articles = new IntelArticlesNamespace(http);
11514
- this.reports = new IntelReportsNamespace(http);
11515
- this.sources = new IntelSourcesNamespace(http);
11516
- this.scripts = new IntelScriptsNamespace(http);
11517
- this.items = new IntelItemsNamespace(http);
11518
- this.config = new IntelConfigNamespace(http);
11519
- this.stats = new IntelStatsNamespace(http);
11554
+ this.feeds = new NewsFeedsNamespace(http);
11555
+ this.sources = new NewsSourcesNamespace(http);
11556
+ this.scripts = new NewsScriptsNamespace(http);
11557
+ this.items = new NewsItemsNamespace(http);
11520
11558
  }
11521
11559
  }
11522
11560
 
@@ -11549,7 +11587,7 @@ var NOTIFICATION_CATEGORIES = [
11549
11587
  "library",
11550
11588
  "forms",
11551
11589
  "tickets",
11552
- "intel",
11590
+ "news",
11553
11591
  "oauth",
11554
11592
  "admin"
11555
11593
  ];
@@ -11588,8 +11626,9 @@ var NOTIFICATION_KINDS = [
11588
11626
  "form_submission_received",
11589
11627
  "ticket_reply",
11590
11628
  "ticket_status_changed",
11591
- "intel_report_ready",
11592
- "intel_source_failing",
11629
+ "news_source_failing",
11630
+ "cron_run_failed",
11631
+ "cron_run_done",
11593
11632
  "oauth_application_approved",
11594
11633
  "oauth_application_rejected",
11595
11634
  "admin_oauth_application_submitted",
@@ -11711,7 +11750,7 @@ class ContentNamespace extends Resource {
11711
11750
  serviceUsages;
11712
11751
  analysis;
11713
11752
  spaceInvaders;
11714
- intel;
11753
+ news;
11715
11754
  constructor(http) {
11716
11755
  super(http);
11717
11756
  this.blogs = new BlogsNamespace(http);
@@ -11723,10 +11762,135 @@ class ContentNamespace extends Resource {
11723
11762
  this.serviceUsages = new ServiceUsagesNamespace(http);
11724
11763
  this.analysis = new AnalysisNamespace(http);
11725
11764
  this.spaceInvaders = new SpaceInvadersNamespace(http);
11726
- this.intel = new IntelNamespace(http);
11765
+ this.news = new NewsNamespace(http);
11727
11766
  }
11728
11767
  }
11729
11768
 
11769
+ // src/resources/cron.ts
11770
+ var CRON_JOB_SCOPES = Object.freeze([
11771
+ "profile",
11772
+ "news:read",
11773
+ "news:write",
11774
+ "storage:read",
11775
+ "storage:write",
11776
+ "llm",
11777
+ "tools:read",
11778
+ "tools:write",
11779
+ "blogs:read",
11780
+ "blogs:write"
11781
+ ]);
11782
+ var CRON_JOB_HEALTHS = Object.freeze(["unknown", "ok", "error"]);
11783
+ var CRON_JOB_DISABLE_AFTER_FAILURES = 10;
11784
+ var CRON_JOB_MAX_CODE_BYTES = 256 * 1024;
11785
+ var CRON_JOB_MAX_STATE_BYTES = 256 * 1024;
11786
+ var CRON_JOB_MAX_CONFIG_BYTES = 64 * 1024;
11787
+ var CRON_JOB_MIN_INTERVAL_MINUTES = 5;
11788
+ var CRON_JOB_MIN_TIMEOUT_SECONDS = 5;
11789
+ var CRON_JOB_MAX_TIMEOUT_SECONDS = 1200;
11790
+ var CRON_JOB_BASE_MAX_TIMEOUT_SECONDS = 120;
11791
+ var CRON_JOB_FILTER_COLUMNS = Object.freeze(["name", "enabled", "health", "template_slug"]);
11792
+ var CRON_RUN_STATUSES = Object.freeze(["queued", "running", "ok", "error", "timeout", "skipped"]);
11793
+ var CRON_RUN_TRIGGERS = Object.freeze(["schedule", "manual", "test"]);
11794
+ var CRON_RUN_FILTER_COLUMNS = Object.freeze(["cron_job_id", "status", "trigger"]);
11795
+
11796
+ class CronJobsNamespace extends Resource {
11797
+ async list(params = {}, options = {}) {
11798
+ const base = { order: "created_at:asc" };
11799
+ return paginate(params, 50, (at) => this.http.get("/cron_jobs", { ...options, query: listQuery(params, at, base) }));
11800
+ }
11801
+ async get(id, options = {}) {
11802
+ return this.http.get(`/cron_jobs/${encodeURIComponent(id)}`, options);
11803
+ }
11804
+ async create(input, options = {}) {
11805
+ return this.http.post("/cron_jobs", jobBody(input), { retry: false, ...options });
11806
+ }
11807
+ async update(id, input, options = {}) {
11808
+ return this.http.patch(`/cron_jobs/${encodeURIComponent(id)}`, jobBody(input), options);
11809
+ }
11810
+ async delete(id, options = {}) {
11811
+ await this.http.delete(`/cron_jobs/${encodeURIComponent(id)}`, options);
11812
+ }
11813
+ async run(id, options = {}) {
11814
+ return this.http.post(`/cron_jobs/${encodeURIComponent(id)}/run`, {}, { retry: false, ...options });
11815
+ }
11816
+ async test(id, options = {}) {
11817
+ return this.http.post(`/cron_jobs/${encodeURIComponent(id)}/test`, {}, { retry: false, ...options });
11818
+ }
11819
+ async check(code, options = {}) {
11820
+ return this.http.post("/cron_jobs/check", { code }, options);
11821
+ }
11822
+ }
11823
+
11824
+ class CronRunsNamespace extends Resource {
11825
+ async list(params = {}, options = {}) {
11826
+ const base = { order: "created_at:desc", exactSearch: { cron_job_id: params.jobId, status: params.status } };
11827
+ return paginate(params, 50, (at) => this.http.get("/cron_runs", { ...options, query: listQuery(params, at, base) }));
11828
+ }
11829
+ async get(id, options = {}) {
11830
+ return this.http.get(`/cron_runs/${encodeURIComponent(id)}`, options);
11831
+ }
11832
+ async delete(id, options = {}) {
11833
+ await this.http.delete(`/cron_runs/${encodeURIComponent(id)}`, options);
11834
+ }
11835
+ }
11836
+
11837
+ class CronTemplatesNamespace extends Resource {
11838
+ async list(options = {}) {
11839
+ return this.http.get("/cron_templates", options);
11840
+ }
11841
+ async get(slug, options = {}) {
11842
+ return this.http.get(`/cron_templates/${encodeURIComponent(slug)}`, options);
11843
+ }
11844
+ }
11845
+
11846
+ class CronNamespace extends Resource {
11847
+ jobs;
11848
+ runs;
11849
+ templates;
11850
+ constructor(http) {
11851
+ super(http);
11852
+ this.jobs = new CronJobsNamespace(http);
11853
+ this.runs = new CronRunsNamespace(http);
11854
+ this.templates = new CronTemplatesNamespace(http);
11855
+ }
11856
+ }
11857
+ function jobBody(input) {
11858
+ const body = {};
11859
+ if (input.name !== undefined)
11860
+ body["name"] = input.name;
11861
+ if (input.description !== undefined)
11862
+ body["description"] = input.description;
11863
+ if (input.schedule !== undefined)
11864
+ body["schedule"] = input.schedule;
11865
+ if (input.timezone !== undefined)
11866
+ body["timezone"] = input.timezone;
11867
+ if (input.code !== undefined)
11868
+ body["code"] = input.code;
11869
+ if (input.scopes !== undefined)
11870
+ body["scopes"] = [...input.scopes];
11871
+ if (input.config !== undefined)
11872
+ body["config"] = input.config;
11873
+ if (input.secrets !== undefined)
11874
+ body["secrets"] = input.secrets;
11875
+ if (input.state !== undefined)
11876
+ body["state"] = input.state;
11877
+ if (input.network !== undefined)
11878
+ body["network"] = input.network;
11879
+ if (input.timeoutSeconds !== undefined)
11880
+ body["timeout_seconds"] = input.timeoutSeconds;
11881
+ if (input.outputDirId !== undefined)
11882
+ body["output_dir_id"] = input.outputDirId;
11883
+ if (input.enabled !== undefined)
11884
+ body["enabled"] = input.enabled;
11885
+ if (input.notifyOnFailure !== undefined)
11886
+ body["notify_on_failure"] = input.notifyOnFailure;
11887
+ if (input.notifyOnSuccess !== undefined)
11888
+ body["notify_on_success"] = input.notifyOnSuccess;
11889
+ if (input.templateSlug !== undefined)
11890
+ body["template_slug"] = input.templateSlug;
11891
+ return body;
11892
+ }
11893
+
11730
11894
  // src/resources/shortLinks.ts
11731
11895
  var SHORT_LINK_BASE_URL = "https://omelhor.site";
11732
11896
  var SHORT_LINK_FILTER_COLUMNS = Object.freeze(["user_id"]);
@@ -12634,6 +12798,12 @@ class LlmChatsNamespace extends Resource {
12634
12798
  await this.http.delete(`/llm_chats/${encodeURIComponent(id)}`, options);
12635
12799
  }
12636
12800
  }
12801
+ var LLM_COMPLETION_TOOLS = Object.freeze(["web_search", "read_url"]);
12802
+ var LLM_COMPLETION_MAX_MESSAGES = 200;
12803
+ var LLM_COMPLETION_MAX_MESSAGE_CHARS = 1e5;
12804
+ var LLM_COMPLETION_MAX_TOTAL_CHARS = 400000;
12805
+ var LLM_COMPLETION_MAX_OUTPUT_TOKENS = 16000;
12806
+ var LLM_COMPLETION_MAX_TOOL_CALLS = 6;
12637
12807
 
12638
12808
  class LlmNamespace extends Resource {
12639
12809
  chats;
@@ -12644,6 +12814,24 @@ class LlmNamespace extends Resource {
12644
12814
  async models(options = {}) {
12645
12815
  return this.http.get("/llm/models", options);
12646
12816
  }
12817
+ async complete(input, options = {}) {
12818
+ const body = {
12819
+ messages: input.messages.map((message) => ({ role: message.role, content: message.content }))
12820
+ };
12821
+ if (input.model !== undefined)
12822
+ body["model"] = input.model;
12823
+ if (input.json !== undefined)
12824
+ body["json"] = input.json;
12825
+ if (input.temperature !== undefined)
12826
+ body["temperature"] = input.temperature;
12827
+ if (input.maxTokens !== undefined)
12828
+ body["max_tokens"] = input.maxTokens;
12829
+ if (input.tools !== undefined)
12830
+ body["tools"] = [...input.tools];
12831
+ if (input.language !== undefined)
12832
+ body["language"] = input.language;
12833
+ return this.http.post("/llm/completions", body, options);
12834
+ }
12647
12835
  async usage(input = {}, options = {}) {
12648
12836
  const query = {};
12649
12837
  if (input.days !== undefined)
@@ -13521,9 +13709,8 @@ var MUSIC_ASSISTANT_MAX_ACTIONS = 10;
13521
13709
  var MUSIC_ASSISTANT_MAX_BODY_BYTES = 256 * 1024;
13522
13710
  var MUSIC_ASSISTANT_READ_ONLY_AFTER_MS = 2 * 24 * 60 * 60 * 1000;
13523
13711
  var MUSIC_ASSISTANT_TIMEOUT_MS = 90000;
13524
- var MUSIC_DJ_HOURLY_CAP = 40;
13712
+ var MUSIC_DJ_HOURLY_CAP = 90;
13525
13713
  var MUSIC_DJ_TIMEOUT_MS = 120000;
13526
- var MUSIC_DJ_BATCH_SIZE = 4;
13527
13714
 
13528
13715
  class MusicJamsNamespace extends Resource {
13529
13716
  async list(options = {}) {
@@ -13614,33 +13801,31 @@ class MusicAssistantNamespace extends Resource {
13614
13801
  }
13615
13802
 
13616
13803
  class MusicDjNamespace extends Resource {
13617
- interstitial(input, options = {}) {
13618
- const body = { next_song_id: input.nextSongId };
13619
- if (input.previousSongId !== undefined && input.previousSongId !== null) {
13620
- body["previous_song_id"] = input.previousSongId;
13621
- }
13622
- return this.http.post("/music_dj", body, {
13623
- ...options,
13624
- timeoutMs: options.timeoutMs ?? MUSIC_DJ_TIMEOUT_MS,
13625
- retry: options.retry ?? false
13626
- });
13627
- }
13628
- batch(input = {}, options = {}) {
13804
+ next(input = {}, options = {}) {
13629
13805
  const body = {};
13806
+ if (input.sessionId !== undefined)
13807
+ body["session_id"] = input.sessionId;
13630
13808
  if (input.request !== undefined)
13631
13809
  body["request"] = input.request;
13632
- if (input.recentSongIds !== undefined)
13633
- body["recent_song_ids"] = input.recentSongIds;
13634
- if (input.skippedSongIds !== undefined)
13635
- body["skipped_song_ids"] = input.skippedSongIds;
13636
- if (input.batchIndex !== undefined)
13637
- body["batch_index"] = input.batchIndex;
13638
- return this.http.post("/music_dj/batch", body, {
13810
+ if (input.skippedSongId !== undefined)
13811
+ body["skipped_song_id"] = input.skippedSongId;
13812
+ if (input.speak !== undefined)
13813
+ body["speak"] = input.speak;
13814
+ if (input.restart !== undefined)
13815
+ body["restart"] = input.restart;
13816
+ return this.http.post("/music_dj/next", body, {
13639
13817
  ...options,
13640
13818
  timeoutMs: options.timeoutMs ?? MUSIC_DJ_TIMEOUT_MS,
13641
13819
  retry: options.retry ?? false
13642
13820
  });
13643
13821
  }
13822
+ async session(options = {}) {
13823
+ const body = await this.http.get("/music_dj/session", options);
13824
+ return body.session ?? null;
13825
+ }
13826
+ async end(options = {}) {
13827
+ await this.http.delete("/music_dj/session", options);
13828
+ }
13644
13829
  }
13645
13830
 
13646
13831
  class MusicSocialNamespace extends Resource {
@@ -13743,7 +13928,8 @@ var SONG_FILTER_COLUMNS = Object.freeze([
13743
13928
  "album",
13744
13929
  "position",
13745
13930
  "year",
13746
- "artist"
13931
+ "artist",
13932
+ "language"
13747
13933
  ]);
13748
13934
  var SONG_ORDER_COLUMNS = Object.freeze([
13749
13935
  "id",
@@ -13938,7 +14124,13 @@ class MusicSongsNamespace extends Resource {
13938
14124
  return listQuery(params, at, {
13939
14125
  order: at === undefined ? undefined : "created_at:asc",
13940
14126
  search: { title: params.title },
13941
- exactSearch: { album: params.album, year: params.year, id: params.ids, artist: params.artist },
14127
+ exactSearch: {
14128
+ album: params.album,
14129
+ year: params.year,
14130
+ id: params.ids,
14131
+ artist: params.artist,
14132
+ language: params.language
14133
+ },
13942
14134
  top: params.artistRole === undefined ? {} : { artist_role: params.artistRole }
13943
14135
  });
13944
14136
  }
@@ -14020,7 +14212,10 @@ var QUOTA_RESOURCES = [
14020
14212
  "caption_seconds",
14021
14213
  "jumpstyle_edits",
14022
14214
  "storage_nodes",
14023
- "music_storage_bytes"
14215
+ "music_storage_bytes",
14216
+ "llm_requests",
14217
+ "llm_cost_microusd",
14218
+ "search_requests"
14024
14219
  ];
14025
14220
 
14026
14221
  class QuotasNamespace extends Resource {
@@ -14434,8 +14629,17 @@ var SEARCH_CATEGORIES = Object.freeze(["general", "images", "news", "videos"]);
14434
14629
  var SEARCH_TIME_RANGES = Object.freeze(["day", "week", "month", "year"]);
14435
14630
  var SEARCH_MAX_PAGE = 10;
14436
14631
  var SEARCH_MAX_QUERY_LENGTH = 200;
14632
+ var SEARCH_PAGE_MAX_URL_LENGTH = 2000;
14633
+ var SEARCH_PAGE_MIN_CHARS = 200;
14634
+ var SEARCH_PAGE_MAX_CHARS = 20000;
14437
14635
 
14438
14636
  class SearchNamespace extends Resource {
14637
+ async readPage(input, options = {}) {
14638
+ const query = { url: input.url };
14639
+ if (input.maxChars !== undefined)
14640
+ query["max_chars"] = input.maxChars;
14641
+ return this.http.get("/search/page", { ...options, query });
14642
+ }
14439
14643
  async query(input, options = {}) {
14440
14644
  const query = { q: input.q };
14441
14645
  if (input.page !== undefined)
@@ -15947,6 +16151,7 @@ class Oms {
15947
16151
  admin;
15948
16152
  search;
15949
16153
  llm;
16154
+ cron;
15950
16155
  realtime;
15951
16156
  local = local;
15952
16157
  constructor(options = {}) {
@@ -15993,6 +16198,7 @@ class Oms {
15993
16198
  this.realtime = new RealtimeNamespace(this.http);
15994
16199
  this.search = new SearchNamespace(this.http);
15995
16200
  this.llm = new LlmNamespace(this.http);
16201
+ this.cron = new CronNamespace(this.http);
15996
16202
  }
15997
16203
  get baseUrl() {
15998
16204
  return this.http.baseUrl;
@@ -16112,7 +16318,6 @@ export {
16112
16318
  isBookChatBusy,
16113
16319
  isBlock,
16114
16320
  isArtistImportTerminal,
16115
- intelArticleImageUrl,
16116
16321
  headerRecord,
16117
16322
  handshakeUrl,
16118
16323
  generatePassword,
@@ -16200,6 +16405,9 @@ export {
16200
16405
  SESSION_BEARER_PREFIX_LENGTH,
16201
16406
  SERVICE_USAGE_IDS,
16202
16407
  SEARCH_TIME_RANGES,
16408
+ SEARCH_PAGE_MIN_CHARS,
16409
+ SEARCH_PAGE_MAX_URL_LENGTH,
16410
+ SEARCH_PAGE_MAX_CHARS,
16203
16411
  SEARCH_MAX_QUERY_LENGTH,
16204
16412
  SEARCH_MAX_PAGE,
16205
16413
  SEARCH_CATEGORIES,
@@ -16226,6 +16434,7 @@ export {
16226
16434
  PLAYLIST_IMPORT_PREVIEW_BURST_LIMIT_PER_MINUTE,
16227
16435
  PLAYLIST_FILTER_COLUMNS,
16228
16436
  PART_URL_WINDOW,
16437
+ OwnBlogsNamespace,
16229
16438
  OmsTimeoutError,
16230
16439
  OmsQuotaError,
16231
16440
  OmsOAuthError,
@@ -16248,10 +16457,25 @@ export {
16248
16457
  NotificationsNamespace,
16249
16458
  NotificationPreferencesNamespace,
16250
16459
  NotepadsNamespace,
16460
+ NewsSourcesNamespace,
16461
+ NewsScriptsNamespace,
16462
+ NewsNamespace,
16463
+ NewsItemsNamespace,
16464
+ NewsFeedsNamespace,
16251
16465
  NULL_SENTINEL,
16252
16466
  NOTIFICATION_KINDS,
16253
16467
  NOTIFICATION_FILTER_COLUMNS,
16254
16468
  NOTIFICATION_CATEGORIES,
16469
+ NEWS_SOURCE_HEALTHS,
16470
+ NEWS_SOURCE_FILTER_COLUMNS,
16471
+ NEWS_SOURCE_DISABLE_AFTER_FAILURES,
16472
+ NEWS_SCRIPT_MAX_CODE_BYTES,
16473
+ NEWS_SCRIPT_FILTER_COLUMNS,
16474
+ NEWS_ITEM_FILTER_COLUMNS,
16475
+ NEWS_FEED_MIN_RETENTION_DAYS,
16476
+ NEWS_FEED_MAX_RETENTION_DAYS,
16477
+ NEWS_FEED_FILTER_COLUMNS,
16478
+ NEWS_FEEDS_PER_ACCOUNT,
16255
16479
  NATIVE_LOOPBACK_REDIRECT_VALUE,
16256
16480
  NATIVE_LOOPBACK_REDIRECT_URIS,
16257
16481
  MyOauthApplicationsNamespace,
@@ -16283,7 +16507,6 @@ export {
16283
16507
  MUSIC_PRESIGNED_URL_TTL_MS,
16284
16508
  MUSIC_DJ_TIMEOUT_MS,
16285
16509
  MUSIC_DJ_HOURLY_CAP,
16286
- MUSIC_DJ_BATCH_SIZE,
16287
16510
  MUSIC_ASSISTANT_TIMEOUT_MS,
16288
16511
  MUSIC_ASSISTANT_READ_ONLY_AFTER_MS,
16289
16512
  MUSIC_ASSISTANT_MAX_BODY_BYTES,
@@ -16335,6 +16558,12 @@ export {
16335
16558
  LLM_TOOL_CALL_STATUSES,
16336
16559
  LLM_PROVIDER_KINDS,
16337
16560
  LLM_LIMIT_KEYS,
16561
+ LLM_COMPLETION_TOOLS,
16562
+ LLM_COMPLETION_MAX_TOTAL_CHARS,
16563
+ LLM_COMPLETION_MAX_TOOL_CALLS,
16564
+ LLM_COMPLETION_MAX_OUTPUT_TOKENS,
16565
+ LLM_COMPLETION_MAX_MESSAGE_CHARS,
16566
+ LLM_COMPLETION_MAX_MESSAGES,
16338
16567
  LLM_CHAT_ROLES,
16339
16568
  LLM_CHAT_MESSAGE_STATUSES,
16340
16569
  LLM_CHAT_FILTER_COLUMNS,
@@ -16360,27 +16589,7 @@ export {
16360
16589
  JAM_SKIP_MODES,
16361
16590
  JAM_QUEUE_MODES,
16362
16591
  IpLookupNamespace,
16363
- IntelStatsNamespace,
16364
- IntelSourcesNamespace,
16365
- IntelScriptsNamespace,
16366
- IntelReportsNamespace,
16367
- IntelNamespace,
16368
- IntelItemsNamespace,
16369
- IntelConfigNamespace,
16370
- IntelArticlesNamespace,
16371
16592
  INTERNAL_SERVICE_SLUGS,
16372
- INTEL_SOURCE_HEALTHS,
16373
- INTEL_SOURCE_FILTER_COLUMNS,
16374
- INTEL_SOURCE_DISABLE_AFTER_FAILURES,
16375
- INTEL_SCRIPT_MAX_CODE_BYTES,
16376
- INTEL_SCRIPT_FILTER_COLUMNS,
16377
- INTEL_REPORT_KINDS,
16378
- INTEL_REPORT_FILTER_COLUMNS,
16379
- INTEL_PROMPT_KEYS,
16380
- INTEL_ITEM_FILTER_COLUMNS,
16381
- INTEL_IMAGE_PROXY_BASE_URL,
16382
- INTEL_ARTICLE_FILTER_COLUMNS,
16383
- INTEL_ARTICLE_CATEGORIES,
16384
16593
  IDENTITY_PROVIDERS,
16385
16594
  GroupChatsNamespace,
16386
16595
  GroupChatMessagesNamespace,
@@ -16426,10 +16635,28 @@ export {
16426
16635
  DEFAULT_DEVICE_EXPIRY_MS,
16427
16636
  DEFAULT_BATCH_SIZE,
16428
16637
  DEFAULT_BASE_URL,
16638
+ CronTemplatesNamespace,
16639
+ CronRunsNamespace,
16640
+ CronNamespace,
16641
+ CronJobsNamespace,
16429
16642
  ContentNamespace,
16430
16643
  ChestsNamespace,
16431
16644
  ChestEntriesNamespace,
16432
16645
  CaptionsNamespace,
16646
+ CRON_RUN_TRIGGERS,
16647
+ CRON_RUN_STATUSES,
16648
+ CRON_RUN_FILTER_COLUMNS,
16649
+ CRON_JOB_SCOPES,
16650
+ CRON_JOB_MIN_TIMEOUT_SECONDS,
16651
+ CRON_JOB_MIN_INTERVAL_MINUTES,
16652
+ CRON_JOB_MAX_TIMEOUT_SECONDS,
16653
+ CRON_JOB_MAX_STATE_BYTES,
16654
+ CRON_JOB_MAX_CONFIG_BYTES,
16655
+ CRON_JOB_MAX_CODE_BYTES,
16656
+ CRON_JOB_HEALTHS,
16657
+ CRON_JOB_FILTER_COLUMNS,
16658
+ CRON_JOB_DISABLE_AFTER_FAILURES,
16659
+ CRON_JOB_BASE_MAX_TIMEOUT_SECONDS,
16433
16660
  CAPTION_UPLOAD_TOKEN_TTL_MS,
16434
16661
  CAPTION_UPLOAD_CONCURRENCY,
16435
16662
  CAPTION_PART_SIZE,
@@ -16466,6 +16693,8 @@ export {
16466
16693
  BOOK_ANNOTATION_NOTE_MAX_LENGTH,
16467
16694
  BOOK_ANNOTATION_KINDS,
16468
16695
  BOOK_ANNOTATION_FILTER_COLUMNS,
16696
+ BLOG_VISIBILITIES,
16697
+ BLOGS_PER_ACCOUNT,
16469
16698
  BASE_FILTER_COLUMNS,
16470
16699
  AuthorizedApplicationsNamespace,
16471
16700
  AuthSessionsNamespace,