@prave/shared 1.4.1 → 1.4.3

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.
@@ -15,4 +15,8 @@ export * from './intelligence.schema.js';
15
15
  export * from './api-keys.schema.js';
16
16
  export * from './skill-report.schema.js';
17
17
  export * from './run.schema.js';
18
+ export * from './vault.schema.js';
19
+ export * from './kv.schema.js';
20
+ export * from './webhook-endpoint.schema.js';
21
+ export * from './sdk.schema.js';
18
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iBAAiB,CAAA"}
@@ -15,3 +15,7 @@ export * from './intelligence.schema.js';
15
15
  export * from './api-keys.schema.js';
16
16
  export * from './skill-report.schema.js';
17
17
  export * from './run.schema.js';
18
+ export * from './vault.schema.js';
19
+ export * from './kv.schema.js';
20
+ export * from './webhook-endpoint.schema.js';
21
+ export * from './sdk.schema.js';
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * KV — per-run persistent key/value store, encrypted at rest.
4
+ *
5
+ * Lives in the `run_kv` table. Each row is scoped to a single `run_id`;
6
+ * RLS for dashboard reads, JWT-scoped service-role for SDK reads.
7
+ *
8
+ * Designed for the canonical "skill exchanged OAuth code → access token,
9
+ * stashes it for the next cron tick" pattern. Values are opaque blobs
10
+ * (we don't introspect them); 64KB per value, optional TTL.
11
+ */
12
+ export declare const kvKeySchema: z.ZodString;
13
+ export type KvKey = z.infer<typeof kvKeySchema>;
14
+ export declare const kvEntrySchema: z.ZodObject<{
15
+ key: z.ZodString;
16
+ value: z.ZodString;
17
+ size_bytes: z.ZodNumber;
18
+ expires_at: z.ZodNullable<z.ZodString>;
19
+ updated_at: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ value: string;
22
+ size_bytes: number;
23
+ updated_at: string;
24
+ expires_at: string | null;
25
+ key: string;
26
+ }, {
27
+ value: string;
28
+ size_bytes: number;
29
+ updated_at: string;
30
+ expires_at: string | null;
31
+ key: string;
32
+ }>;
33
+ export type KvEntry = z.infer<typeof kvEntrySchema>;
34
+ export declare const kvPutInputSchema: z.ZodObject<{
35
+ value: z.ZodString;
36
+ ttl_seconds: z.ZodOptional<z.ZodNumber>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ value: string;
39
+ ttl_seconds?: number | undefined;
40
+ }, {
41
+ value: string;
42
+ ttl_seconds?: number | undefined;
43
+ }>;
44
+ export type KvPutInput = z.infer<typeof kvPutInputSchema>;
45
+ export declare const kvListQuerySchema: z.ZodObject<{
46
+ prefix: z.ZodOptional<z.ZodString>;
47
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ limit?: number | undefined;
50
+ prefix?: string | undefined;
51
+ }, {
52
+ limit?: number | undefined;
53
+ prefix?: string | undefined;
54
+ }>;
55
+ export type KvListQuery = z.infer<typeof kvListQuerySchema>;
56
+ //# sourceMappingURL=kv.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/kv.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;GASG;AAMH,eAAO,MAAM,WAAW,aAOrB,CAAA;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAE/C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMxB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAKnD,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAGzD,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * KV — per-run persistent key/value store, encrypted at rest.
4
+ *
5
+ * Lives in the `run_kv` table. Each row is scoped to a single `run_id`;
6
+ * RLS for dashboard reads, JWT-scoped service-role for SDK reads.
7
+ *
8
+ * Designed for the canonical "skill exchanged OAuth code → access token,
9
+ * stashes it for the next cron tick" pattern. Values are opaque blobs
10
+ * (we don't introspect them); 64KB per value, optional TTL.
11
+ */
12
+ // Same shape as a URL path-segment with a few "scoped" delimiters so
13
+ // skills can build namespaces (`oauth:tiktok:state`, `queue:pending`).
14
+ // We keep it permissive enough not to surprise users; the colon /
15
+ // dash / dot are common across all KV ecosystems.
16
+ export const kvKeySchema = z
17
+ .string()
18
+ .min(1)
19
+ .max(256)
20
+ .regex(/^[A-Za-z0-9_\-.:]+$/, 'Letters, digits, and any of `_ - . :` — no spaces or slashes.');
21
+ export const kvEntrySchema = z.object({
22
+ key: kvKeySchema,
23
+ value: z.string(),
24
+ size_bytes: z.number().int().nonnegative(),
25
+ expires_at: z.string().datetime().nullable(),
26
+ updated_at: z.string().datetime(),
27
+ });
28
+ // Body for PUT /api/v1/sdk/kv/:key (the SDK route) and PUT
29
+ // /api/v1/runs/:slug/kv/:key (the dashboard debug route). ttlSeconds
30
+ // translates to expires_at = now() + ttlSeconds in the service layer.
31
+ export const kvPutInputSchema = z.object({
32
+ value: z.string().max(65_536),
33
+ ttl_seconds: z.number().int().positive().max(60 * 60 * 24 * 365).optional(),
34
+ });
35
+ // GET list filter — prefix is the only filter supported.
36
+ export const kvListQuerySchema = z.object({
37
+ prefix: z.string().max(256).optional(),
38
+ limit: z.number().int().min(1).max(1_000).default(100).optional(),
39
+ });
@@ -220,6 +220,8 @@ export declare const runSchema: z.ZodObject<{
220
220
  total_failures: number;
221
221
  }>;
222
222
  export type Run = z.infer<typeof runSchema>;
223
+ export declare const runEnvVarsSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
224
+ export type RunEnvVars = z.infer<typeof runEnvVarsSchema>;
223
225
  export declare const createRunInputSchema: z.ZodObject<{
224
226
  bundle_id: z.ZodString;
225
227
  name: z.ZodString;
@@ -275,6 +277,7 @@ export declare const createRunInputSchema: z.ZodObject<{
275
277
  }>]>;
276
278
  timezone: z.ZodDefault<z.ZodString>;
277
279
  timeout_seconds: z.ZodOptional<z.ZodNumber>;
280
+ env_vars: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
278
281
  }, "strip", z.ZodTypeAny, {
279
282
  name: string;
280
283
  bundle_id: string;
@@ -298,6 +301,7 @@ export declare const createRunInputSchema: z.ZodObject<{
298
301
  cron_expr: string;
299
302
  };
300
303
  timeout_seconds?: number | undefined;
304
+ env_vars?: Record<string, string> | undefined;
301
305
  }, {
302
306
  name: string;
303
307
  bundle_id: string;
@@ -321,6 +325,7 @@ export declare const createRunInputSchema: z.ZodObject<{
321
325
  };
322
326
  timezone?: string | undefined;
323
327
  timeout_seconds?: number | undefined;
328
+ env_vars?: Record<string, string> | undefined;
324
329
  }>;
325
330
  export type CreateRunInput = z.infer<typeof createRunInputSchema>;
326
331
  export declare const updateRunInputSchema: z.ZodObject<{
@@ -378,6 +383,7 @@ export declare const updateRunInputSchema: z.ZodObject<{
378
383
  timezone: z.ZodOptional<z.ZodString>;
379
384
  timeout_seconds: z.ZodOptional<z.ZodNumber>;
380
385
  status: z.ZodOptional<z.ZodEnum<["active", "paused"]>>;
386
+ env_vars: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
381
387
  }, "strip", z.ZodTypeAny, {
382
388
  status?: "active" | "paused" | undefined;
383
389
  name?: string | undefined;
@@ -401,6 +407,7 @@ export declare const updateRunInputSchema: z.ZodObject<{
401
407
  kind: "custom";
402
408
  cron_expr: string;
403
409
  } | undefined;
410
+ env_vars?: Record<string, string> | undefined;
404
411
  }, {
405
412
  status?: "active" | "paused" | undefined;
406
413
  name?: string | undefined;
@@ -424,6 +431,7 @@ export declare const updateRunInputSchema: z.ZodObject<{
424
431
  kind: "custom";
425
432
  cron_expr: string;
426
433
  } | undefined;
434
+ env_vars?: Record<string, string> | undefined;
427
435
  }>;
428
436
  export type UpdateRunInput = z.infer<typeof updateRunInputSchema>;
429
437
  export declare const runExecutionSchema: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"run.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/run.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;GAWG;AAKH,eAAO,MAAM,cAAc,oEAOzB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAKrD,eAAO,MAAM,qBAAqB,+DAMhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,eAAe,uDAK1B,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,eAAO,MAAM,wBAAwB,qEAMnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAezE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAGrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KA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AO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAGjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB7B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAO7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAG/D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;CACrB"}
@@ -132,6 +132,16 @@ export const runSchema = z.object({
132
132
  created_at: z.string().datetime(),
133
133
  updated_at: z.string().datetime(),
134
134
  });
135
+ // Env-vars dict accepted from the wizard. Keys must be valid POSIX env
136
+ // names; values are free-form strings. Capped at 50 entries to keep
137
+ // the encrypted blob under a few kB and prevent UI runaway.
138
+ export const runEnvVarsSchema = z
139
+ .record(z
140
+ .string()
141
+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'Use POSIX env names: letters, digits, underscore.'), z.string().max(8_000))
142
+ .refine((o) => Object.keys(o).length <= 50, {
143
+ message: 'Max 50 env vars per run.',
144
+ });
135
145
  export const createRunInputSchema = z.object({
136
146
  bundle_id: z.string().uuid(),
137
147
  name: z.string().min(1).max(120),
@@ -139,6 +149,7 @@ export const createRunInputSchema = z.object({
139
149
  schedule: runScheduleInputSchema,
140
150
  timezone: z.string().min(2).max(60).default('UTC'),
141
151
  timeout_seconds: z.number().int().min(5).max(300).optional(),
152
+ env_vars: runEnvVarsSchema.optional(),
142
153
  });
143
154
  export const updateRunInputSchema = z.object({
144
155
  name: z.string().min(1).max(120).optional(),
@@ -147,6 +158,8 @@ export const updateRunInputSchema = z.object({
147
158
  timezone: z.string().optional(),
148
159
  timeout_seconds: z.number().int().min(5).max(300).optional(),
149
160
  status: z.enum(['active', 'paused']).optional(),
161
+ // Replace the full env-vars set. Passing `{}` clears them all.
162
+ env_vars: runEnvVarsSchema.optional(),
150
163
  });
151
164
  // ── Execution ────────────────────────────────────────────────────────
152
165
  export const runExecutionSchema = z.object({
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Shapes for the authenticated SDK surface mounted at `/api/v1/sdk/*`.
4
+ *
5
+ * Auth: middleware verifies a HS256 JWT passed as Bearer in the
6
+ * `PRAVE_SDK_TOKEN` env var inside the bwrap sandbox. Claims fall into
7
+ * the shape below, which is also what `sdkAuth` attaches to `req`.
8
+ *
9
+ * Every SDK request resolves to a single run_id; the rest of the
10
+ * surface is scoped accordingly (no cross-run reads).
11
+ */
12
+ export declare const sdkTokenClaimsSchema: z.ZodObject<{
13
+ run_id: z.ZodString;
14
+ exec_id: z.ZodString;
15
+ exp: z.ZodNumber;
16
+ iat: z.ZodOptional<z.ZodNumber>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ run_id: string;
19
+ exec_id: string;
20
+ exp: number;
21
+ iat?: number | undefined;
22
+ }, {
23
+ run_id: string;
24
+ exec_id: string;
25
+ exp: number;
26
+ iat?: number | undefined;
27
+ }>;
28
+ export type SdkTokenClaims = z.infer<typeof sdkTokenClaimsSchema>;
29
+ export declare const sdkLogInputSchema: z.ZodObject<{
30
+ level: z.ZodEnum<["debug", "info", "warn", "error"]>;
31
+ message: z.ZodString;
32
+ context: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ message: string;
35
+ level: "error" | "debug" | "info" | "warn";
36
+ context?: Record<string, unknown> | undefined;
37
+ }, {
38
+ message: string;
39
+ level: "error" | "debug" | "info" | "warn";
40
+ context?: Record<string, unknown> | undefined;
41
+ }>;
42
+ export type SdkLogInput = z.infer<typeof sdkLogInputSchema>;
43
+ export declare const sdkWebhooksAckInputSchema: z.ZodObject<{
44
+ ids: z.ZodArray<z.ZodString, "many">;
45
+ }, "strip", z.ZodTypeAny, {
46
+ ids: string[];
47
+ }, {
48
+ ids: string[];
49
+ }>;
50
+ export type SdkWebhooksAckInput = z.infer<typeof sdkWebhooksAckInputSchema>;
51
+ //# sourceMappingURL=sdk.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/sdk.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;GASG;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAO/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAW5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAK3D,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Shapes for the authenticated SDK surface mounted at `/api/v1/sdk/*`.
4
+ *
5
+ * Auth: middleware verifies a HS256 JWT passed as Bearer in the
6
+ * `PRAVE_SDK_TOKEN` env var inside the bwrap sandbox. Claims fall into
7
+ * the shape below, which is also what `sdkAuth` attaches to `req`.
8
+ *
9
+ * Every SDK request resolves to a single run_id; the rest of the
10
+ * surface is scoped accordingly (no cross-run reads).
11
+ */
12
+ export const sdkTokenClaimsSchema = z.object({
13
+ run_id: z.string().uuid(),
14
+ exec_id: z.string().uuid(),
15
+ // Standard JWT registered fields. `exp` is required, `iat` is convenient
16
+ // for debugging in logs but not enforced.
17
+ exp: z.number().int().positive(),
18
+ iat: z.number().int().positive().optional(),
19
+ });
20
+ // POST /api/v1/sdk/log — structured log line forwarded to
21
+ // `run_executions.log_text` so it surfaces in the dashboard log viewer.
22
+ export const sdkLogInputSchema = z.object({
23
+ level: z.enum(['debug', 'info', 'warn', 'error']),
24
+ message: z.string().max(8_192),
25
+ // Arbitrary structured context — must JSON-stringify under 4 KB.
26
+ context: z
27
+ .record(z.string(), z.unknown())
28
+ .optional()
29
+ .refine((v) => v === undefined || JSON.stringify(v).length <= 4_096, 'context must serialise to under 4 KB'),
30
+ });
31
+ // POST /api/v1/sdk/webhooks/:endpointId/ack — body is `{ ids: [..] }`
32
+ // or an empty body to ack the events implicitly returned in the prior
33
+ // drain call (cookied via the SDK).
34
+ export const sdkWebhooksAckInputSchema = z.object({
35
+ ids: z.array(z.string().uuid()).min(1).max(500),
36
+ });
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Vault — user-supplied secrets bound to a Run.
4
+ *
5
+ * Values are AES-256-GCM-encrypted at rest (same master key as
6
+ * `runs.env_encrypted` and `user_api_keys`). The plaintext only ever
7
+ * surfaces to the worker via the `/api/v1/sdk/vault/:key` route, which
8
+ * authenticates with the short-lived `PRAVE_SDK_TOKEN` JWT minted per
9
+ * execution.
10
+ *
11
+ * Dashboard UI sets values; SDK reads them. There is intentionally no
12
+ * read endpoint that returns plaintext to the dashboard — once set, a
13
+ * value can only be overwritten, never read back through the web app.
14
+ */
15
+ export declare const vaultKeySchema: z.ZodString;
16
+ export type VaultKey = z.infer<typeof vaultKeySchema>;
17
+ export declare const vaultSecretSchema: z.ZodObject<{
18
+ key: z.ZodString;
19
+ label: z.ZodNullable<z.ZodString>;
20
+ link: z.ZodNullable<z.ZodString>;
21
+ size_bytes: z.ZodNumber;
22
+ created_at: z.ZodString;
23
+ updated_at: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ size_bytes: number;
26
+ created_at: string;
27
+ updated_at: string;
28
+ label: string | null;
29
+ key: string;
30
+ link: string | null;
31
+ }, {
32
+ size_bytes: number;
33
+ created_at: string;
34
+ updated_at: string;
35
+ label: string | null;
36
+ key: string;
37
+ link: string | null;
38
+ }>;
39
+ export type VaultSecret = z.infer<typeof vaultSecretSchema>;
40
+ export declare const vaultPutInputSchema: z.ZodObject<{
41
+ value: z.ZodString;
42
+ label: z.ZodOptional<z.ZodString>;
43
+ link: z.ZodOptional<z.ZodString>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ value: string;
46
+ label?: string | undefined;
47
+ link?: string | undefined;
48
+ }, {
49
+ value: string;
50
+ label?: string | undefined;
51
+ link?: string | undefined;
52
+ }>;
53
+ export type VaultPutInput = z.infer<typeof vaultPutInputSchema>;
54
+ //# sourceMappingURL=vault.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/vault.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;GAYG;AAMH,eAAO,MAAM,cAAc,aAOxB,CAAA;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAK3D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Vault — user-supplied secrets bound to a Run.
4
+ *
5
+ * Values are AES-256-GCM-encrypted at rest (same master key as
6
+ * `runs.env_encrypted` and `user_api_keys`). The plaintext only ever
7
+ * surfaces to the worker via the `/api/v1/sdk/vault/:key` route, which
8
+ * authenticates with the short-lived `PRAVE_SDK_TOKEN` JWT minted per
9
+ * execution.
10
+ *
11
+ * Dashboard UI sets values; SDK reads them. There is intentionally no
12
+ * read endpoint that returns plaintext to the dashboard — once set, a
13
+ * value can only be overwritten, never read back through the web app.
14
+ */
15
+ // POSIX-ish key — same shape as env var names so skill code can stash
16
+ // secrets under the same identifier (`prave.vault.get('TIKTOK_CLIENT_ID')`)
17
+ // or, where a skill expects an env var directly, the SDK's loader can
18
+ // project them into the bwrap env without renaming.
19
+ export const vaultKeySchema = z
20
+ .string()
21
+ .min(1)
22
+ .max(128)
23
+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'Use POSIX-style names: letters, digits, underscore; cannot start with a digit.');
24
+ export const vaultSecretSchema = z.object({
25
+ key: vaultKeySchema,
26
+ label: z.string().max(120).nullable(),
27
+ link: z.string().url().max(2_048).nullable(),
28
+ size_bytes: z.number().int().nonnegative(),
29
+ created_at: z.string().datetime(),
30
+ updated_at: z.string().datetime(),
31
+ });
32
+ // Body for PUT /api/v1/runs/:slug/vault/:key. Caller passes the full
33
+ // new value; we encrypt + replace. Empty string is allowed (some
34
+ // providers expect a literal "" header).
35
+ export const vaultPutInputSchema = z.object({
36
+ value: z.string().max(65_536),
37
+ label: z.string().max(120).optional(),
38
+ link: z.string().url().max(2_048).optional(),
39
+ });
@@ -0,0 +1,161 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Webhook endpoint declarations — each one mints a stable HTTPS URL on
4
+ * `in.prave.app/w/<runs.webhook_token>/<endpoint_id>` that buffers
5
+ * inbound traffic into `webhook_events` (or, when trigger_mode is
6
+ * 'immediate', also enqueues a fresh run execution).
7
+ *
8
+ * Two flavours of inbound traffic share this surface:
9
+ * • short-lived OAuth callbacks (`?code=…&state=…`) — almost always
10
+ * 'immediate' so the code is exchanged before its ~10-minute window
11
+ * closes;
12
+ * • long-tail webhooks (Slack interactivity, TikTok post.published,
13
+ * etc.) — 'buffer', drained by `prave.webhooks.drain()` on the
14
+ * next cron run.
15
+ *
16
+ * HMAC verification is optional and only meaningful for buffered
17
+ * webhooks where the provider signs the body. OAuth callbacks rarely
18
+ * sign — providers rely on the redirect_uri being preregistered.
19
+ */
20
+ export declare const webhookEndpointIdSchema: z.ZodString;
21
+ export type WebhookEndpointId = z.infer<typeof webhookEndpointIdSchema>;
22
+ export declare const webhookTriggerModeSchema: z.ZodEnum<["buffer", "immediate"]>;
23
+ export type WebhookTriggerMode = z.infer<typeof webhookTriggerModeSchema>;
24
+ export declare const webhookHmacAlgorithmSchema: z.ZodEnum<["sha256", "sha1", "sha512"]>;
25
+ export type WebhookHmacAlgorithm = z.infer<typeof webhookHmacAlgorithmSchema>;
26
+ export declare const webhookEndpointSchema: z.ZodObject<{
27
+ id: z.ZodString;
28
+ endpoint_id: z.ZodString;
29
+ label: z.ZodNullable<z.ZodString>;
30
+ url: z.ZodString;
31
+ hmac_header: z.ZodNullable<z.ZodString>;
32
+ hmac_algorithm: z.ZodNullable<z.ZodEnum<["sha256", "sha1", "sha512"]>>;
33
+ signing_secret_preview: z.ZodNullable<z.ZodString>;
34
+ trigger_mode: z.ZodEnum<["buffer", "immediate"]>;
35
+ response_status: z.ZodNumber;
36
+ response_body: z.ZodNullable<z.ZodString>;
37
+ response_content_type: z.ZodNullable<z.ZodString>;
38
+ events_30d: z.ZodOptional<z.ZodNumber>;
39
+ last_received_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ created_at: z.ZodString;
41
+ updated_at: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ id: string;
44
+ created_at: string;
45
+ updated_at: string;
46
+ url: string;
47
+ label: string | null;
48
+ endpoint_id: string;
49
+ hmac_header: string | null;
50
+ hmac_algorithm: "sha256" | "sha1" | "sha512" | null;
51
+ signing_secret_preview: string | null;
52
+ trigger_mode: "buffer" | "immediate";
53
+ response_status: number;
54
+ response_body: string | null;
55
+ response_content_type: string | null;
56
+ events_30d?: number | undefined;
57
+ last_received_at?: string | null | undefined;
58
+ }, {
59
+ id: string;
60
+ created_at: string;
61
+ updated_at: string;
62
+ url: string;
63
+ label: string | null;
64
+ endpoint_id: string;
65
+ hmac_header: string | null;
66
+ hmac_algorithm: "sha256" | "sha1" | "sha512" | null;
67
+ signing_secret_preview: string | null;
68
+ trigger_mode: "buffer" | "immediate";
69
+ response_status: number;
70
+ response_body: string | null;
71
+ response_content_type: string | null;
72
+ events_30d?: number | undefined;
73
+ last_received_at?: string | null | undefined;
74
+ }>;
75
+ export type WebhookEndpoint = z.infer<typeof webhookEndpointSchema>;
76
+ export declare const webhookEndpointCreateInputSchema: z.ZodObject<{
77
+ endpoint_id: z.ZodString;
78
+ label: z.ZodOptional<z.ZodString>;
79
+ trigger_mode: z.ZodDefault<z.ZodEnum<["buffer", "immediate"]>>;
80
+ hmac_header: z.ZodOptional<z.ZodString>;
81
+ hmac_algorithm: z.ZodOptional<z.ZodEnum<["sha256", "sha1", "sha512"]>>;
82
+ signing_secret: z.ZodOptional<z.ZodString>;
83
+ response_status: z.ZodOptional<z.ZodNumber>;
84
+ response_body: z.ZodOptional<z.ZodString>;
85
+ response_content_type: z.ZodOptional<z.ZodString>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ endpoint_id: string;
88
+ trigger_mode: "buffer" | "immediate";
89
+ label?: string | undefined;
90
+ hmac_header?: string | undefined;
91
+ hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
92
+ response_status?: number | undefined;
93
+ response_body?: string | undefined;
94
+ response_content_type?: string | undefined;
95
+ signing_secret?: string | undefined;
96
+ }, {
97
+ endpoint_id: string;
98
+ label?: string | undefined;
99
+ hmac_header?: string | undefined;
100
+ hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
101
+ trigger_mode?: "buffer" | "immediate" | undefined;
102
+ response_status?: number | undefined;
103
+ response_body?: string | undefined;
104
+ response_content_type?: string | undefined;
105
+ signing_secret?: string | undefined;
106
+ }>;
107
+ export type WebhookEndpointCreateInput = z.infer<typeof webhookEndpointCreateInputSchema>;
108
+ export declare const webhookEndpointPatchInputSchema: z.ZodObject<Omit<{
109
+ endpoint_id: z.ZodOptional<z.ZodString>;
110
+ label: z.ZodOptional<z.ZodOptional<z.ZodString>>;
111
+ trigger_mode: z.ZodOptional<z.ZodDefault<z.ZodEnum<["buffer", "immediate"]>>>;
112
+ hmac_header: z.ZodOptional<z.ZodOptional<z.ZodString>>;
113
+ hmac_algorithm: z.ZodOptional<z.ZodOptional<z.ZodEnum<["sha256", "sha1", "sha512"]>>>;
114
+ signing_secret: z.ZodOptional<z.ZodOptional<z.ZodString>>;
115
+ response_status: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
116
+ response_body: z.ZodOptional<z.ZodOptional<z.ZodString>>;
117
+ response_content_type: z.ZodOptional<z.ZodOptional<z.ZodString>>;
118
+ }, "endpoint_id">, "strip", z.ZodTypeAny, {
119
+ label?: string | undefined;
120
+ hmac_header?: string | undefined;
121
+ hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
122
+ trigger_mode?: "buffer" | "immediate" | undefined;
123
+ response_status?: number | undefined;
124
+ response_body?: string | undefined;
125
+ response_content_type?: string | undefined;
126
+ signing_secret?: string | undefined;
127
+ }, {
128
+ label?: string | undefined;
129
+ hmac_header?: string | undefined;
130
+ hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
131
+ trigger_mode?: "buffer" | "immediate" | undefined;
132
+ response_status?: number | undefined;
133
+ response_body?: string | undefined;
134
+ response_content_type?: string | undefined;
135
+ signing_secret?: string | undefined;
136
+ }>;
137
+ export type WebhookEndpointPatchInput = z.infer<typeof webhookEndpointPatchInputSchema>;
138
+ export declare const webhookEventForSdkSchema: z.ZodObject<{
139
+ id: z.ZodString;
140
+ received_at: z.ZodString;
141
+ method: z.ZodString;
142
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
143
+ body: z.ZodNullable<z.ZodString>;
144
+ body_base64: z.ZodNullable<z.ZodString>;
145
+ }, "strip", z.ZodTypeAny, {
146
+ id: string;
147
+ body: string | null;
148
+ received_at: string;
149
+ method: string;
150
+ headers: Record<string, string>;
151
+ body_base64: string | null;
152
+ }, {
153
+ id: string;
154
+ body: string | null;
155
+ received_at: string;
156
+ method: string;
157
+ headers: Record<string, string>;
158
+ body_base64: string | null;
159
+ }>;
160
+ export type WebhookEventForSdk = z.infer<typeof webhookEventForSdkSchema>;
161
+ //# sourceMappingURL=webhook-endpoint.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-endpoint.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/webhook-endpoint.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AAKH,eAAO,MAAM,uBAAuB,aAOjC,CAAA;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE,eAAO,MAAM,wBAAwB,oCAAkC,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,eAAO,MAAM,0BAA0B,yCAAuC,CAAA;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3C,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAEzF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAC4B,CAAA;AACxE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAKvF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAOnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Webhook endpoint declarations — each one mints a stable HTTPS URL on
4
+ * `in.prave.app/w/<runs.webhook_token>/<endpoint_id>` that buffers
5
+ * inbound traffic into `webhook_events` (or, when trigger_mode is
6
+ * 'immediate', also enqueues a fresh run execution).
7
+ *
8
+ * Two flavours of inbound traffic share this surface:
9
+ * • short-lived OAuth callbacks (`?code=…&state=…`) — almost always
10
+ * 'immediate' so the code is exchanged before its ~10-minute window
11
+ * closes;
12
+ * • long-tail webhooks (Slack interactivity, TikTok post.published,
13
+ * etc.) — 'buffer', drained by `prave.webhooks.drain()` on the
14
+ * next cron run.
15
+ *
16
+ * HMAC verification is optional and only meaningful for buffered
17
+ * webhooks where the provider signs the body. OAuth callbacks rarely
18
+ * sign — providers rely on the redirect_uri being preregistered.
19
+ */
20
+ // URL-path-segment shaped — short and lowercase. Skill-builders use
21
+ // it both in their `prave.webhooks.drain('<endpoint_id>')` calls and as
22
+ // the literal path segment in the public URL.
23
+ export const webhookEndpointIdSchema = z
24
+ .string()
25
+ .min(1)
26
+ .max(64)
27
+ .regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/, 'Lowercase letters, digits and dashes — must start and end with an alphanumeric.');
28
+ export const webhookTriggerModeSchema = z.enum(['buffer', 'immediate']);
29
+ export const webhookHmacAlgorithmSchema = z.enum(['sha256', 'sha1', 'sha512']);
30
+ export const webhookEndpointSchema = z.object({
31
+ id: z.string().uuid(),
32
+ endpoint_id: webhookEndpointIdSchema,
33
+ label: z.string().nullable(),
34
+ // Public URL the user pastes into their provider's developer console.
35
+ url: z.string().url(),
36
+ // HMAC config — `null` everywhere means no verification.
37
+ hmac_header: z.string().max(80).nullable(),
38
+ hmac_algorithm: webhookHmacAlgorithmSchema.nullable(),
39
+ // Last 4 chars of the signing secret, to confirm "yes I have one set".
40
+ signing_secret_preview: z.string().nullable(),
41
+ trigger_mode: webhookTriggerModeSchema,
42
+ // Static-response config (Slack slash command wants "200 ok" right back).
43
+ response_status: z.number().int().min(100).max(599),
44
+ response_body: z.string().nullable(),
45
+ response_content_type: z.string().nullable(),
46
+ // Stats surfaced in the UI card.
47
+ events_30d: z.number().int().nonnegative().optional(),
48
+ last_received_at: z.string().datetime().nullable().optional(),
49
+ created_at: z.string().datetime(),
50
+ updated_at: z.string().datetime(),
51
+ });
52
+ export const webhookEndpointCreateInputSchema = z.object({
53
+ endpoint_id: webhookEndpointIdSchema,
54
+ label: z.string().max(120).optional(),
55
+ trigger_mode: webhookTriggerModeSchema.default('buffer'),
56
+ hmac_header: z.string().max(80).optional(),
57
+ hmac_algorithm: webhookHmacAlgorithmSchema.optional(),
58
+ signing_secret: z.string().min(8).max(512).optional(),
59
+ response_status: z.number().int().min(100).max(599).optional(),
60
+ response_body: z.string().max(8_192).optional(),
61
+ response_content_type: z.string().max(120).optional(),
62
+ });
63
+ export const webhookEndpointPatchInputSchema = webhookEndpointCreateInputSchema.partial().omit({ endpoint_id: true });
64
+ // Shape returned to the SDK by GET /api/v1/sdk/webhooks/:endpointId.
65
+ // `body` is a UTF-8 best-effort decode; binary uploads return
66
+ // `body_base64` instead. Headers are forwarded as the captured object.
67
+ export const webhookEventForSdkSchema = z.object({
68
+ id: z.string().uuid(),
69
+ received_at: z.string().datetime(),
70
+ method: z.string(),
71
+ headers: z.record(z.string(), z.string()),
72
+ body: z.string().nullable(),
73
+ body_base64: z.string().nullable(),
74
+ });
@@ -145,6 +145,29 @@ export interface PlanLimits {
145
145
  runs_max_timeout_seconds: number;
146
146
  /** Max stdout/stderr captured per execution (bytes). */
147
147
  runs_max_log_bytes: number;
148
+ /**
149
+ * Vault keys per run. Each key holds a single user-supplied secret
150
+ * (API key, OAuth client_secret, etc.) readable from the skill via
151
+ * `prave.vault.get('KEY')`. `null` = unlimited.
152
+ */
153
+ vault_keys_max: number | null;
154
+ /**
155
+ * Per-run KV bytes budget — the total encrypted-value size summed
156
+ * across all `run_kv` rows for the run. Hits 413 on PUT once
157
+ * exceeded. `null` = unlimited.
158
+ */
159
+ kv_bytes_max: number | null;
160
+ /**
161
+ * Webhook endpoints per run. Each endpoint mints one stable URL on
162
+ * `in.prave.app/w/<token>/<endpoint_id>`. `null` = unlimited.
163
+ */
164
+ webhooks_max: number | null;
165
+ /**
166
+ * Inbound webhook events per day across all endpoints on the run.
167
+ * Over-cap requests are dropped with 429 (event NOT buffered).
168
+ * `null` = unlimited.
169
+ */
170
+ webhook_events_per_day: number | null;
148
171
  }
149
172
  export declare const PLAN_LIMITS: Record<Plan, PlanLimits>;
150
173
  export declare const PLAN_RANK: Record<Plan, number>;
@@ -1 +1 @@
1
- {"version":3,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Ae,EAAE,MAAM,CAAA;IACvB;;;;;;;;OAQG;IACH,kBAAkB,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAC1D,uDAAuD;IACvD,wBAAwB,EAAE,MAAM,CAAA;IAChC,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,CAAA;IAG1B;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;OAIG;IACH,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAID,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAmMhD,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAI1C,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,SAAS,GAAI,QAAQ,IAAI,EAAE,UAAU,IAAI,KAAG,OACf,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,UAAU,KAAG,IAAI,GAAG,IAU7D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,MAAiC,CAAA;AAExE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,EAAE,eAAe,MAAM,KAAG,MAAM,GAAG,IAI9E,CAAA"}
@@ -54,6 +54,10 @@ export const PLAN_LIMITS = {
54
54
  runs_min_frequency: 'none',
55
55
  runs_max_timeout_seconds: 0,
56
56
  runs_max_log_bytes: 0,
57
+ vault_keys_max: 0,
58
+ kv_bytes_max: 0,
59
+ webhooks_max: 0,
60
+ webhook_events_per_day: 0,
57
61
  },
58
62
  // ── Pro (internally `explorer`) ───────────────────────────────────
59
63
  explorer: {
@@ -104,6 +108,10 @@ export const PLAN_LIMITS = {
104
108
  runs_min_frequency: 'daily',
105
109
  runs_max_timeout_seconds: 60,
106
110
  runs_max_log_bytes: 65_536,
111
+ vault_keys_max: 25,
112
+ kv_bytes_max: 1_048_576,
113
+ webhooks_max: 5,
114
+ webhook_events_per_day: 5_000,
107
115
  },
108
116
  // ── Max (internally `creator`) ────────────────────────────────────
109
117
  creator: {
@@ -152,6 +160,10 @@ export const PLAN_LIMITS = {
152
160
  runs_min_frequency: 'custom',
153
161
  runs_max_timeout_seconds: 300,
154
162
  runs_max_log_bytes: 262_144,
163
+ vault_keys_max: null,
164
+ kv_bytes_max: 16_777_216,
165
+ webhooks_max: null,
166
+ webhook_events_per_day: 50_000,
155
167
  },
156
168
  };
157
169
  export const PLAN_RANK = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prave/shared",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"