@mestra-dev/contract 0.0.216 → 0.0.218

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 +1196 -138
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -123,6 +123,10 @@ declare const routes: import("hono/hono-base").HonoBase<{
123
123
  readonly name: "Notifications";
124
124
  readonly description: "Cursor-based incremental notification sync, plus mark-read / archive (single or all). Clients store the sync cursor and pass it on the next call; mutations bump updated_at so changes propagate via sync.";
125
125
  },
126
+ {
127
+ readonly name: "AI Replies";
128
+ readonly description: "AI-assisted replies to customer messages from connected channels: a workspace on/off switch plus a per-room mode (disabled / suggestion / automatic) that each chat has to be given before anything is answered, the suggestion queue an operator can send or dismiss, and the workspace system prompt and monthly token limit. Requires workspace access and crm::chats read or write.";
129
+ },
126
130
  {
127
131
  readonly name: "Finance";
128
132
  readonly description: "Workspace finance accounts (ordered cards with name, color, currency, opening balance, and optional company/bank details), ledger transactions (income, expense, refund, transfer), and a numbers-visibility toggle for the default finance view. Requires workspace access and crm::finance read or write.";
@@ -1659,6 +1663,150 @@ declare const routes: import("hono/hono-base").HonoBase<{
1659
1663
  };
1660
1664
  };
1661
1665
  };
