@nadicodeai/ui 8.5.0 → 9.0.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/AGENTS.md +1 -1
- package/LICENSES/THINKING-ORBS-MIT.txt +21 -0
- package/NOTICE +7 -10
- package/dist/components/agent-orb-appearance.d.ts +54 -0
- package/dist/components/agent-orb-appearance.d.ts.map +1 -0
- package/dist/components/agent-orb-appearance.js +87 -0
- package/dist/components/agent-orb.d.ts +5 -3
- package/dist/components/agent-orb.d.ts.map +1 -1
- package/dist/eslint/index.js +4 -0
- package/dist/eslint/rules/expect-chain.js +60 -0
- package/dist/eslint/rules/no-existence-only-assertion.js +89 -0
- package/dist/eslint/rules/no-subject-derived-expectation.js +129 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/internal/agent-orb-motion.d.ts +3 -3
- package/dist/internal/agent-orb-motion.d.ts.map +1 -1
- package/dist/internal/agent-orb-motion.js +1 -0
- package/dist/internal/agent-orb.d.ts +11 -1
- package/dist/internal/agent-orb.d.ts.map +1 -1
- package/dist/internal/agent-orb.js +80 -5
- package/docs/agent-orb.md +47 -14
- package/docs/contract.md +8 -29
- package/docs/migration/9.0.0.md +35 -0
- package/package.json +2 -3
- package/LICENSES/PAPER-SHADERS-APACHE-2.0.txt +0 -186
- package/dist/components/agent-visual.d.ts +0 -17
- package/dist/components/agent-visual.d.ts.map +0 -1
- package/dist/components/agent-visual.js +0 -63
- package/dist/components/forma-appearance.d.ts +0 -13
- package/dist/components/forma-appearance.d.ts.map +0 -1
- package/dist/components/forma-appearance.js +0 -11
- package/dist/components/forma-avatar.d.ts +0 -23
- package/dist/components/forma-avatar.d.ts.map +0 -1
- package/dist/components/forma-avatar.js +0 -95
- package/dist/internal/agent-visual/color.d.ts +0 -4
- package/dist/internal/agent-visual/color.d.ts.map +0 -1
- package/dist/internal/agent-visual/color.js +0 -78
- package/dist/internal/agent-visual/poster.d.ts +0 -6
- package/dist/internal/agent-visual/poster.d.ts.map +0 -1
- package/dist/internal/agent-visual/poster.js +0 -35
- package/dist/internal/agent-visual/recipes.d.ts +0 -15
- package/dist/internal/agent-visual/recipes.d.ts.map +0 -1
- package/dist/internal/agent-visual/recipes.js +0 -72
- package/dist/internal/agent-visual/renderer.d.ts +0 -10
- package/dist/internal/agent-visual/renderer.d.ts.map +0 -1
- package/dist/internal/agent-visual/renderer.js +0 -112
- package/dist/internal/agent-visual/shader.d.ts +0 -2
- package/dist/internal/agent-visual/shader.d.ts.map +0 -1
- package/dist/internal/agent-visual/shader.js +0 -158
- package/dist/internal/forma/frame.d.ts +0 -10
- package/dist/internal/forma/frame.d.ts.map +0 -1
- package/dist/internal/forma/frame.js +0 -211
- package/dist/internal/forma/geometry.d.ts +0 -41
- package/dist/internal/forma/geometry.d.ts.map +0 -1
- package/dist/internal/forma/geometry.js +0 -235
- package/dist/internal/forma/hallmark.d.ts +0 -5
- package/dist/internal/forma/hallmark.d.ts.map +0 -1
- package/dist/internal/forma/hallmark.js +0 -4
- package/dist/internal/forma/model.d.ts +0 -53
- package/dist/internal/forma/model.d.ts.map +0 -1
- package/dist/internal/forma/model.js +0 -70
- package/dist/internal/forma/motion.d.ts +0 -42
- package/dist/internal/forma/motion.d.ts.map +0 -1
- package/dist/internal/forma/motion.js +0 -194
- package/dist/internal/forma/rig.d.ts +0 -10
- package/dist/internal/forma/rig.d.ts.map +0 -1
- package/dist/internal/forma/rig.js +0 -211
- package/dist/internal/forma/still.d.ts +0 -4
- package/dist/internal/forma/still.d.ts.map +0 -1
- package/dist/internal/forma/still.js +0 -8
- package/dist/internal/forma/stored-appearance.d.ts +0 -29
- package/dist/internal/forma/stored-appearance.d.ts.map +0 -1
- package/dist/internal/forma/stored-appearance.js +0 -53
- package/docs/agent-visual.md +0 -114
- package/docs/forma-avatar.md +0 -110
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-orb.d.ts","sourceRoot":"","sources":["../../src/internal/agent-orb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-orb.d.ts","sourceRoot":"","sources":["../../src/internal/agent-orb.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,QAAQ,EAId,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,aAAa,EAAuC,MAAM,oBAAoB,CAAC;AAE7F,QAAA,MAAM,aAAa;;;;;;;;CAQ0B,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,aAAa,CAAC;AACtD,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAmB7D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAuDpF;AA0DD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,YAAY,EAClB,eAAe,EAAE,OAAO,EACxB,YAAY,GAAE,aAAsB;;sBAIO,OAAO;qBAAuB,aAAa;EA0HvF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MODE_FRAMES, resolvePreset } from "thinking-orbs/engine";
|
|
1
|
+
import { finalizeFrame, MODE_FRAMES, makeProj, radiusScale, resolvePreset, } from "thinking-orbs/engine";
|
|
2
2
|
import { motionPose, paintOrbCue, stateSpeed } from "./agent-orb-motion.js";
|
|
3
3
|
const agentOrbForms = {
|
|
4
4
|
orbit: "working",
|
|
@@ -9,9 +9,81 @@ const agentOrbForms = {
|
|
|
9
9
|
ribbon: "composing",
|
|
10
10
|
morph: "shaping",
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Nadia's four stripes across the ribbon's width, azzurro to rosso. The third
|
|
14
|
+
* is the orb's own pigment, the inherited text colour, so the white of the
|
|
15
|
+
* tricolore stays visible on a white ground as ink.
|
|
16
|
+
*/
|
|
17
|
+
const nadiaStripes = ["--nc-identity-azzurro", "--nc-identity-verde", null, "--nc-identity-rosso"];
|
|
18
|
+
/** A stable direction on the unit sphere, the vendor's Fibonacci lattice. */
|
|
19
|
+
function fibonacci(i, n) {
|
|
20
|
+
const y = 1 - (2 * (i + 0.5)) / n;
|
|
21
|
+
const radius = Math.sqrt(1 - y * y);
|
|
22
|
+
const angle = i * Math.PI * (3 - Math.sqrt(5));
|
|
23
|
+
return [radius * Math.cos(angle), y, radius * Math.sin(angle)];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The vendor's `ribbon` geometry (thinking-orbs 0.3.1, MIT, Jakub Antalik),
|
|
27
|
+
* repeated here only so every dot carries its lane through the depth sort. The
|
|
28
|
+
* engine sorts dots by depth each frame, so colouring by array position makes
|
|
29
|
+
* a stripe jump between lanes as the ribbon turns; the lane is the stable id.
|
|
30
|
+
*/
|
|
31
|
+
export function stripedRibbonFrame(size, t, opts) {
|
|
32
|
+
const cx = size / 2;
|
|
33
|
+
const radius = (size / 2) * 0.78;
|
|
34
|
+
const spin = opts.spin ?? 1;
|
|
35
|
+
const project = makeProj(t * 0.1 * spin, 0.3, cx, cx, 1);
|
|
36
|
+
const scale = radiusScale(size, opts.rsPow ?? 0.6);
|
|
37
|
+
const dots = [];
|
|
38
|
+
const ghosts = opts.ghostN ?? 150;
|
|
39
|
+
for (let i = 0; i < ghosts; i++) {
|
|
40
|
+
const [gx, gy, gz] = fibonacci(i, ghosts);
|
|
41
|
+
const [x, y, z] = project(gx * radius, gy * radius, gz * radius);
|
|
42
|
+
dots.push({ x, y, z, r: 0.8 * scale, white: 0.78, a: 0.1 + 0.22 * ((z / radius + 1) / 2) });
|
|
43
|
+
}
|
|
44
|
+
const yaw = t * 0.24 * spin;
|
|
45
|
+
const tilt = opts.faceOn ? -0.3 : 0.55 + 0.3 * Math.sin(t * 0.18) * spin;
|
|
46
|
+
const [ax, ay, az] = [Math.cos(yaw), 0, Math.sin(yaw)];
|
|
47
|
+
const [bx, by, bz] = [-az * Math.sin(tilt), Math.cos(tilt), ax * Math.sin(tilt)];
|
|
48
|
+
const [nx, ny, nz] = [ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx];
|
|
49
|
+
const wobble = opts.wobMul ?? 1;
|
|
50
|
+
const reach = opts.faceOn ? radius / (1 + 0.85 * 0.23 * wobble) : radius;
|
|
51
|
+
const segments = opts.segs ?? 88;
|
|
52
|
+
const lanes = Math.max(1, Math.round((opts.lanes ?? 5) * (opts.bandMul ?? 1)));
|
|
53
|
+
for (let lane = 0; lane < lanes; lane++) {
|
|
54
|
+
const offset = (lane - (lanes - 1) / 2) * 0.075;
|
|
55
|
+
const edge = Math.abs(lane - (lanes - 1) / 2) / Math.max(1, (lanes - 1) / 2);
|
|
56
|
+
for (let step = 0; step < segments; step++) {
|
|
57
|
+
const angle = (step / segments) * 2 * Math.PI;
|
|
58
|
+
const wave = (0.16 * Math.sin(angle * 3 - t * 1.7 + lane * 0.22) +
|
|
59
|
+
0.07 * Math.sin(angle * 5 + t * 1.1)) *
|
|
60
|
+
wobble;
|
|
61
|
+
const stretch = opts.faceOn ? 1 + wave : 1;
|
|
62
|
+
const lift = opts.faceOn ? offset : offset + wave;
|
|
63
|
+
const px = ax * Math.cos(angle) + bx * Math.sin(angle) + nx * lift;
|
|
64
|
+
const py = ay * Math.cos(angle) + by * Math.sin(angle) + ny * lift;
|
|
65
|
+
const pz = az * Math.cos(angle) + bz * Math.sin(angle) + nz * lift;
|
|
66
|
+
const length = Math.sqrt(px * px + py * py + pz * pz);
|
|
67
|
+
const [x, y, z] = project((px / length) * reach * stretch, (py / length) * reach * stretch, (pz / length) * reach * stretch);
|
|
68
|
+
const depth = (z / radius + 1) / 2;
|
|
69
|
+
dots.push({
|
|
70
|
+
x,
|
|
71
|
+
y,
|
|
72
|
+
z,
|
|
73
|
+
r: ((opts.rBase ?? 1.1) + (opts.rDepth ?? 1.7) * depth) * (1 - 0.25 * edge) * scale,
|
|
74
|
+
white: 0.52 - 0.44 * depth + 0.18 * edge,
|
|
75
|
+
a: 0.4 + 0.6 * depth,
|
|
76
|
+
stripe: Math.min(3, Math.floor((lane / lanes) * 4)),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return finalizeFrame(dots, [], opts.rMin);
|
|
81
|
+
}
|
|
82
|
+
function paintAgentOrb(context, form, size, seconds, color, state = "idle", age = 0, reduced = false, celebrationColors = [color], stripeColors = [color]) {
|
|
83
|
+
const preset = resolvePreset(agentOrbForms[form === "nadia" ? "ribbon" : form], size <= 32 ? 20 : 64);
|
|
84
|
+
const frame = form === "nadia"
|
|
85
|
+
? stripedRibbonFrame(size, seconds, preset.opts)
|
|
86
|
+
: MODE_FRAMES[preset.mode](size, seconds, preset.opts);
|
|
15
87
|
context.clearRect(0, 0, size, size);
|
|
16
88
|
const pose = motionPose(form, state, reduced ? (state === "done" ? 2 : 0.6) : age);
|
|
17
89
|
const gestureSeconds = reduced ? 0.8 : age / (state === "done" ? 0.575 : 0.2875);
|
|
@@ -38,6 +110,7 @@ function paintAgentOrb(context, form, size, seconds, color, state = "idle", age
|
|
|
38
110
|
context.stroke();
|
|
39
111
|
}
|
|
40
112
|
for (const dot of frame.dots) {
|
|
113
|
+
context.fillStyle = dot.stripe === undefined ? color : (stripeColors[dot.stripe] ?? color);
|
|
41
114
|
context.globalAlpha = Math.min(1, Math.max(0, (1 - dot.white) * (dot.a ?? 1) * pose.opacity));
|
|
42
115
|
context.beginPath();
|
|
43
116
|
context.arc(...project(dot.x, dot.y), dot.r, 0, Math.PI * 2);
|
|
@@ -63,11 +136,12 @@ export function mountAgentOrb(canvas, form, size, initiallyPaused, initialState
|
|
|
63
136
|
let ratio = 1;
|
|
64
137
|
let color = getComputedStyle(canvas).color;
|
|
65
138
|
let celebrationColors = [color];
|
|
139
|
+
let stripeColors = [color];
|
|
66
140
|
function paint() {
|
|
67
141
|
if (!context)
|
|
68
142
|
return;
|
|
69
143
|
context.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
70
|
-
paintAgentOrb(context, form, size, seconds, color, state, age, motion.matches, celebrationColors);
|
|
144
|
+
paintAgentOrb(context, form, size, seconds, color, state, age, motion.matches, celebrationColors, stripeColors);
|
|
71
145
|
}
|
|
72
146
|
function running() {
|
|
73
147
|
return (!disposed &&
|
|
@@ -110,6 +184,7 @@ export function mountAgentOrb(canvas, form, size, initiallyPaused, initialState
|
|
|
110
184
|
const appearance = getComputedStyle(canvas);
|
|
111
185
|
color = appearance.color;
|
|
112
186
|
celebrationColors = ["--nc-chart-5", "--nc-chart-6", "--nc-warning", "--nc-chart-4"].map((token) => `color-mix(in oklch, ${appearance.getPropertyValue(token).trim() || color} 75%, white)`);
|
|
187
|
+
stripeColors = nadiaStripes.map((token) => (token && appearance.getPropertyValue(token).trim()) || color);
|
|
113
188
|
play();
|
|
114
189
|
}
|
|
115
190
|
const visibility = new IntersectionObserver(([entry]) => {
|
package/docs/agent-orb.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# Agent orbs
|
|
2
2
|
|
|
3
|
-
`AgentOrb` is the
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this component slice.
|
|
3
|
+
`AgentOrb` is the one Agent identity in every product: seven structures from
|
|
4
|
+
`thinking-orbs` 0.3.1, each painted in one chosen colour, and Nadia's own
|
|
5
|
+
striped ribbon. These are persistent appearance choices, not activity states.
|
|
6
|
+
No other Agent form, avatar or portrait exists; a custom picture a person
|
|
7
|
+
uploads in Nadia is theirs, not an identity this package draws.
|
|
9
8
|
|
|
10
9
|
| Form | Structure | Upstream preset |
|
|
11
10
|
| --- | --- | --- |
|
|
@@ -17,7 +16,40 @@ this component slice.
|
|
|
17
16
|
| `braid` | Interwoven strands | `weaving` |
|
|
18
17
|
| `morph` | Changing geometric contour | `shaping` |
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
## Nadia
|
|
20
|
+
|
|
21
|
+
`form="nadia"` is the ribbon striped along its whole length, across its width:
|
|
22
|
+
azzurro (`--nc-identity-azzurro`), verde, the orb's own pigment, and rosso.
|
|
23
|
+
The third stripe is the white of the tricolore; it takes the inherited text
|
|
24
|
+
colour so it stays visible as ink on a white ground. The stripes are fixed:
|
|
25
|
+
the same four at every size, in both themes and in every state, and nobody
|
|
26
|
+
chooses them. Each dot keeps its lane through the engine's depth sort, so a
|
|
27
|
+
stripe never changes colour as the ribbon turns. Her motion is the ribbon's.
|
|
28
|
+
|
|
29
|
+
## Stored appearance
|
|
30
|
+
|
|
31
|
+
Nadia stores an Agent's look in its profile and reports it to the Portal on
|
|
32
|
+
every check-in; the Portal renders it and never writes it.
|
|
33
|
+
`@nadicodeai/ui/components/agent-orb-appearance` is the one reading of those
|
|
34
|
+
strings, server-safe so a server can resolve a row before it renders:
|
|
35
|
+
|
|
36
|
+
| Field | Stored as |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `shape` | `orb:orbit`, `orb:ribbon`, `orb:lattice`, `orb:globe`, `orb:network`, `orb:braid`, `orb:morph` |
|
|
39
|
+
| `color` | The design system's identity hex of cobalto, verde, rosso or arancio, or null |
|
|
40
|
+
|
|
41
|
+
`resolveAgentOrb(stored, { root })` returns the form and colour to draw. The
|
|
42
|
+
root Agent is Nadia and draws `nadia` whatever is stored. An unknown or empty
|
|
43
|
+
shape draws `orbit`; an unknown or empty colour draws the inherited text
|
|
44
|
+
colour, which is also the default a picker's reset restores. Paint a colour
|
|
45
|
+
with `agentOrbColorTokens[color]`. The four colours clear 3:1 against both the
|
|
46
|
+
white and the black canvas; giallo does not and is not offered. Each retired
|
|
47
|
+
`forma:` spelling resolves to its own orb, so an Agent keeps a distinct look
|
|
48
|
+
until someone changes it.
|
|
49
|
+
|
|
50
|
+
The appearance is a person's choice, never derived: do not infer it from a name,
|
|
51
|
+
an id hash or a role. A machine check-in is not Agent activity, so a surface that
|
|
52
|
+
only knows check-ins draws the orb idle. The form does not select a job, tools or runtime status. Do not switch it when
|
|
21
53
|
an Agent starts searching or solving. Applications own the persisted form,
|
|
22
54
|
colour, name and status; names beside avatars provide exact identification.
|
|
23
55
|
|
|
@@ -26,13 +58,15 @@ colour, name and status; names beside avatars provide exact identification.
|
|
|
26
58
|
```tsx
|
|
27
59
|
import { AgentOrb } from "@nadicodeai/ui/components/agent-orb";
|
|
28
60
|
|
|
29
|
-
<AgentOrb form="ribbon" color="var(--nc-identity-cobalto)" size={32} label="
|
|
61
|
+
<AgentOrb form="ribbon" color="var(--nc-identity-cobalto)" size={32} label="Research" />;
|
|
62
|
+
<AgentOrb form="nadia" size={32} label="Nadia" />;
|
|
30
63
|
```
|
|
31
64
|
|
|
32
65
|
`form` is required. `color` accepts one CSS colour, including a customer-chosen
|
|
33
66
|
colour or a canonical token. Omit it to inherit text colour. This configurable
|
|
34
67
|
artwork is not a new palette for controls or status. Every particle and line
|
|
35
|
-
uses the same pigment
|
|
68
|
+
of a chosen form uses the same pigment, and on Nadia each stripe keeps its own;
|
|
69
|
+
opacity, not another colour, creates depth. Working
|
|
36
70
|
releases occasional coloured flourishes; Done repeats the same arcs,
|
|
37
71
|
arrowheads, rings and sparkles in a short celebration around
|
|
38
72
|
that single-colour identity, using the existing chart and warning tokens. Choose a
|
|
@@ -73,10 +107,9 @@ No state has an enclosing circle. Keep a nearby status label where exact
|
|
|
73
107
|
state identification matters, including reduced motion and compact sizes.
|
|
74
108
|
Reduced motion holds the state pose and skips the celebration.
|
|
75
109
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
running local Portal for compact and
|
|
79
|
-
|
|
80
|
-
stored Agent records.
|
|
110
|
+
In the Portal, [`agent-identity.tsx`](../../../apps/portal/src/components/agent-identity.tsx)
|
|
111
|
+
draws every Agent, in its lists, Agent workspace and the sign-in, sign-up and
|
|
112
|
+
Get Nadia pages. Inspect them in the running local Portal for compact and
|
|
113
|
+
full-size appearances.
|
|
81
114
|
|
|
82
115
|
[Upstream library and presets](https://libraries.dev/orbs), MIT licensed.
|
package/docs/contract.md
CHANGED
|
@@ -152,7 +152,7 @@ states to the orb.
|
|
|
152
152
|
|
|
153
153
|
## Admission Rules
|
|
154
154
|
|
|
155
|
-
Assistant conversation and runtime APIs enter through `@nadicodeai/ui/agents`; Agent identity enters through `@nadicodeai/ui/components/agent-
|
|
155
|
+
Assistant conversation and runtime APIs enter through `@nadicodeai/ui/agents`; Agent identity enters through `@nadicodeai/ui/components/agent-orb`, its stored-appearance resolver `@nadicodeai/ui/components/agent-orb-appearance` (both owned by [`agent-orb.md`](agent-orb.md)), and `@nadicodeai/ui/components/agent-card`. The consuming application still constructs the runtime and owns transport, persistence, permissions, tools, approvals, and failure policy. Shared non-Agent product components (a shell, a settings surface, a generic section, a diff, or a file preview) are admitted only with a named consuming surface landing in the same change. App-bespoke UI and behavior (window chrome, PTY/xterm embeds, queues, approvals, and persistence) stay in the consuming app; they never become package abstractions. A component left unconsumed after its target migration ships gets removed.
|
|
156
156
|
|
|
157
157
|
### Placement
|
|
158
158
|
|
|
@@ -166,34 +166,13 @@ where [`apps/nadia/docs/entry-screen.md`](../../../apps/nadia/docs/entry-screen.
|
|
|
166
166
|
owns their contract. `packages/ui/tests/guards/product-placement.test.ts`
|
|
167
167
|
refuses a product's name in either package.
|
|
168
168
|
|
|
169
|
-
###
|
|
170
|
-
|
|
171
|
-
`AgentOrb` is the
|
|
172
|
-
[`agent-orb.md`](agent-orb.md)
|
|
173
|
-
|
|
174
|
-
`
|
|
175
|
-
|
|
176
|
-
upstream activity names select geometry only and never infer an Agent role or
|
|
177
|
-
change its identity with runtime work. Customer-selected artwork colours are
|
|
178
|
-
inputs, not component palette literals or interface colour roles.
|
|
179
|
-
|
|
180
|
-
### Agent identity presentation
|
|
181
|
-
|
|
182
|
-
The visual system (the closed recipes, motion, fallbacks, and licensing) is
|
|
183
|
-
owned by [`agent-visual.md`](agent-visual.md). What this contract adds is the
|
|
184
|
-
package shape: `AgentVisual` exposes only a recipe (`general`, `reasoning`,
|
|
185
|
-
`coordination`, `communication`, `execution`) and a presentation (`registry`,
|
|
186
|
-
`card`, `detail`); it is decorative by default, and a meaningful selectable
|
|
187
|
-
image opts into `decorative={false}` with a `label`. `AgentCard` composes the
|
|
188
|
-
fundamental `Card` with explicit `visual`, `name`, `job`, `status`, `meta`,
|
|
189
|
-
and `action` slots and owns presentation only; when it is the page identity,
|
|
190
|
-
the `name` slot carries the page's `h1`. The app owns Agent data, recipe
|
|
191
|
-
assignment, status grammar, routing, and actions; it assigns a recipe
|
|
192
|
-
explicitly and never infers or randomizes one from a free-form role.
|
|
193
|
-
When the product chooses a card presentation, use `AgentCard`; registry cells,
|
|
194
|
-
membership rows, and compact detail headers compose the shared `AgentVisual`
|
|
195
|
-
within the structure their reading task requires. An Agent's presence does not
|
|
196
|
-
by itself choose a card layout. There is no `AgentGlyph`, `AgentRow`, or
|
|
169
|
+
### Agent identity
|
|
170
|
+
|
|
171
|
+
`AgentOrb` is the only Agent identity the package ships, and
|
|
172
|
+
[`agent-orb.md`](agent-orb.md) owns its rules. `AgentCard` composes the
|
|
173
|
+
fundamental `Card` with explicit `visual`, `name`, `job`, `status`, `meta`, and
|
|
174
|
+
`action` slots and owns presentation only; when it is the page identity, the
|
|
175
|
+
`name` slot carries the page's `h1`. There is no `AgentGlyph`, `AgentRow`, or
|
|
197
176
|
product-domain `agent` object prop in the shared package.
|
|
198
177
|
|
|
199
178
|
- **Standard components, not app-owned product features.** This package ships primitives, standard UI components, assistant-ui compositions, brand adapters, React adapters, reusable sections, and presentational product components. It must not ship app-specific feature/use-case screens or names such as operator-login, portal activation, customer credential control, or customer management. Domain registries, command search providers, and chart dashboards bind app data and routes in the app; that binding is not a reason to copy reusable presentation. Portal's DataTable owns its Next.js query and registry protocol once, while consuming the shared UI foundation. Product-independent compositions belong here with a real consumer. The source-backed `chart-*` and `kpi-card` package surface is the plan-approved exception per issue #166; apps select charts and bind their titles, data, and navigation. A chart is named by the card title above it and navigated through Recharts' own accessibility layer; the kit ships no hidden table twin, because a component whose complete value is already available in visible text or `aria-valuetext` does not add a redundant table.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Migrating to `@nadicodeai/ui` 9.0.0
|
|
2
|
+
|
|
3
|
+
Every Agent is now an `AgentOrb`, Nadia included. This release removes the
|
|
4
|
+
other Agent identities. `@nadicodeai/ui` 9.0.0 requires
|
|
5
|
+
`@nadicodeai/design-system` 9.0.0; the two packages are released in lockstep.
|
|
6
|
+
|
|
7
|
+
## Removed components
|
|
8
|
+
|
|
9
|
+
| Removed | Use instead |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `components/forma-avatar` (`FormaAvatar`) | `components/agent-orb` (`AgentOrb`). Nadia is `form="nadia"`. |
|
|
12
|
+
| `components/forma-appearance` (`resolveAppearance`, `shapeFor`, `defaultShape`, `formaColorValues`) | `components/agent-orb-appearance` (`resolveAgentOrb`, `shapeForOrb`, `defaultAgentOrbShape`, `agentOrbColorValues`, `agentOrbColorTokens`) |
|
|
13
|
+
| `components/agent-visual` (`AgentVisual`) | `AgentOrb` |
|
|
14
|
+
|
|
15
|
+
`resolveAgentOrb` reads every stored `forma:` spelling, the five launch role
|
|
16
|
+
names included, as a distinct orb, so a stored look keeps drawing until
|
|
17
|
+
someone changes it. Stored colours map to cobalto, verde, rosso and arancio;
|
|
18
|
+
giallo, avorio and unknown values draw the inherited text colour. Store new
|
|
19
|
+
choices as `orb:<form>` and the colour's hex, as
|
|
20
|
+
[`agent-orb.md`](../agent-orb.md#stored-appearance) specifies.
|
|
21
|
+
|
|
22
|
+
## Added
|
|
23
|
+
|
|
24
|
+
`AgentOrb` takes `form="nadia"`: her ribbon, striped azzurro, verde, the orb's
|
|
25
|
+
pigment and rosso. `--nc-identity-azzurro` is the design-system token for her
|
|
26
|
+
azzurro stripe.
|
|
27
|
+
|
|
28
|
+
## Removed tokens and assets
|
|
29
|
+
|
|
30
|
+
| Removed | Use instead |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `--nc-forma-visor`, `--nc-forma-bezel`, `--nc-forma-eye`, `--nc-forma-avorio`, `--nc-forma-sabbia` | No replacement; only Forma painted them. |
|
|
33
|
+
| `@nadicodeai/design-system/assets/nadia-solid-surface` | `<AgentOrb form="nadia" />`. The portrait is retired as Nadia's look; the file stays in the brand archive. |
|
|
34
|
+
|
|
35
|
+
The package no longer depends on `@paper-design/shaders`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadicodeai/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -70,8 +70,7 @@
|
|
|
70
70
|
"@assistant-ui/react": "0.15.20",
|
|
71
71
|
"@assistant-ui/react-markdown": "0.14.15",
|
|
72
72
|
"@base-ui/react": "^1.8.0",
|
|
73
|
-
"@nadicodeai/design-system": "
|
|
74
|
-
"@paper-design/shaders": "0.0.81",
|
|
73
|
+
"@nadicodeai/design-system": "9.0.0",
|
|
75
74
|
"class-variance-authority": "^0.7.1",
|
|
76
75
|
"clsx": "^2.1.1",
|
|
77
76
|
"cmdk": "^1.1.1",
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
-
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by the
|
|
13
|
-
copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all other
|
|
16
|
-
entities that control, are controlled by, or are under common control with
|
|
17
|
-
that entity. For the purposes of this definition, "control" means (i) the
|
|
18
|
-
power, direct or indirect, to cause the direction or management of such
|
|
19
|
-
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
|
|
20
|
-
(50%) or more of the outstanding shares, or (iii) beneficial ownership of
|
|
21
|
-
such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
24
|
-
permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation source, and
|
|
28
|
-
configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical transformation
|
|
31
|
-
or translation of a Source form, including but not limited to compiled object
|
|
32
|
-
code, generated documentation, and conversions to other media types.
|
|
33
|
-
|
|
34
|
-
"Work" shall mean the work of authorship, whether in Source or Object form,
|
|
35
|
-
made available under the License, as indicated by a copyright notice that is
|
|
36
|
-
included in or attached to the work (an example is provided in the Appendix
|
|
37
|
-
below).
|
|
38
|
-
|
|
39
|
-
"Derivative Works" shall mean any work, whether in Source or Object form,
|
|
40
|
-
that is based on (or derived from) the Work and for which the editorial
|
|
41
|
-
revisions, annotations, elaborations, or other modifications represent, as a
|
|
42
|
-
whole, an original work of authorship. For the purposes of this License,
|
|
43
|
-
Derivative Works shall not include works that remain separable from, or merely
|
|
44
|
-
link (or bind by name) to the interfaces of, the Work and Derivative Works
|
|
45
|
-
thereof.
|
|
46
|
-
|
|
47
|
-
"Contribution" shall mean any work of authorship, including the original
|
|
48
|
-
version of the Work and any modifications or additions to that Work or
|
|
49
|
-
Derivative Works thereof, that is intentionally submitted to Licensor for
|
|
50
|
-
inclusion in the Work by the copyright owner or by an individual or Legal
|
|
51
|
-
Entity authorized to submit on behalf of the copyright owner. For the purposes
|
|
52
|
-
of this definition, "submitted" means any form of electronic, verbal, or
|
|
53
|
-
written communication sent to the Licensor or its representatives, including
|
|
54
|
-
but not limited to communication on electronic mailing lists, source code
|
|
55
|
-
control systems, and issue tracking systems that are managed by, or on behalf
|
|
56
|
-
of, the Licensor for the purpose of discussing and improving the Work, but
|
|
57
|
-
excluding communication that is conspicuously marked or otherwise designated
|
|
58
|
-
in writing by the copyright owner as "Not a Contribution."
|
|
59
|
-
|
|
60
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on
|
|
61
|
-
behalf of whom a Contribution has been received by Licensor and subsequently
|
|
62
|
-
incorporated within the Work.
|
|
63
|
-
|
|
64
|
-
2. Grant of Copyright License. Subject to the terms and conditions of this
|
|
65
|
-
License, each Contributor hereby grants to You a perpetual, worldwide,
|
|
66
|
-
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
|
67
|
-
reproduce, prepare Derivative Works of, publicly display, publicly perform,
|
|
68
|
-
sublicense, and distribute the Work and such Derivative Works in Source or
|
|
69
|
-
Object form.
|
|
70
|
-
|
|
71
|
-
3. Grant of Patent License. Subject to the terms and conditions of this
|
|
72
|
-
License, each Contributor hereby grants to You a perpetual, worldwide,
|
|
73
|
-
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
|
74
|
-
section) patent license to make, have made, use, offer to sell, sell, import,
|
|
75
|
-
and otherwise transfer the Work, where such license applies only to those
|
|
76
|
-
patent claims licensable by such Contributor that are necessarily infringed by
|
|
77
|
-
their Contribution(s) alone or by combination of their Contribution(s) with
|
|
78
|
-
the Work to which such Contribution(s) was submitted. If You institute patent
|
|
79
|
-
litigation against any entity (including a cross-claim or counterclaim in a
|
|
80
|
-
lawsuit) alleging that the Work or a Contribution incorporated within the Work
|
|
81
|
-
constitutes direct or contributory patent infringement, then any patent
|
|
82
|
-
licenses granted to You under this License for that Work shall terminate as of
|
|
83
|
-
the date such litigation is filed.
|
|
84
|
-
|
|
85
|
-
4. Redistribution. You may reproduce and distribute copies of the Work or
|
|
86
|
-
Derivative Works thereof in any medium, with or without modifications, and in
|
|
87
|
-
Source or Object form, provided that You meet the following conditions:
|
|
88
|
-
|
|
89
|
-
(a) You must give any other recipients of the Work or Derivative Works a copy
|
|
90
|
-
of this License; and
|
|
91
|
-
|
|
92
|
-
(b) You must cause any modified files to carry prominent notices stating that
|
|
93
|
-
You changed the files; and
|
|
94
|
-
|
|
95
|
-
(c) You must retain, in the Source form of any Derivative Works that You
|
|
96
|
-
distribute, all copyright, patent, trademark, and attribution notices from the
|
|
97
|
-
Source form of the Work, excluding those notices that do not pertain to any
|
|
98
|
-
part of the Derivative Works; and
|
|
99
|
-
|
|
100
|
-
(d) If the Work includes a "NOTICE" text file as part of its distribution,
|
|
101
|
-
then any Derivative Works that You distribute must include a readable copy of
|
|
102
|
-
the attribution notices contained within such NOTICE file, excluding those
|
|
103
|
-
notices that do not pertain to any part of the Derivative Works, in at least
|
|
104
|
-
one of the following places: within a NOTICE text file distributed as part of
|
|
105
|
-
the Derivative Works; within the Source form or documentation, if provided
|
|
106
|
-
along with the Derivative Works; or, within a display generated by the
|
|
107
|
-
Derivative Works, if and wherever such third-party notices normally appear.
|
|
108
|
-
The contents of the NOTICE file are for informational purposes only and do not
|
|
109
|
-
modify the License. You may add Your own attribution notices within Derivative
|
|
110
|
-
Works that You distribute, alongside or as an addendum to the NOTICE text from
|
|
111
|
-
the Work, provided that such additional attribution notices cannot be
|
|
112
|
-
construed as modifying the License.
|
|
113
|
-
|
|
114
|
-
You may add Your own copyright statement to Your modifications and may provide
|
|
115
|
-
additional or different license terms and conditions for use, reproduction,
|
|
116
|
-
or distribution of Your modifications, or for any such Derivative Works as a
|
|
117
|
-
whole, provided Your use, reproduction, and distribution of the Work otherwise
|
|
118
|
-
complies with the conditions stated in this License.
|
|
119
|
-
|
|
120
|
-
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
|
121
|
-
Contribution intentionally submitted for inclusion in the Work by You to the
|
|
122
|
-
Licensor shall be under the terms and conditions of this License, without any
|
|
123
|
-
additional terms or conditions. Notwithstanding the above, nothing herein
|
|
124
|
-
shall supersede or modify the terms of any separate license agreement you may
|
|
125
|
-
have executed with Licensor regarding such Contributions.
|
|
126
|
-
|
|
127
|
-
6. Trademarks. This License does not grant permission to use the trade names,
|
|
128
|
-
trademarks, service marks, or product names of the Licensor, except as required
|
|
129
|
-
for reasonable and customary use in describing the origin of the Work and
|
|
130
|
-
reproducing the content of the NOTICE file.
|
|
131
|
-
|
|
132
|
-
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
|
|
133
|
-
writing, Licensor provides the Work (and each Contributor provides its
|
|
134
|
-
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
135
|
-
KIND, either express or implied, including, without limitation, any warranties
|
|
136
|
-
or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
137
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
138
|
-
appropriateness of using or redistributing the Work and assume any risks
|
|
139
|
-
associated with Your exercise of permissions under this License.
|
|
140
|
-
|
|
141
|
-
8. Limitation of Liability. In no event and under no legal theory, whether in
|
|
142
|
-
tort (including negligence), contract, or otherwise, unless required by
|
|
143
|
-
applicable law (such as deliberate and grossly negligent acts) or agreed to in
|
|
144
|
-
writing, shall any Contributor be liable to You for damages, including any
|
|
145
|
-
direct, indirect, special, incidental, or consequential damages of any
|
|
146
|
-
character arising as a result of this License or out of the use or inability to
|
|
147
|
-
use the Work (including but not limited to damages for loss of goodwill, work
|
|
148
|
-
stoppage, computer failure or malfunction, or any and all other commercial
|
|
149
|
-
damages or losses), even if such Contributor has been advised of the
|
|
150
|
-
possibility of such damages.
|
|
151
|
-
|
|
152
|
-
9. Accepting Warranty or Additional Liability. While redistributing the Work
|
|
153
|
-
or Derivative Works thereof, You may choose to offer, and charge a fee for,
|
|
154
|
-
acceptance of support, warranty, indemnity, or other liability obligations
|
|
155
|
-
and/or rights consistent with this License. However, in accepting such
|
|
156
|
-
obligations, You may act only on Your own behalf and on Your sole
|
|
157
|
-
responsibility, not on behalf of any other Contributor, and only if You agree
|
|
158
|
-
to indemnify, defend, and hold each Contributor harmless for any liability
|
|
159
|
-
incurred by, or claims asserted against, such Contributor by reason of your
|
|
160
|
-
accepting any such warranty or additional liability.
|
|
161
|
-
|
|
162
|
-
END OF TERMS AND CONDITIONS
|
|
163
|
-
|
|
164
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
165
|
-
|
|
166
|
-
To apply the Apache License to your work, attach the following boilerplate
|
|
167
|
-
notice, with the fields enclosed by brackets "[]" replaced with your own
|
|
168
|
-
identifying information. (Don't include the brackets!) The text should be
|
|
169
|
-
enclosed in the appropriate comment syntax for the file format. We also
|
|
170
|
-
recommend that a file or class name and description of purpose be included on
|
|
171
|
-
the same "printed page" as the copyright notice for easier identification
|
|
172
|
-
within third-party archives.
|
|
173
|
-
|
|
174
|
-
Copyright [yyyy] [name of copyright owner]
|
|
175
|
-
|
|
176
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
177
|
-
you may not use this file except in compliance with the License.
|
|
178
|
-
You may obtain a copy of the License at
|
|
179
|
-
|
|
180
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
181
|
-
|
|
182
|
-
Unless required by applicable law or agreed to in writing, software
|
|
183
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
184
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
185
|
-
See the License for the specific language governing permissions and
|
|
186
|
-
limitations under the License.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AgentVisualRecipe } from "../internal/agent-visual/recipes.js";
|
|
2
|
-
type AgentVisualPresentation = "registry" | "card" | "detail";
|
|
3
|
-
type AgentVisualAccessibility = {
|
|
4
|
-
decorative?: true;
|
|
5
|
-
label?: never;
|
|
6
|
-
} | {
|
|
7
|
-
decorative: false;
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
type AgentVisualProps = AgentVisualAccessibility & {
|
|
11
|
-
className?: string;
|
|
12
|
-
presentation?: AgentVisualPresentation;
|
|
13
|
-
recipe: AgentVisualRecipe;
|
|
14
|
-
};
|
|
15
|
-
declare function AgentVisual({ className, decorative, label, presentation, recipe, }: AgentVisualProps): import("react").JSX.Element;
|
|
16
|
-
export { AgentVisual, type AgentVisualPresentation, type AgentVisualProps, type AgentVisualRecipe };
|
|
17
|
-
//# sourceMappingURL=agent-visual.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-visual.d.ts","sourceRoot":"","sources":["../../src/components/agent-visual.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAKzE,KAAK,uBAAuB,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D,KAAK,wBAAwB,GACzB;IAAE,UAAU,CAAC,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACpC;IAAE,UAAU,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,KAAK,gBAAgB,GAAG,wBAAwB,GAAG;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAuBF,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,UAAiB,EACjB,KAAK,EACL,YAAqB,EACrB,MAAM,GACP,EAAE,gBAAgB,+BAoFlB;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Component, lazy, Suspense, useCallback, useEffect, useRef, useState, } from "react";
|
|
4
|
-
import { AgentVisualPoster } from "../internal/agent-visual/poster.js";
|
|
5
|
-
import { cn } from "../lib/utils.js";
|
|
6
|
-
const LazyAgentVisualRenderer = lazy(() => import("../internal/agent-visual/renderer.js"));
|
|
7
|
-
class AgentVisualErrorBoundary extends Component {
|
|
8
|
-
state = { failed: false };
|
|
9
|
-
static getDerivedStateFromError() {
|
|
10
|
-
return { failed: true };
|
|
11
|
-
}
|
|
12
|
-
componentDidCatch(_error, _info) {
|
|
13
|
-
this.props.onUnavailable();
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
return this.state.failed ? null : this.props.children;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function AgentVisual({ className, decorative = true, label, presentation = "card", recipe, }) {
|
|
20
|
-
const hostRef = useRef(null);
|
|
21
|
-
const [canAnimate, setCanAnimate] = useState(false);
|
|
22
|
-
const [isInViewport, setIsInViewport] = useState(false);
|
|
23
|
-
const [rendererReady, setRendererReady] = useState(false);
|
|
24
|
-
const handleReady = useCallback(() => setRendererReady(true), []);
|
|
25
|
-
const handleUnavailable = useCallback(() => {
|
|
26
|
-
setRendererReady(false);
|
|
27
|
-
setCanAnimate(false);
|
|
28
|
-
}, []);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
setCanAnimate(false);
|
|
31
|
-
setRendererReady(false);
|
|
32
|
-
if (typeof window.matchMedia !== "function")
|
|
33
|
-
return;
|
|
34
|
-
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
35
|
-
const update = () => {
|
|
36
|
-
setRendererReady(false);
|
|
37
|
-
setCanAnimate(!reducedMotion.matches);
|
|
38
|
-
};
|
|
39
|
-
update();
|
|
40
|
-
reducedMotion.addEventListener("change", update);
|
|
41
|
-
return () => reducedMotion.removeEventListener("change", update);
|
|
42
|
-
}, [recipe]);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
const host = hostRef.current;
|
|
45
|
-
if (!host)
|
|
46
|
-
return;
|
|
47
|
-
if (typeof IntersectionObserver !== "function") {
|
|
48
|
-
setIsInViewport(true);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
52
|
-
const isIntersecting = entry?.isIntersecting ?? false;
|
|
53
|
-
setIsInViewport(isIntersecting);
|
|
54
|
-
if (!isIntersecting)
|
|
55
|
-
setRendererReady(false);
|
|
56
|
-
});
|
|
57
|
-
observer.observe(host);
|
|
58
|
-
return () => observer.disconnect();
|
|
59
|
-
}, []);
|
|
60
|
-
const hasAmbientRenderer = canAnimate && isInViewport;
|
|
61
|
-
return (_jsxs("div", { "aria-hidden": decorative || undefined, "aria-label": decorative ? undefined : label, className: cn("relative isolate size-full overflow-hidden rounded-md bg-nc-identity-ink", presentation === "card" && "min-h-20", presentation === "detail" && "min-h-48", className), "data-agent-visual-motion": hasAmbientRenderer ? "ambient" : "static", "data-agent-visual-presentation": presentation, "data-agent-visual-recipe": recipe, ref: hostRef, role: decorative ? undefined : "img", children: [_jsx(AgentVisualPoster, { recipe: recipe }), hasAmbientRenderer && hostRef.current ? (_jsx("div", { "aria-hidden": "true", className: cn("absolute inset-0 opacity-0 transition-opacity duration-[var(--nc-duration-close)] ease-[var(--nc-ease-out-strong)]", rendererReady && "opacity-100"), "data-agent-visual-renderer": "paper-metaballs", children: _jsx(AgentVisualErrorBoundary, { onUnavailable: handleUnavailable, children: _jsx(Suspense, { fallback: null, children: _jsx(LazyAgentVisualRenderer, { host: hostRef.current, onReady: handleReady, onUnavailable: handleUnavailable, recipe: recipe }) }) }) })) : null] }));
|
|
62
|
-
}
|
|
63
|
-
export { AgentVisual };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The stored appearance, reachable from a server. `forma-avatar.tsx` is a
|
|
3
|
-
* `"use client"` module, and under React Server Components every export of one
|
|
4
|
-
* becomes a client reference — a re-exported pure function included, which a
|
|
5
|
-
* server caller can only fail to invoke. A product whose server resolves an
|
|
6
|
-
* Agent's look before it renders the avatar (the Portal builds its rows that
|
|
7
|
-
* way) imports the resolver from here, and so does every other consumer: the
|
|
8
|
-
* avatar comes from `@nadicodeai/ui/components/forma-avatar`, the stored
|
|
9
|
-
* spelling from this module, and neither re-exports the other.
|
|
10
|
-
*/
|
|
11
|
-
export { type StoredAppearance, defaultShape, formaColorValues, resolveAppearance, shapeFor, } from "../internal/forma/stored-appearance.js";
|
|
12
|
-
export { type FormaChoice, type FormaColor, type FormaForm, type FormaState, } from "../internal/forma/model.js";
|
|
13
|
-
//# sourceMappingURL=forma-appearance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forma-appearance.d.ts","sourceRoot":"","sources":["../../src/components/forma-appearance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,KAAK,gBAAgB,EACrB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The stored appearance, reachable from a server. `forma-avatar.tsx` is a
|
|
3
|
-
* `"use client"` module, and under React Server Components every export of one
|
|
4
|
-
* becomes a client reference — a re-exported pure function included, which a
|
|
5
|
-
* server caller can only fail to invoke. A product whose server resolves an
|
|
6
|
-
* Agent's look before it renders the avatar (the Portal builds its rows that
|
|
7
|
-
* way) imports the resolver from here, and so does every other consumer: the
|
|
8
|
-
* avatar comes from `@nadicodeai/ui/components/forma-avatar`, the stored
|
|
9
|
-
* spelling from this module, and neither re-exports the other.
|
|
10
|
-
*/
|
|
11
|
-
export { defaultShape, formaColorValues, resolveAppearance, shapeFor, } from "../internal/forma/stored-appearance.js";
|