terse-types 0.0.27 → 0.0.29

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.
@@ -126,6 +126,7 @@ export declare const ApiRoutes: {
126
126
  BY_ID: string;
127
127
  };
128
128
  PROJECTS: {
129
+ LIST: string;
129
130
  BY_ID: string;
130
131
  DEPLOYS: string;
131
132
  SOURCE_FILES: string;
@@ -180,5 +181,13 @@ export declare const ApiRoutes: {
180
181
  CREATE: string;
181
182
  BY_ID: string;
182
183
  };
184
+ BILLING: {
185
+ CATALOG: string;
186
+ CONTEXT: string;
187
+ CHECKOUT_SESSION: string;
188
+ CHANGE: string;
189
+ PORTAL_SESSION: string;
190
+ CACHE_INVALIDATION: string;
191
+ };
183
192
  };
184
193
  export declare function buildRoute(pattern: string, params: Record<string, string | number>): string;
@@ -126,6 +126,7 @@
126
126
  "BY_ID": "/api-tokens/:id"
127
127
  },
128
128
  "PROJECTS": {
129
+ "LIST": "/projects",
129
130
  "BY_ID": "/projects/:id",
130
131
  "DEPLOYS": "/projects/:id/deploys",
131
132
  "SOURCE_FILES": "/projects/:id/source/files",
@@ -179,5 +180,13 @@
179
180
  "USERS": {
180
181
  "CREATE": "/users",
181
182
  "BY_ID": "/users/:id"
183
+ },
184
+ "BILLING": {
185
+ "CATALOG": "/billing/catalog",
186
+ "CONTEXT": "/billing/context",
187
+ "CHECKOUT_SESSION": "/billing/checkout-session",
188
+ "CHANGE": "/billing/change",
189
+ "PORTAL_SESSION": "/billing/portal-session",
190
+ "CACHE_INVALIDATION": "/billing/cache-invalidation"
182
191
  }
183
192
  }
package/dist/Billing.d.ts CHANGED
@@ -19,13 +19,6 @@ export declare const envIdSchema: z.ZodObject<{
19
19
  test: z.ZodString;
20
20
  }, z.core.$strip>;
21
21
  export type EnvId = z.infer<typeof envIdSchema>;
22
- export declare const overageModeSchema: z.ZodEnum<{
23
- soft: "soft";
24
- strict: "strict";
25
- }>;
26
- export type OverageMode = z.infer<typeof overageModeSchema>;
27
- export declare const DEFAULT_OVERAGE_CAP_MULTIPLIER = 2;
28
- export declare const DEFAULT_OVERAGE_MODE: OverageMode;
29
22
  export declare const billingScheduledChangeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
30
23
  kind: z.ZodLiteral<"cancel_to_free">;
31
24
  effectiveAt: z.ZodCoercedDate<unknown>;
