@crasi/bisque-spec 0.0.0-stage → 0.3.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 +21 -0
- package/README.md +23 -2
- package/dist/index.js +1404 -0
- package/dist/index.js.map +7 -0
- package/dist/types/adjust.d.ts +31 -0
- package/dist/types/args.d.ts +11 -0
- package/dist/types/artifact.d.ts +33 -0
- package/dist/types/automation.d.ts +336 -0
- package/dist/types/catalog.d.ts +7 -0
- package/dist/types/describe.d.ts +32 -0
- package/dist/types/diagnostics.d.ts +50 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/migrate.d.ts +8 -0
- package/dist/types/protocol.d.ts +1025 -0
- package/dist/types/schema.d.ts +2536 -0
- package/dist/types/template.d.ts +870 -0
- package/dist/types/theme.d.ts +33 -0
- package/dist/types/validate.d.ts +36 -0
- package/package.json +47 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Problem, type Role } from "@crasi/bisque-core";
|
|
2
|
+
import { type ContractManifest } from "@crasi/bisque-contract";
|
|
3
|
+
/**
|
|
4
|
+
* Theme proposals: the user asks "use our company colours" and the model
|
|
5
|
+
* proposes values for the host's declared theme tokens. A token is a name
|
|
6
|
+
* and a typed value (colour, length or one of a list), never CSS text
|
|
7
|
+
* (Invariant 7), so nothing a model or a user supplies can become a
|
|
8
|
+
* selector, a URL or a property. The host turns validated values into
|
|
9
|
+
* styles itself.
|
|
10
|
+
*
|
|
11
|
+
* Changing the theme is a workspace-wide change, so it needs a role that
|
|
12
|
+
* `canWorkspace` allows.
|
|
13
|
+
*/
|
|
14
|
+
export type ThemeTokens = Record<string, string>;
|
|
15
|
+
export declare const THEME_COLOR: RegExp;
|
|
16
|
+
export declare const THEME_LENGTH: RegExp;
|
|
17
|
+
/** Whether one value fits its token's declared type. */
|
|
18
|
+
export declare function themeValueOk(m: ContractManifest, token: string, value: unknown): boolean;
|
|
19
|
+
export type ThemeValidation = {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
problems: Problem[];
|
|
22
|
+
tokens: ThemeTokens;
|
|
23
|
+
};
|
|
24
|
+
export declare function validateThemeTokens(input: unknown, m: ContractManifest, opts: {
|
|
25
|
+
role: Role;
|
|
26
|
+
}): ThemeValidation;
|
|
27
|
+
/**
|
|
28
|
+
* The card text for a theme proposal, generated by code from the two token
|
|
29
|
+
* sets (Invariant 4): "Brand colour: #0f5c8a → #1d4ed8".
|
|
30
|
+
*/
|
|
31
|
+
export declare function describeTheme(before: ThemeTokens, after: ThemeTokens, m: ContractManifest): string[];
|
|
32
|
+
/** Current values with a proposal laid over them; unknown or ill-typed values are dropped. */
|
|
33
|
+
export declare function mergeTheme(current: ThemeTokens | undefined, proposed: ThemeTokens, m: ContractManifest): ThemeTokens;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Problem, type Role } from "@crasi/bisque-core";
|
|
2
|
+
import { type ContractManifest } from "@crasi/bisque-contract";
|
|
3
|
+
import { type Column } from "@crasi/bisque-ir";
|
|
4
|
+
import { type Draft, type Spec } from "./schema.js";
|
|
5
|
+
export type DraftValidation = {
|
|
6
|
+
ok: boolean;
|
|
7
|
+
problems: Problem[];
|
|
8
|
+
/** Non-blocking: shown in the card, not sent for repair. */
|
|
9
|
+
warnings: Problem[];
|
|
10
|
+
draft?: Draft;
|
|
11
|
+
columns: Record<string, Column>;
|
|
12
|
+
touched: string[];
|
|
13
|
+
};
|
|
14
|
+
export type DraftValidateOptions = {
|
|
15
|
+
/** The acting user's role. Reads and acts are checked against it (P2, P3). */
|
|
16
|
+
role: Role;
|
|
17
|
+
};
|
|
18
|
+
/** Invariant 7 for any proposal: no HTML, CSS or URLs in any string. */
|
|
19
|
+
export declare function unsafeTextProblems(input: unknown): Problem[];
|
|
20
|
+
/** Every column the encode block refers to. */
|
|
21
|
+
export declare function encodeColumns(spec: Spec): {
|
|
22
|
+
path: string;
|
|
23
|
+
col: string;
|
|
24
|
+
numeric?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
/** Intents and navigations a spec invokes. */
|
|
27
|
+
export declare function invoked(spec: Spec): {
|
|
28
|
+
intents: string[];
|
|
29
|
+
navigations: string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The host-side validator: the authority on whether a proposal is
|
|
33
|
+
* acceptable (Invariant 3). The conductor runs the same function for a fast
|
|
34
|
+
* repair loop, but only this run, in the host, decides what renders.
|
|
35
|
+
*/
|
|
36
|
+
export declare function validateDraft(input: unknown, m: ContractManifest, opts: DraftValidateOptions): DraftValidation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crasi/bisque-spec",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "L1 spec schema, catalog, validator, describer, Adjust panel",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Crasi",
|
|
7
|
+
"homepage": "https://github.com/gogeorge/bisque#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/gogeorge/bisque.git",
|
|
11
|
+
"directory": "packages/spec"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/gogeorge/bisque/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"bisque",
|
|
16
|
+
"generative-ui",
|
|
17
|
+
"ai",
|
|
18
|
+
"llm",
|
|
19
|
+
"spec",
|
|
20
|
+
"validation",
|
|
21
|
+
"automations"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20"
|
|
26
|
+
},
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"zod": "^4.6.7",
|
|
43
|
+
"@crasi/bisque-core": "0.3.0",
|
|
44
|
+
"@crasi/bisque-contract": "0.3.0",
|
|
45
|
+
"@crasi/bisque-ir": "0.3.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"typecheck": "tsc -p ."
|
|
49
|
+
}
|
|
6
50
|
}
|