@nadicodeai/ui 0.1.1 → 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/AGENTS.md +9 -4
- package/README.md +41 -7
- package/dist/components/action-band.d.ts.map +1 -1
- package/dist/components/action-band.js +2 -1
- package/dist/components/agent-message.d.ts +2 -1
- package/dist/components/agent-message.d.ts.map +1 -1
- package/dist/components/agent-message.js +14 -21
- package/dist/components/agent-thread.d.ts.map +1 -1
- package/dist/components/agent-thread.js +3 -10
- package/dist/components/ai-elements/code-block.d.ts +8 -1
- package/dist/components/ai-elements/code-block.d.ts.map +1 -1
- package/dist/components/ai-elements/code-block.js +77 -19
- package/dist/components/ai-elements/model-selector.d.ts +1 -1
- package/dist/components/ai-elements/model-selector.d.ts.map +1 -1
- package/dist/components/ai-elements/open-in-chat.d.ts +0 -2
- package/dist/components/ai-elements/open-in-chat.d.ts.map +1 -1
- package/dist/components/ai-elements/open-in-chat.js +7 -29
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert.js +1 -1
- package/dist/components/automation-section.d.ts.map +1 -1
- package/dist/components/automation-section.js +38 -43
- package/dist/components/benefits-bento.js +1 -1
- package/dist/components/bento.d.ts +2 -2
- package/dist/components/bento.d.ts.map +1 -1
- package/dist/components/bento.js +4 -3
- package/dist/components/button.js +5 -5
- package/dist/components/card.js +1 -1
- package/dist/components/chart.d.ts +5 -1
- package/dist/components/chart.d.ts.map +1 -1
- package/dist/components/chart.js +23 -4
- package/dist/components/demo-surface.d.ts +10 -2
- package/dist/components/demo-surface.d.ts.map +1 -1
- package/dist/components/demo-surface.js +9 -2
- package/dist/components/dialog.js +1 -1
- package/dist/components/faq.d.ts +6 -5
- package/dist/components/faq.d.ts.map +1 -1
- package/dist/components/faq.js +8 -6
- package/dist/components/files-preview.d.ts.map +1 -1
- package/dist/components/files-preview.js +8 -17
- package/dist/components/hero-split.d.ts.map +1 -1
- package/dist/components/hero-split.js +3 -2
- package/dist/components/input.js +1 -1
- package/dist/components/installer-shell.d.ts.map +1 -1
- package/dist/components/installer-shell.js +9 -12
- package/dist/components/logo-band.d.ts.map +1 -1
- package/dist/components/logo-band.js +2 -3
- package/dist/components/pricing.d.ts.map +1 -1
- package/dist/components/pricing.js +5 -3
- package/dist/components/seam-grid.d.ts +30 -0
- package/dist/components/seam-grid.d.ts.map +1 -0
- package/dist/components/seam-grid.js +30 -0
- package/dist/components/section-intro.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/shift-band.d.ts.map +1 -1
- package/dist/components/shift-band.js +2 -1
- package/dist/components/sonner.d.ts +1 -1
- package/dist/components/sonner.d.ts.map +1 -1
- package/dist/components/sonner.js +2 -2
- package/dist/components/state-notice.d.ts +13 -0
- package/dist/components/state-notice.d.ts.map +1 -0
- package/dist/components/state-notice.js +8 -0
- package/dist/components/stats-band.d.ts.map +1 -1
- package/dist/components/stats-band.js +4 -5
- package/dist/components/testimonials.d.ts.map +1 -1
- package/dist/components/testimonials.js +3 -4
- package/dist/components/textarea.js +1 -1
- package/dist/components/theme-mode-switcher.d.ts +17 -0
- package/dist/components/theme-mode-switcher.d.ts.map +1 -0
- package/dist/components/theme-mode-switcher.js +24 -0
- package/dist/components/use-case-bento.d.ts +4 -2
- package/dist/components/use-case-bento.d.ts.map +1 -1
- package/dist/components/use-case-bento.js +3 -3
- package/dist/components/watch-it-work-band.d.ts +3 -2
- package/dist/components/watch-it-work-band.d.ts.map +1 -1
- package/dist/components/watch-it-work-band.js +4 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/lib/agent-work-state.d.ts +36 -0
- package/dist/lib/agent-work-state.d.ts.map +1 -0
- package/dist/lib/agent-work-state.js +36 -0
- package/dist/lib/seam.d.ts +29 -0
- package/dist/lib/seam.d.ts.map +1 -0
- package/dist/lib/seam.js +30 -0
- package/dist/lib/theme-mode.d.ts +4 -0
- package/dist/lib/theme-mode.d.ts.map +1 -0
- package/dist/lib/theme-mode.js +4 -0
- package/dist/styles/globals.css +131 -117
- package/docs/agents/nadicodeai-ui.md +22 -0
- package/package.json +9 -3
- package/skills/nadicodeai-ui/SKILL.md +2 -1
package/AGENTS.md
CHANGED
|
@@ -6,9 +6,10 @@ When this file is read from an installed package, use it as the consumer agent
|
|
|
6
6
|
contract: import `@nadicodeai/ui/globals.css` and
|
|
7
7
|
`@nadicodeai/design-system/css` once at the app root, import components from
|
|
8
8
|
`@nadicodeai/ui/components/*` or `@nadicodeai/ui/ai-elements`, and keep all
|
|
9
|
-
new UI token-only. Dark mode is a `.dark` selector remap
|
|
10
|
-
|
|
11
|
-
OS dark-mode branching, or
|
|
9
|
+
new UI token-only. Dark mode is a `.dark` selector remap: the design-system
|
|
10
|
+
theme owns standard shadcn roles, while `globals.css` owns UI-local product
|
|
11
|
+
aliases. Components must not add `dark:` utilities, OS dark-mode branching, or
|
|
12
|
+
raw palette values. The package also ships `llms.txt`,
|
|
12
13
|
`docs/agents/nadicodeai-ui.md`, `docs/migration/`, and
|
|
13
14
|
`skills/nadicodeai-ui/SKILL.md` for agents that index package documentation or
|
|
14
15
|
skills.
|
|
@@ -16,9 +17,10 @@ skills.
|
|
|
16
17
|
## Invariants
|
|
17
18
|
|
|
18
19
|
- **Token-only, no raw literals.** Components style through brand tokens only — the `nadicode.theme.css` role vars bridged into Tailwind utilities (`bg-background`, `text-foreground`, `border-input`, …) plus UI-local product aliases defined in `globals.css` such as `--nc-app-surface`, `--nc-chat-tool-surface`, and `--nc-terminal-bg`. No raw `#hex` / `rgb()` / `hsl()` in any `.tsx`; a new source value goes to `design-system/DESIGN.md` first and flows through generated tokens. Enforced by `tests/no-raw-literal.test.ts` and `tests/token-reference-integrity.test.ts`.
|
|
19
|
-
- **Dark-ready roles, no component `dark:` styling.**
|
|
20
|
+
- **Dark-ready roles, no component `dark:` styling.** The generated design-system Tailwind theme owns the standard shadcn `:root` and `.dark` role maps; `globals.css` owns the Tailwind `@theme inline` bridge and UI-local product aliases. Components consume semantic utilities or product aliases such as `var(--nc-app-surface)`; they must not ship `dark:` Tailwind utilities, OS dark-mode branching, or raw dark palette utilities such as `dark:bg-slate-950` / `dark:text-white`. Enforced by `tests/no-dark.test.ts`, `tests/dark-semantic-roles.test.ts`, and `tests/token-reference-integrity.test.ts`.
|
|
20
21
|
- **Components inherit the brand theme.** Consumers import `@nadicodeai/ui/globals.css` (Tailwind + the generated brand `@theme` + semantic role/alias maps) and `@nadicodeai/design-system/css` (kept `nc-*` geometry, type scale, chat CSS components, motion, and display components). Components carry no theme of their own — they resolve every color/radius from bridged brand tokens, UI-local aliases, and design-system CSS.
|
|
21
22
|
- **Source-authored, built package.** Components are authored as shadcn-style source in this workspace, then emitted to `dist/` for consumption by other apps. Package exports must point at built JS/declarations/CSS, not raw `src/*.tsx`, and `npm pack --dry-run` must include only intentional consumer artifacts.
|
|
23
|
+
- **Public surface changes require a release decision.** Any change to exported components, `src/index.ts`, `src/ai-elements.ts`, package `exports`, `globals.css`, UI-local semantic aliases, theme behavior, package docs, package skills, or design-system token/CSS/theme output consumed by this package must end with an explicit npm release decision before handoff. If the change should reach external consumers, bump the relevant package version(s), run `npm pack --dry-run -w @nadicodeai/ui`, and follow `../docs/agents/npm-publishing.md`. When the UI change depends on modified `@nadicodeai/design-system` output, bump/publish `@nadicodeai/design-system` first, then update `@nadicodeai/ui`'s dependency and publish UI. Never claim a UI package change is shipped to npm until `npm view @nadicodeai/ui version` reports the intended published version.
|
|
22
24
|
- **shadcn and AI Elements are package surface.** The installed shadcn source components under `src/components/` and all 48 Vercel AI Elements under `src/components/ai-elements/` are intentional ready-to-use exports. Keep `src/index.ts`, `src/ai-elements.ts`, package `exports`, README/agent docs, and `website/app/ui-check/elements` synchronized whenever this surface changes.
|
|
23
25
|
- **Named shadcn blocks stay named.** When a user, plan, or issue selects a shadcn block/example such as `login-02`, `signup-02`, `dashboard-01`, or `sidebar-*`, use that registry item as the source of truth through shadcn CLI/MCP. Do not replace it with a package-authored abstraction unless the plan explicitly records the substitution, the reason, and the true consumer route that proves it.
|
|
24
26
|
- **Package surface is source-backed.** `src/components/` is intentionally flat shadcn-style source. Do not document folders or package namespaces that do not exist. Do not add top-level exports for recipes, blocks, agent, or terminal groupings unless a later package API decision adds concrete source, built files, docs, and tests in the same change.
|
|
@@ -110,5 +112,8 @@ through `docs/terminal-tui-semantics.md`.
|
|
|
110
112
|
|
|
111
113
|
| Command | When |
|
|
112
114
|
| --- | --- |
|
|
115
|
+
| `npm run dev -w @nadicodeai/ui` | Watch `src/` and incrementally refresh `dist/` for local website or app iteration |
|
|
116
|
+
| `npm run build:fast -w @nadicodeai/ui` | One-shot incremental `dist/` refresh for local development after the full package has already been built |
|
|
113
117
|
| `npm run build -w @nadicodeai/ui` | Emit the consumable `dist/` package surface before packing or app builds |
|
|
118
|
+
| `npm pack --dry-run -w @nadicodeai/ui` | Verify exactly what external npm consumers would receive after package surface, export, CSS, docs, or skill changes |
|
|
114
119
|
| `npm run test -w @nadicodeai/ui` | Run this workspace's guards (browser-free; also runs inside the root `npm run test` gate) |
|
package/README.md
CHANGED
|
@@ -20,7 +20,8 @@ The package ships:
|
|
|
20
20
|
- React adapters over the design-system grammar and assets
|
|
21
21
|
- reusable marketing/section compositions
|
|
22
22
|
- presentational product components such as `SettingsSection`,
|
|
23
|
-
`DashboardShell`, `AgentChat`, `InstallerShell`,
|
|
23
|
+
`DashboardShell`, `AgentChat`, `InstallerShell`, `PluginSlotBoundary`, and
|
|
24
|
+
`ThemeModeSwitcher`
|
|
24
25
|
- package-local agent guidance: `AGENTS.md`, `llms.txt`,
|
|
25
26
|
`docs/agents/nadicodeai-ui.md`, `docs/migration/`, and
|
|
26
27
|
`skills/nadicodeai-ui/SKILL.md`
|
|
@@ -56,11 +57,12 @@ import "@nadicodeai/design-system/css";
|
|
|
56
57
|
|
|
57
58
|
`@nadicodeai/ui/globals.css` imports Tailwind v4, the generated NadicodeAI
|
|
58
59
|
Tailwind theme, the shadcn role bridge, and the package-local semantic
|
|
59
|
-
`:root`/`.dark`
|
|
60
|
-
|
|
61
|
-
terminal/ANSI, trace/status,
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
`:root`/`.dark` product aliases. The design-system theme owns the standard
|
|
61
|
+
shadcn light and dark role maps; the UI package owns app shell/surface,
|
|
62
|
+
chat/tool/composer, approval, diff/code, terminal/ANSI, trace/status,
|
|
63
|
+
provider/model, and plugin permission aliases. Those aliases reference
|
|
64
|
+
generated `--nc-*` tokens or semantic roles; they are not a new source-token
|
|
65
|
+
group. `@nadicodeai/design-system/css` provides the kept
|
|
64
66
|
`nc-*` page grammar, type scale, geometry, chat CSS components, motion, and
|
|
65
67
|
brand display components that many UI components compose.
|
|
66
68
|
|
|
@@ -71,7 +73,9 @@ needed. Do not add component-level Tailwind `dark:` utilities, OS dark-mode
|
|
|
71
73
|
branching, raw color literals, or raw palette utilities.
|
|
72
74
|
|
|
73
75
|
For Next.js App Router apps, place both imports in the root layout. The app still
|
|
74
|
-
owns its PostCSS setup
|
|
76
|
+
owns its PostCSS setup, theme provider, and persisted light/dark/system
|
|
77
|
+
preference. `ThemeModeSwitcher` is controlled and app-agnostic; the app decides
|
|
78
|
+
how to set `.dark` on the document. This package does not export a PostCSS config.
|
|
75
79
|
|
|
76
80
|
## Imports
|
|
77
81
|
|
|
@@ -128,12 +132,42 @@ Current product subpaths:
|
|
|
128
132
|
- `@nadicodeai/ui/components/installer-shell`
|
|
129
133
|
- `@nadicodeai/ui/components/plugin-slot-boundary`
|
|
130
134
|
- `@nadicodeai/ui/components/settings-section`
|
|
135
|
+
- `@nadicodeai/ui/components/theme-mode-switcher`
|
|
136
|
+
|
|
137
|
+
`StateNotice` (`@nadicodeai/ui/components/state-notice`) is the supported
|
|
138
|
+
low-level state-banner primitive behind `AgentMessageStateNotice` and
|
|
139
|
+
`AgentThreadStateBanner`. It owns the shared icon, required `title`, optional
|
|
140
|
+
description, and actions skeleton with `role="status"`/`role="alert"` semantics.
|
|
131
141
|
|
|
132
142
|
Recommended migration order is documented in
|
|
133
143
|
`docs/migration/nadia-consumer-readiness.md`: web admin or portal first,
|
|
134
144
|
installer second, desktop shell third, desktop chat last, and terminal/TUI
|
|
135
145
|
consumers through `docs/terminal-tui-semantics.md`.
|
|
136
146
|
|
|
147
|
+
## Layout primitives
|
|
148
|
+
|
|
149
|
+
`SeamGrid` is a supported low-level layout primitive: the single owner of the
|
|
150
|
+
"gap-as-seam" grid used by the bordered section grids (stats band, testimonials,
|
|
151
|
+
logo band, and siblings). It renders a `div` with the invariant `grid gap-px`
|
|
152
|
+
base and paints one hairline seam at every cell boundary, so borderless,
|
|
153
|
+
square-cornered cells never double a line.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import { SeamGrid } from "@nadicodeai/ui/components/seam-grid";
|
|
157
|
+
|
|
158
|
+
<SeamGrid surface="canvas" className="grid-cols-2 lg:grid-cols-4">
|
|
159
|
+
{/* borderless, square-cornered cells */}
|
|
160
|
+
</SeamGrid>;
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The only seam-specific prop is `surface`: `"canvas"` (default) paints the brand
|
|
164
|
+
`line` via `bg-border`; `"ink"` mixes the line toward the ink role for darker
|
|
165
|
+
panels. `surface` also lands on a `data-surface` attribute. Pass `className`,
|
|
166
|
+
`children`, and any `div` props to keep your own column map, heights, and
|
|
167
|
+
`data-*` attributes. The seam colour helper itself is an internal implementation
|
|
168
|
+
detail (no public subpath export); couple to `SeamGrid` and its `surface` prop,
|
|
169
|
+
not to the underlying arbitrary Tailwind class string.
|
|
170
|
+
|
|
137
171
|
## shadcn and AI Elements discovery
|
|
138
172
|
|
|
139
173
|
Use shadcn MCP or the CLI for live discovery and install guidance while working
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-band.d.ts","sourceRoot":"","sources":["../../src/components/action-band.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"action-band.d.ts","sourceRoot":"","sources":["../../src/components/action-band.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuC9B,KAAK,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACnD,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,iBAAS,UAAU,CAAC,EAClB,MAAgB,EAChB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,qBAsBjB;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW7B;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW3E;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW7E;AAED,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { SeamGrid } from "./seam-grid.js";
|
|
3
4
|
/**
|
|
4
5
|
* action-band — full-lane conversion stage for a final CTA or page-level ask.
|
|
5
6
|
*
|
|
@@ -22,7 +23,7 @@ function ActionBand({ active = "inset", className, children, style, ...props })
|
|
|
22
23
|
}, ...props, children: [_jsx("div", { className: "nc-stage-fill", "aria-hidden": "true" }), _jsx(ActionBandConnector, { edge: "start" }), _jsx("div", { className: "nc-stage-grid", children: _jsx("div", { className: "nc-stage-active", children: children }) }), _jsx(ActionBandConnector, { edge: "end" })] }));
|
|
23
24
|
}
|
|
24
25
|
function ActionBandContent({ className, ...props }) {
|
|
25
|
-
return (_jsx(
|
|
26
|
+
return (_jsx(SeamGrid, { "data-slot": "action-band-content", className: cn("min-w-0 lg:h-[var(--nc-h-action-band)] lg:grid-cols-12", className), ...props }));
|
|
26
27
|
}
|
|
27
28
|
function ActionBandCopy({ className, ...props }) {
|
|
28
29
|
return (_jsx("div", { "data-slot": "action-band-copy", className: cn("nc-panel-cell relative overflow-hidden !bg-[var(--nc-ink)] !text-[var(--nc-canvas)] lg:col-span-6", className), ...props }));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type AgentArtifactModel, type AgentRedactionRule } from "./artifact-panel";
|
|
3
3
|
import { type AgentApprovalChoice, type AgentToolApprovalRequest } from "./agent-tool-approval";
|
|
4
|
+
import { type AgentWorkState } from "../lib/agent-work-state";
|
|
4
5
|
export type AgentMessageRole = "user" | "assistant" | "system";
|
|
5
|
-
export type AgentWorkState
|
|
6
|
+
export type { AgentWorkState };
|
|
6
7
|
export type AgentMessageSourceKind = "human" | "agent" | "system" | "tool" | "runtime";
|
|
7
8
|
export type AgentMessageSourceMetadata = {
|
|
8
9
|
kind: AgentMessageSourceKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-message.d.ts","sourceRoot":"","sources":["../../src/components/agent-message.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-message.d.ts","sourceRoot":"","sources":["../../src/components/agent-message.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkC9B,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAA;AAIzC,OAAO,EAAqB,KAAK,c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AAW,CAAC,EAAE,oBAAoB,EAAE,CAAA;CACrC,4BA2BA;AAED,iBAAS,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAAE,4BAuB1E;AAkCD,iBAAS,aAAa,CAAC,EACrB,QAAQ,EACR,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gBAAgB,CAAC,EAAE,gCAAgC,CAAA;CACpD,qBAiDA;AA8ED,iBAAS,YAAY,CAAC,EACpB,OAAO,EACP,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,GAAG;IACrD,OAAO,EAAE,iBAAiB,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,oBAAoB,CAAC,EAAE,gCAAgC,CAAA;CACxD,qBA8DA;AAED,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,GACd,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { BotIcon, InfoIcon, UserIcon } from "lucide-react";
|
|
4
4
|
import { Attachment, AttachmentInfo, AttachmentPreview, Attachments, } from "./ai-elements/attachments.js";
|
|
5
5
|
import { Message, MessageContent, MessageResponse, } from "./ai-elements/message.js";
|
|
6
6
|
import { Reasoning, ReasoningContent, ReasoningTrigger, } from "./ai-elements/reasoning.js";
|
|
@@ -9,30 +9,24 @@ import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput, } from "./ai-elem
|
|
|
9
9
|
import { ArtifactPanel, RedactedNotice, StackTraceDisclosure, getAgentRedactionText, } from "./artifact-panel.js";
|
|
10
10
|
import { AgentToolApproval, } from "./agent-tool-approval.js";
|
|
11
11
|
import { Badge } from "./badge.js";
|
|
12
|
+
import { StateNotice } from "./state-notice.js";
|
|
12
13
|
import { agentAttachmentToData } from "../lib/agent-attachment.js";
|
|
14
|
+
import { statePresentation } from "../lib/agent-work-state.js";
|
|
13
15
|
import { cn } from "../lib/utils.js";
|
|
14
16
|
const roleIcons = {
|
|
15
17
|
assistant: BotIcon,
|
|
16
18
|
system: InfoIcon,
|
|
17
19
|
user: UserIcon,
|
|
18
20
|
};
|
|
19
|
-
const
|
|
20
|
-
empty: "Empty",
|
|
21
|
-
fatal: "Fatal",
|
|
22
|
-
idle: "Idle",
|
|
23
|
-
interrupted: "Interrupted",
|
|
24
|
-
"permission-denied": "Permission denied",
|
|
25
|
-
queued: "Queued",
|
|
26
|
-
retryable: "Retryable",
|
|
27
|
-
streaming: "Streaming",
|
|
28
|
-
};
|
|
29
|
-
const stateIcons = {
|
|
30
|
-
fatal: FileWarningIcon,
|
|
31
|
-
interrupted: AlertTriangleIcon,
|
|
32
|
-
"permission-denied": ShieldXIcon,
|
|
33
|
-
queued: ClockIcon,
|
|
34
|
-
retryable: RefreshCwIcon,
|
|
35
|
-
streaming: LoaderCircleIcon,
|
|
21
|
+
const stateMeta = {
|
|
22
|
+
empty: { label: "Empty" },
|
|
23
|
+
fatal: { label: "Fatal" },
|
|
24
|
+
idle: { label: "Idle" },
|
|
25
|
+
interrupted: { label: "Interrupted" },
|
|
26
|
+
"permission-denied": { label: "Permission denied" },
|
|
27
|
+
queued: { label: "Queued" },
|
|
28
|
+
retryable: { label: "Retryable" },
|
|
29
|
+
streaming: { label: "Streaming" },
|
|
36
30
|
};
|
|
37
31
|
const toolStatusToAiState = {
|
|
38
32
|
"approval-requested": "approval-requested",
|
|
@@ -44,8 +38,7 @@ const toolStatusToAiState = {
|
|
|
44
38
|
success: "output-available",
|
|
45
39
|
};
|
|
46
40
|
function AgentMessageStateNotice({ state, title, description, actions, }) {
|
|
47
|
-
|
|
48
|
-
return (_jsxs("div", { "data-slot": "agent-message-state", "data-agent-state": state, role: state === "fatal" || state === "permission-denied" ? "alert" : "status", className: "flex flex-wrap items-center gap-3 rounded-md border bg-muted/30 px-3 py-2 text-sm", children: [_jsx(Icon, { className: cn("size-4 text-muted-foreground", state === "streaming" && "animate-spin") }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium", children: title ?? stateLabels[state] }), description && (_jsx("div", { className: "text-muted-foreground", children: description }))] }), actions] }));
|
|
41
|
+
return (_jsx(StateNotice, { "data-slot": "agent-message-state", state: state, icon: statePresentation(state).icon, title: title ?? stateMeta[state].label, description: description, actions: actions, className: "rounded-md px-3 py-2" }));
|
|
49
42
|
}
|
|
50
43
|
function AgentAttachmentsList({ attachments, }) {
|
|
51
44
|
if (!attachments?.length) {
|
|
@@ -95,7 +88,7 @@ function AgentMessagePartView({ part, toolActions, onToolApprovalChoice, }) {
|
|
|
95
88
|
function AgentMessageMeta({ role, metadata, state, }) {
|
|
96
89
|
const Icon = roleIcons[role];
|
|
97
90
|
const label = metadata?.label ?? role;
|
|
98
|
-
return (_jsxs("div", { "data-slot": "agent-message-meta", className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [_jsx(Icon, { className: "size-3.5" }), _jsx("span", { className: "font-medium capitalize", children: label }), metadata?.model && _jsx(Badge, { variant: "outline", children: metadata.model }), metadata?.timestamp && _jsx("span", { children: metadata.timestamp }), state && state !== "idle" && (_jsx(Badge, { variant: "secondary", children:
|
|
91
|
+
return (_jsxs("div", { "data-slot": "agent-message-meta", className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [_jsx(Icon, { className: "size-3.5" }), _jsx("span", { className: "font-medium capitalize", children: label }), metadata?.model && _jsx(Badge, { variant: "outline", children: metadata.model }), metadata?.timestamp && _jsx("span", { children: metadata.timestamp }), state && state !== "idle" && (_jsx(Badge, { variant: "secondary", children: stateMeta[state].label }))] }));
|
|
99
92
|
}
|
|
100
93
|
function AgentMessage({ message, toolActions, retryAction, onToolApprovalChoice, className, ...props }) {
|
|
101
94
|
const parts = message.parts ??
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-thread.d.ts","sourceRoot":"","sources":["../../src/components/agent-thread.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-thread.d.ts","sourceRoot":"","sources":["../../src/components/agent-thread.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,YAAY,EAEb,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gCAAgC,EACrC,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAA;AAMnC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAsCD,iBAAS,sBAAsB,CAAC,EAC9B,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,GACR,EAAE,oBAAoB,GAAG;IACxB,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;CACjD,qBAcA;AAED,iBAAS,qBAAqB,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,OAAO,GACR,EAAE,oBAAoB,qBAYtB;AAiBD,iBAAS,WAAW,CAAC,EACnB,QAAQ,EACR,KAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,WAA2C,EAC3C,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,UAAU,CAAC,GAAG;IAC/D,QAAQ,EAAE,iBAAiB,EAAE,CAAA;IAC7B,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAA;IAClF,UAAU,CAAC,EAAE,oBAAoB,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,oBAAoB,CAAC,EAAE,gCAAgC,CAAA;IACvD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,qBAqDA;AAED,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -1,52 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { AlertTriangleIcon, ClockIcon, FileWarningIcon, LoaderCircleIcon, RefreshCwIcon, ShieldXIcon, } from "lucide-react";
|
|
4
3
|
import { Conversation, ConversationContent, } from "./ai-elements/conversation.js";
|
|
5
4
|
import { AgentMessage, } from "./agent-message.js";
|
|
6
5
|
import { FeedbackState } from "./feedback-state.js";
|
|
6
|
+
import { StateNotice } from "./state-notice.js";
|
|
7
|
+
import { statePresentation } from "../lib/agent-work-state.js";
|
|
7
8
|
import { cn } from "../lib/utils.js";
|
|
8
9
|
const threadStateDefaults = {
|
|
9
10
|
empty: {
|
|
10
11
|
description: "Start with a prompt or queue an agent task.",
|
|
11
|
-
icon: ClockIcon,
|
|
12
12
|
title: "No agent messages",
|
|
13
13
|
},
|
|
14
14
|
fatal: {
|
|
15
15
|
description: "The consuming app should show its recovery action here.",
|
|
16
|
-
icon: FileWarningIcon,
|
|
17
16
|
title: "Unable to continue",
|
|
18
17
|
},
|
|
19
18
|
interrupted: {
|
|
20
19
|
description: "The current run stopped before the agent finished.",
|
|
21
|
-
icon: AlertTriangleIcon,
|
|
22
20
|
title: "Run interrupted",
|
|
23
21
|
},
|
|
24
22
|
"permission-denied": {
|
|
25
23
|
description: "This session cannot access the requested action or content.",
|
|
26
|
-
icon: ShieldXIcon,
|
|
27
24
|
title: "Permission denied",
|
|
28
25
|
},
|
|
29
26
|
queued: {
|
|
30
27
|
description: "The next agent step is waiting for capacity or approval.",
|
|
31
|
-
icon: ClockIcon,
|
|
32
28
|
title: "Queued",
|
|
33
29
|
},
|
|
34
30
|
retryable: {
|
|
35
31
|
description: "The run can be attempted again by the consuming app.",
|
|
36
|
-
icon: RefreshCwIcon,
|
|
37
32
|
title: "Retry available",
|
|
38
33
|
},
|
|
39
34
|
streaming: {
|
|
40
35
|
description: "The assistant is preparing a response.",
|
|
41
|
-
icon: LoaderCircleIcon,
|
|
42
36
|
title: "Streaming",
|
|
43
37
|
},
|
|
44
38
|
};
|
|
45
39
|
const defaultMaxAgentThreadMessages = 50;
|
|
46
40
|
function AgentThreadStateBanner({ state, title, description, actions, }) {
|
|
47
41
|
const fallback = threadStateDefaults[state];
|
|
48
|
-
|
|
49
|
-
return (_jsxs("div", { "data-slot": "agent-thread-state", "data-agent-state": state, role: state === "fatal" || state === "permission-denied" ? "alert" : "status", className: "flex flex-wrap items-center gap-3 rounded-lg border bg-muted/30 px-4 py-3 text-sm", children: [_jsx(Icon, { className: cn("size-4 text-muted-foreground", state === "streaming" && "animate-spin") }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium", children: title ?? fallback.title }), _jsx("div", { className: "text-muted-foreground", children: description ?? fallback.description })] }), actions] }));
|
|
42
|
+
return (_jsx(StateNotice, { "data-slot": "agent-thread-state", state: state, icon: statePresentation(state).icon, title: title ?? fallback.title, description: description ?? fallback.description, actions: actions, className: "rounded-lg px-4 py-3" }));
|
|
50
43
|
}
|
|
51
44
|
function AgentThreadEmptyState({ title, description, actions, }) {
|
|
52
45
|
return (_jsx(FeedbackState, { "data-slot": "agent-thread-empty-state", status: "empty", title: title ?? threadStateDefaults.empty.title, description: description ?? threadStateDefaults.empty.description, actions: actions, compact: true, className: "min-h-56 rounded-lg bg-muted/20" }));
|
|
@@ -2,15 +2,22 @@ import { Button } from "../button";
|
|
|
2
2
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select";
|
|
3
3
|
import type { ComponentProps, HTMLAttributes } from "react";
|
|
4
4
|
import type { BundledLanguage, ThemedToken } from "shiki";
|
|
5
|
+
type CodeThemeToken = ThemedToken & {
|
|
6
|
+
darkBgColor?: string;
|
|
7
|
+
darkColor?: string;
|
|
8
|
+
darkFontStyle?: ThemedToken["fontStyle"];
|
|
9
|
+
};
|
|
5
10
|
type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
11
|
code: string;
|
|
7
12
|
language: BundledLanguage;
|
|
8
13
|
showLineNumbers?: boolean;
|
|
9
14
|
};
|
|
10
15
|
interface TokenizedCode {
|
|
11
|
-
tokens:
|
|
16
|
+
tokens: CodeThemeToken[][];
|
|
12
17
|
fg: string;
|
|
13
18
|
bg: string;
|
|
19
|
+
darkFg: string;
|
|
20
|
+
darkBg: string;
|
|
14
21
|
}
|
|
15
22
|
export declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void) => TokenizedCode | null;
|
|
16
23
|
export declare const CodeBlockContainer: ({ className, language, style, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,cAAc,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAC;AAW3E,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,cAAc,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAC;AAW3E,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,EAEZ,MAAM,OAAO,CAAC;AAYf,KAAK,cAAc,GAAG,WAAW,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAC;AAsGF,KAAK,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,UAAU,aAAa;IACrB,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAsFD,eAAO,MA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,cAAc,CAChE,OAAO,aAAa,CACrB,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,yBAG9C,qCAAqC,gCASvC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,cAAc,CAC9D,OAAO,WAAW,CACnB,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,OAAO,mCAAmC,gCACb,CAAC;AAEhC,MAAM,MAAM,qCAAqC,GAAG,cAAc,CAChE,OAAO,aAAa,CACrB,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,qBAG9C,qCAAqC,gCAEvC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,cAAc,CAC7D,OAAO,UAAU,CAClB,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,gCACb,CAAC"}
|
|
@@ -21,15 +21,45 @@ const addKeysToTokens = (lines) => lines.map((line, lineIdx) => ({
|
|
|
21
21
|
token,
|
|
22
22
|
})),
|
|
23
23
|
}));
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const tokenStyle = (token) => {
|
|
25
|
+
const htmlStyle = { ...token.htmlStyle };
|
|
26
|
+
delete htmlStyle.background;
|
|
27
|
+
delete htmlStyle.backgroundColor;
|
|
28
|
+
delete htmlStyle.color;
|
|
29
|
+
delete htmlStyle.fontStyle;
|
|
30
|
+
delete htmlStyle.fontWeight;
|
|
31
|
+
delete htmlStyle.textDecoration;
|
|
32
|
+
const darkFontStyle = token.darkFontStyle ?? token.fontStyle;
|
|
33
|
+
return {
|
|
34
|
+
...htmlStyle,
|
|
35
|
+
"--shiki-code-token-dark-bg": token.darkBgColor ?? token.bgColor,
|
|
36
|
+
"--shiki-code-token-dark-color": token.darkColor ?? token.color,
|
|
37
|
+
"--shiki-code-token-dark-font-style": isItalic(darkFontStyle)
|
|
38
|
+
? "italic"
|
|
39
|
+
: "normal",
|
|
40
|
+
"--shiki-code-token-dark-font-weight": isBold(darkFontStyle)
|
|
41
|
+
? "bold"
|
|
42
|
+
: "normal",
|
|
43
|
+
"--shiki-code-token-dark-text-decoration": isUnderline(darkFontStyle)
|
|
44
|
+
? "underline"
|
|
45
|
+
: "none",
|
|
46
|
+
"--shiki-code-token-light-bg": token.bgColor,
|
|
47
|
+
"--shiki-code-token-light-color": token.color,
|
|
48
|
+
"--shiki-code-token-light-font-style": isItalic(token.fontStyle)
|
|
49
|
+
? "italic"
|
|
50
|
+
: "normal",
|
|
51
|
+
"--shiki-code-token-light-font-weight": isBold(token.fontStyle)
|
|
52
|
+
? "bold"
|
|
53
|
+
: "normal",
|
|
54
|
+
"--shiki-code-token-light-text-decoration": isUnderline(token.fontStyle)
|
|
55
|
+
? "underline"
|
|
56
|
+
: "none",
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
// Syntax colors are resolved by the shared UI globals stylesheet so light/dark
|
|
60
|
+
// can switch without re-tokenizing. Importing that stylesheet is part of the
|
|
61
|
+
// package contract for CodeBlock consumers.
|
|
62
|
+
const TokenSpan = ({ token }) => (_jsx("span", { "data-nc-code-token": "", style: tokenStyle(token), children: token.content }));
|
|
33
63
|
// Line number styles using CSS counters
|
|
34
64
|
const LINE_NUMBER_CLASSES = cn("block", "before:content-[counter(line)]", "before:inline-block", "before:[counter-increment:line]", "before:w-8", "before:mr-4", "before:text-right", "before:text-muted-foreground/50", "before:font-mono", "before:select-none");
|
|
35
65
|
// Line rendering component
|
|
@@ -58,14 +88,31 @@ const getHighlighter = (language) => {
|
|
|
58
88
|
}
|
|
59
89
|
const highlighterPromise = createHighlighter({
|
|
60
90
|
langs: [language],
|
|
61
|
-
themes: ["github-light"],
|
|
91
|
+
themes: ["github-light", "github-dark"],
|
|
62
92
|
});
|
|
63
93
|
highlighterCache.set(language, highlighterPromise);
|
|
64
94
|
return highlighterPromise;
|
|
65
95
|
};
|
|
96
|
+
const tokenFromThemeVariants = (token) => {
|
|
97
|
+
const light = token.variants.light ?? {};
|
|
98
|
+
const dark = token.variants.dark ?? light;
|
|
99
|
+
return {
|
|
100
|
+
bgColor: light.bgColor,
|
|
101
|
+
color: light.color,
|
|
102
|
+
content: token.content,
|
|
103
|
+
darkBgColor: dark.bgColor,
|
|
104
|
+
darkColor: dark.color,
|
|
105
|
+
darkFontStyle: dark.fontStyle,
|
|
106
|
+
fontStyle: light.fontStyle,
|
|
107
|
+
htmlStyle: light.htmlStyle,
|
|
108
|
+
offset: token.offset,
|
|
109
|
+
};
|
|
110
|
+
};
|
|
66
111
|
// Create raw tokens for immediate display while highlighting loads
|
|
67
112
|
const createRawTokens = (code) => ({
|
|
68
113
|
bg: "transparent",
|
|
114
|
+
darkBg: "transparent",
|
|
115
|
+
darkFg: "inherit",
|
|
69
116
|
fg: "inherit",
|
|
70
117
|
tokens: code.split("\n").map((line) => line === ""
|
|
71
118
|
? []
|
|
@@ -73,6 +120,8 @@ const createRawTokens = (code) => ({
|
|
|
73
120
|
{
|
|
74
121
|
color: "inherit",
|
|
75
122
|
content: line,
|
|
123
|
+
darkColor: "inherit",
|
|
124
|
+
darkFontStyle: undefined,
|
|
76
125
|
},
|
|
77
126
|
]),
|
|
78
127
|
});
|
|
@@ -99,14 +148,21 @@ callback) => {
|
|
|
99
148
|
.then((highlighter) => {
|
|
100
149
|
const availableLangs = highlighter.getLoadedLanguages();
|
|
101
150
|
const langToUse = availableLangs.includes(language) ? language : "text";
|
|
102
|
-
const
|
|
151
|
+
const tokens = highlighter.codeToTokensWithThemes(code, {
|
|
103
152
|
lang: langToUse,
|
|
104
|
-
|
|
153
|
+
themes: {
|
|
154
|
+
dark: "github-dark",
|
|
155
|
+
light: "github-light",
|
|
156
|
+
},
|
|
105
157
|
});
|
|
158
|
+
const lightTheme = highlighter.getTheme("github-light");
|
|
159
|
+
const darkTheme = highlighter.getTheme("github-dark");
|
|
106
160
|
const tokenized = {
|
|
107
|
-
bg:
|
|
108
|
-
|
|
109
|
-
|
|
161
|
+
bg: lightTheme.bg ?? "transparent",
|
|
162
|
+
darkBg: darkTheme.bg ?? "transparent",
|
|
163
|
+
darkFg: darkTheme.fg ?? "inherit",
|
|
164
|
+
fg: lightTheme.fg ?? "inherit",
|
|
165
|
+
tokens: tokens.map((line) => line.map(tokenFromThemeVariants)),
|
|
110
166
|
};
|
|
111
167
|
// Cache the result
|
|
112
168
|
tokensCache.set(tokensCacheKey, tokenized);
|
|
@@ -128,11 +184,13 @@ callback) => {
|
|
|
128
184
|
};
|
|
129
185
|
const CodeBlockBody = memo(({ tokenized, showLineNumbers, className, }) => {
|
|
130
186
|
const preStyle = useMemo(() => ({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
187
|
+
"--shiki-code-block-dark-bg": tokenized.darkBg,
|
|
188
|
+
"--shiki-code-block-dark-fg": tokenized.darkFg,
|
|
189
|
+
"--shiki-code-block-light-bg": tokenized.bg,
|
|
190
|
+
"--shiki-code-block-light-fg": tokenized.fg,
|
|
191
|
+
}), [tokenized.bg, tokenized.darkBg, tokenized.darkFg, tokenized.fg]);
|
|
134
192
|
const keyedLines = useMemo(() => addKeysToTokens(tokenized.tokens), [tokenized.tokens]);
|
|
135
|
-
return (_jsx("pre", { className: cn("m-0 p-4 text-sm", className), style: preStyle, children: _jsx("code", { className: cn("font-mono text-sm", showLineNumbers && "[counter-increment:line_0] [counter-reset:line]"), children: keyedLines.map((keyedLine) => (_jsx(LineSpan, { keyedLine: keyedLine, showLineNumbers: showLineNumbers }, keyedLine.key))) }) }));
|
|
193
|
+
return (_jsx("pre", { className: cn("m-0 p-4 text-sm", className), "data-nc-code-block-body": "", style: preStyle, children: _jsx("code", { className: cn("font-mono text-sm", showLineNumbers && "[counter-increment:line_0] [counter-reset:line]"), children: keyedLines.map((keyedLine) => (_jsx(LineSpan, { keyedLine: keyedLine, showLineNumbers: showLineNumbers }, keyedLine.key))) }) }));
|
|
136
194
|
}, (prevProps, nextProps) => prevProps.tokenized === nextProps.tokenized &&
|
|
137
195
|
prevProps.showLineNumbers === nextProps.showLineNumbers &&
|
|
138
196
|
prevProps.className === nextProps.className);
|
|
@@ -26,7 +26,7 @@ export declare const ModelSelectorShortcut: (props: ModelSelectorShortcutProps)
|
|
|
26
26
|
export type ModelSelectorSeparatorProps = ComponentProps<typeof CommandSeparator>;
|
|
27
27
|
export declare const ModelSelectorSeparator: (props: ModelSelectorSeparatorProps) => import("react").JSX.Element;
|
|
28
28
|
export type ModelSelectorLogoProps = Omit<ComponentProps<"img">, "src" | "alt"> & {
|
|
29
|
-
provider: "moonshotai-cn" | "lucidquery" | "moonshotai" | "zai-coding-plan" | "alibaba" | "xai" | "vultr" | "nvidia" | "upstage" | "groq" | "github-copilot" | "mistral" | "vercel" | "nebius" | "deepseek" | "alibaba-cn" | "google-vertex-anthropic" | "venice" | "chutes" | "cortecs" | "github-models" | "togetherai" | "azure" | "baseten" | "huggingface" | "opencode" | "fastrouter" | "google" | "google-vertex" | "cloudflare-workers-ai" | "inception" | "wandb" | "openai" | "zhipuai-coding-plan" | "perplexity" | "openrouter" | "zenmux" | "
|
|
29
|
+
provider: "moonshotai-cn" | "lucidquery" | "moonshotai" | "zai-coding-plan" | "alibaba" | "xai" | "vultr" | "nvidia" | "upstage" | "groq" | "github-copilot" | "mistral" | "vercel" | "nebius" | "deepseek" | "alibaba-cn" | "google-vertex-anthropic" | "venice" | "chutes" | "cortecs" | "github-models" | "togetherai" | "azure" | "baseten" | "huggingface" | "opencode" | "fastrouter" | "google" | "google-vertex" | "cloudflare-workers-ai" | "inception" | "wandb" | "openai" | "zhipuai-coding-plan" | "perplexity" | "openrouter" | "zenmux" | "iflowcn" | "synthetic" | "deepinfra" | "zhipuai" | "submodel" | "zai" | "inference" | "requesty" | "morph" | "lmstudio" | "anthropic" | "aihubmix" | "fireworks-ai" | "modelscope" | "llama" | "scaleway" | "amazon-bedrock" | "cerebras" | (string & {});
|
|
30
30
|
};
|
|
31
31
|
export declare const ModelSelectorLogo: ({ provider, className, ...props }: ModelSelectorLogoProps) => import("react").JSX.Element;
|
|
32
32
|
export type ModelSelectorLogoGroupProps = ComponentProps<"div">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-selector.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/model-selector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,MAAM,EACN,aAAa,EAEb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,gCAEtD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,gCAEpE,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAC7E,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,0CAKlC,yBAAyB,gCAc3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,gCAElE,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,kBAAkB,GAAI,yBAGhC,uBAAuB,gCAEzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,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QAAQ,GACR,SAAS,GACT,WAAW,GACX,WAAW,GACX,SAAS,GACT,UAAU,GACV,KAAK,GACL,WAAW,GACX,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,cAAc,GACd,YAAY,GACZ,OAAO,GACP,UAAU,GACV,gBAAgB,GAChB,UAAU,GAEV,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,sBAAsB,gCASxB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEhE,eAAO,MAAM,sBAAsB,GAAI,yBAGpC,2BAA2B,gCAQ7B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,sBAAsB,gCAExB,CAAC"}
|
|
@@ -22,8 +22,6 @@ export type OpenInT3Props = ComponentProps<typeof DropdownMenuItem>;
|
|
|
22
22
|
export declare const OpenInT3: (props: OpenInT3Props) => import("react").JSX.Element;
|
|
23
23
|
export type OpenInSciraProps = ComponentProps<typeof DropdownMenuItem>;
|
|
24
24
|
export declare const OpenInScira: (props: OpenInSciraProps) => import("react").JSX.Element;
|
|
25
|
-
export type OpenInv0Props = ComponentProps<typeof DropdownMenuItem>;
|
|
26
|
-
export declare const OpenInv0: (props: OpenInv0Props) => import("react").JSX.Element;
|
|
27
25
|
export type OpenInCursorProps = ComponentProps<typeof DropdownMenuItem>;
|
|
28
26
|
export declare const OpenInCursor: (props: OpenInCursorProps) => import("react").JSX.Element;
|
|
29
27
|
//# sourceMappingURL=open-in-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-in-chat.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/open-in-chat.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACn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;AAyBF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEzE,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,gCAEtD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,gCAEpD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,gCAE5C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvE,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,gCAElD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,gCAEpD,CAAC"}
|
|
@@ -49,13 +49,6 @@ const providers = {
|
|
|
49
49
|
icon: _jsx(MessageCircleIcon, {}),
|
|
50
50
|
title: "Open in T3 Chat",
|
|
51
51
|
},
|
|
52
|
-
v0: {
|
|
53
|
-
createUrl: (q) => `https://v0.app?${new URLSearchParams({
|
|
54
|
-
q,
|
|
55
|
-
})}`,
|
|
56
|
-
icon: (_jsxs("svg", { fill: "currentColor", viewBox: "0 0 147 70", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("title", { children: "v0" }), _jsx("path", { d: "M56 50.2031V14H70V60.1562C70 65.5928 65.5928 70 60.1562 70C57.5605 70 54.9982 68.9992 53.1562 67.1573L0 14H19.7969L56 50.2031Z" }), _jsx("path", { d: "M147 56H133V23.9531L100.953 56H133V70H96.6875C85.8144 70 77 61.1856 77 50.3125V14H91V46.1562L123.156 14H91V0H127.312C138.186 0 147 8.81439 147 19.6875V56Z" })] })),
|
|
57
|
-
title: "Open in v0",
|
|
58
|
-
},
|
|
59
52
|
};
|
|
60
53
|
const OpenInContext = createContext(undefined);
|
|
61
54
|
const useOpenInContext = () => {
|
|
@@ -74,27 +67,12 @@ export const OpenInItem = (props) => (_jsx(DropdownMenuItem, { ...props }));
|
|
|
74
67
|
export const OpenInLabel = (props) => (_jsx(DropdownMenuLabel, { ...props }));
|
|
75
68
|
export const OpenInSeparator = (props) => (_jsx(DropdownMenuSeparator, { ...props }));
|
|
76
69
|
export const OpenInTrigger = ({ children, ...props }) => (_jsx(DropdownMenuTrigger, { ...props, asChild: true, children: children ?? (_jsxs(Button, { type: "button", variant: "outline", children: ["Open in chat", _jsx(ChevronDownIcon, { className: "size-4" })] })) }));
|
|
77
|
-
|
|
78
|
-
const { query } = useOpenInContext();
|
|
79
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.chatgpt.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.chatgpt.icon }), _jsx("span", { className: "flex-1", children: providers.chatgpt.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
80
|
-
};
|
|
81
|
-
export const OpenInClaude = (props) => {
|
|
82
|
-
const { query } = useOpenInContext();
|
|
83
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.claude.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.claude.icon }), _jsx("span", { className: "flex-1", children: providers.claude.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
84
|
-
};
|
|
85
|
-
export const OpenInT3 = (props) => {
|
|
86
|
-
const { query } = useOpenInContext();
|
|
87
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.t3.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.t3.icon }), _jsx("span", { className: "flex-1", children: providers.t3.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
88
|
-
};
|
|
89
|
-
export const OpenInScira = (props) => {
|
|
90
|
-
const { query } = useOpenInContext();
|
|
91
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.scira.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.scira.icon }), _jsx("span", { className: "flex-1", children: providers.scira.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
92
|
-
};
|
|
93
|
-
export const OpenInv0 = (props) => {
|
|
94
|
-
const { query } = useOpenInContext();
|
|
95
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.v0.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.v0.icon }), _jsx("span", { className: "flex-1", children: providers.v0.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
96
|
-
};
|
|
97
|
-
export const OpenInCursor = (props) => {
|
|
70
|
+
const OpenInProviderItem = ({ provider, ...props }) => {
|
|
98
71
|
const { query } = useOpenInContext();
|
|
99
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.
|
|
72
|
+
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers[provider].createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers[provider].icon }), _jsx("span", { className: "flex-1", children: providers[provider].title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
100
73
|
};
|
|
74
|
+
export const OpenInChatGPT = (props) => (_jsx(OpenInProviderItem, { provider: "chatgpt", ...props }));
|
|
75
|
+
export const OpenInClaude = (props) => (_jsx(OpenInProviderItem, { provider: "claude", ...props }));
|
|
76
|
+
export const OpenInT3 = (props) => (_jsx(OpenInProviderItem, { provider: "t3", ...props }));
|
|
77
|
+
export const OpenInScira = (props) => (_jsx(OpenInProviderItem, { provider: "scira", ...props }));
|
|
78
|
+
export const OpenInCursor = (props) => (_jsx(OpenInProviderItem, { provider: "cursor", ...props }));
|