@fern-api/fdr-sdk 1.2.174-94f3833ee6 → 1.2.174-950bdb766f

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 (43) hide show
  1. package/dist/js/client/FdrClient.js +366 -303
  2. package/dist/js/client/FdrClient.js.map +1 -1
  3. package/dist/js/client/FdrClient.mjs +366 -303
  4. package/dist/js/client/FdrClient.mjs.map +1 -1
  5. package/dist/js/index.js +641 -578
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +641 -578
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/orpc-client/dashboard/sdkVersion.js +3 -1
  10. package/dist/js/orpc-client/dashboard/sdkVersion.js.map +1 -1
  11. package/dist/js/orpc-client/dashboard/sdkVersion.mjs +3 -1
  12. package/dist/js/orpc-client/dashboard/sdkVersion.mjs.map +1 -1
  13. package/dist/js/orpc-client.js +743 -634
  14. package/dist/js/orpc-client.js.map +1 -1
  15. package/dist/js/orpc-client.mjs +729 -634
  16. package/dist/js/orpc-client.mjs.map +1 -1
  17. package/dist/orpc-client/dashboard/sdkVersion.d.ts +3 -1
  18. package/dist/orpc-client/dashboard/sdkVersion.d.ts.map +1 -1
  19. package/dist/orpc-client/dashboard/sdkVersion.js +6 -2
  20. package/dist/orpc-client/dashboard/sdkVersion.js.map +1 -1
  21. package/dist/orpc-client/dashboard/sdkVersion.test.js +5 -1
  22. package/dist/orpc-client/dashboard/sdkVersion.test.js.map +1 -1
  23. package/dist/orpc-client/mcp-hosting/contract.d.ts +138 -0
  24. package/dist/orpc-client/mcp-hosting/contract.d.ts.map +1 -1
  25. package/dist/orpc-client/mcp-hosting/contract.js +17 -1
  26. package/dist/orpc-client/mcp-hosting/contract.js.map +1 -1
  27. package/dist/orpc-client/mcp-hosting/index.d.ts +1 -0
  28. package/dist/orpc-client/mcp-hosting/index.d.ts.map +1 -1
  29. package/dist/orpc-client/mcp-hosting/index.js +1 -0
  30. package/dist/orpc-client/mcp-hosting/index.js.map +1 -1
  31. package/dist/orpc-client/mcp-hosting/usage.d.ts +194 -0
  32. package/dist/orpc-client/mcp-hosting/usage.d.ts.map +1 -0
  33. package/dist/orpc-client/mcp-hosting/usage.js +116 -0
  34. package/dist/orpc-client/mcp-hosting/usage.js.map +1 -0
  35. package/dist/types/orpc-client/dashboard/sdkVersion.d.ts +3 -1
  36. package/dist/types/orpc-client/dashboard/sdkVersion.d.ts.map +1 -1
  37. package/dist/types/orpc-client/mcp-hosting/contract.d.ts +138 -0
  38. package/dist/types/orpc-client/mcp-hosting/contract.d.ts.map +1 -1
  39. package/dist/types/orpc-client/mcp-hosting/index.d.ts +1 -0
  40. package/dist/types/orpc-client/mcp-hosting/index.d.ts.map +1 -1
  41. package/dist/types/orpc-client/mcp-hosting/usage.d.ts +194 -0
  42. package/dist/types/orpc-client/mcp-hosting/usage.d.ts.map +1 -0
  43. package/package.json +1 -1
