@prave/shared 1.4.6 → 1.4.7
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.
- package/dist/schemas/api-keys.schema.d.ts +2 -2
- package/dist/schemas/index.d.ts +0 -9
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +0 -9
- package/dist/schemas/install.schema.d.ts +4 -4
- package/dist/types/plan-limits.d.ts +6 -62
- package/dist/types/plan-limits.d.ts.map +1 -1
- package/dist/types/plan-limits.js +6 -46
- package/package.json +1 -1
- package/dist/schemas/credits.schema.d.ts +0 -73
- package/dist/schemas/credits.schema.d.ts.map +0 -1
- package/dist/schemas/credits.schema.js +0 -52
- package/dist/schemas/kv.schema.d.ts +0 -56
- package/dist/schemas/kv.schema.d.ts.map +0 -1
- package/dist/schemas/kv.schema.js +0 -39
- package/dist/schemas/run.schema.d.ts +0 -509
- package/dist/schemas/run.schema.d.ts.map +0 -1
- package/dist/schemas/run.schema.js +0 -192
- package/dist/schemas/sdk.schema.d.ts +0 -51
- package/dist/schemas/sdk.schema.d.ts.map +0 -1
- package/dist/schemas/sdk.schema.js +0 -36
- package/dist/schemas/skill-pr.schema.d.ts +0 -544
- package/dist/schemas/skill-pr.schema.d.ts.map +0 -1
- package/dist/schemas/skill-pr.schema.js +0 -87
- package/dist/schemas/skill-test.schema.d.ts +0 -60
- package/dist/schemas/skill-test.schema.d.ts.map +0 -1
- package/dist/schemas/skill-test.schema.js +0 -25
- package/dist/schemas/skill-version.schema.d.ts +0 -69
- package/dist/schemas/skill-version.schema.d.ts.map +0 -1
- package/dist/schemas/skill-version.schema.js +0 -21
- package/dist/schemas/vault.schema.d.ts +0 -54
- package/dist/schemas/vault.schema.d.ts.map +0 -1
- package/dist/schemas/vault.schema.js +0 -39
- package/dist/schemas/webhook-endpoint.schema.d.ts +0 -161
- package/dist/schemas/webhook-endpoint.schema.d.ts.map +0 -1
- package/dist/schemas/webhook-endpoint.schema.js +0 -74
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Run schemas — server-side scheduled Skill executions.
|
|
4
|
-
*
|
|
5
|
-
* The on-disk shape is split across three tables:
|
|
6
|
-
*
|
|
7
|
-
* - `skill_bundles` uploaded project folder (SKILL.md + scripts + .env)
|
|
8
|
-
* - `runs` schedule + agent + status for one deployment
|
|
9
|
-
* - `run_executions` append-only fire-history with logs and tokens
|
|
10
|
-
*
|
|
11
|
-
* (See supabase/migrations/049_runs_and_bundles.sql for the full
|
|
12
|
-
* column-level docstrings.)
|
|
13
|
-
*/
|
|
14
|
-
// ── Agent identifier ─────────────────────────────────────────────────
|
|
15
|
-
// Same string set as the existing multi-agent feature. The runner
|
|
16
|
-
// picks the matching CLI invocation per name.
|
|
17
|
-
export const runAgentSchema = z.enum([
|
|
18
|
-
'claude',
|
|
19
|
-
'codex',
|
|
20
|
-
'cursor',
|
|
21
|
-
'gemini',
|
|
22
|
-
'cline',
|
|
23
|
-
'amp',
|
|
24
|
-
]);
|
|
25
|
-
// ── Schedule presets ─────────────────────────────────────────────────
|
|
26
|
-
// The wizard picker only shows the presets; `custom` is a power-user
|
|
27
|
-
// affordance exposed via the same form's "Advanced" twirl-down.
|
|
28
|
-
export const runScheduleKindSchema = z.enum([
|
|
29
|
-
'hourly',
|
|
30
|
-
'daily',
|
|
31
|
-
'weekly',
|
|
32
|
-
'monthly',
|
|
33
|
-
'custom',
|
|
34
|
-
]);
|
|
35
|
-
export const runStatusSchema = z.enum([
|
|
36
|
-
'active',
|
|
37
|
-
'paused',
|
|
38
|
-
'failed',
|
|
39
|
-
'disabled',
|
|
40
|
-
]);
|
|
41
|
-
export const runExecutionStatusSchema = z.enum([
|
|
42
|
-
'running',
|
|
43
|
-
'success',
|
|
44
|
-
'failed',
|
|
45
|
-
'timeout',
|
|
46
|
-
'cancelled',
|
|
47
|
-
]);
|
|
48
|
-
// ── Schedule input ───────────────────────────────────────────────────
|
|
49
|
-
//
|
|
50
|
-
// The wizard sends one of:
|
|
51
|
-
//
|
|
52
|
-
// { kind: 'hourly' } → "0 * * * *"
|
|
53
|
-
// { kind: 'daily', time: '08:00' } → "0 8 * * *"
|
|
54
|
-
// { kind: 'weekly', time: '08:00', weekday: 1 } → "0 8 * * 1"
|
|
55
|
-
// { kind: 'monthly', time: '08:00', day_of_month: 1 } → "0 8 1 * *"
|
|
56
|
-
// { kind: 'custom', cron_expr: '*/15 * * * *' }
|
|
57
|
-
//
|
|
58
|
-
// The API service expands these into the canonical 5-field cron used
|
|
59
|
-
// downstream. Timezone is captured separately so "daily at 08:00" lands
|
|
60
|
-
// at the user's local 08:00 regardless of server location.
|
|
61
|
-
export const runScheduleInputSchema = z.discriminatedUnion('kind', [
|
|
62
|
-
z.object({
|
|
63
|
-
kind: z.literal('hourly'),
|
|
64
|
-
}),
|
|
65
|
-
z.object({
|
|
66
|
-
kind: z.literal('daily'),
|
|
67
|
-
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'HH:MM'),
|
|
68
|
-
}),
|
|
69
|
-
z.object({
|
|
70
|
-
kind: z.literal('weekly'),
|
|
71
|
-
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'HH:MM'),
|
|
72
|
-
weekday: z.number().int().min(0).max(6),
|
|
73
|
-
}),
|
|
74
|
-
z.object({
|
|
75
|
-
kind: z.literal('monthly'),
|
|
76
|
-
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'HH:MM'),
|
|
77
|
-
day_of_month: z.number().int().min(1).max(28),
|
|
78
|
-
}),
|
|
79
|
-
z.object({
|
|
80
|
-
kind: z.literal('custom'),
|
|
81
|
-
cron_expr: z.string().min(9).max(120),
|
|
82
|
-
}),
|
|
83
|
-
]);
|
|
84
|
-
// ── Bundle ───────────────────────────────────────────────────────────
|
|
85
|
-
export const skillBundleSchema = z.object({
|
|
86
|
-
id: z.string().uuid(),
|
|
87
|
-
owner_id: z.string().uuid(),
|
|
88
|
-
skill_id: z.string().uuid().nullable(),
|
|
89
|
-
source: z.enum(['upload', 'github']),
|
|
90
|
-
tarball_path: z.string(),
|
|
91
|
-
manifest: z.array(z.object({
|
|
92
|
-
path: z.string(),
|
|
93
|
-
size: z.number().int().nonnegative(),
|
|
94
|
-
sha256: z.string(),
|
|
95
|
-
kind: z.enum(['text', 'binary', 'script']),
|
|
96
|
-
})),
|
|
97
|
-
total_size_bytes: z.number().int().nonnegative(),
|
|
98
|
-
has_scripts: z.boolean(),
|
|
99
|
-
has_env_template: z.boolean(),
|
|
100
|
-
secret_scan_status: z.enum(['pending', 'clean', 'rejected']),
|
|
101
|
-
secret_scan_findings: z
|
|
102
|
-
.array(z.object({
|
|
103
|
-
path: z.string(),
|
|
104
|
-
rule: z.string(),
|
|
105
|
-
line: z.number().int().nonnegative().optional(),
|
|
106
|
-
}))
|
|
107
|
-
.nullable(),
|
|
108
|
-
created_at: z.string().datetime(),
|
|
109
|
-
updated_at: z.string().datetime(),
|
|
110
|
-
});
|
|
111
|
-
// ── Run ──────────────────────────────────────────────────────────────
|
|
112
|
-
export const runSchema = z.object({
|
|
113
|
-
id: z.string().uuid(),
|
|
114
|
-
owner_id: z.string().uuid(),
|
|
115
|
-
bundle_id: z.string().uuid(),
|
|
116
|
-
slug: z.string(),
|
|
117
|
-
name: z.string(),
|
|
118
|
-
agent: runAgentSchema,
|
|
119
|
-
schedule_kind: runScheduleKindSchema,
|
|
120
|
-
cron_expr: z.string(),
|
|
121
|
-
timezone: z.string(),
|
|
122
|
-
status: runStatusSchema,
|
|
123
|
-
timeout_seconds: z.number().int().positive(),
|
|
124
|
-
max_log_bytes: z.number().int().positive(),
|
|
125
|
-
next_run_at: z.string().datetime().nullable(),
|
|
126
|
-
last_run_at: z.string().datetime().nullable(),
|
|
127
|
-
last_exec_status: z
|
|
128
|
-
.enum(['success', 'failed', 'timeout', 'cancelled'])
|
|
129
|
-
.nullable(),
|
|
130
|
-
total_runs: z.number().int().nonnegative(),
|
|
131
|
-
total_failures: z.number().int().nonnegative(),
|
|
132
|
-
created_at: z.string().datetime(),
|
|
133
|
-
updated_at: z.string().datetime(),
|
|
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
|
-
});
|
|
145
|
-
export const createRunInputSchema = z.object({
|
|
146
|
-
bundle_id: z.string().uuid(),
|
|
147
|
-
name: z.string().min(1).max(120),
|
|
148
|
-
agent: runAgentSchema,
|
|
149
|
-
schedule: runScheduleInputSchema,
|
|
150
|
-
timezone: z.string().min(2).max(60).default('UTC'),
|
|
151
|
-
timeout_seconds: z.number().int().min(5).max(300).optional(),
|
|
152
|
-
env_vars: runEnvVarsSchema.optional(),
|
|
153
|
-
});
|
|
154
|
-
export const updateRunInputSchema = z.object({
|
|
155
|
-
name: z.string().min(1).max(120).optional(),
|
|
156
|
-
agent: runAgentSchema.optional(),
|
|
157
|
-
schedule: runScheduleInputSchema.optional(),
|
|
158
|
-
timezone: z.string().optional(),
|
|
159
|
-
timeout_seconds: z.number().int().min(5).max(300).optional(),
|
|
160
|
-
status: z.enum(['active', 'paused']).optional(),
|
|
161
|
-
// Replace the full env-vars set. Passing `{}` clears them all.
|
|
162
|
-
env_vars: runEnvVarsSchema.optional(),
|
|
163
|
-
});
|
|
164
|
-
// ── Execution ────────────────────────────────────────────────────────
|
|
165
|
-
export const runExecutionSchema = z.object({
|
|
166
|
-
id: z.string().uuid(),
|
|
167
|
-
run_id: z.string().uuid(),
|
|
168
|
-
worker_id: z.string().nullable(),
|
|
169
|
-
status: runExecutionStatusSchema,
|
|
170
|
-
started_at: z.string().datetime(),
|
|
171
|
-
finished_at: z.string().datetime().nullable(),
|
|
172
|
-
duration_ms: z.number().int().nullable(),
|
|
173
|
-
exit_code: z.number().int().nullable(),
|
|
174
|
-
log_text: z.string().nullable(),
|
|
175
|
-
log_truncated: z.boolean(),
|
|
176
|
-
input_tokens: z.number().int().nullable(),
|
|
177
|
-
output_tokens: z.number().int().nullable(),
|
|
178
|
-
cost_estimate_cents: z.number().int().nullable(),
|
|
179
|
-
error_message: z.string().nullable(),
|
|
180
|
-
created_at: z.string().datetime(),
|
|
181
|
-
});
|
|
182
|
-
// ── Deploy-CLI session ──────────────────────────────────────────────
|
|
183
|
-
// The CLI's `prave deploy` flow uses a short-lived session token to
|
|
184
|
-
// hand off the upload from the terminal to the browser wizard. The
|
|
185
|
-
// API mints the session, the CLI uploads the tarball, the browser
|
|
186
|
-
// claims the session and finalizes the Run.
|
|
187
|
-
export const deploySessionSchema = z.object({
|
|
188
|
-
session_id: z.string(),
|
|
189
|
-
upload_url: z.string().url(),
|
|
190
|
-
wizard_url: z.string().url(),
|
|
191
|
-
expires_at: z.string().datetime(),
|
|
192
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
});
|