@adecore/intelligent-ui 0.0.0-stage → 0.21.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 +110 -0
- package/README.md +71 -2
- package/dist/budget.d.ts +30 -0
- package/dist/budget.js +75 -0
- package/dist/catalog.d.ts +368 -0
- package/dist/catalog.js +145 -0
- package/dist/compiler.d.ts +61 -0
- package/dist/compiler.js +362 -0
- package/dist/expression.d.ts +40 -0
- package/dist/expression.js +488 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/links.d.ts +47 -0
- package/dist/links.js +39 -0
- package/dist/protocol.d.ts +12 -0
- package/dist/protocol.js +38 -0
- package/dist/query.d.ts +6 -0
- package/dist/query.js +115 -0
- package/dist/runtime.d.ts +49 -0
- package/dist/runtime.js +319 -0
- package/dist/stream.d.ts +28 -0
- package/dist/stream.js +56 -0
- package/dist/syntax.d.ts +27 -0
- package/dist/syntax.js +356 -0
- package/dist/text.d.ts +5 -0
- package/dist/text.js +53 -0
- package/package.json +97 -4
- package/src/budget.ts +96 -0
- package/src/catalog.ts +155 -0
- package/src/compiler.ts +417 -0
- package/src/expression.ts +507 -0
- package/src/index.ts +43 -0
- package/src/links.ts +49 -0
- package/src/protocol.ts +46 -0
- package/src/query.ts +121 -0
- package/src/runtime.ts +361 -0
- package/src/stream.ts +78 -0
- package/src/syntax.ts +375 -0
- package/src/text.ts +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 - present Bas Milius
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @adecore/intelligent-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A streaming compiler and bounded expression interpreter for UI blocks in agent replies. The catalog defines props once with Zod. Renderers consume evaluated props and input bindings; they do not evaluate model text.
|
|
4
|
+
|
|
5
|
+
Chat wire integration and scheduling are provided by `@adecore/agents`; React renderers are provided by `@adecore/agents-react`. Hosts supply actions, query authorization and platform renderers. The compiler and interpreter do not authorize a query or an action.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { compileUi, evaluateUiBlock, UiState } from '@adecore/intelligent-ui';
|
|
9
|
+
|
|
10
|
+
const blocks = compileUi(reply, { id: assistantItemId, final: true });
|
|
11
|
+
for (const block of blocks) {
|
|
12
|
+
const state = new UiState(block);
|
|
13
|
+
const view = evaluateUiBlock(block, state);
|
|
14
|
+
render(view.nodes);
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Compilation
|
|
19
|
+
|
|
20
|
+
`compileUi(text, options)` finds blocks marked with `UI_FENCE_LANGUAGE` among Markdown, including unfinished fences. It ignores UI fences nested inside another code fence. Each `UiBlock` has its own ID, text range, catalog version, declarations, nodes, diagnostics and Markdown fallback. `compileUiBlock(source, options)` compiles one fence's contents.
|
|
21
|
+
|
|
22
|
+
`UiCompileOptions.id` identifies the assistant item or block. Supply the same ID on each recompile. Node IDs include the start of their tag, so appending text preserves them. `final` reports unfinished syntax when the authoritative response arrives. `latestAttachment` resolves `Image generated="latest"` to an attachment. `limits` overrides the work budget; `now` supplies a clock for deterministic tests.
|
|
23
|
+
|
|
24
|
+
The parser recovers at the next tag or line after malformed input. Open tags remain incomplete. A streamed quoted prop exposes the text already received. CodeBlock contents are literal, including angle brackets and braces. Unknown components retain their own fallback; unknown props produce `refused_prop` and are dropped. A budget failure replaces the whole compiled block with a bounded fallback and one diagnosis.
|
|
25
|
+
|
|
26
|
+
`UiNode` keeps static `props` separate from `expressions` and local-variable `bindings`. Its `type` is a string so an unfamiliar component can fall back without rejecting neighboring content. `UiNodeSchema`, `UiBlockSchema`, `UiBlocksSchema` and `UiDiagnosticSchema` describe the wire envelope. Component names, props and expressions stay open, so a future catalog can be retained and shown as fallback. The optional assistant field and daemon integration still await the package's first publication setup.
|
|
27
|
+
|
|
28
|
+
`parseUiSyntax` exposes the intermediate `UiSyntax` and `UiSyntaxNode` for compiler tooling. `UiDiagnostic` carries a code, message, source range and optional node ID. `uiDiagnostic` turns a caught failure into that shape.
|
|
29
|
+
|
|
30
|
+
## Catalog
|
|
31
|
+
|
|
32
|
+
`UI_CATALOG` contains each component's schema, description, group and applicable parent, child or binding rule. `UI_GROUPS` contains the instructions shared by each group. `isUiComponent` recognizes a catalog name; `uiCatalogText` lists names, props and descriptions for tooling. `uiCompactCatalog` derives the short prop list from those schemas, `uiSessionNote` adds explicit tag syntax and a fenced example checked by the compiler, and `uiReferenceText` combines full descriptions with group rules. `uiFallbackText` replaces UI fences with their compiled fallback while retaining surrounding prose.
|
|
33
|
+
|
|
34
|
+
`UiComponentName` is the key union. `UiProps<Name>` is inferred from that component's schema. `UiToneSchema` and `UiTone` provide neutral, info, success, warning and danger. `UI_CATALOG_VERSION` identifies this catalog.
|
|
35
|
+
|
|
36
|
+
| Group | Components |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| Status | Summary, Callout, Tag, Progress, Steps / Step |
|
|
39
|
+
| Data | Stats / Stat, EntityList / Entry, Table / Column, Chart |
|
|
40
|
+
| Structure | Tabs / Tab, Sections / Section |
|
|
41
|
+
| Content | CodeBlock, Image, Sources / Source |
|
|
42
|
+
| Host links | File, Diff, Commit, Node |
|
|
43
|
+
| Local inputs | Checklist / Item, Switch, Slider, Segmented / Option, Show, Each |
|
|
44
|
+
| Choices | Choices / Choice |
|
|
45
|
+
|
|
46
|
+
Image accepts exactly one of `attachment` and `generated="latest"`, plus an optional alt and caption. It never takes a URL or a filesystem path. Charts use rows with a label and numeric series; their renderer will validate usable series before drawing. A Column names a field and optionally its title, unit and presentation.
|
|
47
|
+
|
|
48
|
+
## Expressions and state
|
|
49
|
+
|
|
50
|
+
`parseUiExpression(source, budget?)` returns a `UiExpression` AST. `evaluateUiExpression(ast, variables?, budget?)` returns a finite JSON `UiValue`. It supports scalar, array and object literals, variables, own field/index reads, arithmetic, strict comparisons, boolean operators and these helpers:
|
|
51
|
+
|
|
52
|
+
| Helper | Arguments |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `@Count` | list or string |
|
|
55
|
+
| `@Filter` | list, local name, boolean predicate, e.g. `@Filter($rows, row, row.failed)` |
|
|
56
|
+
| `@Sum` | numeric list, or record list and a field name |
|
|
57
|
+
| `@Join` | scalar list and optional separator |
|
|
58
|
+
| `@Round` | number and optional precision from zero to six |
|
|
59
|
+
|
|
60
|
+
There is no JavaScript execution, general function call, assignment, network access or inherited field access. `__proto__`, `constructor` and `prototype` are refused. `copyUiValue` validates and copies JSON input without invoking accessors; class instances, nonfinite numbers, sparse arrays and cycles are refused.
|
|
61
|
+
|
|
62
|
+
`UiState` belongs to one chat/item/block identity. `sync(block)` preserves edits when a declaration's default is unchanged, resets changed defaults, removes disappeared variables and clears changed query data. A reload creates a new state from defaults. `scope()` returns a safe copy. `set(name, value)` changes a declared local variable without changing its type. `run(ast)` accepts only `@Set($name, expression)`, `@Reset($name)` and `@Reset()`. `snapshot()` and `subscribe(listener)` let a renderer observe input edits.
|
|
63
|
+
|
|
64
|
+
`evaluateUiBlock(block, state?, limits?)` returns `UiEvaluation`, including `UiViewNode` objects and per-element diagnostics. View nodes contain validated evaluated props, children and `UiBinding` callbacks. A binding changes state only after its input node is complete and the new prop passes its schema. Show and Each are resolved before rendering. Repetition reserves iterations before allocating children. Unknown catalog versions and invalid elements retain their fallback.
|
|
65
|
+
|
|
66
|
+
`$name = @Query("source", {literalArgs})` requires a matching schema in `UiCompileOptions.querySchemas`. It yields a read-only `UiQuery`; ordinary value evaluation never performs a query. The authorized host may supply data with `state.setQuery(name, value, block)`. Results for replaced query definitions are refused. Transport, quotas, rights, fixed versus variable arguments and visible-only refresh still belong to the upcoming host integration.
|
|
67
|
+
|
|
68
|
+
## Budgets and acceptance
|
|
69
|
+
|
|
70
|
+
`UI_LIMITS` bounds characters, nesting, nodes, diagnoses, steps, iterations, string length and elapsed time. `UiLimits` describes overrides. `UiBudget` counts work inside helpers as well as ordinary evaluation. `UiFailure` carries a machine-readable refusal code; `safeKey` applies the forbidden-field rule.
|
|
71
|
+
|
|
72
|
+
The tests compile ten hand-written examples and every character prefix, then exercise malformed syntax, prototype/accessor attacks, helper budgets, output expansion, query replacement and state reset. Recorded Claude/Codex responses, daemon event-loop/log measurements and iPhone JavaScriptCore parity remain acceptance work. The package does not yet render replies in an application.
|
package/dist/budget.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UiLimits {
|
|
2
|
+
characters: number;
|
|
3
|
+
depth: number;
|
|
4
|
+
nodes: number;
|
|
5
|
+
diagnostics: number;
|
|
6
|
+
steps: number;
|
|
7
|
+
iterations: number;
|
|
8
|
+
stringLength: number;
|
|
9
|
+
milliseconds: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const UI_LIMITS: Readonly<UiLimits>;
|
|
12
|
+
export declare class UiFailure extends Error {
|
|
13
|
+
readonly code: string;
|
|
14
|
+
constructor(code: string, message: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class UiBudget {
|
|
17
|
+
readonly limits: Readonly<UiLimits>;
|
|
18
|
+
private steps;
|
|
19
|
+
private iterations;
|
|
20
|
+
private nodes;
|
|
21
|
+
private readonly started;
|
|
22
|
+
private readonly now;
|
|
23
|
+
constructor(limits?: Partial<UiLimits>, now?: () => number);
|
|
24
|
+
step(count?: number): void;
|
|
25
|
+
iteration(count?: number): void;
|
|
26
|
+
node(): void;
|
|
27
|
+
depth(depth: number): void;
|
|
28
|
+
string(value: string): string;
|
|
29
|
+
}
|
|
30
|
+
export declare function safeKey(key: string): string;
|
package/dist/budget.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const UI_LIMITS = {
|
|
2
|
+
characters: 65536,
|
|
3
|
+
depth: 32,
|
|
4
|
+
nodes: 512,
|
|
5
|
+
diagnostics: 20,
|
|
6
|
+
steps: 20000,
|
|
7
|
+
iterations: 2000,
|
|
8
|
+
stringLength: 16384,
|
|
9
|
+
milliseconds: 30
|
|
10
|
+
};
|
|
11
|
+
export class UiFailure extends Error {
|
|
12
|
+
code;
|
|
13
|
+
constructor(code, message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.name = 'UiFailure';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class UiBudget {
|
|
20
|
+
limits;
|
|
21
|
+
steps = 0;
|
|
22
|
+
iterations = 0;
|
|
23
|
+
nodes = 0;
|
|
24
|
+
started;
|
|
25
|
+
now;
|
|
26
|
+
constructor(limits = {}, now = Date.now) {
|
|
27
|
+
this.now = now;
|
|
28
|
+
this.limits = { ...UI_LIMITS, ...limits };
|
|
29
|
+
for (const value of Object.values(this.limits)) {
|
|
30
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
31
|
+
throw new UiFailure('invalid_limits', 'Budgets must be positive safe integers.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this.started = now();
|
|
35
|
+
}
|
|
36
|
+
step(count = 1) {
|
|
37
|
+
this.steps += count;
|
|
38
|
+
if (this.steps > this.limits.steps || this.now() - this.started > this.limits.milliseconds) {
|
|
39
|
+
throw new UiFailure('budget_exceeded', 'The operation exceeded its work budget.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
iteration(count = 1) {
|
|
43
|
+
this.iterations += count;
|
|
44
|
+
this.step(count);
|
|
45
|
+
if (this.iterations > this.limits.iterations) {
|
|
46
|
+
throw new UiFailure('budget_exceeded', 'The operation exceeded its iteration budget.');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
node() {
|
|
50
|
+
this.nodes += 1;
|
|
51
|
+
this.step();
|
|
52
|
+
if (this.nodes > this.limits.nodes) {
|
|
53
|
+
throw new UiFailure('budget_exceeded', 'The operation exceeded its node budget.');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
depth(depth) {
|
|
57
|
+
this.step();
|
|
58
|
+
if (depth > this.limits.depth) {
|
|
59
|
+
throw new UiFailure('budget_exceeded', 'The operation exceeded its nesting budget.');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
string(value) {
|
|
63
|
+
this.step(value.length);
|
|
64
|
+
if (value.length > this.limits.stringLength) {
|
|
65
|
+
throw new UiFailure('budget_exceeded', 'The operation exceeded its string budget.');
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function safeKey(key) {
|
|
71
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
72
|
+
throw new UiFailure('refused_access', `Access to ${key} is refused.`);
|
|
73
|
+
}
|
|
74
|
+
return key;
|
|
75
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const UI_CATALOG_VERSION = 1;
|
|
3
|
+
export declare const UiToneSchema: z.ZodEnum<{
|
|
4
|
+
danger: "danger";
|
|
5
|
+
info: "info";
|
|
6
|
+
neutral: "neutral";
|
|
7
|
+
success: "success";
|
|
8
|
+
warning: "warning";
|
|
9
|
+
}>;
|
|
10
|
+
export type UiTone = z.infer<typeof UiToneSchema>;
|
|
11
|
+
export declare const UI_GROUPS: {
|
|
12
|
+
readonly status: {
|
|
13
|
+
readonly description: 'Summarize a result or show progress.';
|
|
14
|
+
readonly rules: 'Use one leading Summary. Children are inline prose, not headings or tables.';
|
|
15
|
+
};
|
|
16
|
+
readonly data: {
|
|
17
|
+
readonly description: 'Compare values and records.';
|
|
18
|
+
readonly rules: 'Give numbers as numbers. Tone expresses meaning, never infer it from an increase.';
|
|
19
|
+
};
|
|
20
|
+
readonly structure: {
|
|
21
|
+
readonly description: 'Organize distinct topics.';
|
|
22
|
+
readonly rules: 'Use Tabs for alternatives and Sections for independent topics.';
|
|
23
|
+
};
|
|
24
|
+
readonly content: {
|
|
25
|
+
readonly description: 'Include code, attachments and sources.';
|
|
26
|
+
readonly rules: 'Image accepts a chat attachment or generated="latest", never a URL or a local path.';
|
|
27
|
+
};
|
|
28
|
+
readonly links: {
|
|
29
|
+
readonly description: 'Refer to a host-owned resource.';
|
|
30
|
+
readonly rules: 'Targets are checked by the host. No arbitrary navigation or file reads.';
|
|
31
|
+
};
|
|
32
|
+
readonly inputs: {
|
|
33
|
+
readonly description: 'Change local block state.';
|
|
34
|
+
readonly rules: 'Bind value={$name}. State stays local until a Choice sends visible context.';
|
|
35
|
+
};
|
|
36
|
+
readonly choices: {
|
|
37
|
+
readonly description: 'Ask the person to pick a next step.';
|
|
38
|
+
readonly rules: 'Give a short label and precise visible context. A Choice sends once after streaming ends.';
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare const UI_CATALOG: {
|
|
42
|
+
readonly Summary: {
|
|
43
|
+
readonly group: 'status';
|
|
44
|
+
readonly description: 'The result in one sentence.';
|
|
45
|
+
readonly schema: z.ZodObject<{
|
|
46
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
danger: "danger";
|
|
48
|
+
info: "info";
|
|
49
|
+
neutral: "neutral";
|
|
50
|
+
success: "success";
|
|
51
|
+
warning: "warning";
|
|
52
|
+
}>>;
|
|
53
|
+
badge: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
};
|
|
56
|
+
readonly Callout: {
|
|
57
|
+
readonly group: 'status';
|
|
58
|
+
readonly description: 'A note that needs attention.';
|
|
59
|
+
readonly schema: z.ZodObject<{
|
|
60
|
+
tone: z.ZodEnum<{
|
|
61
|
+
danger: "danger";
|
|
62
|
+
info: "info";
|
|
63
|
+
neutral: "neutral";
|
|
64
|
+
success: "success";
|
|
65
|
+
warning: "warning";
|
|
66
|
+
}>;
|
|
67
|
+
title: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
};
|
|
70
|
+
readonly Tag: {
|
|
71
|
+
readonly group: 'status';
|
|
72
|
+
readonly description: 'A short status label.';
|
|
73
|
+
readonly schema: z.ZodObject<{
|
|
74
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
danger: "danger";
|
|
76
|
+
info: "info";
|
|
77
|
+
neutral: "neutral";
|
|
78
|
+
success: "success";
|
|
79
|
+
warning: "warning";
|
|
80
|
+
}>>;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
};
|
|
83
|
+
readonly Progress: {
|
|
84
|
+
readonly group: 'status';
|
|
85
|
+
readonly description: 'Progress with a label; omit value for indeterminate progress.';
|
|
86
|
+
readonly schema: z.ZodObject<{
|
|
87
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
};
|
|
91
|
+
readonly Steps: {
|
|
92
|
+
readonly group: 'status';
|
|
93
|
+
readonly description: 'An ordered sequence of steps.';
|
|
94
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
95
|
+
readonly children: readonly ['Step'];
|
|
96
|
+
};
|
|
97
|
+
readonly Step: {
|
|
98
|
+
readonly group: 'status';
|
|
99
|
+
readonly description: 'One step in a sequence.';
|
|
100
|
+
readonly schema: z.ZodObject<{
|
|
101
|
+
state: z.ZodEnum<{
|
|
102
|
+
done: "done";
|
|
103
|
+
failed: "failed";
|
|
104
|
+
pending: "pending";
|
|
105
|
+
running: "running";
|
|
106
|
+
skipped: "skipped";
|
|
107
|
+
}>;
|
|
108
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
readonly parent: 'Steps';
|
|
111
|
+
};
|
|
112
|
+
readonly Stats: {
|
|
113
|
+
readonly group: 'data';
|
|
114
|
+
readonly description: 'A small set of key numbers.';
|
|
115
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
116
|
+
readonly children: readonly ['Stat'];
|
|
117
|
+
};
|
|
118
|
+
readonly Stat: {
|
|
119
|
+
readonly group: 'data';
|
|
120
|
+
readonly description: 'A labeled value and optional previous value.';
|
|
121
|
+
readonly schema: z.ZodObject<{
|
|
122
|
+
label: z.ZodString;
|
|
123
|
+
value: z.ZodNumber;
|
|
124
|
+
previous: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
126
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
127
|
+
danger: "danger";
|
|
128
|
+
info: "info";
|
|
129
|
+
neutral: "neutral";
|
|
130
|
+
success: "success";
|
|
131
|
+
warning: "warning";
|
|
132
|
+
}>>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
readonly parent: 'Stats';
|
|
135
|
+
};
|
|
136
|
+
readonly EntityList: {
|
|
137
|
+
readonly group: 'data';
|
|
138
|
+
readonly description: 'Labeled facts about an entity.';
|
|
139
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
140
|
+
readonly children: readonly ['Entry'];
|
|
141
|
+
};
|
|
142
|
+
readonly Entry: {
|
|
143
|
+
readonly group: 'data';
|
|
144
|
+
readonly description: 'One labeled fact.';
|
|
145
|
+
readonly schema: z.ZodObject<{
|
|
146
|
+
label: z.ZodString;
|
|
147
|
+
}, z.core.$strict>;
|
|
148
|
+
readonly parent: 'EntityList';
|
|
149
|
+
};
|
|
150
|
+
readonly Table: {
|
|
151
|
+
readonly group: 'data';
|
|
152
|
+
readonly description: 'Rows with named columns.';
|
|
153
|
+
readonly schema: z.ZodObject<{
|
|
154
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
readonly children: readonly ['Column'];
|
|
157
|
+
};
|
|
158
|
+
readonly Column: {
|
|
159
|
+
readonly group: 'data';
|
|
160
|
+
readonly description: 'A field of each table row.';
|
|
161
|
+
readonly schema: z.ZodObject<{
|
|
162
|
+
key: z.ZodString;
|
|
163
|
+
title: z.ZodOptional<z.ZodString>;
|
|
164
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
165
|
+
as: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
bytes: "bytes";
|
|
167
|
+
date: "date";
|
|
168
|
+
duration: "duration";
|
|
169
|
+
file: "file";
|
|
170
|
+
number: "number";
|
|
171
|
+
tag: "tag";
|
|
172
|
+
text: "text";
|
|
173
|
+
}>>;
|
|
174
|
+
}, z.core.$strict>;
|
|
175
|
+
readonly parent: 'Table';
|
|
176
|
+
};
|
|
177
|
+
readonly Chart: {
|
|
178
|
+
readonly group: 'data';
|
|
179
|
+
readonly description: 'Compare labeled numeric series. Data rows have label and up to six numeric series.';
|
|
180
|
+
readonly schema: z.ZodObject<{
|
|
181
|
+
kind: z.ZodEnum<{
|
|
182
|
+
bar: "bar";
|
|
183
|
+
hbar: "hbar";
|
|
184
|
+
line: "line";
|
|
185
|
+
stacked: "stacked";
|
|
186
|
+
}>;
|
|
187
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
188
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
};
|
|
191
|
+
readonly Tabs: {
|
|
192
|
+
readonly group: 'structure';
|
|
193
|
+
readonly description: 'Switch between alternative topics.';
|
|
194
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
195
|
+
readonly children: readonly ['Tab'];
|
|
196
|
+
};
|
|
197
|
+
readonly Tab: {
|
|
198
|
+
readonly group: 'structure';
|
|
199
|
+
readonly description: 'A named tab.';
|
|
200
|
+
readonly schema: z.ZodObject<{
|
|
201
|
+
title: z.ZodString;
|
|
202
|
+
}, z.core.$strict>;
|
|
203
|
+
readonly parent: 'Tabs';
|
|
204
|
+
};
|
|
205
|
+
readonly Sections: {
|
|
206
|
+
readonly group: 'structure';
|
|
207
|
+
readonly description: 'Independent collapsible topics.';
|
|
208
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
209
|
+
readonly children: readonly ['Section'];
|
|
210
|
+
};
|
|
211
|
+
readonly Section: {
|
|
212
|
+
readonly group: 'structure';
|
|
213
|
+
readonly description: 'A named section.';
|
|
214
|
+
readonly schema: z.ZodObject<{
|
|
215
|
+
title: z.ZodString;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
readonly parent: 'Sections';
|
|
218
|
+
};
|
|
219
|
+
readonly CodeBlock: {
|
|
220
|
+
readonly group: 'content';
|
|
221
|
+
readonly description: 'Code as text, without execution.';
|
|
222
|
+
readonly schema: z.ZodObject<{
|
|
223
|
+
language: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strict>;
|
|
225
|
+
};
|
|
226
|
+
readonly Image: {
|
|
227
|
+
readonly group: 'content';
|
|
228
|
+
readonly description: 'A chat attachment with an optional caption.';
|
|
229
|
+
readonly schema: z.ZodObject<{
|
|
230
|
+
attachment: z.ZodOptional<z.ZodString>;
|
|
231
|
+
generated: z.ZodOptional<z.ZodLiteral<"latest">>;
|
|
232
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
};
|
|
235
|
+
readonly Sources: {
|
|
236
|
+
readonly group: 'content';
|
|
237
|
+
readonly description: 'Numbered sources without preloading.';
|
|
238
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
239
|
+
readonly children: readonly ['Source'];
|
|
240
|
+
};
|
|
241
|
+
readonly Source: {
|
|
242
|
+
readonly group: 'content';
|
|
243
|
+
readonly description: 'An HTTP or HTTPS source.';
|
|
244
|
+
readonly schema: z.ZodObject<{
|
|
245
|
+
title: z.ZodString;
|
|
246
|
+
url: z.ZodString;
|
|
247
|
+
}, z.core.$strict>;
|
|
248
|
+
readonly parent: 'Sources';
|
|
249
|
+
};
|
|
250
|
+
readonly File: {
|
|
251
|
+
readonly group: 'links';
|
|
252
|
+
readonly description: 'A file in the project or a worktree.';
|
|
253
|
+
readonly schema: z.ZodObject<{
|
|
254
|
+
path: z.ZodString;
|
|
255
|
+
line: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
256
|
+
}, z.core.$strict>;
|
|
257
|
+
};
|
|
258
|
+
readonly Diff: {
|
|
259
|
+
readonly group: 'links';
|
|
260
|
+
readonly description: 'A changed project file.';
|
|
261
|
+
readonly schema: z.ZodObject<{
|
|
262
|
+
path: z.ZodString;
|
|
263
|
+
}, z.core.$strict>;
|
|
264
|
+
};
|
|
265
|
+
readonly Commit: {
|
|
266
|
+
readonly group: 'links';
|
|
267
|
+
readonly description: 'A repository commit.';
|
|
268
|
+
readonly schema: z.ZodObject<{
|
|
269
|
+
sha: z.ZodString;
|
|
270
|
+
}, z.core.$strict>;
|
|
271
|
+
};
|
|
272
|
+
readonly Node: {
|
|
273
|
+
readonly group: 'links';
|
|
274
|
+
readonly description: 'A host node.';
|
|
275
|
+
readonly schema: z.ZodObject<{
|
|
276
|
+
id: z.ZodString;
|
|
277
|
+
}, z.core.$strict>;
|
|
278
|
+
};
|
|
279
|
+
readonly Checklist: {
|
|
280
|
+
readonly group: 'inputs';
|
|
281
|
+
readonly description: 'Select values in a local list.';
|
|
282
|
+
readonly schema: z.ZodObject<{
|
|
283
|
+
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
284
|
+
}, z.core.$strict>;
|
|
285
|
+
readonly children: readonly ['Item'];
|
|
286
|
+
readonly binding: 'value';
|
|
287
|
+
};
|
|
288
|
+
readonly Item: {
|
|
289
|
+
readonly group: 'inputs';
|
|
290
|
+
readonly description: 'One selectable value.';
|
|
291
|
+
readonly schema: z.ZodObject<{
|
|
292
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
293
|
+
}, z.core.$strict>;
|
|
294
|
+
readonly parent: 'Checklist';
|
|
295
|
+
};
|
|
296
|
+
readonly Switch: {
|
|
297
|
+
readonly group: 'inputs';
|
|
298
|
+
readonly description: 'A local boolean.';
|
|
299
|
+
readonly schema: z.ZodObject<{
|
|
300
|
+
value: z.ZodBoolean;
|
|
301
|
+
}, z.core.$strict>;
|
|
302
|
+
readonly binding: 'value';
|
|
303
|
+
};
|
|
304
|
+
readonly Slider: {
|
|
305
|
+
readonly group: 'inputs';
|
|
306
|
+
readonly description: 'A local number in a range.';
|
|
307
|
+
readonly schema: z.ZodObject<{
|
|
308
|
+
value: z.ZodNumber;
|
|
309
|
+
min: z.ZodNumber;
|
|
310
|
+
max: z.ZodNumber;
|
|
311
|
+
step: z.ZodOptional<z.ZodNumber>;
|
|
312
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
313
|
+
}, z.core.$strict>;
|
|
314
|
+
readonly binding: 'value';
|
|
315
|
+
};
|
|
316
|
+
readonly Segmented: {
|
|
317
|
+
readonly group: 'inputs';
|
|
318
|
+
readonly description: 'Choose one local value.';
|
|
319
|
+
readonly schema: z.ZodObject<{
|
|
320
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
321
|
+
}, z.core.$strict>;
|
|
322
|
+
readonly children: readonly ['Option'];
|
|
323
|
+
readonly binding: 'value';
|
|
324
|
+
};
|
|
325
|
+
readonly Option: {
|
|
326
|
+
readonly group: 'inputs';
|
|
327
|
+
readonly description: 'One local alternative.';
|
|
328
|
+
readonly schema: z.ZodObject<{
|
|
329
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
330
|
+
}, z.core.$strict>;
|
|
331
|
+
readonly parent: 'Segmented';
|
|
332
|
+
};
|
|
333
|
+
readonly Show: {
|
|
334
|
+
readonly group: 'inputs';
|
|
335
|
+
readonly description: 'Show children when the condition is true.';
|
|
336
|
+
readonly schema: z.ZodObject<{
|
|
337
|
+
when: z.ZodBoolean;
|
|
338
|
+
}, z.core.$strict>;
|
|
339
|
+
};
|
|
340
|
+
readonly Each: {
|
|
341
|
+
readonly group: 'inputs';
|
|
342
|
+
readonly description: 'Repeat children over local data.';
|
|
343
|
+
readonly schema: z.ZodObject<{
|
|
344
|
+
items: z.ZodArray<z.ZodUnknown>;
|
|
345
|
+
as: z.ZodString;
|
|
346
|
+
}, z.core.$strict>;
|
|
347
|
+
};
|
|
348
|
+
readonly Choices: {
|
|
349
|
+
readonly group: 'choices';
|
|
350
|
+
readonly description: 'Visible next steps.';
|
|
351
|
+
readonly schema: z.ZodObject<{}, z.core.$strict>;
|
|
352
|
+
readonly children: readonly ['Choice'];
|
|
353
|
+
};
|
|
354
|
+
readonly Choice: {
|
|
355
|
+
readonly group: 'choices';
|
|
356
|
+
readonly description: 'Send its label and visible context once.';
|
|
357
|
+
readonly schema: z.ZodObject<{
|
|
358
|
+
context: z.ZodOptional<z.ZodString>;
|
|
359
|
+
primary: z.ZodOptional<z.ZodBoolean>;
|
|
360
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
361
|
+
}, z.core.$strict>;
|
|
362
|
+
readonly parent: 'Choices';
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
export type UiComponentName = keyof typeof UI_CATALOG;
|
|
366
|
+
export type UiProps<Name extends UiComponentName> = z.infer<(typeof UI_CATALOG)[Name]['schema']>;
|
|
367
|
+
export declare function isUiComponent(name: string): name is UiComponentName;
|
|
368
|
+
export declare function uiCatalogText(): string;
|