@@ -0,0 +1,194 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Monthly tool-call allowance for hosted MCP: the contract between FDR (which
4
+ * decides an org's allowance and writes it to KV) and the dispatcher (which
5
+ * counts every `tools/call` it forwards and refuses calls over the allowance).
6
+ *
7
+ * What counts is decided by the dispatcher alone, so it is written down here
8
+ * once:
9
+ *
10
+ * - Every JSON-RPC `tools/call` request the dispatcher forwards to a tenant,
11
+ * including each one inside a batch.
12
+ * - Nothing else: `initialize`, `tools/list`, resources, prompts, `ping`,
13
+ * notifications and browser GETs are free.
14
+ * - A call that never reached the customer's API is refunded once its outcome
15
+ * is known: a tool the server does not expose (`unknown_tool`), a JSON-RPC
16
+ * error the server raised before calling the API (`rpc_error`, e.g. invalid
17
+ * arguments), and a platform failure (the tenant could not be reached).
18
+ * A call the API answered, with success or with an error, stays counted.
19
+ * So does a tool error the generated server raises itself before calling
20
+ * the API (a missing credential): it is a `tool_error` at HTTP 200, told
21
+ * apart only by its text, which nothing here matches on.
22
+ *
23
+ * The count is per organization across all its servers, per UTC calendar
24
+ * month, and resets on the 1st.
25
+ */
26
+ /** Free tool calls per org per month when FDR has written no allowance. */
27
+ export declare const MCP_FREE_TOOL_CALLS_PER_MONTH = 1000;
28
+ /** JSON-RPC error code the dispatcher answers with when the allowance is used up (paused is -32001). */
29
+ export declare const MCP_QUOTA_EXCEEDED_CODE = -32002;
30
+ /** Where "need more tool calls" points by default: the sales contact page. */
31
+ export declare const MCP_SALES_CONTACT_URL = "https://buildwithfern.com/book-demo";
32
+ /**
33
+ * Org allowance. Addressed by org id (`quota:{orgId}`), not by script name, so
34
+ * it is not part of KV_KEY_PREFIXES_ALL: deleting a server leaves its org's
35
+ * allowance alone. No key means the default free allowance.
36
+ */
37
+ export declare const KV_KEY_PREFIX_QUOTA = "quota:";
38
+ export declare const McpOrgQuotaSchema: z.ZodObject<{
39
+ /** Tool calls per month; null means no limit. */
40
+ limit: z.ZodNullable<z.ZodNumber>;
41
+ /**
42
+ * Sales approved the org to go over its limit. The dispatcher keeps
43
+ * counting but never refuses a call.
44
+ */
45
+ approved: z.ZodBoolean;
46
+ }, "strip", z.ZodTypeAny, {
47
+ limit: number | null;
48
+ approved: boolean;
49
+ }, {
50
+ limit: number | null;
51
+ approved: boolean;
52
+ }>;
53
+ /** Value of the `quota:{orgId}` key. */
54
+ export type McpOrgQuota = z.infer<typeof McpOrgQuotaSchema>;
55
+ export declare const DEFAULT_MCP_ORG_QUOTA: McpOrgQuota;
56
+ /** `yyyy-mm` of a date in UTC: the key a month's counts are stored under. */
57
+ export declare function usageMonth(date: Date): string;
58
+ /** First instant of the month after `month` (`yyyy-mm`), UTC: when its count resets. */
59
+ export declare function usageMonthResetsAt(month: string): Date;
60
+ export declare const UsageMonthSchema: z.ZodString;
61
+ /** What the dispatcher's internal usage route returns for one org and month. */
62
+ export declare const McpUsageCountsSchema: z.ZodObject<{
63
+ month: z.ZodString;
64
+ toolCalls: z.ZodNumber;
65
+ /** Calls refused because the allowance was used up. */
66
+ blockedCalls: z.ZodNumber;
67
+ servers: z.ZodArray<z.ZodObject<{
68
+ slug: z.ZodString;
69
+ toolCalls: z.ZodNumber;
70
+ }, "strip", z.ZodTypeAny, {
71
+ slug: string;
72
+ toolCalls: number;
73
+ }, {
74
+ slug: string;
75
+ toolCalls: number;
76
+ }>, "many">;
77
+ /** Whether this dispatcher refuses calls over the allowance (QUOTA_ENFORCE), or only counts them. */
78
+ enforced: z.ZodBoolean;
79
+ }, "strip", z.ZodTypeAny, {
80
+ month: string;
81
+ toolCalls: number;
82
+ blockedCalls: number;
83
+ servers: {
84
+ slug: string;
85
+ toolCalls: number;
86
+ }[];
87
+ enforced: boolean;
88
+ }, {
89
+ month: string;
90
+ toolCalls: number;
91
+ blockedCalls: number;
92
+ servers: {
93
+ slug: string;
94
+ toolCalls: number;
95
+ }[];
96
+ enforced: boolean;
97
+ }>;
98
+ export type McpUsageCounts = z.infer<typeof McpUsageCountsSchema>;
99
+ /** Input of getUsage: one org, one month (default: the current one). */
100
+ export declare const GetMcpUsageInputSchema: z.ZodObject<{
101
+ orgId: z.ZodString;
102
+ month: z.ZodOptional<z.ZodString>;
103
+ }, "strip", z.ZodTypeAny, {
104
+ orgId: string;
105
+ month?: string | undefined;
106
+ }, {
107
+ orgId: string;
108
+ month?: string | undefined;
109
+ }>;
110
+ /** Input of setUsageAllowance (Fern staff only). */
111
+ export declare const SetMcpUsageAllowanceInputSchema: z.ZodObject<{
112
+ orgId: z.ZodString;
113
+ /** Tool calls per month; null means no limit. */
114
+ limit: z.ZodNullable<z.ZodNumber>;
115
+ /** Approved to go over the limit: calls are counted but never refused. */
116
+ approved: z.ZodBoolean;
117
+ note: z.ZodOptional<z.ZodString>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ orgId: string;
120
+ limit: number | null;
121
+ approved: boolean;
122
+ note?: string | undefined;
123
+ }, {
124
+ orgId: string;
125
+ limit: number | null;
126
+ approved: boolean;
127
+ note?: string | undefined;
128
+ }>;
129
+ /**
130
+ * An org's hosted-MCP usage for one month against its allowance: what the
131
+ * dashboard shows. `toolCalls` is the dispatcher's exact count (not the
132
+ * sampled analytics). `blocked` is true when calls are being refused now.
133
+ */
134
+ export declare const McpOrgUsageSchema: z.ZodObject<{
135
+ month: z.ZodString;
136
+ resetsAt: z.ZodString;
137
+ toolCalls: z.ZodNumber;
138
+ blockedCalls: z.ZodNumber;
139
+ /** Tool calls per month; null means no limit. */
140
+ limit: z.ZodNullable<z.ZodNumber>;
141
+ approved: z.ZodBoolean;
142
+ /** The org has the free allowance (no allowance set by Fern). */
143
+ isFreeAllowance: z.ZodBoolean;
144
+ blocked: z.ZodBoolean;
145
+ /** Whether calls over the allowance are refused in this environment, or only counted. */
146
+ enforced: z.ZodBoolean;
147
+ servers: z.ZodArray<z.ZodObject<{
148
+ slug: z.ZodString;
149
+ toolCalls: z.ZodNumber;
150
+ }, "strip", z.ZodTypeAny, {
151
+ slug: string;
152
+ toolCalls: number;
153
+ }, {
154
+ slug: string;
155
+ toolCalls: number;
156
+ }>, "many">;
157
+ contactUrl: z.ZodString;
158
+ }, "strip", z.ZodTypeAny, {
159
+ limit: number | null;
160
+ month: string;
161
+ toolCalls: number;
162
+ approved: boolean;
163
+ blockedCalls: number;
164
+ servers: {
165
+ slug: string;
166
+ toolCalls: number;
167
+ }[];
168
+ enforced: boolean;
169
+ resetsAt: string;
170
+ isFreeAllowance: boolean;
171
+ blocked: boolean;
172
+ contactUrl: string;
173
+ }, {
174
+ limit: number | null;
175
+ month: string;
176
+ toolCalls: number;
177
+ approved: boolean;
178
+ blockedCalls: number;
179
+ servers: {
180
+ slug: string;
181
+ toolCalls: number;
182
+ }[];
183
+ enforced: boolean;
184
+ resetsAt: string;
185
+ isFreeAllowance: boolean;
186
+ blocked: boolean;
187
+ contactUrl: string;
188
+ }>;
189
+ export type GetMcpUsageInput = z.infer<typeof GetMcpUsageInputSchema>;
190
+ export type SetMcpUsageAllowanceInput = z.infer<typeof SetMcpUsageAllowanceInputSchema>;
191
+ export type McpOrgUsage = z.infer<typeof McpOrgUsageSchema>;
192
+ /** "Need more tool calls?" link for an org, carrying context for sales. */
193
+ export declare function mcpSalesContactUrl(orgId: string, base?: string): string;
194
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../../src/orpc-client/mcp-hosting/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,wGAAwG;AACxG,eAAO,MAAM,uBAAuB,SAAS,CAAC;AAE9C,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,wCAAwC,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,iBAAiB;IAC1B,iDAAiD;;IAEjD;;;OAGG;;;;;;;;EAEL,CAAC;AACH,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,qBAAqB,EAAE,WAAuE,CAAC;AAE5G,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED,eAAO,MAAM,gBAAgB,aAAkE,CAAC;AAEhG,gFAAgF;AAChF,eAAO,MAAM,oBAAoB;;;IAG7B,uDAAuD;;;;;;;;;;;;IAGvD,qGAAqG;;;;;;;;;;;;;;;;;;;;EAEvG,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AASlE,wEAAwE;AACxE,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AAEH,oDAAoD;AACpD,eAAO,MAAM,+BAA+B;;IAExC,iDAAiD;;IAEjD,0EAA0E;;;;;;;;;;;;;EAG5E,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;IAK1B,iDAAiD;;;IAGjD,iEAAiE;;;IAGjE,yFAAyF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI3F,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAA8B,GAAG,MAAM,CAK9F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/fdr-sdk",
3
- "version": "1.2.174-94f3833ee6",
3
+ "version": "1.2.174-950bdb766f",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/postman-eng/sdk-gen-fern-platform.git",