@mestra-dev/contract 0.0.231 → 0.0.232

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 (2) hide show
  1. package/dist/index.d.ts +69 -197
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4,6 +4,13 @@ import type { JwtVariables } from 'hono/jwt';
4
4
  type FinanceCurrency = "ruble" | "dollar" | "euro";
5
5
  type FinanceTransactionType = "refund" | "income" | "expense" | "transfer";
6
6
  type GrowthDirection = "positive" | "negative" | "none";
7
+ type AiUnavailableReason =
8
+ /** AI_ENABLED is not set: the master switch for the whole deployment. */
9
+ "service_disabled" | "no_subscription" | "subscription_not_active"
10
+ /** An unpaid invoice is outstanding, which also blocks ordinary writes. */
11
+ | "payment_pending" | "plan_has_no_ai" | "allowance_exhausted"
12
+ /** The workspace has AI switched off in its own settings. */
13
+ | "workspace_disabled";
7
14
  type Variables = JwtVariables;
8
15
  /** Shared error body for middleware / HTTPException responses (typed into AppType). */
9
16
  export type ApiError = {
@@ -6064,6 +6071,12 @@ declare const routes: import("hono/hono-base").HonoBase<{
6064
6071
  } | undefined;
6065
6072
  };
6066
6073
  readonly status: number;
6074
+ readonly body: {
6075
+ readonly locked: boolean;
6076
+ pipeThrough: never;
6077
+ pipeTo: never;
6078
+ values: never;
6079
+ } | null;
6067
6080
  readonly ok: boolean;
6068
6081
  config: {
6069
6082
  headers: {
@@ -7675,12 +7688,6 @@ declare const routes: import("hono/hono-base").HonoBase<{
7675
7688
  };
7676
7689
  readonly redirected: boolean;
7677
7690
  readonly statusText: string;
7678
- readonly body: {
7679
- readonly locked: boolean;
7680
- pipeThrough: never;
7681
- pipeTo: never;
7682
- values: never;
7683
- } | null;
7684
7691
  readonly bodyUsed: boolean;
7685
7692
  };
7686
7693
  };
@@ -9635,7 +9642,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
9635
9642
  roomId: string;
9636
9643
  sender: string;
9637
9644
  channel: string;
9638
- text: string;
9645
+ msgtype?: string | undefined;
9646
+ text?: string | undefined;
9639
9647
  sentAt?: number | undefined;
9640
9648
  }[];
9641
9649
  };
@@ -9654,7 +9662,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
9654
9662
  roomId: string;
9655
9663
  sender: string;
9656
9664
  channel: string;
9657
- text: string;
9665
+ msgtype?: string | undefined;
9666
+ text?: string | undefined;
9658
9667
  sentAt?: number | undefined;
9659
9668
  }[];
9660
9669
  };
@@ -9677,12 +9686,10 @@ declare const routes: import("hono/hono-base").HonoBase<{
9677
9686
  };
9678
9687
  output: {
9679
9688
  success: true;
9680
- settings: {
9681
- enabled: boolean;
9682
- systemPrompt: string | null;
9683
- monthlyTokenLimit: number | null;
9684
- tokensUsedThisMonth: number;
9685
- };
9689
+ settings: any;
9690
+ availability: any;
9691
+ schedule: any;
9692
+ activeActivation: any;
9686
9693
  };
9687
9694
  outputFormat: "json";
9688
9695
  status: 200;
@@ -9696,7 +9703,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
9696
9703
  workspace: string;
9697
9704
  enabled?: boolean | undefined;
9698
9705
  systemPrompt?: string | null | undefined;
9699
- monthlyTokenLimit?: number | null | undefined;
9706
+ preferences?: {
9707
+ [x: string]: unknown;
9708
+ } | undefined;
9700
9709
  };
9701
9710
  };
