@mestra-dev/contract 0.0.231 → 0.0.233

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 +80 -193
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,6 +3,13 @@ import type { JwtVariables } from 'hono/jwt';
3
3
 
4
4
  type FinanceCurrency = "ruble" | "dollar" | "euro";
5
5
  type FinanceTransactionType = "refund" | "income" | "expense" | "transfer";
6
+ type AiUnavailableReason =
7
+ /** AI_ENABLED is not set: the master switch for the whole deployment. */
8
+ "service_disabled" | "no_subscription" | "subscription_not_active"
9
+ /** An unpaid invoice is outstanding, which also blocks ordinary writes. */
10
+ | "payment_pending" | "plan_has_no_ai" | "allowance_exhausted"
11
+ /** The workspace has AI switched off in its own settings. */
12
+ | "workspace_disabled";
6
13
  type GrowthDirection = "positive" | "negative" | "none";
7
14
  type Variables = JwtVariables;
8
15
  /** Shared error body for middleware / HTTPException responses (typed into AppType). */
@@ -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
  };
@@ -9680,8 +9689,21 @@ declare const routes: import("hono/hono-base").HonoBase<{
9680
9689
  settings: {
9681
9690
  enabled: boolean;
9682
9691
  systemPrompt: string | null;
9683
- monthlyTokenLimit: number | null;
9684
- tokensUsedThisMonth: number;
9692
+ preferences: {
9693
+ [x: string]: import("hono/utils/types").JSONValue;
9694
+ };
9695
+ };
9696
+ availability: {
9697
+ available: boolean;
9698
+ reason: AiUnavailableReason | null;
9699
+ allowance: number;
9700
+ used: number;
9701
+ remaining: number;
9702
+ period: {
9703
+ start: string;
9704
+ end: string;
9705
+ kind: "trial" | "billing";
9706
+ } | null;
9685
9707
  };
9686
9708
  };
9687
9709
  outputFormat: "json";
@@ -9696,7 +9718,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
9696
9718
  workspace: string;
9697
9719
  enabled?: boolean | undefined;
9698
9720
  systemPrompt?: string | null | undefined;
9699
- monthlyTokenLimit?: number | null | undefined;
9721
+ preferences?: {
9722
+ [x: string]: unknown;
9723
+ } | undefined;
9700
9724
  };
9701
9725
  };
9702
9726
  output: {
@@ -9704,100 +9728,22 @@ declare const routes: import("hono/hono-base").HonoBase<{
9704
9728
  settings: {
9705
9729
  enabled: boolean;
9706
9730
  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;
9731
+ preferences: {
9732
+ [x: string]: import("hono/utils/types").JSONValue;
9733
+ };
9720
9734
  };
9721
9735
  };
9722
- output: {
9723
- success: true;
9724
- rooms: {
9725
- roomId: string;
9726
- mode: "disabled" | "suggestion" | "automatic";
9727
- updated_at: string | null;
9728
- }[];
9729
- };
9730
9736
  outputFormat: "json";
9731
9737
  status: 200;
9732
9738
  };
9733
9739
  };
9734
9740
  } & {
9735
- "/rooms/mode": {
9741
+ "/suggest": {
9736
9742
  $post: {
9737
9743
  input: {
9738
9744
  json: {
9739
9745
  workspace: string;
9740
9746
  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
9747
  };
9802
9748
  };
9803
9749
  output: {
@@ -9805,85 +9751,23 @@ declare const routes: import("hono/hono-base").HonoBase<{
9805
9751
  error: string;
9806
9752
  };
9807
9753
  outputFormat: "json";
9808
- status: 404;
9754
+ status: 403 | 502 | 409;
9809
9755
  } | {
9810
9756
  input: {
9811
9757
  json: {
9812
9758
  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;
9759
+ roomId: string;
9840
9760
  };
9841
9761
  };
9842
9762
  output: {
9843
9763
  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;
9764
+ suggestion: string;
9765
+ operationId: string;
9766
+ usage: {
9767
+ totalTokens: number;
9768
+ remaining: number;
9882
9769
  };
9883
9770
  };
9884
- output: {
9885
- success: true;
9886
- };
9887
9771
  outputFormat: "json";
9888
9772
  status: 200;
9889
9773
  };
@@ -10804,47 +10688,50 @@ declare const routes: import("hono/hono-base").HonoBase<{
10804
10688
  "/:workspace/ai-usage": {
10805
10689
  $get: {
10806
10690
  input: {
10807
- query: {
10808
- from?: string | string[] | undefined;
10809
- to?: string | string[] | undefined;
10810
- };
10811
- } & {
10812
10691
  param: {
10813
10692
  workspace: string;
10814
10693
  };
10815
10694
  };
10816
10695
  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;
10696
+ availability: {
10697
+ available: boolean;
10698
+ reason: AiUnavailableReason;
10827
10699
  };
10828
- } & {
10829
- param: {
10830
- workspace: string;
10831
- };
10832
- };
10833
- output: {
10700
+ allowance: number;
10701
+ used: number;
10702
+ remaining: number;
10703
+ period: null;
10704
+ byOperationType: never[];
10705
+ byOperator: never[];
10706
+ byRoom: never[];
10834
10707
  success: true;
10835
10708
  workspaceId: string;
10836
- period: {
10837
- from: string | null;
10838
- to: string | null;
10709
+ } | {
10710
+ availability: {
10711
+ available: true;
10712
+ } | {
10713
+ available: false;
10714
+ reason: AiUnavailableReason;
10839
10715
  };
10840
- usage: {
10841
- requestCount: number;
10842
- promptTokens: number;
10843
- completionTokens: number;
10844
- totalTokens: number;
10716
+ allowance: number;
10717
+ used: number;
10718
+ remaining: number;
10719
+ period: {
10720
+ start: string;
10721
+ end: string;
10722
+ kind: "trial" | "billing";
10845
10723
  };
10846
- tokensUsedThisMonth: number;
10847
- monthlyTokenLimit: number | null;
10724
+ byOperationType: {
10725
+ [x: string]: import("hono/utils/types").JSONValue;
10726
+ }[];
10727
+ byOperator: {
10728
+ [x: string]: import("hono/utils/types").JSONValue;
10729
+ }[];
10730
+ byRoom: {
10731
+ [x: string]: import("hono/utils/types").JSONValue;
10732
+ }[];
10733
+ success: true;
10734
+ workspaceId: string;
10848
10735
  };
10849
10736
  outputFormat: "json";
10850
10737
  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.233",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,