@@ -44,10 +37,6 @@ export declare const balanceSummarySchema: z.ZodObject<{
44
37
  totalCreditCapacity: z.ZodNumber;
45
38
  periodStart: z.ZodCoercedDate<unknown>;
46
39
  periodEnd: z.ZodCoercedDate<unknown>;
47
- overageMode: z.ZodEnum<{
48
- soft: "soft";
49
- strict: "strict";
50
- }>;
51
40
  hardCap: z.ZodNumber;
52
41
  canBuyTopups: z.ZodBoolean;
53
42
  scheduledChange: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -63,14 +52,20 @@ export type BalanceSummary = z.infer<typeof balanceSummarySchema>;
63
52
  export declare const usageBucketSchema: z.ZodObject<{
64
53
  startTimestamp: z.ZodNumber;
65
54
  endTimestamp: z.ZodNumber;
66
- credits: z.ZodNumber;
55
+ inputTokenCredits: z.ZodNumber;
56
+ outputTokenCredits: z.ZodNumber;
57
+ cachedInputCredits: z.ZodNumber;
58
+ runCredits: z.ZodNumber;
67
59
  }, z.core.$strip>;
68
60
  export type UsageBucket = z.infer<typeof usageBucketSchema>;
69
61
  export declare const usageResponseSchema: z.ZodObject<{
70
62
  buckets: z.ZodArray<z.ZodObject<{
71
63
  startTimestamp: z.ZodNumber;
72
64
  endTimestamp: z.ZodNumber;
73
- credits: z.ZodNumber;
65
+ inputTokenCredits: z.ZodNumber;
66
+ outputTokenCredits: z.ZodNumber;
67
+ cachedInputCredits: z.ZodNumber;
68
+ runCredits: z.ZodNumber;
74
69
  }, z.core.$strip>>;
75
70
  }, z.core.$strip>;
76
71
  export type UsageResponse = z.infer<typeof usageResponseSchema>;
@@ -85,10 +80,6 @@ export declare const billingContextResponseSchema: z.ZodObject<{
85
80
  totalCreditCapacity: z.ZodNumber;
86
81
  periodStart: z.ZodCoercedDate<unknown>;
87
82
  periodEnd: z.ZodCoercedDate<unknown>;
88
- overageMode: z.ZodEnum<{
89
- soft: "soft";
90
- strict: "strict";
91
- }>;
92
83
  hardCap: z.ZodNumber;
93
84
  canBuyTopups: z.ZodBoolean;
94
85
  scheduledChange: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -104,7 +95,10 @@ export declare const billingContextResponseSchema: z.ZodObject<{
104
95
  buckets: z.ZodArray<z.ZodObject<{
105
96
  startTimestamp: z.ZodNumber;
106
97
  endTimestamp: z.ZodNumber;
107
- credits: z.ZodNumber;
98
+ inputTokenCredits: z.ZodNumber;
99
+ outputTokenCredits: z.ZodNumber;
100
+ cachedInputCredits: z.ZodNumber;
101
+ runCredits: z.ZodNumber;
108
102
  }, z.core.$strip>>;
109
103
  }, z.core.$strip>;
110
104
  }, z.core.$strip>;
@@ -120,17 +114,18 @@ export declare const completedEventUsageSchema: z.ZodObject<{
120
114
  export type CompletedEventUsage = z.infer<typeof completedEventUsageSchema>;
121
115
  export declare const billingRunGateRequestBodySchema: z.ZodObject<{
122
116
  organizationId: z.ZodString;
117
+ breakCache: z.ZodDefault<z.ZodBoolean>;
123
118
  }, z.core.$strip>;
124
119
  export type BillingRunGateRequestBody = z.infer<typeof billingRunGateRequestBodySchema>;
125
120
  export declare const billingChargeRunBaseBodySchema: z.ZodObject<{
126
121
  organizationId: z.ZodString;
122
+ breakCache: z.ZodDefault<z.ZodBoolean>;
127
123
  runId: z.ZodString;
128
124
  }, z.core.$strip>;
129
125
  export type BillingChargeRunBaseBody = z.infer<typeof billingChargeRunBaseBodySchema>;
130
126
  /** Acknowledgement from POST /billing/charge-run-base (credits debited for starting a run). */
131
127
  export declare const billingChargeRunBaseResponseSchema: z.ZodObject<{
132
128
  runId: z.ZodString;
133
- creditsCharged: z.ZodNumber;
134
129
  }, z.core.$strip>;
135
130
  export type BillingChargeRunBaseResponse = z.infer<typeof billingChargeRunBaseResponseSchema>;
136
131
  export declare const billingRecordLlmBodySchema: z.ZodObject<{
@@ -158,7 +153,6 @@ export type BillingRecordLlmBody = z.infer<typeof billingRecordLlmBodySchema>;
158
153
  /** Acknowledgement from POST /billing/record-llm (credits debited for model usage). */
159
154
  export declare const billingRecordLlmResponseSchema: z.ZodObject<{
160
155
  responseId: z.ZodString;
161
- creditsCharged: z.ZodNumber;
162
156
  }, z.core.$strip>;
163
157
  export type BillingRecordLlmResponse = z.infer<typeof billingRecordLlmResponseSchema>;
164
158
  export declare const billingRecordLlmPayloadSchema: z.ZodObject<{
@@ -221,18 +215,13 @@ export declare const billingChangeRequestBodySchema: z.ZodDiscriminatedUnion<[z.
221
215
  period: z.ZodEnum<typeof TimePeriods>;
222
216
  }, z.core.$strip>], "kind">;
223
217
  export type BillingChangeRequestBody = z.infer<typeof billingChangeRequestBodySchema>;
224
- export declare const billingOverageModePatchBodySchema: z.ZodObject<{
225
- mode: z.ZodEnum<{
226
- soft: "soft";
227
- strict: "strict";
228
- }>;
229
- }, z.core.$strip>;
230
- export type BillingOverageModePatchBody = z.infer<typeof billingOverageModePatchBodySchema>;
231
218
  export declare const billingPortalSessionRequestBodySchema: z.ZodObject<{}, z.core.$strict>;
232
219
  export type BillingPortalSessionRequestBody = z.infer<typeof billingPortalSessionRequestBodySchema>;
220
+ export declare const DEFAULT_BILLING_CONTEXT_TIMEZONE = "UTC";
233
221
  export declare const billingContextQuerySchema: z.ZodObject<{
234
222
  start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
235
223
  end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
224
+ timezone: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string | undefined>>;
236
225
  }, z.core.$strip>;
237
226
  export type BillingContextQuery = z.infer<typeof billingContextQuerySchema>;
238
227
  export declare const getOrCreateCustomerRequestBodySchema: z.ZodObject<{}, z.core.$strict>;
@@ -301,20 +290,9 @@ export declare const planSchema: z.ZodObject<{
301
290
  live: z.ZodString;
302
291
  test: z.ZodString;
303
292
  }, z.core.$strip>>;
304
- overagePriceId: z.ZodNullable<z.ZodObject<{
305
- live: z.ZodString;
306
- test: z.ZodString;
307
- }, z.core.$strip>>;
308
293
  priceInUsdMonthly: z.ZodNullable<z.ZodNumber>;
309
294
  priceInUsdMonthlyAnnual: z.ZodNullable<z.ZodNumber>;
310
295
  includedCreditsPerMonth: z.ZodNumber;
311
- markupPct: z.ZodNumber;
312
- overageCentsPerCredit: z.ZodNumber;
313
- hardCapMultiplier: z.ZodNumber;
314
- defaultOverageMode: z.ZodEnum<{
315
- soft: "soft";
316
- strict: "strict";
317
- }>;
318
296
  }, z.core.$strip>;
319
297
  export type Plan = z.infer<typeof planSchema>;
320
298
  export declare function isPurchasablePlan(plan: Plan): boolean;
@@ -339,20 +317,9 @@ export declare const billingCatalogResponseSchema: z.ZodObject<{
339
317
  live: z.ZodString;
340
318
  test: z.ZodString;
341
319
  }, z.core.$strip>>;
342
- overagePriceId: z.ZodNullable<z.ZodObject<{
343
- live: z.ZodString;
344
- test: z.ZodString;
345
- }, z.core.$strip>>;
346
320
  priceInUsdMonthly: z.ZodNullable<z.ZodNumber>;
347
321
  priceInUsdMonthlyAnnual: z.ZodNullable<z.ZodNumber>;
348
322
  includedCreditsPerMonth: z.ZodNumber;
349
- markupPct: z.ZodNumber;
350
- overageCentsPerCredit: z.ZodNumber;
351
- hardCapMultiplier: z.ZodNumber;
352
- defaultOverageMode: z.ZodEnum<{
353
- soft: "soft";
354
- strict: "strict";
355
- }>;
356
323
  }, z.core.$strip>>;
357
324
  topUps: z.ZodArray<z.ZodObject<{
358
325
  credits: z.ZodEnum<typeof SupportedTopUps>;
@@ -378,14 +345,13 @@ export declare const BillingRoutes: {
378
345
  CHECKOUT_SESSION: string;
379
346
  CHANGE: string;
380
347
  PORTAL_SESSION: string;
381
- OVERAGE_MODE: string;
382
348
  CUSTOMER: string;
383
349
  RUN_GATE: string;
384
350
  CHARGE_RUN_BASE: string;
385
351
  RECORD_LLM: string;
386
352
  CACHE_INVALIDATION: string;
387
353
  };
388
- export type BillingForbiddenErrorType = "CreditGateDeniedError" | "StripeError";
354
+ export type BillingForbiddenErrorType = "CreditGateDeniedError" | "BillingError";
389
355
  export type BillingForbiddenErrorBody = {
390
356
  type: BillingForbiddenErrorType;
391
357
  reason?: string;
@@ -394,10 +360,10 @@ export declare class CreditGateDeniedError extends Error {
394
360
  readonly reason: RunGateDenyReason;
395
361
  constructor(reason: RunGateDenyReason);
396
362
  }
397
- export declare class StripeError extends Error {
363
+ export declare class BillingError extends Error {
398
364
  readonly reason?: string;
399
365
  constructor(message?: string, reason?: string);
400
366
  }
401
- export declare function billingErrorFromForbiddenBody(body: unknown): CreditGateDeniedError | StripeError | null;
367
+ export declare function billingErrorFromForbiddenBody(body: unknown): CreditGateDeniedError | BillingError | null;
402
368
  /** Parse JSON body from a billing HTTP 403 response */
403
- export declare function parseBillingForbiddenJson(raw: string): CreditGateDeniedError | StripeError | null;
369
+ export declare function parseBillingForbiddenJson(raw: string): CreditGateDeniedError | BillingError | null;
package/dist/Billing.js CHANGED
@@ -22,9 +22,6 @@ export const envIdSchema = z.object({
22
22
  live: z.string(),
23
23
  test: z.string()
24
24
  });
25
- export const overageModeSchema = z.enum(["soft", "strict"]);
26
- export const DEFAULT_OVERAGE_CAP_MULTIPLIER = 2;
27
- export const DEFAULT_OVERAGE_MODE = "strict";
28
25
  export const billingScheduledChangeSchema = z.discriminatedUnion("kind", [
29
26
  z.object({
30
27
  kind: z.literal("cancel_to_free"),
@@ -45,7 +42,6 @@ export const balanceSummarySchema = z.object({
45
42
  totalCreditCapacity: z.number(),
46
43
  periodStart: z.coerce.date(),
47
44
  periodEnd: z.coerce.date(),
48
- overageMode: overageModeSchema,
49
45
  hardCap: z.number(),
50
46
  canBuyTopups: z.boolean(),
51
47
  scheduledChange: billingScheduledChangeSchema.nullable()
@@ -53,7 +49,10 @@ export const balanceSummarySchema = z.object({
53
49
  export const usageBucketSchema = z.object({
54
50
  startTimestamp: z.number(),
55
51
  endTimestamp: z.number(),
56
- credits: z.number()
52
+ inputTokenCredits: z.number(),
53
+ outputTokenCredits: z.number(),
54
+ cachedInputCredits: z.number(),
55
+ runCredits: z.number()
57
56
  });
58
57
  export const usageResponseSchema = z.object({
59
58
  buckets: z.array(usageBucketSchema)
@@ -72,15 +71,15 @@ export const completedEventUsageSchema = z.object({
72
71
  })
73
72
  });
74
73
  export const billingRunGateRequestBodySchema = z.object({
75
- organizationId: z.string().min(1)
74
+ organizationId: z.string().min(1),
75
+ breakCache: z.boolean().default(false)
76
76
  });
77
77
  export const billingChargeRunBaseBodySchema = billingRunGateRequestBodySchema.extend({
78
78
  runId: z.string().min(1)
79
79
  });
80
80
  /** Acknowledgement from POST /billing/charge-run-base (credits debited for starting a run). */
81
81
  export const billingChargeRunBaseResponseSchema = z.object({
82
- runId: z.string().min(1),
83
- creditsCharged: z.number().nonnegative()
82
+ runId: z.string().min(1)
84
83
  });
85
84
  export const billingRecordLlmBodySchema = z.object({
86
85
  organizationId: z.string().min(1),
@@ -91,8 +90,7 @@ export const billingRecordLlmBodySchema = z.object({
91
90
  });
92
91
  /** Acknowledgement from POST /billing/record-llm (credits debited for model usage). */
93
92
  export const billingRecordLlmResponseSchema = z.object({
94
- responseId: z.string().min(1),
95
- creditsCharged: z.number().nonnegative()
93
+ responseId: z.string().min(1)
96
94
  });
97
95
  export const billingRecordLlmPayloadSchema = billingRecordLlmBodySchema.pick({
98
96
  responseId: true,
@@ -119,13 +117,26 @@ export const billingChangePeriodBodySchema = z.object({
119
117
  period: billingPeriodSchema
120
118
  });
121
119
  export const billingChangeRequestBodySchema = z.discriminatedUnion("kind", [billingChangeCancelBodySchema, billingChangePeriodBodySchema]);
122
- export const billingOverageModePatchBodySchema = z.object({
123
- mode: overageModeSchema
124
- });
125
120
  export const billingPortalSessionRequestBodySchema = z.object({}).strict();
121
+ export const DEFAULT_BILLING_CONTEXT_TIMEZONE = "UTC";
122
+ function isValidTimezone(timezone) {
123
+ try {
124
+ new Intl.DateTimeFormat("en-US", { timeZone: timezone }).format();
125
+ return true;
126
+ }
127
+ catch {
128
+ return false;
129
+ }
130
+ }
126
131
  export const billingContextQuerySchema = z.object({
127
132
  start: z.coerce.date().optional(),
128
- end: z.coerce.date().optional()
133
+ end: z.coerce.date().optional(),
134
+ timezone: z
135
+ .string()
136
+ .trim()
137
+ .optional()
138
+ .transform(timezone => timezone || DEFAULT_BILLING_CONTEXT_TIMEZONE)
139
+ .refine(isValidTimezone, { message: "Invalid timezone" })
129
140
  });
130
141
  export const getOrCreateCustomerRequestBodySchema = z.object({}).strict();
131
142
  export const billingStripeRedirectResponseSchema = z.object({
@@ -157,14 +168,9 @@ export const planSchema = z.object({
157
168
  name: z.string(),
158
169
  monthlyBasePriceId: envIdSchema.nullable(),
159
170
  annualBasePriceId: envIdSchema.nullable(),
160
- overagePriceId: envIdSchema.nullable(),
161
171
  priceInUsdMonthly: z.number().nullable(),
162
172
  priceInUsdMonthlyAnnual: z.number().nullable(),
163
- includedCreditsPerMonth: z.number(),
164
- markupPct: z.number(),
165
- overageCentsPerCredit: z.number(),
166
- hardCapMultiplier: z.number(),
167
- defaultOverageMode: overageModeSchema
173
+ includedCreditsPerMonth: z.number()
168
174
  });
169
175
  export function isPurchasablePlan(plan) {
170
176
  return !!(plan.monthlyBasePriceId || plan.annualBasePriceId);
@@ -194,11 +200,11 @@ export class CreditGateDeniedError extends Error {
194
200
  this.reason = reason;
195
201
  }
196
202
  }
197
- export class StripeError extends Error {
203
+ export class BillingError extends Error {
198
204
  reason;
199
205
  constructor(message, reason) {
200
206
  super(message ?? reason ?? "Billing provider error");
201
- this.name = "StripeError";
207
+ this.name = "BillingError";
202
208
  this.reason = reason;
203
209
  }
204
210
  }
@@ -210,9 +216,9 @@ export function billingErrorFromForbiddenBody(body) {
210
216
  if (t === "CreditGateDeniedError") {
211
217
  return new CreditGateDeniedError(parseRunGateDenyReason(o.reason));
212
218
  }
213
- if (t === "StripeError") {
219
+ if (t === "BillingError") {
214
220
  const reason = typeof o.reason === "string" ? o.reason : undefined;
215
- return new StripeError(reason, reason);
221
+ return new BillingError(reason, reason);
216
222
  }
217
223
  return null;
218
224
  }
@@ -4,7 +4,6 @@
4
4
  "CHECKOUT_SESSION": "/billing/checkout-session",
5
5
  "CHANGE": "/billing/change",
6
6
  "PORTAL_SESSION": "/billing/portal-session",
7
- "OVERAGE_MODE": "/billing/overage-mode",
8
7
  "CUSTOMER": "/billing/customer",
9
8
  "RUN_GATE": "/billing/run-gate",
10
9
  "CHARGE_RUN_BASE": "/billing/charge-run-base",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "APP": "/app",
3
+ "PRICING": "/app/pricing",
3
4
  "OAUTH": {
4
5
  "SUCCESS": "/oauth/success",
5
6
  "ERROR": "/oauth/error"
@@ -26,6 +27,7 @@
26
27
  "STATS": "/app/stats",
27
28
  "NOTIFICATIONS": "/app/notifications",
28
29
  "API_TOKENS": "/app/api-tokens",
30
+ "BILLING": "/app/billing",
29
31
  "PROFILE": "/app/profile",
30
32
  "USER_MANAGEMENT": "/app/profile?tab=users",
31
33
  "ORGANIZATIONS": {
@@ -2,6 +2,7 @@
2
2
  export declare const FROM_SETUP_CHAT_PARAM = "fromSetupChat";
3
3
  export declare const FrontendRoutes: {
4
4
  APP: string;
5
+ PRICING: string;
5
6
  OAUTH: {
6
7
  SUCCESS: string;
7
8
  ERROR: string;
@@ -28,6 +29,7 @@ export declare const FrontendRoutes: {
28
29
  STATS: string;
29
30
  NOTIFICATIONS: string;
30
31
  API_TOKENS: string;
32
+ BILLING: string;
31
33
  PROFILE: string;
32
34
  USER_MANAGEMENT: string;
33
35
  ORGANIZATIONS: {
@@ -1,3 +1,4 @@
1
+ import type { BillingContextQuery } from "./Billing.js";
1
2
  import { GetRunHistoryParams } from "./RunHistoryTypes.js";
2
3
  import type { StatsInterval } from "./types.js";
3
4
  export declare const currentUserKey: () => readonly [string];
@@ -50,3 +51,6 @@ export declare const agentFileContentKey: (agentId: string, fileId: string) => r
50
51
  export declare const projectDeploysKey: (projectId: string) => readonly [string, string];
51
52
  export declare const projectSourceFilesKey: (projectId: string) => readonly [string, string];
52
53
  export declare const projectSourceFileContentKey: (projectId: string, fileId: string) => readonly [string, string, string];
54
+ export declare const billingContextKey: (params?: Partial<BillingContextQuery>) => readonly [string, string, string, string];
55
+ export declare const billingCatalogKey: () => readonly [string];
56
+ export declare const organizationProjectsKey: () => readonly [string];
@@ -6,7 +6,7 @@ export const notificationDestinationsKey = () => ["notificationDestinations"];
6
6
  export const apiTokensKey = () => ["apiTokens"];
7
7
  export const notificationSettingsKey = () => ["notificationSettings"];
8
8
  export const sentNotificationsKey = () => ["sentNotifications"];
9
- export const pendingApprovalsKey = () => ["pending Approvals"];
9
+ export const pendingApprovalsKey = () => ["pendingApprovals"];
10
10
  export const slackChannelsKey = (integrationId) => {
11
11
  if (!integrationId) {
12
12
  return null;
@@ -145,3 +145,11 @@ export const agentFileContentKey = (agentId, fileId) => ["agentFileContent", age
145
145
  export const projectDeploysKey = (projectId) => ["projectDeploys", projectId];
146
146
  export const projectSourceFilesKey = (projectId) => ["projectSourceFiles", projectId];
147
147
  export const projectSourceFileContentKey = (projectId, fileId) => ["projectSourceFileContent", projectId, fileId];
148
+ export const billingContextKey = (params) => [
149
+ "billingContext",
150
+ params?.timezone ?? "",
151
+ params?.start?.toISOString() ?? "",
152
+ params?.end?.toISOString() ?? ""
153
+ ];
154
+ export const billingCatalogKey = () => ["billingCatalog"];
155
+ export const organizationProjectsKey = () => ["organization-projects"];
@@ -1,10 +1,6 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
  export declare const organizationMetadataSchema: z.ZodObject<{
3
3
  stripeCustomerId: z.ZodString;
4
- overageMode: z.ZodEnum<{
5
- soft: "soft";
6
- strict: "strict";
7
- }>;
8
- overageCapMultiplier: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
4
+ runExecutionBlocked: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean | undefined>>;
9
5
  }, z.core.$strip>;
10
6
  export type OrganizationMetadata = z.infer<typeof organizationMetadataSchema>;
@@ -1,6 +1,10 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
+ // Can be serialized a string, supports deserialization
3
+ const booleanMetadataSchema = z
4
+ .union([z.boolean(), z.string()])
5
+ .optional()
6
+ .transform(value => value === true || value === "true");
2
7
  export const organizationMetadataSchema = z.object({
3
8
  stripeCustomerId: z.string(),
4
- overageMode: z.enum(["soft", "strict"]),
5
- overageCapMultiplier: z.string().transform(val => Number(val))
9
+ runExecutionBlocked: booleanMetadataSchema
6
10
  });
@@ -233,15 +233,6 @@ const TOOL_DISPLAY_CONFIG = {
233
233
  return name ? `Loaded layout for "${truncate(name)}"` : "Layout loaded";
234
234
  }
235
235
  },
236
- notion_fetch_related_events: {
237
- preparing: "Looking for related activity",
238
- executing: () => "Loading related activity",
239
- complete: (_params, result) => {
240
- const parsed = safeParseResult(result);
241
- const count = parsed?.events_count;
242
- return count !== undefined ? `Found ${count} related update${count !== 1 ? "s" : ""}` : "Related activity loaded";
243
- }
244
- },
245
236
  notion_list_users: {
246
237
  preparing: "Loading workspace members",
247
238
  executing: () => "Loading workspace members",
package/dist/Tools.d.ts CHANGED
@@ -1532,11 +1532,6 @@ export declare const notionGetSchemaInputSchema: z.ZodObject<{
1532
1532
  integrationId: z.ZodString;
1533
1533
  databaseId: z.ZodString;
1534
1534
  }, z.core.$strip>;
1535
- export declare const notionFetchRelatedEventsInputSchema: z.ZodObject<{
1536
- integrationId: z.ZodString;
1537
- pageId: z.ZodString;
1538
- block_id: z.ZodString;
1539
- }, z.core.$strip>;
1540
1535
  export declare const notionListUsersInputSchema: z.ZodObject<{
1541
1536
  integrationId: z.ZodString;
1542
1537
  query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -3274,41 +3269,6 @@ export declare const notionGetSchemaTool: {
3274
3269
  property_count: z.ZodNumber;
3275
3270
  }, z.core.$strip>;
3276
3271
  };
3277
- export declare const notionFetchRelatedEventsTool: {
3278
- name: "notion_fetch_related_events";
3279
- inputSchema: z.ZodObject<{
3280
- integrationId: z.ZodString;
3281
- pageId: z.ZodString;
3282
- block_id: z.ZodString;
3283
- }, z.core.$strip>;
3284
- outputSchema: z.ZodObject<{
3285
- actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
3286
- action: z.ZodString;
3287
- integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
3288
- target: z.ZodString;
3289
- details: z.ZodString;
3290
- url: z.ZodOptional<z.ZodString>;
3291
- step_id: z.ZodOptional<z.ZodString>;
3292
- type: z.ZodEnum<{
3293
- error: "error";
3294
- create: "create";
3295
- update: "update";
3296
- delete: "delete";
3297
- read: "read";
3298
- approve: "approve";
3299
- }>;
3300
- isReadOnly: z.ZodOptional<z.ZodBoolean>;
3301
- output_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
3302
- output_item_id: z.ZodString;
3303
- output_item_type: z.ZodEnum<typeof import("./Configs.js").ConfigType>;
3304
- }, z.core.$strip>>>;
3305
- }, z.core.$strip>>>;
3306
- success: z.ZodLiteral<true>;
3307
- events_count: z.ZodNumber;
3308
- events: z.ZodOptional<z.ZodString>;
3309
- message: z.ZodString;
3310
- }, z.core.$strip>;
3311
- };
3312
3272
  export declare const notionListUsersTool: {
3313
3273
  name: "notion_list_users";
3314
3274
  inputSchema: z.ZodObject<{
@@ -4183,8 +4143,8 @@ export declare const webExtractInputSchema: z.ZodObject<{
4183
4143
  export declare const webResearchInputSchema: z.ZodObject<{
4184
4144
  input: z.ZodString;
4185
4145
  model: z.ZodNullable<z.ZodEnum<{
4186
- mini: "mini";
4187
4146
  pro: "pro";
4147
+ mini: "mini";
4188
4148
  auto: "auto";
4189
4149
  }>>;
4190
4150
  }, z.core.$strip>;
@@ -4573,8 +4533,8 @@ export declare const webResearchTool: {
4573
4533
  inputSchema: z.ZodObject<{
4574
4534
  input: z.ZodString;
4575
4535
  model: z.ZodNullable<z.ZodEnum<{
4576
- mini: "mini";
4577
4536
  pro: "pro";
4537
+ mini: "mini";
4578
4538
  auto: "auto";
4579
4539
  }>>;
4580
4540
  }, z.core.$strip>;
@@ -6951,41 +6911,6 @@ export declare const ToolDefinitions: {
6951
6911
  property_count: z.ZodNumber;
6952
6912
  }, z.core.$strip>;
6953
6913
  };
6954
- readonly notion_fetch_related_events: {
6955
- name: "notion_fetch_related_events";
6956
- inputSchema: z.ZodObject<{
6957
- integrationId: z.ZodString;
6958
- pageId: z.ZodString;
6959
- block_id: z.ZodString;
6960
- }, z.core.$strip>;
6961
- outputSchema: z.ZodObject<{
6962
- actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
6963
- action: z.ZodString;
6964
- integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
6965
- target: z.ZodString;
6966
- details: z.ZodString;
6967
- url: z.ZodOptional<z.ZodString>;
6968
- step_id: z.ZodOptional<z.ZodString>;
6969
- type: z.ZodEnum<{
6970
- error: "error";
6971
- create: "create";
6972
- update: "update";
6973
- delete: "delete";
6974
- read: "read";
6975
- approve: "approve";
6976
- }>;
6977
- isReadOnly: z.ZodOptional<z.ZodBoolean>;
6978
- output_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
6979
- output_item_id: z.ZodString;
6980
- output_item_type: z.ZodEnum<typeof import("./Configs.js").ConfigType>;
6981
- }, z.core.$strip>>>;
6982
- }, z.core.$strip>>>;
6983
- success: z.ZodLiteral<true>;
6984
- events_count: z.ZodNumber;
6985
- events: z.ZodOptional<z.ZodString>;
6986
- message: z.ZodString;
6987
- }, z.core.$strip>;
6988
- };
6989
6914
  readonly notion_list_users: {
6990
6915
  name: "notion_list_users";
6991
6916
  inputSchema: z.ZodObject<{
@@ -8344,8 +8269,8 @@ export declare const ToolDefinitions: {
8344
8269
  inputSchema: z.ZodObject<{
8345
8270
  input: z.ZodString;
8346
8271
  model: z.ZodNullable<z.ZodEnum<{
8347
- mini: "mini";
8348
8272
  pro: "pro";
8273
+ mini: "mini";
8349
8274
  auto: "auto";
8350
8275
  }>>;
8351
8276
  }, z.core.$strip>;
package/dist/Tools.js CHANGED
@@ -823,11 +823,6 @@ export const notionGetSchemaInputSchema = z.object({
823
823
  integrationId: z.string().describe("The integration ID of the Notion workspace to use."),
824
824
  databaseId: z.string().describe("The Notion database ID (data source ID) to get the schema for.")
825
825
  });
826
- export const notionFetchRelatedEventsInputSchema = z.object({
827
- integrationId: z.string().describe("The integration ID of the Notion workspace to use."),
828
- pageId: z.string().describe("The Notion page ID (not used directly, but required for consistency)."),
829
- block_id: z.string().describe("The Notion block ID to fetch related events for")
830
- });
831
826
  export const notionListUsersInputSchema = z.object({
832
827
  integrationId: z.string().describe("The integration ID of the Notion workspace to use."),
833
828
  query: z.string().nullable().optional().describe("Optional search query to filter users by name. Case-insensitive partial match.")
@@ -1187,15 +1182,6 @@ export const notionGetSchemaTool = defineTool({
1187
1182
  property_count: z.number().int()
1188
1183
  })
1189
1184
  });
1190
- export const notionFetchRelatedEventsTool = defineTool({
1191
- name: "notion_fetch_related_events",
1192
- inputSchema: notionFetchRelatedEventsInputSchema,
1193
- outputSchema: toolOutputSuccessSchema.extend({
1194
- events_count: z.number().int(),
1195
- events: z.string().optional(),
1196
- message: z.string()
1197
- })
1198
- });
1199
1185
  export const notionListUsersTool = defineTool({
1200
1186
  name: "notion_list_users",
1201
1187
  inputSchema: notionListUsersInputSchema,
@@ -1858,7 +1844,6 @@ export const ToolDefinitions = {
1858
1844
  [notionQueryPageTool.name]: notionQueryPageTool,
1859
1845
  [notionQueryDatabaseTool.name]: notionQueryDatabaseTool,
1860
1846
  [notionGetSchemaTool.name]: notionGetSchemaTool,
1861
- [notionFetchRelatedEventsTool.name]: notionFetchRelatedEventsTool,
1862
1847
  [notionListUsersTool.name]: notionListUsersTool,
1863
1848
  [gmailSendEmailTool.name]: gmailSendEmailTool,
1864
1849
  [gmailCreateDraftTool.name]: gmailCreateDraftTool,
package/dist/index.d.ts CHANGED
@@ -13,9 +13,12 @@ export * from "./Notifications.js";
13
13
  export * from "./RunHistoryTypes.js";
14
14
  export * from "./SentNotifications.js";
15
15
  export * from "./SlackTypes.js";
16
+ export * from "./OrganizationMetadata.js";
16
17
  export * from "./SocketEvents.js";
17
18
  export * from "./Survey.js";
18
19
  export * from "./Tools.js";
20
+ export * from "./Billing.js";
21
+ export * from "./ModelRegistry.js";
19
22
  export { Comment, CreateTicketInput, LinearStateName, Milestone, Organization, Project, Team, Ticket, TicketState, TicketSystemType, TicketWebhookHandler, Update, UpdateTicketInput, UserContext } from "./TicketSystem.js";
20
23
  export * from "./ToolDisplayUtils.js";
21
24
  export * from "./Triggers.js";
package/dist/index.js CHANGED
@@ -13,9 +13,12 @@ export * from "./Notifications.js";
13
13
  export * from "./RunHistoryTypes.js";
14
14
  export * from "./SentNotifications.js";
15
15
  export * from "./SlackTypes.js";
16
+ export * from "./OrganizationMetadata.js";
16
17
  export * from "./SocketEvents.js";
17
18
  export * from "./Survey.js";
18
19
  export * from "./Tools.js";
20
+ export * from "./Billing.js";
21
+ export * from "./ModelRegistry.js";
19
22
  export { LinearStateName, TicketSystemType } from "./TicketSystem.js";
20
23
  export * from "./ToolDisplayUtils.js";
21
24
  export * from "./Triggers.js";
package/dist/types.d.ts CHANGED
@@ -1859,12 +1859,12 @@ export declare const agentUpdateSchema: z.ZodObject<{
1859
1859
  export type AgentUpdate = z.infer<typeof agentUpdateSchema>;
1860
1860
  export declare const agentCreateSchema: z.ZodObject<{
1861
1861
  isActive: z.ZodBoolean;
1862
+ name: z.ZodString;
1862
1863
  metadata: z.ZodNullable<z.ZodObject<{
1863
1864
  remoteServerUrl: z.ZodNullable<z.ZodString>;
1864
1865
  projectId: z.ZodNullable<z.ZodString>;
1865
1866
  projectName: z.ZodNullable<z.ZodString>;
1866
1867
  }, z.core.$strip>>;
1867
- name: z.ZodString;
1868
1868
  prompt: z.ZodObject<{
1869
1869
  text: z.ZodString;
1870
1870
  }, z.core.$strip>;
@@ -2224,12 +2224,12 @@ export declare const agentCreateSchema: z.ZodObject<{
2224
2224
  export type AgentCreate = z.infer<typeof agentCreateSchema>;
2225
2225
  export declare const agentDraftSchema: z.ZodObject<{
2226
2226
  isActive: z.ZodBoolean;
2227
+ name: z.ZodString;
2227
2228
  metadata: z.ZodNullable<z.ZodObject<{
2228
2229
  remoteServerUrl: z.ZodNullable<z.ZodString>;
2229
2230
  projectId: z.ZodNullable<z.ZodString>;
2230
2231
  projectName: z.ZodNullable<z.ZodString>;
2231
2232
  }, z.core.$strip>>;
2232
- name: z.ZodString;
2233
2233
  prompt: z.ZodObject<{
2234
2234
  text: z.ZodString;
2235
2235
  }, z.core.$strip>;
@@ -5517,6 +5517,18 @@ export declare const sdkCreateProjectResponseBodySchema: z.ZodObject<{
5517
5517
  name: z.ZodString;
5518
5518
  }, z.core.$strip>;
5519
5519
  export type SdkCreateProjectResponseBody = z.infer<typeof sdkCreateProjectResponseBodySchema>;
5520
+ export declare const projectListItemSchema: z.ZodObject<{
5521
+ id: z.ZodString;
5522
+ name: z.ZodString;
5523
+ }, z.core.$strip>;
5524
+ export type ProjectListItem = z.infer<typeof projectListItemSchema>;
5525
+ export declare const projectsListResponseSchema: z.ZodObject<{
5526
+ projects: z.ZodArray<z.ZodObject<{
5527
+ id: z.ZodString;
5528
+ name: z.ZodString;
5529
+ }, z.core.$strip>>;
5530
+ }, z.core.$strip>;
5531
+ export type ProjectsListResponse = z.infer<typeof projectsListResponseSchema>;
5520
5532
  export declare const projectDetailResponseSchema: z.ZodObject<{
5521
5533
  id: z.ZodString;
5522
5534
  name: z.ZodString;
@@ -6587,11 +6599,13 @@ export declare const toggleImprovementsEnabledRequestSchema: z.ZodObject<{
6587
6599
  }, z.core.$strip>;
6588
6600
  export type ToggleImprovementsEnabledRequest = z.infer<typeof toggleImprovementsEnabledRequestSchema>;
6589
6601
  export declare const workosWebhookSecretUpdateRequestSchema: z.ZodObject<{
6590
- webhookSecret: z.ZodString;
6602
+ webhookSecret: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
6591
6603
  state: z.ZodOptional<z.ZodString>;
6592
6604
  }, z.core.$strip>;
6593
6605
  export type WorkosWebhookSecretUpdateRequest = z.infer<typeof workosWebhookSecretUpdateRequestSchema>;
6594
6606
  export declare const sdkSampleEventsRequestSchema: z.ZodObject<{
6607
+ projectId: z.ZodOptional<z.ZodString>;
6608
+ jobName: z.ZodOptional<z.ZodString>;
6595
6609
  triggers: z.ZodArray<z.ZodObject<{
6596
6610
  triggerId: z.ZodOptional<z.ZodString>;
6597
6611
  integrationId: z.ZodString;
@@ -6788,7 +6802,7 @@ export declare const identifiableSchema: z.ZodObject<{
6788
6802
  }, z.core.$strip>;
6789
6803
  export type Identifiable = z.infer<typeof identifiableSchema>;
6790
6804
  export declare const sdkSampleEventRefSchema: z.ZodObject<{
6791
- entity: z.ZodObject<{
6805
+ entity: z.ZodOptional<z.ZodObject<{
6792
6806
  entityType: z.ZodEnum<{
6793
6807
  run_history_raw_event: "run_history_raw_event";
6794
6808
  slack_message_event: "slack_message_event";
@@ -6799,7 +6813,8 @@ export declare const sdkSampleEventRefSchema: z.ZodObject<{
6799
6813
  webmonitor_event: "webmonitor_event";
6800
6814
  }>;
6801
6815
  entityId: z.ZodString;
6802
- }, z.core.$strip>;
6816
+ }, z.core.$strip>>;
6817
+ recordedAt: z.ZodOptional<z.ZodString>;
6803
6818
  serializedEvent: z.ZodObject<{
6804
6819
  integrationType: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
6805
6820
  eventType: z.ZodUnion<readonly [z.ZodEnum<{
@@ -7518,7 +7533,7 @@ export declare const sdkSampleEventRefSchema: z.ZodObject<{
7518
7533
  export type SdkSampleEventRef = z.infer<typeof sdkSampleEventRefSchema>;
7519
7534
  export declare const sdkSampleEventsResponseSchema: z.ZodObject<{
7520
7535
  events: z.ZodArray<z.ZodObject<{
7521
- entity: z.ZodObject<{
7536
+ entity: z.ZodOptional<z.ZodObject<{
7522
7537
  entityType: z.ZodEnum<{
7523
7538
  run_history_raw_event: "run_history_raw_event";
7524
7539
  slack_message_event: "slack_message_event";
@@ -7529,7 +7544,8 @@ export declare const sdkSampleEventsResponseSchema: z.ZodObject<{
7529
7544
  webmonitor_event: "webmonitor_event";
7530
7545
  }>;
7531
7546
  entityId: z.ZodString;
7532
- }, z.core.$strip>;
7547
+ }, z.core.$strip>>;
7548
+ recordedAt: z.ZodOptional<z.ZodString>;
7533
7549
  serializedEvent: z.ZodObject<{
7534
7550
  integrationType: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
7535
7551
  eventType: z.ZodUnion<readonly [z.ZodEnum<{
@@ -8245,6 +8261,10 @@ export declare const sdkSampleEventsResponseSchema: z.ZodObject<{
8245
8261
  }, z.core.$strip>]>;
8246
8262
  }, z.core.$strip>;
8247
8263
  }, z.core.$strip>>;
8264
+ webhookEndpoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
8265
+ triggerId: z.ZodString;
8266
+ webhookUrl: z.ZodString;
8267
+ }, z.core.$strip>>>;
8248
8268
  }, z.core.$strip>;
8249
8269
  export type SdkSampleEventsResponse = z.infer<typeof sdkSampleEventsResponseSchema>;
8250
8270
  export declare const sdkHydrateSampleEventRequestSchema: z.ZodObject<{
package/dist/types.js CHANGED
@@ -480,6 +480,13 @@ export const sdkCreateProjectResponseBodySchema = z.object({
480
480
  projectId: z.string(),
481
481
  name: z.string()
482
482
  });
483
+ export const projectListItemSchema = z.object({
484
+ id: z.string(),
485
+ name: z.string()
486
+ });
487
+ export const projectsListResponseSchema = z.object({
488
+ projects: z.array(projectListItemSchema)
489
+ });
483
490
  export const projectDetailResponseSchema = z.object({
484
491
  id: z.string(),
485
492
  name: z.string(),
@@ -621,10 +628,15 @@ export const toggleImprovementsEnabledRequestSchema = z.object({
621
628
  enabled: z.boolean()
622
629
  });
623
630
  export const workosWebhookSecretUpdateRequestSchema = z.object({
624
- webhookSecret: z.string(),
631
+ webhookSecret: z
632
+ .string()
633
+ .transform(s => s.trim())
634
+ .pipe(z.string().min(1, "Webhook signing secret is required")),
625
635
  state: z.string().optional()
626
636
  });
627
637
  export const sdkSampleEventsRequestSchema = z.object({
638
+ projectId: z.string().optional(),
639
+ jobName: z.string().optional(),
628
640
  triggers: z
629
641
  .array(z.object({
630
642
  triggerId: z.string().optional(),
@@ -640,11 +652,18 @@ export const identifiableSchema = z.object({
640
652
  entityId: z.string()
641
653
  });
642
654
  export const sdkSampleEventRefSchema = z.object({
643
- entity: identifiableSchema,
655
+ entity: identifiableSchema.optional(),
656
+ recordedAt: z.string().optional(),
644
657
  serializedEvent: serializedEventSchema
645
658
  });
646
659
  export const sdkSampleEventsResponseSchema = z.object({
647
- events: z.array(sdkSampleEventRefSchema)
660
+ events: z.array(sdkSampleEventRefSchema),
661
+ webhookEndpoints: z
662
+ .array(z.object({
663
+ triggerId: z.string(),
664
+ webhookUrl: z.string()
665
+ }))
666
+ .optional()
648
667
  });
649
668
  export const sdkHydrateSampleEventRequestSchema = z.object({
650
669
  entityType: hydratorTypeEnum,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terse-types",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "type": "module",
5
5
  "description": "Shared Terse TypeScript types, enums, constants, and helpers.",
6
6
  "main": "./dist/index.js",