@rayspec/spec 1.5.0
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/LICENSE +105 -0
- package/dist/brace-params.d.ts +32 -0
- package/dist/brace-params.d.ts.map +1 -0
- package/dist/brace-params.js +89 -0
- package/dist/brace-params.js.map +1 -0
- package/dist/detect.d.ts +44 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +72 -0
- package/dist/detect.js.map +1 -0
- package/dist/errors.d.ts +204 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +165 -0
- package/dist/errors.js.map +1 -0
- package/dist/export.d.ts +54 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +121 -0
- package/dist/export.js.map +1 -0
- package/dist/grammar.d.ts +569 -0
- package/dist/grammar.d.ts.map +1 -0
- package/dist/grammar.js +503 -0
- package/dist/grammar.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/lint.d.ts +79 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +823 -0
- package/dist/lint.js.map +1 -0
- package/dist/parse.d.ts +8 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +118 -0
- package/dist/parse.js.map +1 -0
- package/dist/product-events.d.ts +73 -0
- package/dist/product-events.d.ts.map +1 -0
- package/dist/product-events.js +42 -0
- package/dist/product-events.js.map +1 -0
- package/dist/product-grammar.d.ts +948 -0
- package/dist/product-grammar.d.ts.map +1 -0
- package/dist/product-grammar.js +581 -0
- package/dist/product-grammar.js.map +1 -0
- package/dist/product-lint.d.ts +74 -0
- package/dist/product-lint.d.ts.map +1 -0
- package/dist/product-lint.js +821 -0
- package/dist/product-lint.js.map +1 -0
- package/dist/product-parse.d.ts +8 -0
- package/dist/product-parse.d.ts.map +1 -0
- package/dist/product-parse.js +119 -0
- package/dist/product-parse.js.map +1 -0
- package/dist/product-scope.d.ts +53 -0
- package/dist/product-scope.d.ts.map +1 -0
- package/dist/product-scope.js +55 -0
- package/dist/product-scope.js.map +1 -0
- package/dist/product-views-lint.d.ts +14 -0
- package/dist/product-views-lint.d.ts.map +1 -0
- package/dist/product-views-lint.js +669 -0
- package/dist/product-views-lint.js.map +1 -0
- package/dist/product-views.d.ts +426 -0
- package/dist/product-views.d.ts.map +1 -0
- package/dist/product-views.js +317 -0
- package/dist/product-views.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The supported spec major.minor. Parsed FIRST (two-phase) so an unknown major fails cleanly. */
|
|
3
|
+
export declare const SPEC_VERSION: "1.0";
|
|
4
|
+
/** Minimal deployment metadata. `name` identifies the backend; extend later as needed. */
|
|
5
|
+
export declare const Metadata: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type Metadata = z.infer<typeof Metadata>;
|
|
10
|
+
/**
|
|
11
|
+
* Deployment-level properties of a backend. These describe HOW the
|
|
12
|
+
* deployment runs, NOT what any SDK can do — so `async`/off-request execution belongs HERE, on the
|
|
13
|
+
* spec, gated by "is a durable worker configured?", and is INVISIBLE to the neutral `Backend`
|
|
14
|
+
* interface and the per-backend `CapabilityDescriptor` (which must NOT be touched: whether a run
|
|
15
|
+
* executes off-request has no backend asymmetry to absorb — `runAgent` takes the same `ctx`
|
|
16
|
+
* in-request or off-request).
|
|
17
|
+
*
|
|
18
|
+
* - `durableWorker` — when true, the deployment runs a durable off-request worker (DBOS),
|
|
19
|
+
* so a per-request `async:true` run is enqueued onto it (202 + runId) rather than fail-closed-501.
|
|
20
|
+
* A lint rule (lint.ts) enforces it: a spec must not be deployed expecting async without it — but
|
|
21
|
+
* the LOAD-BEARING gate is the RUNTIME one (the run surface 501s if no executor is wired,
|
|
22
|
+
* regardless of this flag), so this is a declaration + a static best-effort check, defense-in-depth.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DeploymentSpec: z.ZodObject<{
|
|
25
|
+
durableWorker: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type DeploymentSpec = z.infer<typeof DeploymentSpec>;
|
|
28
|
+
/**
|
|
29
|
+
* The closed set of column types an author may declare. Small + closed so the store generator
|
|
30
|
+
* can map each to a Drizzle/Postgres type deterministically and the migration gate sees a finite
|
|
31
|
+
* vocabulary. (Authors declare BUSINESS columns only — the tenancy/GDPR columns `tenant_id`,
|
|
32
|
+
* `id`, `created_at`, `deleted_at`, `retention_days`, `region` are INJECTED by the generator,
|
|
33
|
+
* never declared here.)
|
|
34
|
+
*/
|
|
35
|
+
export declare const ColumnType: z.ZodEnum<{
|
|
36
|
+
boolean: "boolean";
|
|
37
|
+
text: "text";
|
|
38
|
+
uuid: "uuid";
|
|
39
|
+
timestamp: "timestamp";
|
|
40
|
+
integer: "integer";
|
|
41
|
+
jsonb: "jsonb";
|
|
42
|
+
}>;
|
|
43
|
+
export type ColumnType = z.infer<typeof ColumnType>;
|
|
44
|
+
/**
|
|
45
|
+
* A SAFE SQL/TS IDENTIFIER for a store name / column name / FK column-or-reference (TEN-1).
|
|
46
|
+
* Store/column names are interpolated VERBATIM into generated SQL (`CREATE TABLE "<name>"`)
|
|
47
|
+
* AND generated TS (`export const <camel> = pgTable('<name>', …)`) — so an unconstrained
|
|
48
|
+
* `z.string()` is an INJECTION seam (a name like `m" ); DROP …` lands in executable DDL, and the
|
|
49
|
+
* destructive scan is a closed blocklist that can never catch every form). Fail-closed at the
|
|
50
|
+
* SOURCE: a safe identifier is `[a-z_][a-z0-9_]*`, length 1..63 (the Postgres identifier limit),
|
|
51
|
+
* lowercase only (Postgres folds unquoted idents to lowercase; we keep snake_case author names and
|
|
52
|
+
* camelCase them for TS). `parseSpec` rejects a metacharacter/over-long name as `schema_violation`.
|
|
53
|
+
* The generators re-assert the SAME shape (defense-in-depth for a code-built spec bypassing parse).
|
|
54
|
+
*/
|
|
55
|
+
export declare const SAFE_IDENTIFIER_RE: RegExp;
|
|
56
|
+
export declare const MAX_IDENTIFIER_LENGTH = 63;
|
|
57
|
+
export declare const SafeIdentifier: z.ZodString;
|
|
58
|
+
/**
|
|
59
|
+
* Re-assert the safe-identifier shape OUTSIDE Zod (the generators call this on a spec that may have
|
|
60
|
+
* been built in code, bypassing parseSpec). THROWS — never returns a malformed identifier into
|
|
61
|
+
* generated SQL/TS. Single source of the rule shared by the grammar refine above + both generators.
|
|
62
|
+
*/
|
|
63
|
+
export declare function assertSafeIdentifier(value: string, what: string): void;
|
|
64
|
+
/** One business column on a store. `nullable`/`unique` default false (the conservative shape). */
|
|
65
|
+
export declare const StoreColumn: z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
type: z.ZodEnum<{
|
|
68
|
+
boolean: "boolean";
|
|
69
|
+
text: "text";
|
|
70
|
+
uuid: "uuid";
|
|
71
|
+
timestamp: "timestamp";
|
|
72
|
+
integer: "integer";
|
|
73
|
+
jsonb: "jsonb";
|
|
74
|
+
}>;
|
|
75
|
+
nullable: z.ZodDefault<z.ZodBoolean>;
|
|
76
|
+
unique: z.ZodDefault<z.ZodBoolean>;
|
|
77
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
export type StoreColumn = z.infer<typeof StoreColumn>;
|
|
80
|
+
/**
|
|
81
|
+
* A child→parent foreign key (the throwaway has `transcripts` referencing `meetings`). The
|
|
82
|
+
* generator emits the FK + `ON DELETE` policy; the parent must be another declared store (the
|
|
83
|
+
* lint pass resolves `references`). This is a PRODUCT-to-PRODUCT FK; FK-to-core (e.g. orgs) is
|
|
84
|
+
* the injected tenancy column, not declared here.
|
|
85
|
+
*/
|
|
86
|
+
export declare const StoreForeignKey: z.ZodObject<{
|
|
87
|
+
column: z.ZodString;
|
|
88
|
+
references: z.ZodString;
|
|
89
|
+
referencesColumn: z.ZodOptional<z.ZodString>;
|
|
90
|
+
onDelete: z.ZodDefault<z.ZodEnum<{
|
|
91
|
+
cascade: "cascade";
|
|
92
|
+
restrict: "restrict";
|
|
93
|
+
"set null": "set null";
|
|
94
|
+
}>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export type StoreForeignKey = z.infer<typeof StoreForeignKey>;
|
|
97
|
+
/**
|
|
98
|
+
* A declared product store. Authors declare a name + business columns (+ optional child→parent
|
|
99
|
+
* FKs). Tenancy is NON-OPTIONAL by construction — there is no opt-out field (a non-tenant store
|
|
100
|
+
* would be the spec-level analogue of `.unscoped()`, deliberately not expressible in v1.0).
|
|
101
|
+
*/
|
|
102
|
+
export declare const StoreSpec: z.ZodObject<{
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
105
|
+
name: z.ZodString;
|
|
106
|
+
type: z.ZodEnum<{
|
|
107
|
+
boolean: "boolean";
|
|
108
|
+
text: "text";
|
|
109
|
+
uuid: "uuid";
|
|
110
|
+
timestamp: "timestamp";
|
|
111
|
+
integer: "integer";
|
|
112
|
+
jsonb: "jsonb";
|
|
113
|
+
}>;
|
|
114
|
+
nullable: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
+
unique: z.ZodDefault<z.ZodBoolean>;
|
|
116
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
+
}, z.core.$strict>>;
|
|
118
|
+
foreignKeys: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
119
|
+
column: z.ZodString;
|
|
120
|
+
references: z.ZodString;
|
|
121
|
+
referencesColumn: z.ZodOptional<z.ZodString>;
|
|
122
|
+
onDelete: z.ZodDefault<z.ZodEnum<{
|
|
123
|
+
cascade: "cascade";
|
|
124
|
+
restrict: "restrict";
|
|
125
|
+
"set null": "set null";
|
|
126
|
+
}>>;
|
|
127
|
+
}, z.core.$strict>>>;
|
|
128
|
+
softDelete: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
fullTextSearch: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export type StoreSpec = z.infer<typeof StoreSpec>;
|
|
132
|
+
/**
|
|
133
|
+
* What a handler is wired into. A logical id maps to a TS module + export; `kind` declares the
|
|
134
|
+
* chokepoint it dispatches through (tool → dispatchTool; route → the api chokepoint; trigger →
|
|
135
|
+
* the triggers seam). The loader resolves the symbol from a path-jailed escape-hatch
|
|
136
|
+
* root — the grammar layer parses the mapping only.
|
|
137
|
+
*/
|
|
138
|
+
export declare const HandlerKind: z.ZodEnum<{
|
|
139
|
+
tool: "tool";
|
|
140
|
+
route: "route";
|
|
141
|
+
trigger: "trigger";
|
|
142
|
+
}>;
|
|
143
|
+
export type HandlerKind = z.infer<typeof HandlerKind>;
|
|
144
|
+
export declare const HandlerSpec: z.ZodObject<{
|
|
145
|
+
id: z.ZodString;
|
|
146
|
+
module: z.ZodString;
|
|
147
|
+
export: z.ZodString;
|
|
148
|
+
kind: z.ZodEnum<{
|
|
149
|
+
tool: "tool";
|
|
150
|
+
route: "route";
|
|
151
|
+
trigger: "trigger";
|
|
152
|
+
}>;
|
|
153
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
}, z.core.$strict>;
|
|
155
|
+
export type HandlerSpec = z.infer<typeof HandlerSpec>;
|
|
156
|
+
/**
|
|
157
|
+
* A declared agent. WRAPS `core.AgentSpec`:
|
|
158
|
+
* - `.omit({ input })` — `input` is the per-request RUNTIME value, never config.
|
|
159
|
+
* - `.omit({ tools })` — the neutral inline tool array is replaced by ID references into the
|
|
160
|
+
* `tooling[]` section (a config agent wires tools by id; lint resolves them).
|
|
161
|
+
* - `.extend(...)` — the wrap-layer fields the engine needs: a logical `id`, a `backend`
|
|
162
|
+
* selection, the `tools` id-reference list, and an optional `requireNativeStructuredOutput`
|
|
163
|
+
* flag so a capability violation (e.g. native structured output demanded on pi) is expressible
|
|
164
|
+
* and checked at config time (lint).
|
|
165
|
+
* - `.strict()` — fail-closed unknown-key rejection (applied last; verified to compose).
|
|
166
|
+
*
|
|
167
|
+
* Single source of truth: `name`/`instructions`/`model`/`outputSchema`/`maxTurns` come straight
|
|
168
|
+
* from the neutral type. If the neutral `AgentSpec` churns, this wrap is where the compat decision
|
|
169
|
+
* (minor vs major spec bump) is made — by design.
|
|
170
|
+
*/
|
|
171
|
+
export declare const AgentSpecConfig: z.ZodObject<{
|
|
172
|
+
name: z.ZodString;
|
|
173
|
+
instructions: z.ZodString;
|
|
174
|
+
model: z.ZodString;
|
|
175
|
+
outputSchema: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
178
|
+
}, z.core.$strict>>;
|
|
179
|
+
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
backend: z.ZodEnum<{
|
|
182
|
+
openai: "openai";
|
|
183
|
+
anthropic: "anthropic";
|
|
184
|
+
pi: "pi";
|
|
185
|
+
codex: "codex";
|
|
186
|
+
}>;
|
|
187
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
188
|
+
requireNativeStructuredOutput: z.ZodDefault<z.ZodBoolean>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
export type AgentSpecConfig = z.infer<typeof AgentSpecConfig>;
|
|
191
|
+
/**
|
|
192
|
+
* A declared tool. WRAPS `core.ToolSpec` (name/description/parameters — the model-facing
|
|
193
|
+
* declaration) + the wrap-layer fields the resolver needs to build a `NeutralTool`:
|
|
194
|
+
* - `id` — logical id referenced from `agents[].tools` and unique within `tooling[]`.
|
|
195
|
+
* - `handler` — a logical handler id from the `handlers[]` section (lint-resolved).
|
|
196
|
+
* - `idempotent` — REQUIRED, NO DEFAULT. This is the reviewed replay-safety declaration the whole
|
|
197
|
+
* `dispatchTool` contract keys off (a `false` tool must never re-fire / return a cached output
|
|
198
|
+
* on replay). There is no platform-side verification of this boolean — it must be an explicit,
|
|
199
|
+
* reviewed author decision, so we give it no default.
|
|
200
|
+
* - `timeoutMs` — bounds the handler (AbortSignal in dispatchTool).
|
|
201
|
+
* - `outputSchema` — optional embedded JSON-Schema validating the handler output (Ajv-compiled
|
|
202
|
+
* at load by the lint pass). `parameters` (the input schema) is inherited from `ToolSpec`.
|
|
203
|
+
*/
|
|
204
|
+
export declare const ToolSpecConfig: z.ZodObject<{
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
description: z.ZodString;
|
|
207
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
handler: z.ZodString;
|
|
210
|
+
idempotent: z.ZodBoolean;
|
|
211
|
+
timeoutMs: z.ZodNumber;
|
|
212
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
213
|
+
}, z.core.$strict>;
|
|
214
|
+
export type ToolSpecConfig = z.infer<typeof ToolSpecConfig>;
|
|
215
|
+
/** The HTTP method a route handles. */
|
|
216
|
+
export declare const HttpMethod: z.ZodEnum<{
|
|
217
|
+
GET: "GET";
|
|
218
|
+
POST: "POST";
|
|
219
|
+
PUT: "PUT";
|
|
220
|
+
PATCH: "PATCH";
|
|
221
|
+
DELETE: "DELETE";
|
|
222
|
+
}>;
|
|
223
|
+
export type HttpMethod = z.infer<typeof HttpMethod>;
|
|
224
|
+
/** A CRUD operation against a materialized store. */
|
|
225
|
+
export declare const StoreOp: z.ZodEnum<{
|
|
226
|
+
list: "list";
|
|
227
|
+
get: "get";
|
|
228
|
+
create: "create";
|
|
229
|
+
update: "update";
|
|
230
|
+
delete: "delete";
|
|
231
|
+
}>;
|
|
232
|
+
export type StoreOp = z.infer<typeof StoreOp>;
|
|
233
|
+
/**
|
|
234
|
+
* A `stream` route's runtime mode — discriminates the init shape the interpreter builds WITHIN the
|
|
235
|
+
* `kind:'stream'` arm (NOT a union discriminant — the union still discriminates on `kind`):
|
|
236
|
+
* - `ingest` — the binary write half: the interpreter reads the RAW request body.
|
|
237
|
+
* - `playback` — the media read half: Range/206 + conditional-GET from a `BlobStore`.
|
|
238
|
+
*
|
|
239
|
+
* `mode` is a per-arm field (like a store action's `op`), not a fourth `kind`: an ingest and a
|
|
240
|
+
* playback route are the SAME kind of action (a raw-Request/Response stream handler) differing only
|
|
241
|
+
* in runtime behavior, so one `kind` keeps the closed union minimal.
|
|
242
|
+
*/
|
|
243
|
+
export declare const StreamMode: z.ZodEnum<{
|
|
244
|
+
ingest: "ingest";
|
|
245
|
+
playback: "playback";
|
|
246
|
+
}>;
|
|
247
|
+
export type StreamMode = z.infer<typeof StreamMode>;
|
|
248
|
+
/**
|
|
249
|
+
* A route action — a discriminated union over its `kind`:
|
|
250
|
+
* - `store` — CRUD over a materialized store via TenantDb.
|
|
251
|
+
* - `agent` — invoke a declared agent over the SSE/JSON run surface.
|
|
252
|
+
* - `handler` — a declared route-handler id.
|
|
253
|
+
* - `stream` — a raw binary ingest / Range-206 playback handler; `mode`
|
|
254
|
+
* discriminates ingest vs playback WITHIN this arm (the union still keys on `kind`).
|
|
255
|
+
*
|
|
256
|
+
* The discriminant `kind` is an explicit field (not inferred from which payload is set) so the union
|
|
257
|
+
* is unambiguous and fail-closed. The `stream` arm's `handler` resolves against a declared
|
|
258
|
+
* `route`-kind handler — the SAME chokepoint a `kind:'handler'` route uses (a stream handler is a
|
|
259
|
+
* route handler that receives a raw `Request` instead of parsed JSON; the raw-vs-JSON init shape is
|
|
260
|
+
* a RUNTIME concern, not a grammar-kind concern — so no new `HandlerKind` is introduced).
|
|
261
|
+
*/
|
|
262
|
+
export declare const RouteAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
263
|
+
kind: z.ZodLiteral<"store">;
|
|
264
|
+
store: z.ZodString;
|
|
265
|
+
op: z.ZodEnum<{
|
|
266
|
+
list: "list";
|
|
267
|
+
get: "get";
|
|
268
|
+
create: "create";
|
|
269
|
+
update: "update";
|
|
270
|
+
delete: "delete";
|
|
271
|
+
}>;
|
|
272
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
273
|
+
kind: z.ZodLiteral<"agent">;
|
|
274
|
+
agent: z.ZodString;
|
|
275
|
+
persistTo: z.ZodOptional<z.ZodString>;
|
|
276
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
277
|
+
kind: z.ZodLiteral<"handler">;
|
|
278
|
+
handler: z.ZodString;
|
|
279
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
280
|
+
kind: z.ZodLiteral<"stream">;
|
|
281
|
+
handler: z.ZodString;
|
|
282
|
+
mode: z.ZodEnum<{
|
|
283
|
+
ingest: "ingest";
|
|
284
|
+
playback: "playback";
|
|
285
|
+
}>;
|
|
286
|
+
}, z.core.$strict>], "kind">;
|
|
287
|
+
export type RouteAction = z.infer<typeof RouteAction>;
|
|
288
|
+
/** A declared HTTP route mounted on the existing auth chain. */
|
|
289
|
+
export declare const ApiRouteSpec: z.ZodObject<{
|
|
290
|
+
method: z.ZodEnum<{
|
|
291
|
+
GET: "GET";
|
|
292
|
+
POST: "POST";
|
|
293
|
+
PUT: "PUT";
|
|
294
|
+
PATCH: "PATCH";
|
|
295
|
+
DELETE: "DELETE";
|
|
296
|
+
}>;
|
|
297
|
+
path: z.ZodString;
|
|
298
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
299
|
+
kind: z.ZodLiteral<"store">;
|
|
300
|
+
store: z.ZodString;
|
|
301
|
+
op: z.ZodEnum<{
|
|
302
|
+
list: "list";
|
|
303
|
+
get: "get";
|
|
304
|
+
create: "create";
|
|
305
|
+
update: "update";
|
|
306
|
+
delete: "delete";
|
|
307
|
+
}>;
|
|
308
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
309
|
+
kind: z.ZodLiteral<"agent">;
|
|
310
|
+
agent: z.ZodString;
|
|
311
|
+
persistTo: z.ZodOptional<z.ZodString>;
|
|
312
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
313
|
+
kind: z.ZodLiteral<"handler">;
|
|
314
|
+
handler: z.ZodString;
|
|
315
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
316
|
+
kind: z.ZodLiteral<"stream">;
|
|
317
|
+
handler: z.ZodString;
|
|
318
|
+
mode: z.ZodEnum<{
|
|
319
|
+
ingest: "ingest";
|
|
320
|
+
playback: "playback";
|
|
321
|
+
}>;
|
|
322
|
+
}, z.core.$strict>], "kind">;
|
|
323
|
+
}, z.core.$strict>;
|
|
324
|
+
export type ApiRouteSpec = z.infer<typeof ApiRouteSpec>;
|
|
325
|
+
/**
|
|
326
|
+
* A trigger action — what fires when the trigger runs. A trigger fires an agent or a declared
|
|
327
|
+
* trigger-handler (lint-resolved). Parse/register only (the durable worker is a deployment
|
|
328
|
+
* property); a cron/async fire is fail-closed-rejected at runtime (not in this grammar).
|
|
329
|
+
*/
|
|
330
|
+
export declare const TriggerAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
331
|
+
kind: z.ZodLiteral<"agent">;
|
|
332
|
+
agent: z.ZodString;
|
|
333
|
+
persistTo: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
335
|
+
kind: z.ZodLiteral<"handler">;
|
|
336
|
+
handler: z.ZodString;
|
|
337
|
+
}, z.core.$strict>], "kind">;
|
|
338
|
+
export type TriggerAction = z.infer<typeof TriggerAction>;
|
|
339
|
+
/**
|
|
340
|
+
* A declared trigger. `kind` selects the descriptor:
|
|
341
|
+
* - `cron` — requires `schedule` (a cron expression; not evaluated at the grammar level).
|
|
342
|
+
* - `webhook` — an inbound webhook (path interpreted later).
|
|
343
|
+
* - `event` — requires `event` (a logical event name).
|
|
344
|
+
* - `manual` — fired by an explicit call.
|
|
345
|
+
*
|
|
346
|
+
* `schedule`/`event` are optional at the GRAMMAR level (different kinds need different fields);
|
|
347
|
+
* the lint pass enforces the kind→field requirement (cron needs schedule, event needs event) so a
|
|
348
|
+
* malformed trigger fails fail-closed rather than parsing into a half-specified descriptor.
|
|
349
|
+
*/
|
|
350
|
+
export declare const TriggerKind: z.ZodEnum<{
|
|
351
|
+
cron: "cron";
|
|
352
|
+
webhook: "webhook";
|
|
353
|
+
event: "event";
|
|
354
|
+
manual: "manual";
|
|
355
|
+
}>;
|
|
356
|
+
export type TriggerKind = z.infer<typeof TriggerKind>;
|
|
357
|
+
export declare const TriggerSpec: z.ZodObject<{
|
|
358
|
+
name: z.ZodString;
|
|
359
|
+
kind: z.ZodEnum<{
|
|
360
|
+
cron: "cron";
|
|
361
|
+
webhook: "webhook";
|
|
362
|
+
event: "event";
|
|
363
|
+
manual: "manual";
|
|
364
|
+
}>;
|
|
365
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
366
|
+
event: z.ZodOptional<z.ZodString>;
|
|
367
|
+
catchUp: z.ZodOptional<z.ZodBoolean>;
|
|
368
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
369
|
+
kind: z.ZodLiteral<"agent">;
|
|
370
|
+
agent: z.ZodString;
|
|
371
|
+
persistTo: z.ZodOptional<z.ZodString>;
|
|
372
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
373
|
+
kind: z.ZodLiteral<"handler">;
|
|
374
|
+
handler: z.ZodString;
|
|
375
|
+
}, z.core.$strict>], "kind">;
|
|
376
|
+
}, z.core.$strict>;
|
|
377
|
+
export type TriggerSpec = z.infer<typeof TriggerSpec>;
|
|
378
|
+
export declare const ExactVersionPin: z.ZodString;
|
|
379
|
+
/**
|
|
380
|
+
* A reference to an extension pack to load. The pack carries ALL product code (its
|
|
381
|
+
* own stores/handlers/tooling/route fragments + capability impls); core validates ONLY this
|
|
382
|
+
* reference shape, never the pack's contents. `config` is an OPEN passthrough record whose CONTENTS
|
|
383
|
+
* are validated by the PACK's own Zod at load time, NEVER by core — but the ExtensionRef
|
|
384
|
+
* wrapper itself is `.strict()`, so an unknown key ON THE REF is fail-closed-rejected.
|
|
385
|
+
*
|
|
386
|
+
* - `id` — a logical id for the pack (unique within `extensions[]`; lint-resolvable later).
|
|
387
|
+
* - `module` — the pack module/directory reference (resolved + path-jailed by `loadExtensions`).
|
|
388
|
+
* - `version` — an EXACT version pin (no range — see `ExactVersionPin`).
|
|
389
|
+
* - `config` — optional opaque pack-validated config (passthrough; core does not inspect it).
|
|
390
|
+
*/
|
|
391
|
+
export declare const ExtensionRef: z.ZodObject<{
|
|
392
|
+
id: z.ZodString;
|
|
393
|
+
module: z.ZodString;
|
|
394
|
+
version: z.ZodString;
|
|
395
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
396
|
+
}, z.core.$strict>;
|
|
397
|
+
export type ExtensionRef = z.infer<typeof ExtensionRef>;
|
|
398
|
+
/**
|
|
399
|
+
* One static frontend mount served alongside the backend's API. A backend may declare a list of
|
|
400
|
+
* these so a spec can ship its own web UI (built assets) next to the routes it exposes.
|
|
401
|
+
*
|
|
402
|
+
* - `route` — the URL prefix the mount is served under (e.g. `/` or `/app`); must start with `/`.
|
|
403
|
+
* - `dir` — the directory of built static assets, relative to the spec file.
|
|
404
|
+
* - `spa` — when true, an unmatched path under `route` falls back to `index.html` (the
|
|
405
|
+
* History-API single-page-app fallback); default false (plain static file serving).
|
|
406
|
+
*
|
|
407
|
+
* `.strict()` — fail-closed unknown-key rejection, consistent with every other grammar level.
|
|
408
|
+
*/
|
|
409
|
+
export declare const FrontendSpec: z.ZodObject<{
|
|
410
|
+
route: z.ZodString;
|
|
411
|
+
dir: z.ZodString;
|
|
412
|
+
spa: z.ZodDefault<z.ZodBoolean>;
|
|
413
|
+
}, z.core.$strict>;
|
|
414
|
+
export type FrontendSpec = z.infer<typeof FrontendSpec>;
|
|
415
|
+
/**
|
|
416
|
+
* The full RaySpec config document. `version` is `z.literal('1.0')` — but the parser checks it
|
|
417
|
+
* FIRST (two-phase, see `parse.ts`) so an unsupported major yields a clean `unsupported_version`
|
|
418
|
+
* SpecError instead of a wall of strict-shape errors. `.strict()` at the top level rejects any
|
|
419
|
+
* unknown top-level section.
|
|
420
|
+
*
|
|
421
|
+
* Every section defaults to `[]` so a minimal spec (just `version` + `metadata`) is valid.
|
|
422
|
+
*/
|
|
423
|
+
export declare const RaySpec: z.ZodObject<{
|
|
424
|
+
version: z.ZodLiteral<"1.0">;
|
|
425
|
+
metadata: z.ZodObject<{
|
|
426
|
+
name: z.ZodString;
|
|
427
|
+
description: z.ZodOptional<z.ZodString>;
|
|
428
|
+
}, z.core.$strict>;
|
|
429
|
+
stores: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
430
|
+
name: z.ZodString;
|
|
431
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
432
|
+
name: z.ZodString;
|
|
433
|
+
type: z.ZodEnum<{
|
|
434
|
+
boolean: "boolean";
|
|
435
|
+
text: "text";
|
|
436
|
+
uuid: "uuid";
|
|
437
|
+
timestamp: "timestamp";
|
|
438
|
+
integer: "integer";
|
|
439
|
+
jsonb: "jsonb";
|
|
440
|
+
}>;
|
|
441
|
+
nullable: z.ZodDefault<z.ZodBoolean>;
|
|
442
|
+
unique: z.ZodDefault<z.ZodBoolean>;
|
|
443
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
444
|
+
}, z.core.$strict>>;
|
|
445
|
+
foreignKeys: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
446
|
+
column: z.ZodString;
|
|
447
|
+
references: z.ZodString;
|
|
448
|
+
referencesColumn: z.ZodOptional<z.ZodString>;
|
|
449
|
+
onDelete: z.ZodDefault<z.ZodEnum<{
|
|
450
|
+
cascade: "cascade";
|
|
451
|
+
restrict: "restrict";
|
|
452
|
+
"set null": "set null";
|
|
453
|
+
}>>;
|
|
454
|
+
}, z.core.$strict>>>;
|
|
455
|
+
softDelete: z.ZodOptional<z.ZodBoolean>;
|
|
456
|
+
fullTextSearch: z.ZodOptional<z.ZodBoolean>;
|
|
457
|
+
}, z.core.$strict>>>;
|
|
458
|
+
api: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
459
|
+
method: z.ZodEnum<{
|
|
460
|
+
GET: "GET";
|
|
461
|
+
POST: "POST";
|
|
462
|
+
PUT: "PUT";
|
|
463
|
+
PATCH: "PATCH";
|
|
464
|
+
DELETE: "DELETE";
|
|
465
|
+
}>;
|
|
466
|
+
path: z.ZodString;
|
|
467
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
468
|
+
kind: z.ZodLiteral<"store">;
|
|
469
|
+
store: z.ZodString;
|
|
470
|
+
op: z.ZodEnum<{
|
|
471
|
+
list: "list";
|
|
472
|
+
get: "get";
|
|
473
|
+
create: "create";
|
|
474
|
+
update: "update";
|
|
475
|
+
delete: "delete";
|
|
476
|
+
}>;
|
|
477
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
478
|
+
kind: z.ZodLiteral<"agent">;
|
|
479
|
+
agent: z.ZodString;
|
|
480
|
+
persistTo: z.ZodOptional<z.ZodString>;
|
|
481
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
482
|
+
kind: z.ZodLiteral<"handler">;
|
|
483
|
+
handler: z.ZodString;
|
|
484
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
485
|
+
kind: z.ZodLiteral<"stream">;
|
|
486
|
+
handler: z.ZodString;
|
|
487
|
+
mode: z.ZodEnum<{
|
|
488
|
+
ingest: "ingest";
|
|
489
|
+
playback: "playback";
|
|
490
|
+
}>;
|
|
491
|
+
}, z.core.$strict>], "kind">;
|
|
492
|
+
}, z.core.$strict>>>;
|
|
493
|
+
agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
494
|
+
name: z.ZodString;
|
|
495
|
+
instructions: z.ZodString;
|
|
496
|
+
model: z.ZodString;
|
|
497
|
+
outputSchema: z.ZodOptional<z.ZodObject<{
|
|
498
|
+
name: z.ZodString;
|
|
499
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
500
|
+
}, z.core.$strict>>;
|
|
501
|
+
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
502
|
+
id: z.ZodString;
|
|
503
|
+
backend: z.ZodEnum<{
|
|
504
|
+
openai: "openai";
|
|
505
|
+
anthropic: "anthropic";
|
|
506
|
+
pi: "pi";
|
|
507
|
+
codex: "codex";
|
|
508
|
+
}>;
|
|
509
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
510
|
+
requireNativeStructuredOutput: z.ZodDefault<z.ZodBoolean>;
|
|
511
|
+
}, z.core.$strict>>>;
|
|
512
|
+
tooling: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
513
|
+
name: z.ZodString;
|
|
514
|
+
description: z.ZodString;
|
|
515
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
516
|
+
id: z.ZodString;
|
|
517
|
+
handler: z.ZodString;
|
|
518
|
+
idempotent: z.ZodBoolean;
|
|
519
|
+
timeoutMs: z.ZodNumber;
|
|
520
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
521
|
+
}, z.core.$strict>>>;
|
|
522
|
+
triggers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
523
|
+
name: z.ZodString;
|
|
524
|
+
kind: z.ZodEnum<{
|
|
525
|
+
cron: "cron";
|
|
526
|
+
webhook: "webhook";
|
|
527
|
+
event: "event";
|
|
528
|
+
manual: "manual";
|
|
529
|
+
}>;
|
|
530
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
531
|
+
event: z.ZodOptional<z.ZodString>;
|
|
532
|
+
catchUp: z.ZodOptional<z.ZodBoolean>;
|
|
533
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
534
|
+
kind: z.ZodLiteral<"agent">;
|
|
535
|
+
agent: z.ZodString;
|
|
536
|
+
persistTo: z.ZodOptional<z.ZodString>;
|
|
537
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
538
|
+
kind: z.ZodLiteral<"handler">;
|
|
539
|
+
handler: z.ZodString;
|
|
540
|
+
}, z.core.$strict>], "kind">;
|
|
541
|
+
}, z.core.$strict>>>;
|
|
542
|
+
handlers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
543
|
+
id: z.ZodString;
|
|
544
|
+
module: z.ZodString;
|
|
545
|
+
export: z.ZodString;
|
|
546
|
+
kind: z.ZodEnum<{
|
|
547
|
+
tool: "tool";
|
|
548
|
+
route: "route";
|
|
549
|
+
trigger: "trigger";
|
|
550
|
+
}>;
|
|
551
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
552
|
+
}, z.core.$strict>>>;
|
|
553
|
+
extensions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
554
|
+
id: z.ZodString;
|
|
555
|
+
module: z.ZodString;
|
|
556
|
+
version: z.ZodString;
|
|
557
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
558
|
+
}, z.core.$strict>>>;
|
|
559
|
+
deployment: z.ZodOptional<z.ZodObject<{
|
|
560
|
+
durableWorker: z.ZodOptional<z.ZodBoolean>;
|
|
561
|
+
}, z.core.$strict>>;
|
|
562
|
+
frontend: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
563
|
+
route: z.ZodString;
|
|
564
|
+
dir: z.ZodString;
|
|
565
|
+
spa: z.ZodDefault<z.ZodBoolean>;
|
|
566
|
+
}, z.core.$strict>>>;
|
|
567
|
+
}, z.core.$strict>;
|
|
568
|
+
export type RaySpec = z.infer<typeof RaySpec>;
|
|
569
|
+
//# sourceMappingURL=grammar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../src/grammar.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kGAAkG;AAClG,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAM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