@awesomate/platform-sdk 0.7.0 → 0.8.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 CHANGED
@@ -79,6 +79,9 @@ const admin = new ServiceClient({
79
79
 
80
80
  await admin.upsertTenant("dale", { contact_id: 42, display_name: "Dale", plan: "pro" }, `kt:dale:${version}`);
81
81
  const minted = await admin.mintKey("dale", { class: "p", name: "social console", allowed_origins: ["https://social.awesomate.ai"] }, "key:dale:console:1");
82
+ // a website chatbot key with its own ceilings: 30 answers/min for the key, 1,000 a month
83
+ // (q and p keys only). The platform answers 429 monthly_cap_exceeded once the month is spent.
84
+ const capped = await admin.mintKey("dale", { class: "p", name: "site chatbot", agent_id, allowed_origins: ["https://dale.example"], per_minute_cap: 30, monthly_answer_cap: 1000 }, "key:dale:chatbot:1");
82
85
  // minted.data.key is returned exactly once — hand it to its destination and discard.
83
86
  ```
84
87
 
@@ -346,6 +346,8 @@ export type CreateImportBody = {
346
346
  export interface TenantLimits {
347
347
  chat_per_minute?: number;
348
348
  public_chat_per_minute?: number;
349
+ /** Per-visitor ceiling on p-key answers (hashed connecting address). Default 6. */
350
+ public_visitor_per_minute?: number;
349
351
  session_chat_per_minute?: number;
350
352
  max_queued_jobs?: number;
351
353
  /** hard storage ceiling, checked at upload time */
@@ -413,6 +415,14 @@ export interface MintKeyBody {
413
415
  /** The audience the key serves. p keys are always public (anything else is a 400); q keys
414
416
  * default to private (the owner) and may be minted narrower; omit for the class default. */
415
417
  audience?: Audience;
418
+ /**
419
+ * This key's own monthly answer ceiling (q and p keys only; others are a 400). Once the
420
+ * key's metered answers in the current UTC month reach it the platform answers
421
+ * `429 monthly_cap_exceeded` with `Retry-After` = seconds to the next UTC month.
422
+ */
423
+ monthly_answer_cap?: number;
424
+ /** This key's own per-minute ceiling (q and p only). Only ever narrows the class bucket. */
425
+ per_minute_cap?: number;
416
426
  }
417
427
  export interface AgentScope {
418
428
  source_ids: string[];
@@ -562,6 +572,9 @@ export interface MintedKey {
562
572
  key_prefix: string;
563
573
  /** The audience the key serves. Absent on platforms that predate it. */
564
574
  audience?: Audience;
575
+ /** The per-key caps as stored; null when none was set. Absent on older platforms. */
576
+ monthly_answer_cap?: number | null;
577
+ per_minute_cap?: number | null;
565
578
  /** Plaintext — returned by the platform exactly ONCE. Hand it to its destination and discard. */
566
579
  key: string;
567
580
  }
@@ -569,6 +582,8 @@ export interface TenantKeyMeta {
569
582
  key_id: string;
570
583
  key_prefix: string;
571
584
  class?: string;
585
+ monthly_answer_cap?: number | null;
586
+ per_minute_cap?: number | null;
572
587
  scopes?: string[];
573
588
  expires_at?: string | null;
574
589
  }
@@ -346,6 +346,8 @@ export type CreateImportBody = {
346
346
  export interface TenantLimits {
347
347
  chat_per_minute?: number;
348
348
  public_chat_per_minute?: number;
349
+ /** Per-visitor ceiling on p-key answers (hashed connecting address). Default 6. */
350
+ public_visitor_per_minute?: number;
349
351
  session_chat_per_minute?: number;
350
352
  max_queued_jobs?: number;
351
353
  /** hard storage ceiling, checked at upload time */
@@ -413,6 +415,14 @@ export interface MintKeyBody {
413
415
  /** The audience the key serves. p keys are always public (anything else is a 400); q keys
414
416
  * default to private (the owner) and may be minted narrower; omit for the class default. */
415
417
  audience?: Audience;
418
+ /**
419
+ * This key's own monthly answer ceiling (q and p keys only; others are a 400). Once the
420
+ * key's metered answers in the current UTC month reach it the platform answers
421
+ * `429 monthly_cap_exceeded` with `Retry-After` = seconds to the next UTC month.
422
+ */
423
+ monthly_answer_cap?: number;
424
+ /** This key's own per-minute ceiling (q and p only). Only ever narrows the class bucket. */
425
+ per_minute_cap?: number;
416
426
  }
417
427
  export interface AgentScope {
418
428
  source_ids: string[];
@@ -562,6 +572,9 @@ export interface MintedKey {
562
572
  key_prefix: string;
563
573
  /** The audience the key serves. Absent on platforms that predate it. */
564
574
  audience?: Audience;
575
+ /** The per-key caps as stored; null when none was set. Absent on older platforms. */
576
+ monthly_answer_cap?: number | null;
577
+ per_minute_cap?: number | null;
565
578
  /** Plaintext — returned by the platform exactly ONCE. Hand it to its destination and discard. */
566
579
  key: string;
567
580
  }
@@ -569,6 +582,8 @@ export interface TenantKeyMeta {
569
582
  key_id: string;
570
583
  key_prefix: string;
571
584
  class?: string;
585
+ monthly_answer_cap?: number | null;
586
+ per_minute_cap?: number | null;
572
587
  scopes?: string[];
573
588
  expires_at?: string | null;
574
589
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomate/platform-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Typed client for the Awesomate platform /v1 API — tenant API (answer, query, media, ingest, data) and the hub service channel. Browser + Node, no dependencies.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {