@mestra-dev/contract 0.0.217 → 0.0.219

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 +1169 -97
  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: {
@@ -4100,6 +4248,10 @@ declare const routes: import("hono/hono-base").HonoBase<{
4100
4248
  readonly type: "integer";
4101
4249
  readonly nullable: true;
4102
4250
  };
4251
+ readonly agencyCommission: {
4252
+ readonly type: "integer";
4253
+ readonly nullable: true;
4254
+ };
4103
4255
  readonly alternativeEURCurrency: {
4104
4256
  readonly type: "boolean";
4105
4257
  readonly nullable: true;
@@ -12983,6 +13135,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
12983
13135
  readonly pricePerSquareMeter: {
12984
13136
  readonly type: "number";
12985
13137
  };
13138
+ readonly agencyCommission: {
13139
+ readonly type: "number";
13140
+ };
12986
13141
  readonly alternativeEURCurrency: {
12987
13142
  readonly type: "boolean";
12988
13143
  };
@@ -13231,6 +13386,9 @@ declare const routes: import("hono/hono-base").HonoBase<{
13231
13386
  readonly pricePerSquareMeter: {
13232
13387
  readonly type: "number";
13233
13388
  };
13389
+ readonly agencyCommission: {
13390
+ readonly type: "number";
13391
+ };
13234
13392
  readonly alternativeEURCurrency: {
13235
13393
  readonly type: "boolean";
13236
13394
  };
@@ -16706,41 +16864,69 @@ declare const routes: import("hono/hono-base").HonoBase<{
16706
16864
  };
16707
16865
  };
16708
16866
  };
16709
- readonly "/freason/list/{workspace}": {
16710
- readonly get: {
16867
+ readonly "/ai/inbound": {
16868
+ readonly post: {
16711
16869
  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
16870
+ "AI Replies"
16718
16871
  ];
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";
16872
+ readonly summary: "Customer messages forwarded by the Synapse dispatch module";
16873
+ 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.";
16874
+ readonly requestBody: {
16875
+ readonly required: true;
16876
+ readonly content: {
16877
+ readonly "application/json": {
16878
+ readonly schema: {
16879
+ readonly type: "object";
16880
+ readonly required: readonly [
16881
+ "messages"
16882
+ ];
16883
+ readonly properties: {
16884
+ readonly messages: {
16885
+ readonly type: "array";
16886
+ readonly maxItems: 200;
16887
+ readonly items: {
16888
+ readonly type: "object";
16889
+ readonly required: readonly [
16890
+ "eventId",
16891
+ "roomId",
16892
+ "sender",
16893
+ "channel",
16894
+ "text"
16895
+ ];
16896
+ readonly properties: any;
16897
+ };
16898
+ };
16899
+ };
16900
+ };
16727
16901
  };
16728
- readonly description: "Workspace identifier.";
16729
- }
16730
- ];
16902
+ };
16903
+ };
16731
16904
  readonly responses: {
16732
- readonly 200: {
16733
- readonly description: "Failure reasons fetched successfully.";
16905
+ readonly 202: {
16906
+ readonly description: "Messages taken. `buffered` is how many were actually stored.";
16734
16907
  readonly content: {
16735
16908
  readonly "application/json": {
16736
16909
  readonly schema: {
16737
- readonly $ref: "#/components/schemas/ListFailureReasonsSuccess";
16910
+ readonly type: "object";
16911
+ readonly required: readonly [
16912
+ "success",
16913
+ "buffered"
16914
+ ];
16915
+ readonly properties: {
16916
+ readonly success: {
16917
+ readonly type: "boolean";
16918
+ readonly const: true;
16919
+ };
16920
+ readonly buffered: {
16921
+ readonly type: "integer";
16922
+ };
16923
+ };
16738
16924
  };
16739
16925
  };
16740
16926
  };
16741
16927
  };
16742
- readonly 401: {
16743
- readonly description: "Unauthorized - Missing or invalid access token.";
16928
+ readonly 400: {
16929
+ readonly description: "Validation error.";
16744
16930
  readonly content: {
16745
16931
  readonly "application/json": {
16746
16932
  readonly schema: {
@@ -16749,8 +16935,8 @@ declare const routes: import("hono/hono-base").HonoBase<{
16749
16935
  };
16750
16936
  };
16751
16937
  };
16752
- readonly 403: {
16753
- readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
16938
+ readonly 401: {
16939
+ readonly description: "Missing or wrong inbound token.";
16754
16940
  readonly content: {
16755
16941
  readonly "application/json": {
16756
16942
  readonly schema: {
@@ -16762,13 +16948,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
16762
16948
  };
16763
16949
  };
16764
16950
  };
16765
- readonly "/freason/get/{workspace}/{failureReasonId}": {
16951
+ readonly "/ai/settings/{workspace}": {
16766
16952
  readonly get: {
16767
16953
  readonly tags: readonly [
16768
- "Failure Reasons"
16954
+ "AI Replies"
16769
16955
  ];
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.";
16956
+ readonly summary: "Get the workspace AI reply settings";
16957
+ 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
16958
  readonly security: readonly [
16773
16959
  never
16774
16960
  ];
@@ -16782,25 +16968,15 @@ declare const routes: import("hono/hono-base").HonoBase<{
16782
16968
  readonly format: "uuid";
16783
16969
  };
16784
16970
  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
16971
  }
16796
16972
  ];
16797
16973
  readonly responses: {
16798
16974
  readonly 200: {
16799
- readonly description: "Failure reason fetched successfully.";
16975
+ readonly description: "Settings fetched successfully.";
16800
16976
  readonly content: {
16801
16977
  readonly "application/json": {
16802
16978
  readonly schema: {
16803
- readonly $ref: "#/components/schemas/FailureReasonSuccess";
16979
+ readonly $ref: "#/components/schemas/AiSettingsSuccess";
16804
16980
  };
16805
16981
  };
16806
16982
  };
@@ -16816,17 +16992,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
16816
16992
  };
16817
16993
  };
16818
16994
  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.";
16995
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::chats.";
16830
16996
  readonly content: {
16831
16997
  readonly "application/json": {
16832
16998
  readonly schema: {
@@ -16838,13 +17004,13 @@ declare const routes: import("hono/hono-base").HonoBase<{
16838
17004
  };
16839
17005
  };
16840
17006
  };
16841
- readonly "/freason/create": {
17007
+ readonly "/ai/settings": {
16842
17008
  readonly post: {
16843
17009
  readonly tags: readonly [
16844
- "Failure Reasons"
17010
+ "AI Replies"
16845
17011
  ];
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.";
17012
+ readonly summary: "Set the workspace AI reply mode";
17013
+ 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
17014
  readonly security: readonly [
16849
17015
  never
16850
17016
  ];
@@ -16855,24 +17021,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
16855
17021
  readonly schema: {
16856
17022
  readonly type: "object";
16857
17023
  readonly required: readonly [
16858
- "workspace",
16859
- "title"
17024
+ "workspace"
16860
17025
  ];
16861
17026
  readonly properties: {
16862
17027
  readonly workspace: {
16863
17028
  readonly type: "string";
16864
17029
  readonly format: "uuid";
16865
- readonly description: "Workspace identifier.";
16866
17030
  };
16867
- readonly title: {
16868
- readonly type: "string";
16869
- readonly maxLength: 256;
16870
- readonly description: "Failure reason title.";
17031
+ readonly enabled: {
17032
+ readonly type: "boolean";
16871
17033
  };
16872
- readonly description: {
17034
+ readonly systemPrompt: {
16873
17035
  readonly type: "string";
16874
- readonly maxLength: 256;
16875
- readonly description: "Optional failure reason description.";
17036
+ readonly nullable: true;
17037
+ readonly maxLength: 2000;
17038
+ };
17039
+ readonly monthlyTokenLimit: {
17040
+ readonly type: "integer";
17041
+ readonly nullable: true;
17042
+ readonly minimum: 0;
16876
17043
  };
16877
17044
  };
16878
17045
  };
@@ -16880,28 +17047,18 @@ declare const routes: import("hono/hono-base").HonoBase<{
16880
17047
  };
16881
17048
  };
16882
17049
  readonly responses: {
16883
- readonly 201: {
16884
- readonly description: "Failure reason created successfully.";
17050
+ readonly 200: {
17051
+ readonly description: "Settings saved.";
16885
17052
  readonly content: {
16886
17053
  readonly "application/json": {
16887
17054
  readonly schema: {
16888
- readonly $ref: "#/components/schemas/FailureReasonSuccess";
17055
+ readonly $ref: "#/components/schemas/AiSettingsSuccess";
16889
17056
  };
16890
17057
  };
16891
17058
  };
16892
17059
  };
16893
17060
  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.";
17061
+ readonly description: "Validation error.";
16905
17062
  readonly content: {
16906
17063
  readonly "application/json": {
16907
17064
  readonly schema: {
@@ -16911,17 +17068,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
16911
17068
  };
16912
17069
  };
16913
17070
  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.";
17071
+ readonly description: "Forbidden - User lacks workspace access or write access to crm::chats.";
16925
17072
  readonly content: {
16926
17073
  readonly "application/json": {
16927
17074
  readonly schema: {
@@ -16933,13 +17080,669 @@ declare const routes: import("hono/hono-base").HonoBase<{
16933
17080
  };
16934
17081
  };
16935
17082
  };
16936
- readonly "/freason/update": {
16937
- readonly post: {
17083
+ readonly "/ai/rooms/list/{workspace}": {
17084
+ readonly get: {
16938
17085
  readonly tags: readonly [
16939
- "Failure Reasons"
17086
+ "AI Replies"
16940
17087
  ];
16941
- readonly summary: "Update a failure reason";
16942
- readonly description: "Updates a failure reason's title and/or description. Requires workspace access and write access to crm::tasks.";
17088
+ readonly summary: "List the rooms the AI has been turned on for";
17089
+ 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.";
17090
+ readonly security: readonly [
17091
+ never
17092
+ ];
17093
+ readonly parameters: readonly [
17094
+ {
17095
+ readonly name: "workspace";
17096
+ readonly in: "path";
17097
+ readonly required: true;
17098
+ readonly schema: {
17099
+ readonly type: "string";
17100
+ readonly format: "uuid";
17101
+ };
17102
+ readonly description: "Workspace identifier.";
17103
+ }
17104
+ ];
17105
+ readonly responses: {
17106
+ readonly 200: {
17107
+ readonly description: "Room modes fetched successfully.";
17108
+ readonly content: {
17109
+ readonly "application/json": {
17110
+ readonly schema: {
17111
+ readonly type: "object";
17112
+ readonly required: readonly [
17113
+ "success",
17114
+ "rooms"
17115
+ ];
17116
+ readonly properties: {
17117
+ readonly success: {
17118
+ readonly type: "boolean";
17119
+ readonly const: true;
17120
+ };
17121
+ readonly rooms: {
17122
+ readonly type: "array";
17123
+ readonly items: any;
17124
+ };
17125
+ };
17126
+ };
17127
+ };
17128
+ };
17129
+ };
17130
+ readonly 403: {
17131
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::chats.";
17132
+ readonly content: {
17133
+ readonly "application/json": {
17134
+ readonly schema: {
17135
+ readonly $ref: "#/components/schemas/ErrorResponse";
17136
+ };
17137
+ };
17138
+ };
17139
+ };
17140
+ };
17141
+ };
17142
+ };
17143
+ readonly "/ai/rooms/mode": {
17144
+ readonly post: {
17145
+ readonly tags: readonly [
17146
+ "AI Replies"
17147
+ ];
17148
+ readonly summary: "Set or clear one room's AI mode";
17149
+ 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.";
17150
+ readonly security: readonly [
17151
+ never
17152
+ ];
17153
+ readonly requestBody: {
17154
+ readonly required: true;
17155
+ readonly content: {
17156
+ readonly "application/json": {
17157
+ readonly schema: {
17158
+ readonly type: "object";
17159
+ readonly required: readonly [
17160
+ "workspace",
17161
+ "roomId",
17162
+ "mode"
17163
+ ];
17164
+ readonly properties: {
17165
+ readonly workspace: {
17166
+ readonly type: "string";
17167
+ readonly format: "uuid";
17168
+ };
17169
+ readonly roomId: {
17170
+ readonly type: "string";
17171
+ readonly description: "Matrix room id.";
17172
+ };
17173
+ readonly mode: {
17174
+ readonly type: "string";
17175
+ readonly nullable: true;
17176
+ readonly enum: readonly [
17177
+ "disabled",
17178
+ "suggestion",
17179
+ "automatic"
17180
+ ];
17181
+ };
17182
+ };
17183
+ };
17184
+ };
17185
+ };
17186
+ };
17187
+ readonly responses: {
17188
+ readonly 200: {
17189
+ readonly description: "Room mode saved, or removed when null was sent.";
17190
+ readonly content: {
17191
+ readonly "application/json": {
17192
+ readonly schema: {
17193
+ readonly type: "object";
17194
+ readonly required: readonly [
17195
+ "success",
17196
+ "room"
17197
+ ];
17198
+ readonly properties: {
17199
+ readonly success: {
17200
+ readonly type: "boolean";
17201
+ readonly const: true;
17202
+ };
17203
+ readonly room: {
17204
+ readonly type: "object";
17205
+ readonly properties: any;
17206
+ };
17207
+ };
17208
+ };
17209
+ };
17210
+ };
17211
+ };
17212
+ readonly 400: {
17213
+ readonly description: "Validation error.";
17214
+ readonly content: {
17215
+ readonly "application/json": {
17216
+ readonly schema: {
17217
+ readonly $ref: "#/components/schemas/ErrorResponse";
17218
+ };
17219
+ };
17220
+ };
17221
+ };
17222
+ readonly 403: {
17223
+ readonly description: "Forbidden - User lacks workspace access or write access to crm::chats.";
17224
+ readonly content: {
17225
+ readonly "application/json": {
17226
+ readonly schema: {
17227
+ readonly $ref: "#/components/schemas/ErrorResponse";
17228
+ };
17229
+ };
17230
+ };
17231
+ };
17232
+ };
17233
+ };
17234
+ };
17235
+ readonly "/ai/suggestions/list/{workspace}": {
17236
+ readonly get: {
17237
+ readonly tags: readonly [
17238
+ "AI Replies"
17239
+ ];
17240
+ readonly summary: "List pending AI suggestions";
17241
+ 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.";
17242
+ readonly security: readonly [
17243
+ never
17244
+ ];
17245
+ readonly parameters: readonly [
17246
+ {
17247
+ readonly name: "workspace";
17248
+ readonly in: "path";
17249
+ readonly required: true;
17250
+ readonly schema: {
17251
+ readonly type: "string";
17252
+ readonly format: "uuid";
17253
+ };
17254
+ readonly description: "Workspace identifier.";
17255
+ },
17256
+ {
17257
+ readonly name: "roomId";
17258
+ readonly in: "query";
17259
+ readonly required: false;
17260
+ readonly schema: {
17261
+ readonly type: "string";
17262
+ };
17263
+ readonly description: "Only return suggestions for this chat room.";
17264
+ }
17265
+ ];
17266
+ readonly responses: {
17267
+ readonly 200: {
17268
+ readonly description: "Suggestions fetched successfully.";
17269
+ readonly content: {
17270
+ readonly "application/json": {
17271
+ readonly schema: {
17272
+ readonly $ref: "#/components/schemas/ListAiSuggestionsSuccess";
17273
+ };
17274
+ };
17275
+ };
17276
+ };
17277
+ readonly 403: {
17278
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::chats.";
17279
+ readonly content: {
17280
+ readonly "application/json": {
17281
+ readonly schema: {
17282
+ readonly $ref: "#/components/schemas/ErrorResponse";
17283
+ };
17284
+ };
17285
+ };
17286
+ };
17287
+ };
17288
+ };
17289
+ };
17290
+ readonly "/ai/suggestions/send": {
17291
+ readonly post: {
17292
+ readonly tags: readonly [
17293
+ "AI Replies"
17294
+ ];
17295
+ readonly summary: "Send an AI suggestion to the customer";
17296
+ 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.";
17297
+ readonly security: readonly [
17298
+ never
17299
+ ];
17300
+ readonly requestBody: {
17301
+ readonly required: true;
17302
+ readonly content: {
17303
+ readonly "application/json": {
17304
+ readonly schema: {
17305
+ readonly type: "object";
17306
+ readonly required: readonly [
17307
+ "workspace",
17308
+ "replyId"
17309
+ ];
17310
+ readonly properties: {
17311
+ readonly workspace: {
17312
+ readonly type: "string";
17313
+ readonly format: "uuid";
17314
+ };
17315
+ readonly replyId: {
17316
+ readonly type: "string";
17317
+ readonly format: "uuid";
17318
+ };
17319
+ };
17320
+ };
17321
+ };
17322
+ };
17323
+ };
17324
+ readonly responses: {
17325
+ readonly 200: {
17326
+ readonly description: "Suggestion sent.";
17327
+ readonly content: {
17328
+ readonly "application/json": {
17329
+ readonly schema: {
17330
+ readonly $ref: "#/components/schemas/SimpleSuccess";
17331
+ };
17332
+ };
17333
+ };
17334
+ };
17335
+ readonly 400: {
17336
+ readonly description: "Validation error, or the suggestion was already sent.";
17337
+ readonly content: {
17338
+ readonly "application/json": {
17339
+ readonly schema: {
17340
+ readonly $ref: "#/components/schemas/ErrorResponse";
17341
+ };
17342
+ };
17343
+ };
17344
+ };
17345
+ readonly 404: {
17346
+ readonly description: "Suggestion not found in this workspace.";
17347
+ readonly content: {
17348
+ readonly "application/json": {
17349
+ readonly schema: {
17350
+ readonly $ref: "#/components/schemas/ErrorResponse";
17351
+ };
17352
+ };
17353
+ };
17354
+ };
17355
+ readonly 502: {
17356
+ readonly description: "The chat server rejected the message, or the operator has no chat session.";
17357
+ readonly content: {
17358
+ readonly "application/json": {
17359
+ readonly schema: {
17360
+ readonly $ref: "#/components/schemas/ErrorResponse";
17361
+ };
17362
+ };
17363
+ };
17364
+ };
17365
+ };
17366
+ };
17367
+ };
17368
+ readonly "/ai/suggestions/dismiss": {
17369
+ readonly post: {
17370
+ readonly tags: readonly [
17371
+ "AI Replies"
17372
+ ];
17373
+ readonly summary: "Dismiss an AI suggestion";
17374
+ readonly description: "Marks a suggestion as dismissed so it leaves the queue. Requires workspace access and write access to crm::chats.";
17375
+ readonly security: readonly [
17376
+ never
17377
+ ];
17378
+ readonly requestBody: {
17379
+ readonly required: true;
17380
+ readonly content: {
17381
+ readonly "application/json": {
17382
+ readonly schema: {
17383
+ readonly type: "object";
17384
+ readonly required: readonly [
17385
+ "workspace",
17386
+ "replyId"
17387
+ ];
17388
+ readonly properties: {
17389
+ readonly workspace: {
17390
+ readonly type: "string";
17391
+ readonly format: "uuid";
17392
+ };
17393
+ readonly replyId: {
17394
+ readonly type: "string";
17395
+ readonly format: "uuid";
17396
+ };
17397
+ };
17398
+ };
17399
+ };
17400
+ };
17401
+ };
17402
+ readonly responses: {
17403
+ readonly 200: {
17404
+ readonly description: "Suggestion dismissed.";
17405
+ readonly content: {
17406
+ readonly "application/json": {
17407
+ readonly schema: {
17408
+ readonly $ref: "#/components/schemas/SimpleSuccess";
17409
+ };
17410
+ };
17411
+ };
17412
+ };
17413
+ readonly 400: {
17414
+ readonly description: "Validation error, or the suggestion was already sent.";
17415
+ readonly content: {
17416
+ readonly "application/json": {
17417
+ readonly schema: {
17418
+ readonly $ref: "#/components/schemas/ErrorResponse";
17419
+ };
17420
+ };
17421
+ };
17422
+ };
17423
+ readonly 404: {
17424
+ readonly description: "Suggestion not found in this workspace.";
17425
+ readonly content: {
17426
+ readonly "application/json": {
17427
+ readonly schema: {
17428
+ readonly $ref: "#/components/schemas/ErrorResponse";
17429
+ };
17430
+ };
17431
+ };
17432
+ };
17433
+ };
17434
+ };
17435
+ };
17436
+ readonly "/analytics/{workspace}/ai-usage": {
17437
+ readonly get: {
17438
+ readonly tags: readonly [
17439
+ "Analytics"
17440
+ ];
17441
+ readonly summary: "AI token usage for a workspace";
17442
+ 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.";
17443
+ readonly security: readonly [
17444
+ never
17445
+ ];
17446
+ readonly parameters: readonly [
17447
+ {
17448
+ readonly name: "workspace";
17449
+ readonly in: "path";
17450
+ readonly required: true;
17451
+ readonly schema: {
17452
+ readonly type: "string";
17453
+ readonly format: "uuid";
17454
+ };
17455
+ readonly description: "Workspace identifier.";
17456
+ },
17457
+ {
17458
+ readonly name: "from";
17459
+ readonly in: "query";
17460
+ readonly required: false;
17461
+ readonly schema: {
17462
+ readonly type: "string";
17463
+ readonly format: "date-time";
17464
+ };
17465
+ readonly description: "Inclusive start of the reporting period.";
17466
+ },
17467
+ {
17468
+ readonly name: "to";
17469
+ readonly in: "query";
17470
+ readonly required: false;
17471
+ readonly schema: {
17472
+ readonly type: "string";
17473
+ readonly format: "date-time";
17474
+ };
17475
+ readonly description: "Exclusive end of the reporting period.";
17476
+ }
17477
+ ];
17478
+ readonly responses: {
17479
+ readonly 200: {
17480
+ readonly description: "Usage fetched successfully.";
17481
+ readonly content: {
17482
+ readonly "application/json": {
17483
+ readonly schema: {
17484
+ readonly $ref: "#/components/schemas/AiUsageSuccess";
17485
+ };
17486
+ };
17487
+ };
17488
+ };
17489
+ readonly 400: {
17490
+ readonly description: "Invalid period.";
17491
+ readonly content: {
17492
+ readonly "application/json": {
17493
+ readonly schema: {
17494
+ readonly $ref: "#/components/schemas/ErrorResponse";
17495
+ };
17496
+ };
17497
+ };
17498
+ };
17499
+ readonly 403: {
17500
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::analytics.";
17501
+ readonly content: {
17502
+ readonly "application/json": {
17503
+ readonly schema: {
17504
+ readonly $ref: "#/components/schemas/ErrorResponse";
17505
+ };
17506
+ };
17507
+ };
17508
+ };
17509
+ };
17510
+ };
17511
+ };
17512
+ readonly "/freason/list/{workspace}": {
17513
+ readonly get: {
17514
+ readonly tags: readonly [
17515
+ "Failure Reasons"
17516
+ ];
17517
+ readonly summary: "List failure reasons by workspace";
17518
+ readonly description: "Returns all failure reasons for the given workspace. Requires workspace access and read access to crm::tasks.";
17519
+ readonly security: readonly [
17520
+ never
17521
+ ];
17522
+ readonly parameters: readonly [
17523
+ {
17524
+ readonly name: "workspace";
17525
+ readonly in: "path";
17526
+ readonly required: true;
17527
+ readonly schema: {
17528
+ readonly type: "string";
17529
+ readonly format: "uuid";
17530
+ };
17531
+ readonly description: "Workspace identifier.";
17532
+ }
17533
+ ];
17534
+ readonly responses: {
17535
+ readonly 200: {
17536
+ readonly description: "Failure reasons fetched successfully.";
17537
+ readonly content: {
17538
+ readonly "application/json": {
17539
+ readonly schema: {
17540
+ readonly $ref: "#/components/schemas/ListFailureReasonsSuccess";
17541
+ };
17542
+ };
17543
+ };
17544
+ };
17545
+ readonly 401: {
17546
+ readonly description: "Unauthorized - Missing or invalid access token.";
17547
+ readonly content: {
17548
+ readonly "application/json": {
17549
+ readonly schema: {
17550
+ readonly $ref: "#/components/schemas/ErrorResponse";
17551
+ };
17552
+ };
17553
+ };
17554
+ };
17555
+ readonly 403: {
17556
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
17557
+ readonly content: {
17558
+ readonly "application/json": {
17559
+ readonly schema: {
17560
+ readonly $ref: "#/components/schemas/ErrorResponse";
17561
+ };
17562
+ };
17563
+ };
17564
+ };
17565
+ };
17566
+ };
17567
+ };
17568
+ readonly "/freason/get/{workspace}/{failureReasonId}": {
17569
+ readonly get: {
17570
+ readonly tags: readonly [
17571
+ "Failure Reasons"
17572
+ ];
17573
+ readonly summary: "Get a failure reason";
17574
+ readonly description: "Returns a single failure reason by id. Requires workspace access and read access to crm::tasks.";
17575
+ readonly security: readonly [
17576
+ never
17577
+ ];
17578
+ readonly parameters: readonly [
17579
+ {
17580
+ readonly name: "workspace";
17581
+ readonly in: "path";
17582
+ readonly required: true;
17583
+ readonly schema: {
17584
+ readonly type: "string";
17585
+ readonly format: "uuid";
17586
+ };
17587
+ readonly description: "Workspace identifier.";
17588
+ },
17589
+ {
17590
+ readonly name: "failureReasonId";
17591
+ readonly in: "path";
17592
+ readonly required: true;
17593
+ readonly schema: {
17594
+ readonly type: "string";
17595
+ readonly format: "uuid";
17596
+ };
17597
+ readonly description: "Failure reason identifier.";
17598
+ }
17599
+ ];
17600
+ readonly responses: {
17601
+ readonly 200: {
17602
+ readonly description: "Failure reason fetched successfully.";
17603
+ readonly content: {
17604
+ readonly "application/json": {
17605
+ readonly schema: {
17606
+ readonly $ref: "#/components/schemas/FailureReasonSuccess";
17607
+ };
17608
+ };
17609
+ };
17610
+ };
17611
+ readonly 401: {
17612
+ readonly description: "Unauthorized - Missing or invalid access token.";
17613
+ readonly content: {
17614
+ readonly "application/json": {
17615
+ readonly schema: {
17616
+ readonly $ref: "#/components/schemas/ErrorResponse";
17617
+ };
17618
+ };
17619
+ };
17620
+ };
17621
+ readonly 403: {
17622
+ readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks.";
17623
+ readonly content: {
17624
+ readonly "application/json": {
17625
+ readonly schema: {
17626
+ readonly $ref: "#/components/schemas/ErrorResponse";
17627
+ };
17628
+ };
17629
+ };
17630
+ };
17631
+ readonly 404: {
17632
+ readonly description: "Failure reason not found.";
17633
+ readonly content: {
17634
+ readonly "application/json": {
17635
+ readonly schema: {
17636
+ readonly $ref: "#/components/schemas/ErrorResponse";
17637
+ };
17638
+ };
17639
+ };
17640
+ };
17641
+ };
17642
+ };
17643
+ };
17644
+ readonly "/freason/create": {
17645
+ readonly post: {
17646
+ readonly tags: readonly [
17647
+ "Failure Reasons"
17648
+ ];
17649
+ readonly summary: "Create a failure reason";
17650
+ readonly description: "Creates a failure reason in the specified workspace. Requires workspace access and write access to crm::tasks.";
17651
+ readonly security: readonly [
17652
+ never
17653
+ ];
17654
+ readonly requestBody: {
17655
+ readonly required: true;
17656
+ readonly content: {
17657
+ readonly "application/json": {
17658
+ readonly schema: {
17659
+ readonly type: "object";
17660
+ readonly required: readonly [
17661
+ "workspace",
17662
+ "title"
17663
+ ];
17664
+ readonly properties: {
17665
+ readonly workspace: {
17666
+ readonly type: "string";
17667
+ readonly format: "uuid";
17668
+ readonly description: "Workspace identifier.";
17669
+ };
17670
+ readonly title: {
17671
+ readonly type: "string";
17672
+ readonly maxLength: 256;
17673
+ readonly description: "Failure reason title.";
17674
+ };
17675
+ readonly description: {
17676
+ readonly type: "string";
17677
+ readonly maxLength: 256;
17678
+ readonly description: "Optional failure reason description.";
17679
+ };
17680
+ };
17681
+ };
17682
+ };
17683
+ };
17684
+ };
17685
+ readonly responses: {
17686
+ readonly 201: {
17687
+ readonly description: "Failure reason created successfully.";
17688
+ readonly content: {
17689
+ readonly "application/json": {
17690
+ readonly schema: {
17691
+ readonly $ref: "#/components/schemas/FailureReasonSuccess";
17692
+ };
17693
+ };
17694
+ };
17695
+ };
17696
+ readonly 400: {
17697
+ readonly description: "Invalid request payload.";
17698
+ readonly content: {
17699
+ readonly "application/json": {
17700
+ readonly schema: {
17701
+ readonly $ref: "#/components/schemas/ErrorResponse";
17702
+ };
17703
+ };
17704
+ };
17705
+ };
17706
+ readonly 401: {
17707
+ readonly description: "Unauthorized - Missing or invalid access token.";
17708
+ readonly content: {
17709
+ readonly "application/json": {
17710
+ readonly schema: {
17711
+ readonly $ref: "#/components/schemas/ErrorResponse";
17712
+ };
17713
+ };
17714
+ };
17715
+ };
17716
+ readonly 403: {
17717
+ readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks.";
17718
+ readonly content: {
17719
+ readonly "application/json": {
17720
+ readonly schema: {
17721
+ readonly $ref: "#/components/schemas/ErrorResponse";
17722
+ };
17723
+ };
17724
+ };
17725
+ };
17726
+ readonly 409: {
17727
+ readonly description: "A failure reason with this title already exists.";
17728
+ readonly content: {
17729
+ readonly "application/json": {
17730
+ readonly schema: {
17731
+ readonly $ref: "#/components/schemas/ErrorResponse";
17732
+ };
17733
+ };
17734
+ };
17735
+ };
17736
+ };
17737
+ };
17738
+ };
17739
+ readonly "/freason/update": {
17740
+ readonly post: {
17741
+ readonly tags: readonly [
17742
+ "Failure Reasons"
17743
+ ];
17744
+ readonly summary: "Update a failure reason";
17745
+ readonly description: "Updates a failure reason's title and/or description. Requires workspace access and write access to crm::tasks.";
16943
17746
  readonly security: readonly [
16944
17747
  never
16945
17748
  ];
@@ -23209,6 +24012,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
23209
24012
  loggiaAccess: boolean | null;
23210
24013
  otherFeatures: string | null;
23211
24014
  pricePerSquareMeter: number | null;
24015
+ agencyCommission: number | null;
23212
24016
  alternativeEURCurrency: boolean | null;
23213
24017
  alternativeRUBCurrency: boolean | null;
23214
24018
  alternativeUSDCurrency: boolean | null;
@@ -23298,6 +24102,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
23298
24102
  mortgagePaymentAmount: number | null;
23299
24103
  installmentPaymentAmount: number | null;
23300
24104
  pricePerSquareMeter: number | null;
24105
+ agencyCommission: number | null;
23301
24106
  alternativeEURCurrency: boolean | null;
23302
24107
  alternativeRUBCurrency: boolean | null;
23303
24108
  alternativeUSDCurrency: boolean | null;
@@ -23399,6 +24204,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
23399
24204
  mortgagePaymentAmount: number | null;
23400
24205
  installmentPaymentAmount: number | null;
23401
24206
  pricePerSquareMeter: number | null;
24207
+ agencyCommission: number | null;
23402
24208
  alternativeEURCurrency: boolean | null;
23403
24209
  alternativeRUBCurrency: boolean | null;
23404
24210
  alternativeUSDCurrency: boolean | null;
@@ -23518,6 +24324,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
23518
24324
  mortgagePaymentAmount: number | null;
23519
24325
  installmentPaymentAmount: number | null;
23520
24326
  pricePerSquareMeter: number | null;
24327
+ agencyCommission: number | null;
23521
24328
  alternativeEURCurrency: boolean | null;
23522
24329
  alternativeRUBCurrency: boolean | null;
23523
24330
  alternativeUSDCurrency: boolean | null;
@@ -29310,6 +30117,217 @@ declare const routes: import("hono/hono-base").HonoBase<{
29310
30117
  };
29311
30118
  };
29312
30119
  }, "/chat"> | import("hono/types").MergeSchemaPath<{
30120
+ "/inbound": {
30121
+ $post: {
30122
+ input: {};
30123
+ output: {
30124
+ success: false;
30125
+ error: string;
30126
+ };
30127
+ outputFormat: "json";
30128
+ status: 401;
30129
+ } | {
30130
+ input: {};
30131
+ output: {
30132
+ success: false;
30133
+ error: never;
30134
+ };
30135
+ outputFormat: "json";
30136
+ status: 400;
30137
+ } | {
30138
+ input: {};
30139
+ output: {
30140
+ success: true;
30141
+ buffered: number;
30142
+ };
30143
+ outputFormat: "json";
30144
+ status: 202;
30145
+ };
30146
+ };
30147
+ } & {
30148
+ "/settings/:workspace": {
30149
+ $get: {
30150
+ input: {
30151
+ param: {
30152
+ workspace: string;
30153
+ };
30154
+ };
30155
+ output: {
30156
+ success: true;
30157
+ settings: {
30158
+ enabled: boolean;
30159
+ systemPrompt: string | null;
30160
+ monthlyTokenLimit: number | null;
30161
+ tokensUsedThisMonth: number;
30162
+ };
30163
+ };
30164
+ outputFormat: "json";
30165
+ status: 200;
30166
+ };
30167
+ };
30168
+ } & {
30169
+ "/settings": {
30170
+ $post: {
30171
+ input: {};
30172
+ output: {
30173
+ success: false;
30174
+ error: never;
30175
+ };
30176
+ outputFormat: "json";
30177
+ status: 400;
30178
+ } | {
30179
+ input: {};
30180
+ output: {
30181
+ success: true;
30182
+ settings: {
30183
+ enabled: boolean;
30184
+ systemPrompt: string | null;
30185
+ monthlyTokenLimit: number | null;
30186
+ };
30187
+ };
30188
+ outputFormat: "json";
30189
+ status: 200;
30190
+ };
30191
+ };
30192
+ } & {
30193
+ "/rooms/list/:workspace": {
30194
+ $get: {
30195
+ input: {
30196
+ param: {
30197
+ workspace: string;
30198
+ };
30199
+ };
30200
+ output: {
30201
+ success: true;
30202
+ rooms: {
30203
+ roomId: string;
30204
+ mode: "disabled" | "suggestion" | "automatic";
30205
+ updated_at: string | null;
30206
+ }[];
30207
+ };
30208
+ outputFormat: "json";
30209
+ status: 200;
30210
+ };
30211
+ };
30212
+ } & {
30213
+ "/rooms/mode": {
30214
+ $post: {
30215
+ input: {};
30216
+ output: {
30217
+ success: false;
30218
+ error: never;
30219
+ };
30220
+ outputFormat: "json";
30221
+ status: 400;
30222
+ } | {
30223
+ input: {};
30224
+ output: {
30225
+ success: true;
30226
+ room: {
30227
+ roomId: string;
30228
+ mode: null;
30229
+ };
30230
+ };
30231
+ outputFormat: "json";
30232
+ status: 200;
30233
+ } | {
30234
+ input: {};
30235
+ output: {
30236
+ success: true;
30237
+ room: {
30238
+ roomId: string;
30239
+ mode: "disabled" | "suggestion" | "automatic";
30240
+ };
30241
+ };
30242
+ outputFormat: "json";
30243
+ status: 200;
30244
+ };
30245
+ };
30246
+ } & {
30247
+ "/suggestions/list/:workspace": {
30248
+ $get: {
30249
+ input: {
30250
+ param: {
30251
+ workspace: string;
30252
+ };
30253
+ };
30254
+ output: {
30255
+ success: true;
30256
+ suggestions: {
30257
+ id: string;
30258
+ roomId: string;
30259
+ channel: string;
30260
+ text: string;
30261
+ created_at: string;
30262
+ }[];
30263
+ };
30264
+ outputFormat: "json";
30265
+ status: 200;
30266
+ };
30267
+ };
30268
+ } & {
30269
+ "/suggestions/send": {
30270
+ $post: {
30271
+ input: {};
30272
+ output: {
30273
+ success: false;
30274
+ error: string;
30275
+ };
30276
+ outputFormat: "json";
30277
+ status: 404;
30278
+ } | {
30279
+ input: {};
30280
+ output: {
30281
+ success: false;
30282
+ error: string;
30283
+ };
30284
+ outputFormat: "json";
30285
+ status: 400;
30286
+ } | {
30287
+ input: {};
30288
+ output: {
30289
+ success: false;
30290
+ error: string;
30291
+ };
30292
+ outputFormat: "json";
30293
+ status: 502;
30294
+ } | {
30295
+ input: {};
30296
+ output: {
30297
+ success: true;
30298
+ };
30299
+ outputFormat: "json";
30300
+ status: 200;
30301
+ };
30302
+ };
30303
+ } & {
30304
+ "/suggestions/dismiss": {
30305
+ $post: {
30306
+ input: {};
30307
+ output: {
30308
+ success: false;
30309
+ error: string;
30310
+ };
30311
+ outputFormat: "json";
30312
+ status: 404;
30313
+ } | {
30314
+ input: {};
30315
+ output: {
30316
+ success: false;
30317
+ error: string;
30318
+ };
30319
+ outputFormat: "json";
30320
+ status: 400;
30321
+ } | {
30322
+ input: {};
30323
+ output: {
30324
+ success: true;
30325
+ };
30326
+ outputFormat: "json";
30327
+ status: 200;
30328
+ };
30329
+ };
30330
+ }, "/ai"> | import("hono/types").MergeSchemaPath<{
29313
30331
  "/sync": {
29314
30332
  $get: {
29315
30333
  input: {};
@@ -30178,6 +31196,60 @@ declare const routes: import("hono/hono-base").HonoBase<{
30178
31196
  status: 200;
30179
31197
  };
30180
31198
  };
31199
+ } & {
31200
+ "/:workspace/ai-usage": {
31201
+ $get: {
31202
+ input: {
31203
+ param: {
31204
+ workspace: string;
31205
+ };
31206
+ };
31207
+ output: {
31208
+ success: false;
31209
+ error: {
31210
+ [x: string]: import("hono/utils/types").JSONValue;
31211
+ };
31212
+ };
31213
+ outputFormat: "json";
31214
+ status: 400;
31215
+ } | {
31216
+ input: {
31217
+ param: {
31218
+ workspace: string;
31219
+ };
31220
+ };
31221
+ output: {
31222
+ success: false;
31223
+ error: string;
31224
+ };
31225
+ outputFormat: "json";
31226
+ status: 400;
31227
+ } | {
31228
+ input: {
31229
+ param: {
31230
+ workspace: string;
31231
+ };
31232
+ };
31233
+ output: {
31234
+ success: true;
31235
+ workspaceId: string;
31236
+ period: {
31237
+ from: string | null;
31238
+ to: string | null;
31239
+ };
31240
+ usage: {
31241
+ requestCount: number;
31242
+ promptTokens: number;
31243
+ completionTokens: number;
31244
+ totalTokens: number;
31245
+ };
31246
+ tokensUsedThisMonth: number;
31247
+ monthlyTokenLimit: number | null;
31248
+ };
31249
+ outputFormat: "json";
31250
+ status: 200;
31251
+ };
31252
+ };
30181
31253
  }, "/analytics"> | import("hono/types").MergeSchemaPath<{
30182
31254
  "/accounts/list/:workspace": {
30183
31255
  $get: {