1666
+ readonly AiSettings: {
1667
+ readonly type: "object";
1668
+ readonly required: readonly [
1669
+ "enabled"
1670
+ ];
1671
+ readonly properties: {
1672
+ readonly enabled: {
1673
+ readonly type: "boolean";
1674
+ readonly description: "The workspace switch. While false no room in the workspace is answered, whatever its own mode says. Turning it on answers nothing by itself: each room still has to be given a mode.";
1675
+ };
1676
+ readonly systemPrompt: {
1677
+ readonly type: "string";
1678
+ readonly nullable: true;
1679
+ readonly description: "Workspace instructions prepended to every AI request.";
1680
+ };
1681
+ readonly monthlyTokenLimit: {
1682
+ readonly type: "integer";
1683
+ readonly nullable: true;
1684
+ readonly description: "Calendar-month token ceiling; null means no limit.";
1685
+ };
1686
+ readonly tokensUsedThisMonth: {
1687
+ readonly type: "integer";
1688
+ readonly description: "Total tokens recorded for the workspace since the start of the month.";
1689
+ };
1690
+ };
1691
+ };
1692
+ readonly AiSettingsSuccess: {
1693
+ readonly type: "object";
1694
+ readonly required: readonly [
1695
+ "success",
1696
+ "settings"
1697
+ ];
1698
+ readonly properties: {
1699
+ readonly success: {
1700
+ readonly type: "boolean";
1701
+ readonly const: true;
1702
+ };
1703
+ readonly settings: {
1704
+ readonly $ref: "#/components/schemas/AiSettings";
1705
+ };
1706
+ };
1707
+ };
1708
+ readonly AiSuggestion: {
1709
+ readonly type: "object";
1710
+ readonly properties: {
1711
+ readonly id: {
1712
+ readonly type: "string";
1713
+ readonly format: "uuid";
1714
+ };
1715
+ readonly roomId: {
1716
+ readonly type: "string";
1717
+ readonly description: "Matrix room the customer messages arrived in.";
1718
+ };
1719
+ readonly channel: {
1720
+ readonly type: "string";
1721
+ readonly description: "Source channel, e.g. telegram or whatsapp.";
1722
+ };
1723
+ readonly text: {
1724
+ readonly type: "string";
1725
+ readonly description: "The generated reply.";
1726
+ };
1727
+ readonly created_at: {
1728
+ readonly type: "string";
1729
+ readonly format: "date-time";
1730
+ };
1731
+ };
1732
+ };
1733
+ readonly ListAiSuggestionsSuccess: {
1734
+ readonly type: "object";
1735
+ readonly required: readonly [
1736
+ "success",
1737
+ "suggestions"
1738
+ ];
1739
+ readonly properties: {
1740
+ readonly success: {
1741
+ readonly type: "boolean";
1742
+ readonly const: true;
1743
+ };
1744
+ readonly suggestions: {
1745
+ readonly type: "array";
1746
+ readonly items: {
1747
+ readonly $ref: "#/components/schemas/AiSuggestion";
1748
+ };
1749
+ readonly description: "Pending suggestions, newest first.";
1750
+ };
1751
+ };
1752
+ };
1753
+ readonly AiUsageSuccess: {
1754
+ readonly type: "object";
1755
+ readonly required: readonly [
1756
+ "success",
1757
+ "usage"
1758
+ ];
1759
+ readonly properties: {
1760
+ readonly success: {
1761
+ readonly type: "boolean";
1762
+ readonly const: true;
1763
+ };
1764
+ readonly workspaceId: {
1765
+ readonly type: "string";
1766
+ readonly format: "uuid";
1767
+ };
1768
+ readonly period: {
1769
+ readonly type: "object";
1770
+ readonly properties: {
1771
+ readonly from: {
1772
+ readonly type: "string";
1773
+ readonly format: "date-time";
1774
+ readonly nullable: true;
1775
+ };
1776
+ readonly to: {
1777
+ readonly type: "string";
1778
+ readonly format: "date-time";
1779
+ readonly nullable: true;
1780
+ };
1781
+ };
1782
+ };
1783
+ readonly usage: {
1784
+ readonly type: "object";
1785
+ readonly properties: {
1786
+ readonly requestCount: {
1787
+ readonly type: "integer";
1788
+ readonly description: "AI requests recorded in the period.";
1789
+ };
1790
+ readonly promptTokens: {
1791
+ readonly type: "integer";
1792
+ };
1793
+ readonly completionTokens: {
1794
+ readonly type: "integer";
1795
+ };
1796
+ readonly totalTokens: {
1797
+ readonly type: "integer";
1798
+ };
1799
+ };
1800
+ };
1801
+ readonly tokensUsedThisMonth: {
1802
+ readonly type: "integer";
1803
+ };
1804
+ readonly monthlyTokenLimit: {
1805
+ readonly type: "integer";
1806
+ readonly nullable: true;
1807
+ };
1808
+ };
1809
+ };
1662
1810
  readonly S3FileObject: {
1663
1811
  readonly type: "object";
1664
1812
  readonly properties: {
@@ -4630,23 +4778,23 @@ declare const routes: import("hono/hono-base").HonoBase<{
4630
4778
  readonly type: "string";
4631
4779
  readonly nullable: true;
4632
4780
  };
4633
- readonly inn: {
4781
+ readonly companyAccountNumber: {
4634
4782
  readonly type: "string";
4635
4783
  readonly nullable: true;
4636
4784
  };
4637
- readonly kpp: {
4785
+ readonly companyInn: {
4638
4786
  readonly type: "string";
4639
4787
  readonly nullable: true;
4640
4788
  };
4641
- readonly ogrn: {
4789
+ readonly companyKpp: {
4642
4790
  readonly type: "string";
4643
4791
  readonly nullable: true;
4644
4792
  };
4645
- readonly bankName: {
4793
+ readonly companyOgrn: {
4646
4794
  readonly type: "string";
4647
4795
  readonly nullable: true;
4648
4796
  };
4649
- readonly bankAccountNumber: {
4797
+ readonly bankName: {
4650
4798
  readonly type: "string";
4651
4799
  readonly nullable: true;
4652
4800
  };
@@ -6143,23 +6291,23 @@ declare const routes: import("hono/hono-base").HonoBase<{
6143
6291
  readonly type: "string";
6144
6292
  readonly nullable: true;
6145
6293
  };
6146
- readonly inn: {
6294
+ readonly companyAccountNumber: {
6147
6295
  readonly type: "string";
6148
6296
  readonly nullable: true;
6149
6297
  };
6150
- readonly kpp: {
6298
+ readonly companyInn: {
6151
6299
  readonly type: "string";
6152
6300
  readonly nullable: true;
6153
6301
  };
6154
- readonly ogrn: {
6302
+ readonly companyKpp: {
6155
6303
  readonly type: "string";
6156
6304
  readonly nullable: true;
6157
6305
  };
6158
- readonly bankName: {
6306
+ readonly companyOgrn: {
6159
6307
  readonly type: "string";
6160
6308
  readonly nullable: true;
6161
6309
  };
6162
- readonly bankAccountNumber: {
6310
+ readonly bankName: {
6163
6311
  readonly type: "string";
6164
6312
  readonly nullable: true;
6165
6313
  };
@@ -16706,41 +16854,69 @@ declare const routes: import("hono/hono-base").HonoBase<{
16706
16854
  };
16707
16855
  };
16708
16856
  };
16709
- readonly "/freason/list/{workspace}": {
16710
- readonly get: {
16857
+ readonly "/ai/inbound": {
16858
+ readonly post: {
16711
16859
  readonly tags: readonly [
16712
- "Failure Reasons"
16713
- ];
16714
- readonly summary: "List failure reasons by workspace";
16715
- readonly description: "Returns all failure reasons for the given workspace. Requires workspace access and read access to crm::tasks.";
16716
- readonly security: readonly [
16717
- never
16860
+ "AI Replies"
16718
16861
  ];
16719
- readonly parameters: readonly [
16720
- {
16721
- readonly name: "workspace";
16722
- readonly in: "path";
16723
- readonly required: true;
16724
- readonly schema: {
16725
- readonly type: "string";
16726
- readonly format: "uuid";
16862
+ readonly summary: "Customer messages forwarded by the Synapse dispatch module";
16863
+ readonly description: "Called by the Synapse module (synapse/aio/mestra_ai_dispatch.py), not by the app. Authenticated with the AI_INBOUND_TOKEN shared secret in an `Authorization: Bearer` header, not a user JWT. The room decides the workspace; messages whose room belongs to no workspace, whose workspace has AI disabled, or that were already forwarded are dropped, so `buffered` can be lower than the number sent. Always returns 202 when the token is valid, including when AI_ENABLED is off, so the module does not retry.";
16864
+ readonly requestBody: {
16865
+ readonly required: true;
16866
+ readonly content: {
16867
+ readonly "application/json": {
16868
+ readonly schema: {
16869
+ readonly type: "object";
16870
+ readonly required: readonly [
16871
+ "messages"
16872
+ ];
16873
+ readonly properties: {
16874
+ readonly messages: {
16875
+ readonly type: "array";
16876
+ readonly maxItems: 200;
16877
+ readonly items: {
16878
+ readonly type: "object";
16879
+ readonly required: readonly [
16880
+ "eventId",
16881
+ "roomId",
16882
+ "sender",
16883
+ "channel",
16884
+ "text"
16885
+ ];
16886
+ readonly properties: any;
16887
+ };
16888
+ };
16889
+ };
16890
+ };
16727
16891
  };
16728
- readonly description: "Workspace identifier.";
16729
- }
16730
- ];
16892
+ };
16893
+ };
16731
16894
  readonly responses: {
16732
- readonly 200: {
16733
- readonly description: "Failure reasons fetched successfully.";
16895
+ readonly 202: {
16896
+ readonly description: "Messages taken. `buffered` is how many were actually stored.";
16734
16897
  readonly content: {
16735
16898
  readonly "application/json": {
16736
16899
  readonly schema: {
16737
- readonly $ref: "#/components/schemas/ListFailureReasonsSuccess";
16900
+ readonly type: "object";
16901
+ readonly required: readonly [
16902
+ "success",
16903
+ "buffered"
16904
+ ];
16905
+ readonly properties: {
16906
+ readonly success: {
16907
+ readonly type: "boolean";
16908
+ readonly const: true;
16909
+ };
16910
+ readonly buffered: {
16911
+ readonly type: "integer";
16912
+ };
16913
+ };
16738
16914
  };
16739
16915
  };
16740
16916
  };
16741
16917
  };
16742
- readonly 401: {
16743
- readonly description: "Unauthorized - Missing or invalid access token.";
16918
+ readonly 400: {
16919
+ readonly description: "Validation error.";
16744
16920
  readonly content: {
16745
16921
  readonly "application/json": {
16746
16922
  readonly schema: {
@@ -16749,8 +16925,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
16749
16925
  };
16750
16926
  };
16751
16927
  };
16752
- readonly 403: {
16753
- readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
16928
+ readonly 401: {
16929
+ readonly description: "Missing or wrong inbound token.";
16754
16930
  readonly content: {
16755
16931
  readonly "application/json": {
16756
16932
  readonly schema: {
@@ -16762,13 +16938,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
16762
16938
  };
16763
16939
  };
16764
16940
  };
16765
- readonly "/freason/get/{workspace}/{failureReasonId}": {
16941
+ readonly "/ai/settings/{workspace}": {
16766
16942
  readonly get: {
16767
16943
  readonly tags: readonly [
16768
- "Failure Reasons"
16944
+ "AI Replies"
16769
16945
  ];
16770
- readonly summary: "Get a failure reason";
16771
- readonly description: "Returns a single failure reason by id. Requires workspace access and read access to crm::tasks.";
16946
+ readonly summary: "Get the workspace AI reply settings";
16947
+ readonly description: "Returns the AI mode, system prompt, monthly token limit, and the tokens used so far this month. Workspaces without a settings row default to `disabled`. Requires workspace access and read access to crm::chats.";
16772
16948
  readonly security: readonly [
16773
16949
  never
16774
16950
  ];
@@ -16782,25 +16958,15 @@ declare const routes: import("hono/hono-base").HonoBase<{
16782
16958
  readonly format: "uuid";
16783
16959
  };
16784
16960
  readonly description: "Workspace identifier.";
16785
- },
16786
- {
16787
- readonly name: "failureReasonId";
16788
- readonly in: "path";
16789
- readonly required: true;
16790
- readonly schema: {
16791
- readonly type: "string";
16792
- readonly format: "uuid";
16793
- };
16794
- readonly description: "Failure reason identifier.";
16795
16961
  }
16796
16962
  ];
16797
16963
  readonly responses: {
16798
16964
  readonly 200: {
16799
- readonly description: "Failure reason fetched successfully.";
16965
+ readonly description: "Settings fetched successfully.";
16800
16966
  readonly content: {
16801
16967
  readonly "application/json": {
16802
16968
  readonly schema: {
16803
- readonly $ref: "#/components/schemas/FailureReasonSuccess";
16969
+ readonly $ref: "#/components/schemas/AiSettingsSuccess";
16804
16970
  };
16805
16971
  };
16806
16972
  };
@@ -16816,17 +16982,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
16816
16982
  };
16817
16983
  };
16818
16984
  readonly 403: {
16819
- readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
16820
- readonly content: {
16821
- readonly "application/json": {
16822
- readonly schema: {
16823
- readonly $ref: "#/components/schemas/ErrorResponse";
16824
- };
16825
- };
16826
- };
16827
- };
16828
- readonly 404: {
16829
- readonly description: "Failure reason not found.";
16985
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::chats.";
16830
16986
  readonly content: {
16831
16987
  readonly "application/json": {
16832
16988
  readonly schema: {
@@ -16838,13 +16994,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
16838
16994
  };
16839
16995
  };
16840
16996
  };
16841
- readonly "/freason/create": {
16997
+ readonly "/ai/settings": {
16842
16998
  readonly post: {
16843
16999
  readonly tags: readonly [
16844
- "Failure Reasons"
17000
+ "AI Replies"
16845
17001
  ];
16846
- readonly summary: "Create a failure reason";
16847
- readonly description: "Creates a failure reason in the specified workspace. Requires workspace access and write access to crm::tasks.";
17002
+ readonly summary: "Set the workspace AI reply mode";
17003
+ readonly description: "Creates or updates the workspace AI settings. `enabled` is the workspace switch; rooms are still off until each is given a mode through /ai/rooms/mode. Every field keeps its current value when omitted, and `systemPrompt` / `monthlyTokenLimit` are cleared when sent as null. Requires workspace access and write access to crm::chats.";
16848
17004
  readonly security: readonly [
16849
17005
  never
16850
17006
  ];
@@ -16855,24 +17011,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
16855
17011
  readonly schema: {
16856
17012
  readonly type: "object";
16857
17013
  readonly required: readonly [
16858
- "workspace",
16859
- "title"
17014
+ "workspace"
16860
17015
  ];
16861
17016
  readonly properties: {
16862
17017
  readonly workspace: {
16863
17018
  readonly type: "string";
16864
17019
  readonly format: "uuid";
16865
- readonly description: "Workspace identifier.";
16866
17020
  };
16867
- readonly title: {
16868
- readonly type: "string";
16869
- readonly maxLength: 256;
16870
- readonly description: "Failure reason title.";
17021
+ readonly enabled: {
17022
+ readonly type: "boolean";
16871
17023
  };
16872
- readonly description: {
17024
+ readonly systemPrompt: {
16873
17025
  readonly type: "string";
16874
- readonly maxLength: 256;
16875
- readonly description: "Optional failure reason description.";
17026
+ readonly nullable: true;
17027
+ readonly maxLength: 2000;
17028
+ };
17029
+ readonly monthlyTokenLimit: {
17030
+ readonly type: "integer";
17031
+ readonly nullable: true;
17032
+ readonly minimum: 0;
16876
17033
  };
16877
17034
  };
16878
17035
  };
@@ -16880,28 +17037,18 @@ declare const routes: import("hono/hono-base").HonoBase<{
16880
17037
  };
16881
17038
  };
16882
17039
  readonly responses: {
16883
- readonly 201: {
16884
- readonly description: "Failure reason created successfully.";
17040
+ readonly 200: {
17041
+ readonly description: "Settings saved.";
16885
17042
  readonly content: {
16886
17043
  readonly "application/json": {
16887
17044
  readonly schema: {
16888
- readonly $ref: "#/components/schemas/FailureReasonSuccess";
17045
+ readonly $ref: "#/components/schemas/AiSettingsSuccess";
16889
17046
  };
16890
17047
  };
16891
17048
  };
16892
17049
  };
16893
17050
  readonly 400: {
16894
- readonly description: "Invalid request payload.";
16895
- readonly content: {
16896
- readonly "application/json": {
16897
- readonly schema: {
16898
- readonly $ref: "#/components/schemas/ErrorResponse";
16899
- };
16900
- };
16901
- };
16902
- };
16903
- readonly 401: {
16904
- readonly description: "Unauthorized - Missing or invalid access token.";
17051
+ readonly description: "Validation error.";
16905
17052
  readonly content: {
16906
17053
  readonly "application/json": {
16907
17054
  readonly schema: {
@@ -16911,17 +17058,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
16911
17058
  };
16912
17059
  };
16913
17060
  readonly 403: {
16914
- readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks.";
16915
- readonly content: {
16916
- readonly "application/json": {
16917
- readonly schema: {
16918
- readonly $ref: "#/components/schemas/ErrorResponse";
16919
- };
16920
- };
16921
- };
16922
- };
16923
- readonly 409: {
16924
- readonly description: "A failure reason with this title already exists.";
17061
+ readonly description: "Forbidden - User lacks workspace access or write access to crm::chats.";
16925
17062
  readonly content: {
16926
17063
  readonly "application/json": {
16927
17064
  readonly schema: {
@@ -16933,8 +17070,664 @@ declare const routes: import("hono/hono-base").HonoBase<{
16933
17070
  };
16934
17071
  };
16935
17072
  };
16936
- readonly "/freason/update": {
16937
- readonly post: {
17073
+ readonly "/ai/rooms/list/{workspace}": {
17074
+ readonly get: {
17075
+ readonly tags: readonly [
17076
+ "AI Replies"
17077
+ ];
17078
+ readonly summary: "List the rooms the AI has been turned on for";
17079
+ readonly description: "Rooms with a mode of their own. Rooms that are not listed are off, even when the workspace is enabled. Requires workspace access and read access to crm::chats.";
17080
+ readonly security: readonly [
17081
+ never
17082
+ ];
17083
+ readonly parameters: readonly [
17084
+ {
17085
+ readonly name: "workspace";
17086
+ readonly in: "path";
17087
+ readonly required: true;
17088
+ readonly schema: {
17089
+ readonly type: "string";
17090
+ readonly format: "uuid";
17091
+ };
17092
+ readonly description: "Workspace identifier.";
17093
+ }
17094
+ ];
17095
+ readonly responses: {
17096
+ readonly 200: {
17097
+ readonly description: "Room modes fetched successfully.";
17098
+ readonly content: {
17099
+ readonly "application/json": {
17100
+ readonly schema: {
17101
+ readonly type: "object";
17102
+ readonly required: readonly [
17103
+ "success",
17104
+ "rooms"
17105
+ ];
17106
+ readonly properties: {
17107
+ readonly success: {
17108
+ readonly type: "boolean";
17109
+ readonly const: true;
17110
+ };
17111
+ readonly rooms: {
17112
+ readonly type: "array";
17113
+ readonly items: any;
17114
+ };
17115
+ };
17116
+ };
17117
+ };
17118
+ };
17119
+ };
17120
+ readonly 403: {
17121
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::chats.";
17122
+ readonly content: {
17123
+ readonly "application/json": {
17124
+ readonly schema: {
17125
+ readonly $ref: "#/components/schemas/ErrorResponse";
17126
+ };
17127
+ };
17128
+ };
17129
+ };
17130
+ };
17131
+ };
17132
+ };
17133
+ readonly "/ai/rooms/mode": {
17134
+ readonly post: {
17135
+ readonly tags: readonly [
17136
+ "AI Replies"
17137
+ ];
17138
+ readonly summary: "Set or clear one room's AI mode";
17139
+ readonly description: "Turns the AI on for a single chat room: `suggestion` stores replies for an operator, `automatic` sends them to the customer, `disabled` keeps it off. Send `mode: null` to remove the room's setting, which also leaves it off. Rooms are off until this is called, so enabling a workspace never answers anyone on its own. Requires workspace access and write access to crm::chats.";
17140
+ readonly security: readonly [
17141
+ never
17142
+ ];
17143
+ readonly requestBody: {
17144
+ readonly required: true;
17145
+ readonly content: {
17146
+ readonly "application/json": {
17147
+ readonly schema: {
17148
+ readonly type: "object";
17149
+ readonly required: readonly [
17150
+ "workspace",
17151
+ "roomId",
17152
+ "mode"
17153
+ ];
17154
+ readonly properties: {
17155
+ readonly workspace: {
17156
+ readonly type: "string";
17157
+ readonly format: "uuid";
17158
+ };
17159
+ readonly roomId: {
17160
+ readonly type: "string";
17161
+ readonly description: "Matrix room id.";
17162
+ };
17163
+ readonly mode: {
17164
+ readonly type: "string";
17165
+ readonly nullable: true;
17166
+ readonly enum: readonly [
17167
+ "disabled",
17168
+ "suggestion",
17169
+ "automatic"
17170
+ ];
17171
+ };
17172
+ };
17173
+ };
17174
+ };
17175
+ };
17176
+ };
17177
+ readonly responses: {
17178
+ readonly 200: {
17179
+ readonly description: "Room mode saved, or removed when null was sent.";
17180
+ readonly content: {
17181
+ readonly "application/json": {
17182
+ readonly schema: {
17183
+ readonly type: "object";
17184
+ readonly required: readonly [
17185
+ "success",
17186
+ "room"
17187
+ ];
17188
+ readonly properties: {
17189
+ readonly success: {
17190
+ readonly type: "boolean";
17191
+ readonly const: true;
17192
+ };
17193
+ readonly room: {
17194
+ readonly type: "object";
17195
+ readonly properties: any;
17196
+ };
17197
+ };
17198
+ };
17199
+ };
17200
+ };
17201
+ };
17202
+ readonly 400: {
17203
+ readonly description: "Validation error.";
17204
+ readonly content: {
17205
+ readonly "application/json": {
17206
+ readonly schema: {
17207
+ readonly $ref: "#/components/schemas/ErrorResponse";
17208
+ };
17209
+ };
17210
+ };
17211
+ };
17212
+ readonly 403: {
17213
+ readonly description: "Forbidden - User lacks workspace access or write access to crm::chats.";
17214
+ readonly content: {
17215
+ readonly "application/json": {
17216
+ readonly schema: {
17217
+ readonly $ref: "#/components/schemas/ErrorResponse";
17218
+ };
17219
+ };
17220
+ };
17221
+ };
17222
+ };
17223
+ };
17224
+ };
17225
+ readonly "/ai/suggestions/list/{workspace}": {
17226
+ readonly get: {
17227
+ readonly tags: readonly [
17228
+ "AI Replies"
17229
+ ];
17230
+ readonly summary: "List pending AI suggestions";
17231
+ readonly description: "Returns the AI replies waiting for an operator decision, newest first. Optional `roomId` query filter. Requires workspace access and read access to crm::chats.";
17232
+ readonly security: readonly [
17233
+ never
17234
+ ];
17235
+ readonly parameters: readonly [
17236
+ {
17237
+ readonly name: "workspace";
17238
+ readonly in: "path";
17239
+ readonly required: true;
17240
+ readonly schema: {
17241
+ readonly type: "string";
17242
+ readonly format: "uuid";
17243
+ };
17244
+ readonly description: "Workspace identifier.";
17245
+ },
17246
+ {
17247
+ readonly name: "roomId";
17248
+ readonly in: "query";
17249
+ readonly required: false;
17250
+ readonly schema: {
17251
+ readonly type: "string";
17252
+ };
17253
+ readonly description: "Only return suggestions for this chat room.";
17254
+ }
17255
+ ];
17256
+ readonly responses: {
17257
+ readonly 200: {
17258
+ readonly description: "Suggestions fetched successfully.";
17259
+ readonly content: {
17260
+ readonly "application/json": {
17261
+ readonly schema: {
17262
+ readonly $ref: "#/components/schemas/ListAiSuggestionsSuccess";
17263
+ };
17264
+ };
17265
+ };
17266
+ };
17267
+ readonly 403: {
17268
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::chats.";
17269
+ readonly content: {
17270
+ readonly "application/json": {
17271
+ readonly schema: {
17272
+ readonly $ref: "#/components/schemas/ErrorResponse";
17273
+ };
17274
+ };
17275
+ };
17276
+ };
17277
+ };
17278
+ };
17279
+ };
17280
+ readonly "/ai/suggestions/send": {
17281
+ readonly post: {
17282
+ readonly tags: readonly [
17283
+ "AI Replies"
17284
+ ];
17285
+ readonly summary: "Send an AI suggestion to the customer";
17286
+ readonly description: "Sends a stored suggestion into its chat room as the calling operator and marks it sent. The operator needs an existing chat session (see POST /chat/start). Requires workspace access and write access to crm::chats.";
17287
+ readonly security: readonly [
17288
+ never
17289
+ ];
17290
+ readonly requestBody: {
17291
+ readonly required: true;
17292
+ readonly content: {
17293
+ readonly "application/json": {
17294
+ readonly schema: {
17295
+ readonly type: "object";
17296
+ readonly required: readonly [
17297
+ "workspace",
17298
+ "replyId"
17299
+ ];
17300
+ readonly properties: {
17301
+ readonly workspace: {
17302
+ readonly type: "string";
17303
+ readonly format: "uuid";
17304
+ };
17305
+ readonly replyId: {
17306
+ readonly type: "string";
17307
+ readonly format: "uuid";
17308
+ };
17309
+ };
17310
+ };
17311
+ };
17312
+ };
17313
+ };
17314
+ readonly responses: {
17315
+ readonly 200: {
17316
+ readonly description: "Suggestion sent.";
17317
+ readonly content: {
17318
+ readonly "application/json": {
17319
+ readonly schema: {
17320
+ readonly $ref: "#/components/schemas/SimpleSuccess";
17321
+ };
17322
+ };
17323
+ };
17324
+ };
17325
+ readonly 400: {
17326
+ readonly description: "Validation error, or the suggestion was already sent.";
17327
+ readonly content: {
17328
+ readonly "application/json": {
17329
+ readonly schema: {
17330
+ readonly $ref: "#/components/schemas/ErrorResponse";
17331
+ };
17332
+ };
17333
+ };
17334
+ };
17335
+ readonly 404: {
17336
+ readonly description: "Suggestion not found in this workspace.";
17337
+ readonly content: {
17338
+ readonly "application/json": {
17339
+ readonly schema: {
17340
+ readonly $ref: "#/components/schemas/ErrorResponse";
17341
+ };
17342
+ };
17343
+ };
17344
+ };
17345
+ readonly 502: {
17346
+ readonly description: "The chat server rejected the message, or the operator has no chat session.";
17347
+ readonly content: {
17348
+ readonly "application/json": {
17349
+ readonly schema: {
17350
+ readonly $ref: "#/components/schemas/ErrorResponse";
17351
+ };
17352
+ };
17353
+ };
17354
+ };
17355
+ };
17356
+ };
17357
+ };
17358
+ readonly "/ai/suggestions/dismiss": {
17359
+ readonly post: {
17360
+ readonly tags: readonly [
17361
+ "AI Replies"
17362
+ ];
17363
+ readonly summary: "Dismiss an AI suggestion";
17364
+ readonly description: "Marks a suggestion as dismissed so it leaves the queue. Requires workspace access and write access to crm::chats.";
17365
+ readonly security: readonly [
17366
+ never
17367
+ ];
17368
+ readonly requestBody: {
17369
+ readonly required: true;
17370
+ readonly content: {
17371
+ readonly "application/json": {
17372
+ readonly schema: {
17373
+ readonly type: "object";
17374
+ readonly required: readonly [
17375
+ "workspace",
17376
+ "replyId"
17377
+ ];
17378
+ readonly properties: {
17379
+ readonly workspace: {
17380
+ readonly type: "string";
17381
+ readonly format: "uuid";
17382
+ };
17383
+ readonly replyId: {
17384
+ readonly type: "string";
17385
+ readonly format: "uuid";
17386
+ };
17387
+ };
17388
+ };
17389
+ };
17390
+ };
17391
+ };
17392
+ readonly responses: {
17393
+ readonly 200: {
17394
+ readonly description: "Suggestion dismissed.";
17395
+ readonly content: {
17396
+ readonly "application/json": {
17397
+ readonly schema: {
17398
+ readonly $ref: "#/components/schemas/SimpleSuccess";
17399
+ };
17400
+ };
17401
+ };
17402
+ };
17403
+ readonly 400: {
17404
+ readonly description: "Validation error, or the suggestion was already sent.";
17405
+ readonly content: {
17406
+ readonly "application/json": {
17407
+ readonly schema: {
17408
+ readonly $ref: "#/components/schemas/ErrorResponse";
17409
+ };
17410
+ };
17411
+ };
17412
+ };
17413
+ readonly 404: {
17414
+ readonly description: "Suggestion not found in this workspace.";
17415
+ readonly content: {
17416
+ readonly "application/json": {
17417
+ readonly schema: {
17418
+ readonly $ref: "#/components/schemas/ErrorResponse";
17419
+ };
17420
+ };
17421
+ };
17422
+ };
17423
+ };
17424
+ };
17425
+ };
17426
+ readonly "/analytics/{workspace}/ai-usage": {
17427
+ readonly get: {
17428
+ readonly tags: readonly [
17429
+ "Analytics"
17430
+ ];
17431
+ readonly summary: "AI token usage for a workspace";
17432
+ readonly description: "Prompt, completion, and total tokens recorded for the workspace, optionally limited to a period with `from` / `to`, plus the current month total and the configured monthly limit. Requires workspace access and read access to crm::analytics.";
17433
+ readonly security: readonly [
17434
+ never
17435
+ ];
17436
+ readonly parameters: readonly [
17437
+ {
17438
+ readonly name: "workspace";
17439
+ readonly in: "path";
17440
+ readonly required: true;
17441
+ readonly schema: {
17442
+ readonly type: "string";
17443
+ readonly format: "uuid";
17444
+ };
17445
+ readonly description: "Workspace identifier.";
17446
+ },
17447
+ {
17448
+ readonly name: "from";
17449
+ readonly in: "query";
17450
+ readonly required: false;
17451
+ readonly schema: {
17452
+ readonly type: "string";
17453
+ readonly format: "date-time";
17454
+ };
17455
+ readonly description: "Inclusive start of the reporting period.";
17456
+ },
17457
+ {
17458
+ readonly name: "to";
17459
+ readonly in: "query";
17460
+ readonly required: false;
17461
+ readonly schema: {
17462
+ readonly type: "string";
17463
+ readonly format: "date-time";
17464
+ };
17465
+ readonly description: "Exclusive end of the reporting period.";
17466
+ }
17467
+ ];
17468
+ readonly responses: {
17469
+ readonly 200: {
17470
+ readonly description: "Usage fetched successfully.";
17471
+ readonly content: {
17472
+ readonly "application/json": {
17473
+ readonly schema: {
17474
+ readonly $ref: "#/components/schemas/AiUsageSuccess";
17475
+ };
17476
+ };
17477
+ };
17478
+ };
17479
+ readonly 400: {
17480
+ readonly description: "Invalid period.";
17481
+ readonly content: {
17482
+ readonly "application/json": {
17483
+ readonly schema: {
17484
+ readonly $ref: "#/components/schemas/ErrorResponse";
17485
+ };
17486
+ };
17487
+ };
17488
+ };
17489
+ readonly 403: {
17490
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::analytics.";
17491
+ readonly content: {
17492
+ readonly "application/json": {
17493
+ readonly schema: {
17494
+ readonly $ref: "#/components/schemas/ErrorResponse";
17495
+ };
17496
+ };
17497
+ };
17498
+ };
17499
+ };
17500
+ };
17501
+ };
17502
+ readonly "/freason/list/{workspace}": {
17503
+ readonly get: {
17504
+ readonly tags: readonly [
17505
+ "Failure Reasons"
17506
+ ];
17507
+ readonly summary: "List failure reasons by workspace";
17508
+ readonly description: "Returns all failure reasons for the given workspace. Requires workspace access and read access to crm::tasks.";
17509
+ readonly security: readonly [
17510
+ never
17511
+ ];
17512
+ readonly parameters: readonly [
17513
+ {
17514
+ readonly name: "workspace";
17515
+ readonly in: "path";
17516
+ readonly required: true;
17517
+ readonly schema: {
17518
+ readonly type: "string";
17519
+ readonly format: "uuid";
17520
+ };
17521
+ readonly description: "Workspace identifier.";
17522
+ }
17523
+ ];
17524
+ readonly responses: {
17525
+ readonly 200: {
17526
+ readonly description: "Failure reasons fetched successfully.";
17527
+ readonly content: {
17528
+ readonly "application/json": {
17529
+ readonly schema: {
17530
+ readonly $ref: "#/components/schemas/ListFailureReasonsSuccess";
17531
+ };
17532
+ };
17533
+ };
17534
+ };
17535
+ readonly 401: {
17536
+ readonly description: "Unauthorized - Missing or invalid access token.";
17537
+ readonly content: {
17538
+ readonly "application/json": {
17539
+ readonly schema: {
17540
+ readonly $ref: "#/components/schemas/ErrorResponse";
17541
+ };
17542
+ };
17543
+ };
17544
+ };
17545
+ readonly 403: {
17546
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
17547
+ readonly content: {
17548
+ readonly "application/json": {
17549
+ readonly schema: {
17550
+ readonly $ref: "#/components/schemas/ErrorResponse";
17551
+ };
17552
+ };
17553
+ };
17554
+ };
17555
+ };
17556
+ };
17557
+ };
17558
+ readonly "/freason/get/{workspace}/{failureReasonId}": {
17559
+ readonly get: {
17560
+ readonly tags: readonly [
17561
+ "Failure Reasons"
17562
+ ];
17563
+ readonly summary: "Get a failure reason";
17564
+ readonly description: "Returns a single failure reason by id. Requires workspace access and read access to crm::tasks.";
17565
+ readonly security: readonly [
17566
+ never
17567
+ ];
17568
+ readonly parameters: readonly [
17569
+ {
17570
+ readonly name: "workspace";
17571
+ readonly in: "path";
17572
+ readonly required: true;
17573
+ readonly schema: {
17574
+ readonly type: "string";
17575
+ readonly format: "uuid";
17576
+ };
17577
+ readonly description: "Workspace identifier.";
17578
+ },
17579
+ {
17580
+ readonly name: "failureReasonId";
17581
+ readonly in: "path";
17582
+ readonly required: true;
17583
+ readonly schema: {
17584
+ readonly type: "string";
17585
+ readonly format: "uuid";
17586
+ };
17587
+ readonly description: "Failure reason identifier.";
17588
+ }
17589
+ ];
17590
+ readonly responses: {
17591
+ readonly 200: {
17592
+ readonly description: "Failure reason fetched successfully.";
17593
+ readonly content: {
17594
+ readonly "application/json": {
17595
+ readonly schema: {
17596
+ readonly $ref: "#/components/schemas/FailureReasonSuccess";
17597
+ };
17598
+ };
17599
+ };
17600
+ };
17601
+ readonly 401: {
17602
+ readonly description: "Unauthorized - Missing or invalid access token.";
17603
+ readonly content: {
17604
+ readonly "application/json": {
17605
+ readonly schema: {
17606
+ readonly $ref: "#/components/schemas/ErrorResponse";
17607
+ };
17608
+ };
17609
+ };
17610
+ };
17611
+ readonly 403: {
17612
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
17613
+ readonly content: {
17614
+ readonly "application/json": {
17615
+ readonly schema: {
17616
+ readonly $ref: "#/components/schemas/ErrorResponse";
17617
+ };
17618
+ };
17619
+ };
17620
+ };
17621
+ readonly 404: {
17622
+ readonly description: "Failure reason not found.";
17623
+ readonly content: {
17624
+ readonly "application/json": {
17625
+ readonly schema: {
17626
+ readonly $ref: "#/components/schemas/ErrorResponse";
17627
+ };
17628
+ };
17629
+ };
17630
+ };
17631
+ };
17632
+ };
17633
+ };
17634
+ readonly "/freason/create": {
17635
+ readonly post: {
17636
+ readonly tags: readonly [
17637
+ "Failure Reasons"
17638
+ ];
17639
+ readonly summary: "Create a failure reason";
17640
+ readonly description: "Creates a failure reason in the specified workspace. Requires workspace access and write access to crm::tasks.";
17641
+ readonly security: readonly [
17642
+ never
17643
+ ];
17644
+ readonly requestBody: {
17645
+ readonly required: true;
17646
+ readonly content: {
17647
+ readonly "application/json": {
17648
+ readonly schema: {
17649
+ readonly type: "object";
17650
+ readonly required: readonly [
17651
+ "workspace",
17652
+ "title"
17653
+ ];
17654
+ readonly properties: {
17655
+ readonly workspace: {
17656
+ readonly type: "string";
17657
+ readonly format: "uuid";
17658
+ readonly description: "Workspace identifier.";
17659
+ };
17660
+ readonly title: {
17661
+ readonly type: "string";
17662
+ readonly maxLength: 256;
17663
+ readonly description: "Failure reason title.";
17664
+ };
17665
+ readonly description: {
17666
+ readonly type: "string";
17667
+ readonly maxLength: 256;
17668
+ readonly description: "Optional failure reason description.";
17669
+ };
17670
+ };
17671
+ };
17672
+ };
17673
+ };
17674
+ };
17675
+ readonly responses: {
17676
+ readonly 201: {
17677
+ readonly description: "Failure reason created successfully.";
17678
+ readonly content: {
17679
+ readonly "application/json": {
17680
+ readonly schema: {
17681
+ readonly $ref: "#/components/schemas/FailureReasonSuccess";
17682
+ };
17683
+ };
17684
+ };
17685
+ };
17686
+ readonly 400: {
17687
+ readonly description: "Invalid request payload.";
17688
+ readonly content: {
17689
+ readonly "application/json": {
17690
+ readonly schema: {
17691
+ readonly $ref: "#/components/schemas/ErrorResponse";
17692
+ };
17693
+ };
17694
+ };
17695
+ };
17696
+ readonly 401: {
17697
+ readonly description: "Unauthorized - Missing or invalid access token.";
17698
+ readonly content: {
17699
+ readonly "application/json": {
17700
+ readonly schema: {
17701
+ readonly $ref: "#/components/schemas/ErrorResponse";
17702
+ };
17703
+ };
17704
+ };
17705
+ };
17706
+ readonly 403: {
17707
+ readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks.";
17708
+ readonly content: {
17709
+ readonly "application/json": {
17710
+ readonly schema: {
17711
+ readonly $ref: "#/components/schemas/ErrorResponse";
17712
+ };
17713
+ };
17714
+ };
17715
+ };
17716
+ readonly 409: {
17717
+ readonly description: "A failure reason with this title already exists.";
17718
+ readonly content: {
17719
+ readonly "application/json": {
17720
+ readonly schema: {
17721
+ readonly $ref: "#/components/schemas/ErrorResponse";
17722
+ };
17723
+ };
17724
+ };
17725
+ };
17726
+ };
17727
+ };
17728
+ };
17729
+ readonly "/freason/update": {
17730
+ readonly post: {
16938
17731
  readonly tags: readonly [
16939
17732
  "Failure Reasons"
16940
17733
  ];
@@ -20203,19 +20996,19 @@ declare const routes: import("hono/hono-base").HonoBase<{
20203
20996
  readonly companyName: {
20204
20997
  readonly type: "string";
20205
20998
  };
20206
- readonly inn: {
20999
+ readonly companyAccountNumber: {
20207
21000
  readonly type: "string";
20208
21001
  };
20209
- readonly kpp: {
21002
+ readonly companyInn: {
20210
21003
  readonly type: "string";
20211
21004
  };
20212
- readonly ogrn: {
21005
+ readonly companyKpp: {
20213
21006
  readonly type: "string";
20214
21007
  };
20215
- readonly bankName: {
21008
+ readonly companyOgrn: {
20216
21009
  readonly type: "string";
20217
21010
  };
20218
- readonly bankAccountNumber: {
21011
+ readonly bankName: {
20219
21012
  readonly type: "string";
20220
21013
  };
20221
21014
  readonly bankBik: {
@@ -20340,19 +21133,19 @@ declare const routes: import("hono/hono-base").HonoBase<{
20340
21133
  readonly companyName: {
20341
21134
  readonly type: "string";
20342
21135
  };
20343
- readonly inn: {
21136
+ readonly companyAccountNumber: {
20344
21137
  readonly type: "string";
20345
21138
  };
20346
- readonly kpp: {
21139
+ readonly companyInn: {
20347
21140
  readonly type: "string";
20348
21141
  };
20349
- readonly ogrn: {
21142
+ readonly companyKpp: {
20350
21143
  readonly type: "string";
20351
21144
  };
20352
- readonly bankName: {
21145
+ readonly companyOgrn: {
20353
21146
  readonly type: "string";
20354
21147
  };
20355
- readonly bankAccountNumber: {
21148
+ readonly bankName: {
20356
21149
  readonly type: "string";
20357
21150
  };
20358
21151
  readonly bankBik: {
@@ -24094,9 +24887,6 @@ declare const routes: import("hono/hono-base").HonoBase<{
24094
24887
  workspaceId: string;
24095
24888
  country: string | null;
24096
24889
  companyName: string | null;
24097
- inn: string | null;
24098
- kpp: string | null;
24099
- bankAccountNumber: string | null;
24100
24890
  bankBik: string | null;
24101
24891
  bankKc: string | null;
24102
24892
  vatRate: number | null;
@@ -24104,7 +24894,10 @@ declare const routes: import("hono/hono-base").HonoBase<{
24104
24894
  order: number;
24105
24895
  cardColor: string;
24106
24896
  updated_at: string | null;
24107
- ogrn: string | null;
24897
+ companyAccountNumber: string | null;
24898
+ companyInn: string | null;
24899
+ companyKpp: string | null;
24900
+ companyOgrn: string | null;
24108
24901
  bankName: string | null;
24109
24902
  bankInn: string | null;
24110
24903
  bankKpp: string | null;
@@ -29310,6 +30103,217 @@ declare const routes: import("hono/hono-base").HonoBase<{
29310
30103
  };
29311
30104
  };
29312
30105
  }, "/chat"> | import("hono/types").MergeSchemaPath<{
30106
+ "/inbound": {
30107
+ $post: {
30108
+ input: {};
30109
+ output: {
30110
+ success: false;
30111
+ error: string;
30112
+ };
30113
+ outputFormat: "json";
30114
+ status: 401;
30115
+ } | {
30116
+ input: {};
30117
+ output: {
30118
+ success: false;
30119
+ error: never;
30120
+ };
30121
+ outputFormat: "json";
30122
+ status: 400;
30123
+ } | {
30124
+ input: {};
30125
+ output: {
30126
+ success: true;
30127
+ buffered: number;
30128
+ };
30129
+ outputFormat: "json";
30130
+ status: 202;
30131
+ };
30132
+ };
30133
+ } & {
30134
+ "/settings/:workspace": {
30135
+ $get: {
30136
+ input: {
30137
+ param: {
30138
+ workspace: string;
30139
+ };
30140
+ };
30141
+ output: {
30142
+ success: true;
30143
+ settings: {
30144
+ enabled: boolean;
30145
+ systemPrompt: string | null;
30146
+ monthlyTokenLimit: number | null;
30147
+ tokensUsedThisMonth: number;
30148
+ };
30149
+ };
30150
+ outputFormat: "json";
30151
+ status: 200;
30152
+ };
30153
+ };
30154
+ } & {
30155
+ "/settings": {
30156
+ $post: {
30157
+ input: {};
30158
+ output: {
30159
+ success: false;
30160
+ error: never;
30161
+ };
30162
+ outputFormat: "json";
30163
+ status: 400;
30164
+ } | {
30165
+ input: {};
30166
+ output: {
30167
+ success: true;
30168
+ settings: {
30169
+ enabled: boolean;
30170
+ systemPrompt: string | null;
30171
+ monthlyTokenLimit: number | null;
30172
+ };
30173
+ };
30174
+ outputFormat: "json";
30175
+ status: 200;
30176
+ };
30177
+ };
30178
+ } & {
30179
+ "/rooms/list/:workspace": {
30180
+ $get: {
30181
+ input: {
30182
+ param: {
30183
+ workspace: string;
30184
+ };
30185
+ };
30186
+ output: {
30187
+ success: true;
30188
+ rooms: {
30189
+ roomId: string;
30190
+ mode: "disabled" | "suggestion" | "automatic";
30191
+ updated_at: string | null;
30192
+ }[];
30193
+ };
30194
+ outputFormat: "json";
30195
+ status: 200;
30196
+ };
30197
+ };
30198
+ } & {
30199
+ "/rooms/mode": {
30200
+ $post: {
30201
+ input: {};
30202
+ output: {
30203
+ success: false;
30204
+ error: never;
30205
+ };
30206
+ outputFormat: "json";
30207
+ status: 400;
30208
+ } | {
30209
+ input: {};
30210
+ output: {
30211
+ success: true;
30212
+ room: {
30213
+ roomId: string;
30214
+ mode: null;
30215
+ };
30216
+ };
30217
+ outputFormat: "json";
30218
+ status: 200;
30219
+ } | {
30220
+ input: {};
30221
+ output: {
30222
+ success: true;
30223
+ room: {
30224
+ roomId: string;
30225
+ mode: "disabled" | "suggestion" | "automatic";
30226
+ };
30227
+ };
30228
+ outputFormat: "json";
30229
+ status: 200;
30230
+ };
30231
+ };
30232
+ } & {
30233
+ "/suggestions/list/:workspace": {
30234
+ $get: {
30235
+ input: {
30236
+ param: {
30237
+ workspace: string;
30238
+ };
30239
+ };
30240
+ output: {
30241
+ success: true;
30242
+ suggestions: {
30243
+ id: string;
30244
+ roomId: string;
30245
+ channel: string;
30246
+ text: string;
30247
+ created_at: string;
30248
+ }[];
30249
+ };
30250
+ outputFormat: "json";
30251
+ status: 200;
30252
+ };
30253
+ };
30254
+ } & {
30255
+ "/suggestions/send": {
30256
+ $post: {
30257
+ input: {};
30258
+ output: {
30259
+ success: false;
30260
+ error: string;
30261
+ };
30262
+ outputFormat: "json";
30263
+ status: 404;
30264
+ } | {
30265
+ input: {};
30266
+ output: {
30267
+ success: false;
30268
+ error: string;
30269
+ };
30270
+ outputFormat: "json";
30271
+ status: 400;
30272
+ } | {
30273
+ input: {};
30274
+ output: {
30275
+ success: false;
30276
+ error: string;
30277
+ };
30278
+ outputFormat: "json";
30279
+ status: 502;
30280
+ } | {
30281
+ input: {};
30282
+ output: {
30283
+ success: true;
30284
+ };
30285
+ outputFormat: "json";
30286
+ status: 200;
30287
+ };
30288
+ };
30289
+ } & {
30290
+ "/suggestions/dismiss": {
30291
+ $post: {
30292
+ input: {};
30293
+ output: {
30294
+ success: false;
30295
+ error: string;
30296
+ };
30297
+ outputFormat: "json";
30298
+ status: 404;
30299
+ } | {
30300
+ input: {};
30301
+ output: {
30302
+ success: false;
30303
+ error: string;
30304
+ };
30305
+ outputFormat: "json";
30306
+ status: 400;
30307
+ } | {
30308
+ input: {};
30309
+ output: {
30310
+ success: true;
30311
+ };
30312
+ outputFormat: "json";
30313
+ status: 200;
30314
+ };
30315
+ };
30316
+ }, "/ai"> | import("hono/types").MergeSchemaPath<{
29313
30317
  "/sync": {
29314
30318
  $get: {
29315
30319
  input: {};
@@ -30178,6 +31182,60 @@ declare const routes: import("hono/hono-base").HonoBase<{
30178
31182
  status: 200;
30179
31183
  };
30180
31184
  };
31185
+ } & {
31186
+ "/:workspace/ai-usage": {
31187
+ $get: {
31188
+ input: {
31189
+ param: {
31190
+ workspace: string;
31191
+ };
31192
+ };
31193
+ output: {
31194
+ success: false;
31195
+ error: {
31196
+ [x: string]: import("hono/utils/types").JSONValue;
31197
+ };
31198
+ };
31199
+ outputFormat: "json";
31200
+ status: 400;
31201
+ } | {
31202
+ input: {
31203
+ param: {
31204
+ workspace: string;
31205
+ };
31206
+ };
31207
+ output: {
31208
+ success: false;
31209
+ error: string;
31210
+ };
31211
+ outputFormat: "json";
31212
+ status: 400;
31213
+ } | {
31214
+ input: {
31215
+ param: {
31216
+ workspace: string;
31217
+ };
31218
+ };
31219
+ output: {
31220
+ success: true;
31221
+ workspaceId: string;
31222
+ period: {
31223
+ from: string | null;
31224
+ to: string | null;
31225
+ };
31226
+ usage: {
31227
+ requestCount: number;
31228
+ promptTokens: number;
31229
+ completionTokens: number;
31230
+ totalTokens: number;
31231
+ };
31232
+ tokensUsedThisMonth: number;
31233
+ monthlyTokenLimit: number | null;
31234
+ };
31235
+ outputFormat: "json";
31236
+ status: 200;
31237
+ };
31238
+ };
30181
31239
  }, "/analytics"> | import("hono/types").MergeSchemaPath<{
30182
31240
  "/accounts/list/:workspace": {
30183
31241
  $get: {
@@ -30198,11 +31256,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
30198
31256
  openingBalance: number;
30199
31257
  country: string | null;
30200
31258
  companyName: string | null;
30201
- inn: string | null;
30202
- kpp: string | null;
30203
- ogrn: string | null;
31259
+ companyAccountNumber: string | null;
31260
+ companyInn: string | null;
31261
+ companyKpp: string | null;
31262
+ companyOgrn: string | null;
30204
31263
  bankName: string | null;
30205
- bankAccountNumber: string | null;
30206
31264
  bankBik: string | null;
30207
31265
  bankKc: string | null;
30208
31266
  bankInn: string | null;
@@ -30253,11 +31311,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
30253
31311
  openingBalance: number;
30254
31312
  country: string | null;
30255
31313
  companyName: string | null;
30256
- inn: string | null;
30257
- kpp: string | null;
30258
- ogrn: string | null;
31314
+ companyAccountNumber: string | null;
31315
+ companyInn: string | null;
31316
+ companyKpp: string | null;
31317
+ companyOgrn: string | null;
30259
31318
  bankName: string | null;
30260
- bankAccountNumber: string | null;
30261
31319
  bankBik: string | null;
30262
31320
  bankKc: string | null;
30263
31321
  bankInn: string | null;
@@ -30296,11 +31354,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
30296
31354
  openingBalance: number;
30297
31355
  country: string | null;
30298
31356
  companyName: string | null;
30299
- inn: string | null;
30300
- kpp: string | null;
30301
- ogrn: string | null;
31357
+ companyAccountNumber: string | null;
31358
+ companyInn: string | null;
31359
+ companyKpp: string | null;
31360
+ companyOgrn: string | null;
30302
31361
  bankName: string | null;
30303
- bankAccountNumber: string | null;
30304
31362
  bankBik: string | null;
30305
31363
  bankKc: string | null;
30306
31364
  bankInn: string | null;
@@ -30347,11 +31405,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
30347
31405
  openingBalance: number;
30348
31406
  country: string | null;
30349
31407
  companyName: string | null;
30350
- inn: string | null;
30351
- kpp: string | null;
30352
- ogrn: string | null;
31408
+ companyAccountNumber: string | null;
31409
+ companyInn: string | null;
31410
+ companyKpp: string | null;
31411
+ companyOgrn: string | null;
30353
31412
  bankName: string | null;
30354
- bankAccountNumber: string | null;
30355
31413
  bankBik: string | null;
30356
31414
  bankKc: string | null;
30357
31415
  bankInn: string | null;
@@ -30390,11 +31448,11 @@ declare const routes: import("hono/hono-base").HonoBase<{
30390
31448
  openingBalance: number;
30391
31449
  country: string | null;
30392
31450
  companyName: string | null;
30393
- inn: string | null;
30394
- kpp: string | null;
30395
- ogrn: string | null;
31451
+ companyAccountNumber: string | null;
31452
+ companyInn: string | null;
31453
+ companyKpp: string | null;
31454
+ companyOgrn: string | null;
30396
31455
  bankName: string | null;
30397
- bankAccountNumber: string | null;
30398
31456
  bankBik: string | null;
30399
31457
  bankKc: string | null;
30400
31458
  bankInn: string | null;