9702
9711
  output: {
@@ -9704,100 +9713,22 @@ declare const routes: import("hono/hono-base").HonoBase<{
9704
9713
  settings: {
9705
9714
  enabled: boolean;
9706
9715
  systemPrompt: string | null;
9707
- monthlyTokenLimit: number | null;
9708
- };
9709
- };
9710
- outputFormat: "json";
9711
- status: 200;
9712
- };
9713
- };
9714
- } & {
9715
- "/rooms/list/:workspace": {
9716
- $get: {
9717
- input: {
9718
- param: {
9719
- workspace: string;
9716
+ preferences: {
9717
+ [x: string]: import("hono/utils/types").JSONValue;
9718
+ };
9720
9719
  };
9721
9720
  };
9722
- output: {
9723
- success: true;
9724
- rooms: {
9725
- roomId: string;
9726
- mode: "disabled" | "suggestion" | "automatic";
9727
- updated_at: string | null;
9728
- }[];
9729
- };
9730
9721
  outputFormat: "json";
9731
9722
  status: 200;
9732
9723
  };
9733
9724
  };
9734
9725
  } & {
9735
- "/rooms/mode": {
9726
+ "/suggest": {
9736
9727
  $post: {
9737
9728
  input: {
9738
9729
  json: {
9739
9730
  workspace: string;
9740
9731
  roomId: string;
9741
- mode: "disabled" | "suggestion" | "automatic" | null;
9742
- };
9743
- };
9744
- output: {
9745
- success: true;
9746
- room: {
9747
- roomId: string;
9748
- mode: null;
9749
- };
9750
- };
9751
- outputFormat: "json";
9752
- status: 200;
9753
- } | {
9754
- input: {
9755
- json: {
9756
- workspace: string;
9757
- roomId: string;
9758
- mode: "disabled" | "suggestion" | "automatic" | null;
9759
- };
9760
- };
9761
- output: {
9762
- success: true;
9763
- room: {
9764
- roomId: string;
9765
- mode: "disabled" | "suggestion" | "automatic";
9766
- };
9767
- };
9768
- outputFormat: "json";
9769
- status: 200;
9770
- };
9771
- };
9772
- } & {
9773
- "/suggestions/list/:workspace": {
9774
- $get: {
9775
- input: {
9776
- param: {
9777
- workspace: string;
9778
- };
9779
- };
9780
- output: {
9781
- success: true;
9782
- suggestions: {
9783
- id: string;
9784
- roomId: string;
9785
- channel: string;
9786
- text: string;
9787
- created_at: string;
9788
- }[];
9789
- };
9790
- outputFormat: "json";
9791
- status: 200;
9792
- };
9793
- };
9794
- } & {
9795
- "/suggestions/send": {
9796
- $post: {
9797
- input: {
9798
- json: {
9799
- workspace: string;
9800
- replyId: string;
9801
9732
  };
9802
9733
  };
9803
9734
  output: {
@@ -9805,85 +9736,23 @@ declare const routes: import("hono/hono-base").HonoBase<{
9805
9736
  error: string;
9806
9737
  };
9807
9738
  outputFormat: "json";
9808
- status: 404;
9739
+ status: 403 | 502 | 409;
9809
9740
  } | {
9810
9741
  input: {
9811
9742
  json: {
9812
9743
  workspace: string;
9813
- replyId: string;
9814
- };
9815
- };
9816
- output: {
9817
- success: false;
9818
- error: string;
9819
- };
9820
- outputFormat: "json";
9821
- status: 400;
9822
- } | {
9823
- input: {
9824
- json: {
9825
- workspace: string;
9826
- replyId: string;
9827
- };
9828
- };
9829
- output: {
9830
- success: false;
9831
- error: string;
9832
- };
9833
- outputFormat: "json";
9834
- status: 502;
9835
- } | {
9836
- input: {
9837
- json: {
9838
- workspace: string;
9839
- replyId: string;
9744
+ roomId: string;
9840
9745
  };
9841
9746
  };
9842
9747
  output: {
9843
9748
  success: true;
9844
- };
9845
- outputFormat: "json";
9846
- status: 200;
9847
- };
9848
- };
9849
- } & {
9850
- "/suggestions/dismiss": {
9851
- $post: {
9852
- input: {
9853
- json: {
9854
- workspace: string;
9855
- replyId: string;
9856
- };
9857
- };
9858
- output: {
9859
- success: false;
9860
- error: string;
9861
- };
9862
- outputFormat: "json";
9863
- status: 404;
9864
- } | {
9865
- input: {
9866
- json: {
9867
- workspace: string;
9868
- replyId: string;
9869
- };
9870
- };
9871
- output: {
9872
- success: false;
9873
- error: string;
9874
- };
9875
- outputFormat: "json";
9876
- status: 400;
9877
- } | {
9878
- input: {
9879
- json: {
9880
- workspace: string;
9881
- replyId: string;
9749
+ suggestion: string;
9750
+ operationId: string;
9751
+ usage: {
9752
+ totalTokens: number;
9753
+ remaining: number;
9882
9754
  };
9883
9755
  };
9884
- output: {
9885
- success: true;
9886
- };
9887
9756
  outputFormat: "json";
9888
9757
  status: 200;
9889
9758
  };
@@ -10804,47 +10673,50 @@ declare const routes: import("hono/hono-base").HonoBase<{
10804
10673
  "/:workspace/ai-usage": {
10805
10674
  $get: {
10806
10675
  input: {
10807
- query: {
10808
- from?: string | string[] | undefined;
10809
- to?: string | string[] | undefined;
10810
- };
10811
- } & {
10812
10676
  param: {
10813
10677
  workspace: string;
10814
10678
  };
10815
10679
  };
10816
10680
  output: {
10817
- success: false;
10818
- error: string;
10819
- };
10820
- outputFormat: "json";
10821
- status: 400;
10822
- } | {
10823
- input: {
10824
- query: {
10825
- from?: string | string[] | undefined;
10826
- to?: string | string[] | undefined;
10681
+ availability: {
10682
+ available: boolean;
10683
+ reason: AiUnavailableReason;
10827
10684
  };
10828
- } & {
10829
- param: {
10830
- workspace: string;
10831
- };
10832
- };
10833
- output: {
10685
+ allowance: number;
10686
+ used: number;
10687
+ remaining: number;
10688
+ period: null;
10689
+ byOperationType: never[];
10690
+ byOperator: never[];
10691
+ byRoom: never[];
10834
10692
  success: true;
10835
10693
  workspaceId: string;
10836
- period: {
10837
- from: string | null;
10838
- to: string | null;
10694
+ } | {
10695
+ availability: {
10696
+ available: true;
10697
+ } | {
10698
+ available: false;
10699
+ reason: AiUnavailableReason;
10839
10700
  };
10840
- usage: {
10841
- requestCount: number;
10842
- promptTokens: number;
10843
- completionTokens: number;
10844
- totalTokens: number;
10701
+ allowance: number;
10702
+ used: number;
10703
+ remaining: number;
10704
+ period: {
10705
+ start: string;
10706
+ end: string;
10707
+ kind: "trial" | "billing";
10845
10708
  };
10846
- tokensUsedThisMonth: number;
10847
- monthlyTokenLimit: number | null;
10709
+ byOperationType: {
10710
+ [x: string]: import("hono/utils/types").JSONValue;
10711
+ }[];
10712
+ byOperator: {
10713
+ [x: string]: import("hono/utils/types").JSONValue;
10714
+ }[];
10715
+ byRoom: {
10716
+ [x: string]: import("hono/utils/types").JSONValue;
10717
+ }[];
10718
+ success: true;
10719
+ workspaceId: string;
10848
10720
  };
10849
10721
  outputFormat: "json";
10850
10722
  status: 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.231",
3
+ "version": "0.0.232",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,