@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,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-YAML semantic validation + the fail-closed no-code guardrails.
|
|
3
|
+
*
|
|
4
|
+
* Two exported passes, both returning the FULL list of violations (never the first):
|
|
5
|
+
*
|
|
6
|
+
* 1. `scanProductGuardrails(raw)` — the NO-CODE-IN-YAML enforcement,
|
|
7
|
+
* run on the RAW parsed object BEFORE the strict Zod parse so each ban produces a SPECIFIC,
|
|
8
|
+
* EXPLAINING error (the draft's validation-error table) instead of a generic strict unknown-key.
|
|
9
|
+
* It is SECTION-AWARE:
|
|
10
|
+
* • GLOBAL (whole doc EXCEPT `contracts`): hard code/handler/SQL/shell keys + inline-code string
|
|
11
|
+
* VALUES + provider-native WIRE-BLOB keys are banned everywhere (`no_code_in_yaml` /
|
|
12
|
+
* `provider_native_leak`). `contracts` is EXCLUDED because there a `code`/`function` KEY is a
|
|
13
|
+
* legitimate DATA property name, not a handler reference — contracts are vetted by the
|
|
14
|
+
* vocabulary check in `lintProductSpec` instead.
|
|
15
|
+
* • WORKFLOWS + EXTRACTORS subtrees ONLY: provider/model POLICY keys, provider NAMES, and prompt keys
|
|
16
|
+
* are ALSO banned — this is the EXECUTABLE graph, which must stay provider-neutral so it compiles
|
|
17
|
+
* through `@rayspec/product-yaml-workflow-bridge`. The key sets/regexes MIRROR that bridge's
|
|
18
|
+
* neutrality walk exactly, so a spec that validates here feeds the bridge unchanged, AND provider
|
|
19
|
+
* POLICY stays legal where the draft allows it (`capabilities[].provider_policy`,
|
|
20
|
+
* `deployment_overrides`).
|
|
21
|
+
*
|
|
22
|
+
* 2. `lintProductSpec(spec)` — cross-reference resolution, duplicate-id rejection, capability-status
|
|
23
|
+
* discipline, and the CLOSED contract vocabulary — over an already-shape-valid `ProductSpec`.
|
|
24
|
+
*
|
|
25
|
+
* NOTHING is ever silently dropped or decoratively validated (the fail-open lesson: reject loudly,
|
|
26
|
+
* never silently drop). Every mis-specified element is rejected with a closed `SpecError` code.
|
|
27
|
+
*/
|
|
28
|
+
import { type SpecError } from './errors.js';
|
|
29
|
+
import type { ProductSpec } from './product-grammar.js';
|
|
30
|
+
/**
|
|
31
|
+
* HARD code/handler keys — banned EVERYWHERE (except inside `contracts`, where a property may
|
|
32
|
+
* legitimately be named this). A key here means product-owned code/handlers/SQL/shell are being
|
|
33
|
+
* smuggled into product meaning; implementation belongs in Tier A/B.
|
|
34
|
+
*/
|
|
35
|
+
export declare const GLOBAL_CODE_KEYS: ReadonlySet<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Provider-native WIRE-BLOB keys — banned EVERYWHERE (a raw provider request/response payload is never
|
|
38
|
+
* a Product-YAML contract). DISTINCT from provider POLICY keys (`default_provider`/`default_model`/…),
|
|
39
|
+
* which are ALLOWED on a capability / in `deployment_overrides` and only banned inside workflows/extractors.
|
|
40
|
+
*/
|
|
41
|
+
export declare const GLOBAL_PROVIDER_BLOB_KEYS: ReadonlySet<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Provider/model POLICY keys — banned INSIDE `workflows`/`extractors` (the executable graph). These mirror
|
|
44
|
+
* `@rayspec/product-yaml-workflow-bridge`'s `providerNativeKeys` so the two neutrality boundaries are
|
|
45
|
+
* identical. Legal OUTSIDE the graph (capability provider_policy / deployment_overrides).
|
|
46
|
+
*/
|
|
47
|
+
export declare const GRAPH_PROVIDER_POLICY_KEYS: ReadonlySet<string>;
|
|
48
|
+
/** Prompt keys — banned inside the graph (prompt text is a Tier-B agent-execution concern, not YAML). */
|
|
49
|
+
export declare const GRAPH_PROMPT_KEYS: ReadonlySet<string>;
|
|
50
|
+
/**
|
|
51
|
+
* The no-code-in-YAML guardrail scan over the RAW parsed doc. Returns SPECIFIC, explaining errors
|
|
52
|
+
* (`no_code_in_yaml` / `provider_native_leak`). Section-aware (see the module docstring).
|
|
53
|
+
*/
|
|
54
|
+
export declare function scanProductGuardrails(raw: unknown): SpecError[];
|
|
55
|
+
/**
|
|
56
|
+
* The store checks — section-level (names, columns, keys) + step-level (target resolution, column
|
|
57
|
+
* contracts, the conflict-key law, per-type field discipline). ONE shared implementation consumed by
|
|
58
|
+
* BOTH `lintProductSpec` (doc/parse time) and `composeProductDeploy` (mount time, defense-in-depth for
|
|
59
|
+
* a code-built spec that bypassed the parser) — never two drifting copies. Returns the FULL list.
|
|
60
|
+
*
|
|
61
|
+
* `capabilityStoreNames` (OPTIONAL — CW-1): the CAPABILITY-OWNED store names of the composing
|
|
62
|
+
* runtime (e.g. the audio mount's stores). A declared store shadowing one is rejected fail-closed
|
|
63
|
+
* (capability stores are owned by their Tier-B runtime). PARSE-TIME callers pass NOTHING —
|
|
64
|
+
* @rayspec/spec cannot import runtime store names, so the doc-level lint covers COLLECTION
|
|
65
|
+
* collisions only (the documented cut); COMPOSE passes the real wired set and covers BOTH (so a
|
|
66
|
+
* code-built spec that bypassed the parser is caught at compose, BEFORE derive/rollout).
|
|
67
|
+
*/
|
|
68
|
+
export declare function checkProductStores(spec: ProductSpec, capabilityStoreNames?: ReadonlySet<string>): SpecError[];
|
|
69
|
+
/**
|
|
70
|
+
* The full semantic pass over an already-shape-valid `ProductSpec`. Resolves every cross-reference,
|
|
71
|
+
* rejects duplicates, enforces the capability-status discipline, and vets the contract vocabulary.
|
|
72
|
+
*/
|
|
73
|
+
export declare function lintProductSpec(spec: ProductSpec): SpecError[];
|
|
74
|
+
//# sourceMappingURL=product-lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-lint.d.ts","sourceRoot":"","sources":["../src/product-lint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,aAAa,CAAC;AAOxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAUxD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAkB/C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CASxD,CAAC;AASH;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAYzD,CAAC;AAEH,yGAAyG;AACzG,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAKhD,CAAC;AAmEH;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,EAAE,CAyH/D;AAkMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,EACjB,oBAAoB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACzC,SAAS,EAAE,CAoRb;AAgCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,EAAE,CAiZ9D"}
|