@kitn.ai/ui 0.28.0 → 0.29.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/README.md +1 -1
- package/dist/agent-tooling/construct/public.d.ts +15 -0
- package/dist/agent-tooling/construct/schema.d.ts +111 -0
- package/dist/construct-cli.es.js +3 -3
- package/dist/construct.d.ts +5 -0
- package/dist/construct.js +327 -0
- package/dist/core-C8fzo39E.js +1 -12
- package/dist/engine-javascript-C1x7zo1_.js +1 -141
- package/dist/mcp.es.js +1 -1
- package/package.json +16 -16
- package/bin/route.test.js +0 -58
- package/src/agent-tooling/README.md +0 -192
- package/src/agent-tooling/archetypes.ts +0 -205
- package/src/agent-tooling/catalog/README.md +0 -676
- package/src/agent-tooling/catalog/catalog-types.ts +0 -231
- package/src/agent-tooling/catalog/fabrications.ts +0 -96
- package/src/agent-tooling/catalog/invariants.ts +0 -284
- package/src/agent-tooling/catalog/labs-titles.ts +0 -114
- package/src/agent-tooling/catalog/scenarios.ts +0 -87
- package/src/agent-tooling/catalog/surfaces.ts +0 -347
- package/src/agent-tooling/construct/cli-entry.ts +0 -8
- package/src/agent-tooling/construct/cli.ts +0 -147
- package/src/agent-tooling/construct/codegen.ts +0 -1635
- package/src/agent-tooling/construct/construct.v1.schema.json +0 -319
- package/src/agent-tooling/construct/dev.ts +0 -148
- package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +0 -7
- package/src/agent-tooling/construct/fixtures/ops-console.construct.json +0 -44
- package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +0 -32
- package/src/agent-tooling/construct/schema.ts +0 -452
- package/src/agent-tooling/integrations/anthropic.ts +0 -442
- package/src/agent-tooling/integrations/cloudflare.ts +0 -218
- package/src/agent-tooling/integrations/langgraph.ts +0 -133
- package/src/agent-tooling/integrations/mastra.ts +0 -182
- package/src/agent-tooling/integrations/mock.ts +0 -148
- package/src/agent-tooling/integrations/ollama.ts +0 -97
- package/src/agent-tooling/integrations/openai.ts +0 -95
- package/src/agent-tooling/integrations/openrouter.ts +0 -82
- package/src/agent-tooling/integrations/pi.ts +0 -176
- package/src/agent-tooling/integrations/pydantic-ai.ts +0 -108
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +0 -398
- package/src/agent-tooling/mcp/css-raw.d.ts +0 -12
- package/src/agent-tooling/mcp/manifest.ts +0 -422
- package/src/agent-tooling/mcp/server.ts +0 -116
- package/src/agent-tooling/mcp/stdio.ts +0 -18
- package/src/agent-tooling/mcp/tools/construct.ts +0 -130
- package/src/agent-tooling/mcp/tools/debug.ts +0 -621
- package/src/agent-tooling/mcp/tools/reference.ts +0 -980
- package/src/agent-tooling/mcp/tools/scaffold.ts +0 -6708
- package/src/agent-tooling/mcp/tools/theme.ts +0 -456
- package/src/agent-tooling/mcp/tools/types.ts +0 -14
- package/src/agent-tooling/mcp/validate-args.ts +0 -141
- package/src/agent-tooling/recipes/composed-thread.ts +0 -714
- package/src/agent-tooling/recipes/index.ts +0 -22
- package/src/agent-tooling/recipes/types.ts +0 -32
- package/src/agent-tooling/registry.ts +0 -132
- package/src/agent-tooling/route-emit.ts +0 -305
- package/src/agent-tooling/types.ts +0 -390
- package/src/components/artifact-card.tsx +0 -120
- package/src/components/artifact.tsx +0 -914
- package/src/components/attachment-types.ts +0 -66
- package/src/components/attachments.tsx +0 -536
- package/src/components/audio-visualizer/audio-visualizer.voice-fixture.ts +0 -257
- package/src/components/audio-visualizer/aurora.glsl.ts +0 -330
- package/src/components/audio-visualizer/fit-scale.ts +0 -112
- package/src/components/audio-visualizer/index.tsx +0 -528
- package/src/components/audio-visualizer/labs/lab-choreography.ts +0 -187
- package/src/components/audio-visualizer/labs/lab-shaders.ts +0 -363
- package/src/components/audio-visualizer/labs/lab-visualizer.tsx +0 -102
- package/src/components/audio-visualizer/shader-canvas.tsx +0 -876
- package/src/components/audio-visualizer/sizes.ts +0 -54
- package/src/components/audio-visualizer/variant-aurora.tsx +0 -305
- package/src/components/audio-visualizer/variant-bar.tsx +0 -175
- package/src/components/audio-visualizer/variant-custom.tsx +0 -344
- package/src/components/audio-visualizer/variant-grid.tsx +0 -175
- package/src/components/audio-visualizer/variant-radial.tsx +0 -163
- package/src/components/audio-visualizer/variant-wave.tsx +0 -130
- package/src/components/audio-visualizer/wave.glsl.ts +0 -130
- package/src/components/card-fallback.tsx +0 -60
- package/src/components/card-renderer.tsx +0 -220
- package/src/components/card.tsx +0 -212
- package/src/components/chain-of-thought.tsx +0 -348
- package/src/components/chat-container.tsx +0 -89
- package/src/components/chat-scope-picker.tsx +0 -57
- package/src/components/chat-thread.tsx +0 -1014
- package/src/components/checkpoint.tsx +0 -88
- package/src/components/choice-card.tsx +0 -743
- package/src/components/coachmark.tsx +0 -249
- package/src/components/code-block.tsx +0 -181
- package/src/components/composer-dom.ts +0 -159
- package/src/components/composer-highlight.ts +0 -242
- package/src/components/composer-history.ts +0 -82
- package/src/components/composer.tsx +0 -1075
- package/src/components/confirm-card.tsx +0 -402
- package/src/components/context.tsx +0 -377
- package/src/components/conversation-item.tsx +0 -241
- package/src/components/conversation-list.tsx +0 -429
- package/src/components/conversation-panel.tsx +0 -118
- package/src/components/dismissed-stub.tsx +0 -80
- package/src/components/embed.tsx +0 -200
- package/src/components/empty.tsx +0 -177
- package/src/components/feedback-bar.tsx +0 -166
- package/src/components/file-tree.tsx +0 -530
- package/src/components/file-upload.tsx +0 -167
- package/src/components/form-widgets.tsx +0 -525
- package/src/components/form.tsx +0 -1296
- package/src/components/home-panel.tsx +0 -159
- package/src/components/image.tsx +0 -65
- package/src/components/link-preview.tsx +0 -195
- package/src/components/loader.tsx +0 -367
- package/src/components/markdown.tsx +0 -162
- package/src/components/message-skills.tsx +0 -40
- package/src/components/message.tsx +0 -765
- package/src/components/model-switcher.tsx +0 -132
- package/src/components/prompt-input.tsx +0 -188
- package/src/components/prompt-suggestion.tsx +0 -150
- package/src/components/reasoning.tsx +0 -293
- package/src/components/response-compare-types.ts +0 -152
- package/src/components/response-compare.tsx +0 -455
- package/src/components/response-stream.tsx +0 -109
- package/src/components/screen.tsx +0 -181
- package/src/components/scroll-button.tsx +0 -93
- package/src/components/source.tsx +0 -192
- package/src/components/tasks-card.tsx +0 -801
- package/src/components/text-shimmer.tsx +0 -37
- package/src/components/thinking-bar.tsx +0 -50
- package/src/components/thread.tsx +0 -228
- package/src/components/toast.tsx +0 -503
- package/src/components/tool-classify.ts +0 -26
- package/src/components/tool-types.ts +0 -49
- package/src/components/tool.tsx +0 -190
- package/src/components/use-card-resolution.ts +0 -44
- package/src/components/voice-input.tsx +0 -222
- package/src/components/voice-output.tsx +0 -242
- package/src/components/widget-tab-bar.tsx +0 -73
- package/src/components/workspace-shell.tsx +0 -285
- package/src/diagnostics/hook.ts +0 -352
- package/src/diagnostics/index.ts +0 -82
- package/src/diagnostics/report-request.ts +0 -296
- package/src/elements/agent-card.tsx +0 -67
- package/src/elements/artifact.tsx +0 -194
- package/src/elements/attachments.tsx +0 -140
- package/src/elements/audio-visualizer.tsx +0 -227
- package/src/elements/autoloader.ts +0 -89
- package/src/elements/avatar.tsx +0 -33
- package/src/elements/badge.tsx +0 -32
- package/src/elements/button.tsx +0 -149
- package/src/elements/card.tsx +0 -133
- package/src/elements/cards.tsx +0 -266
- package/src/elements/chain-of-thought.tsx +0 -141
- package/src/elements/chat-scope-picker.tsx +0 -65
- package/src/elements/chat-types.ts +0 -102
- package/src/elements/chat-workspace.tsx +0 -188
- package/src/elements/chat.tsx +0 -304
- package/src/elements/checkbox-group.tsx +0 -164
- package/src/elements/checkbox.tsx +0 -134
- package/src/elements/checkpoint.tsx +0 -47
- package/src/elements/choice.tsx +0 -100
- package/src/elements/coachmark.tsx +0 -90
- package/src/elements/code-block.tsx +0 -60
- package/src/elements/command.tsx +0 -197
- package/src/elements/compare.tsx +0 -111
- package/src/elements/compiled.css +0 -2
- package/src/elements/composer.tsx +0 -162
- package/src/elements/confirm-card.tsx +0 -76
- package/src/elements/context-meter.tsx +0 -107
- package/src/elements/conversation-item.tsx +0 -120
- package/src/elements/conversation-list.tsx +0 -203
- package/src/elements/css.ts +0 -5
- package/src/elements/default-input.tsx +0 -392
- package/src/elements/define-entry.ts +0 -12
- package/src/elements/define.tsx +0 -563
- package/src/elements/diagnostic-events.ts +0 -114
- package/src/elements/dialog.tsx +0 -145
- package/src/elements/disclosure.ts +0 -95
- package/src/elements/dock.tsx +0 -215
- package/src/elements/dropdown.tsx +0 -123
- package/src/elements/editable-label.tsx +0 -140
- package/src/elements/element-data-types.ts +0 -152
- package/src/elements/element-diagnostics.ts +0 -392
- package/src/elements/element-manifest.json +0 -354
- package/src/elements/element-nonscalar.json +0 -187
- package/src/elements/element-types.d.ts +0 -4353
- package/src/elements/embed.tsx +0 -35
- package/src/elements/empty.tsx +0 -29
- package/src/elements/feedback-bar.tsx +0 -66
- package/src/elements/file-tree.tsx +0 -62
- package/src/elements/file-upload.tsx +0 -44
- package/src/elements/form.tsx +0 -94
- package/src/elements/hover-card.tsx +0 -80
- package/src/elements/icon.tsx +0 -41
- package/src/elements/image.tsx +0 -32
- package/src/elements/input.tsx +0 -492
- package/src/elements/kbd.tsx +0 -45
- package/src/elements/link-preview.tsx +0 -34
- package/src/elements/loader.tsx +0 -25
- package/src/elements/markdown.tsx +0 -38
- package/src/elements/menu.tsx +0 -241
- package/src/elements/message-skills.tsx +0 -83
- package/src/elements/message.tsx +0 -361
- package/src/elements/model-switcher.tsx +0 -121
- package/src/elements/nav.tsx +0 -87
- package/src/elements/notice.tsx +0 -53
- package/src/elements/pane-grid.tsx +0 -111
- package/src/elements/pane-group.tsx +0 -119
- package/src/elements/pane.tsx +0 -129
- package/src/elements/popover.tsx +0 -81
- package/src/elements/progress-bar.tsx +0 -39
- package/src/elements/prompt-dock.tsx +0 -82
- package/src/elements/prompt-input.tsx +0 -240
- package/src/elements/prompt-suggestions.tsx +0 -113
- package/src/elements/radio-group.tsx +0 -129
- package/src/elements/reasoning.tsx +0 -71
- package/src/elements/register-impl.ts +0 -148
- package/src/elements/register.ts +0 -76
- package/src/elements/remote.tsx +0 -225
- package/src/elements/resizable.globals.d.ts +0 -36
- package/src/elements/resizable.tsx +0 -704
- package/src/elements/response-stream.tsx +0 -40
- package/src/elements/screen.tsx +0 -90
- package/src/elements/scroll-area.tsx +0 -33
- package/src/elements/scroll-button.tsx +0 -179
- package/src/elements/search.tsx +0 -185
- package/src/elements/segmented.tsx +0 -129
- package/src/elements/select.tsx +0 -165
- package/src/elements/separator.tsx +0 -36
- package/src/elements/setting-item.tsx +0 -50
- package/src/elements/settings-group.tsx +0 -37
- package/src/elements/skeleton.tsx +0 -45
- package/src/elements/slider.tsx +0 -171
- package/src/elements/slot-text.ts +0 -73
- package/src/elements/slots.ts +0 -787
- package/src/elements/source.tsx +0 -126
- package/src/elements/status.tsx +0 -42
- package/src/elements/styles.css +0 -328
- package/src/elements/switch.tsx +0 -118
- package/src/elements/tabs.tsx +0 -95
- package/src/elements/tasks.tsx +0 -103
- package/src/elements/text-shimmer.tsx +0 -28
- package/src/elements/thinking-bar.tsx +0 -43
- package/src/elements/thread.tsx +0 -139
- package/src/elements/toast.tsx +0 -106
- package/src/elements/tool.tsx +0 -78
- package/src/elements/tooltip.tsx +0 -85
- package/src/elements/validate-messages.ts +0 -76
- package/src/elements/voice-input.tsx +0 -100
- package/src/elements/voice-output.tsx +0 -82
- package/src/index.ts +0 -430
- package/src/primitives/audio-bands.ts +0 -174
- package/src/primitives/card-component-types.ts +0 -63
- package/src/primitives/card-contract.ts +0 -80
- package/src/primitives/card-data-types.ts +0 -361
- package/src/primitives/card-host.tsx +0 -37
- package/src/primitives/card-recovery.ts +0 -160
- package/src/primitives/card-registry.tsx +0 -78
- package/src/primitives/card-resolution.ts +0 -36
- package/src/primitives/card-routing.ts +0 -85
- package/src/primitives/card-schemas/artifact.schema.json +0 -92
- package/src/primitives/card-schemas/card-envelope.schema.json +0 -14
- package/src/primitives/card-schemas/card-event.schema.json +0 -12
- package/src/primitives/card-schemas/choice.schema.json +0 -75
- package/src/primitives/card-schemas/confirm.schema.json +0 -65
- package/src/primitives/card-schemas/embed.schema.json +0 -63
- package/src/primitives/card-schemas/form.result.schema.json +0 -7
- package/src/primitives/card-schemas/form.schema.json +0 -53
- package/src/primitives/card-schemas/link.schema.json +0 -54
- package/src/primitives/card-schemas/tasks.result.schema.json +0 -16
- package/src/primitives/card-schemas/tasks.schema.json +0 -83
- package/src/primitives/card-tags.ts +0 -61
- package/src/primitives/card-validate-cards.ts +0 -255
- package/src/primitives/card-validate-schemas.ts +0 -58
- package/src/primitives/card-validate.ts +0 -131
- package/src/primitives/chat-config.tsx +0 -103
- package/src/primitives/composer-model.ts +0 -49
- package/src/primitives/composer-triggers.ts +0 -35
- package/src/primitives/controllable.ts +0 -21
- package/src/primitives/conversation-store.ts +0 -248
- package/src/primitives/create-kai-chat.ts +0 -66
- package/src/primitives/create-tween.ts +0 -266
- package/src/primitives/embed-providers.ts +0 -254
- package/src/primitives/field-mask.ts +0 -256
- package/src/primitives/field-semantics.ts +0 -115
- package/src/primitives/highlighter.ts +0 -157
- package/src/primitives/input-mask.ts +0 -853
- package/src/primitives/link-preview.ts +0 -87
- package/src/primitives/message-feedback.ts +0 -124
- package/src/primitives/pdf-preview.ts +0 -121
- package/src/primitives/toast-store.ts +0 -338
- package/src/primitives/url-scheme-policy.ts +0 -70
- package/src/primitives/use-audio-analysis.ts +0 -340
- package/src/primitives/use-auto-resize.ts +0 -31
- package/src/primitives/use-resize-observer.ts +0 -45
- package/src/primitives/use-sequencer.ts +0 -72
- package/src/primitives/use-speech-recognition.ts +0 -146
- package/src/primitives/use-stick-to-bottom.ts +0 -75
- package/src/primitives/use-text-stream.ts +0 -143
- package/src/primitives/use-voice-recorder.ts +0 -62
- package/src/primitives/visualizer-sequences.ts +0 -350
- package/src/remote/host-embed.ts +0 -345
- package/src/remote/index.ts +0 -2
- package/src/remote/origin.ts +0 -30
- package/src/remote/provider-runtime.ts +0 -262
- package/src/remote/provider.ts +0 -2
- package/src/remote/validate.ts +0 -22
- package/src/remote/version.ts +0 -12
- package/src/remote/wire.ts +0 -48
- package/src/schemas/from-tool-call.ts +0 -151
- package/src/schemas/index.ts +0 -341
- package/src/schemas/provider-subsets.ts +0 -538
- package/src/schemas/registry.ts +0 -355
- package/src/schemas/tool-defs.ts +0 -793
- package/src/solid.ts +0 -173
- package/src/state/index.ts +0 -44
- package/src/state/messages.ts +0 -53
- package/src/state/mock.ts +0 -297
- package/src/state/parts.ts +0 -295
- package/src/state/persistence.ts +0 -180
- package/src/state/stream.ts +0 -246
- package/src/state/suggestions.ts +0 -9
- package/src/state/threads.ts +0 -142
- package/src/test-utils/fake-clock.ts +0 -88
- package/src/types.ts +0 -95
- package/src/ui/action-icons.ts +0 -53
- package/src/ui/agent-card.tsx +0 -218
- package/src/ui/avatar.tsx +0 -23
- package/src/ui/badge.tsx +0 -21
- package/src/ui/button.tsx +0 -49
- package/src/ui/card.tsx +0 -245
- package/src/ui/checkbox-group.tsx +0 -153
- package/src/ui/checkbox.tsx +0 -63
- package/src/ui/collapsible.tsx +0 -163
- package/src/ui/command.tsx +0 -103
- package/src/ui/dialog.tsx +0 -223
- package/src/ui/dock.tsx +0 -630
- package/src/ui/dropdown.tsx +0 -636
- package/src/ui/editable-label.tsx +0 -112
- package/src/ui/hover-card.tsx +0 -345
- package/src/ui/icon.tsx +0 -167
- package/src/ui/input.tsx +0 -391
- package/src/ui/kbd.tsx +0 -118
- package/src/ui/nav.tsx +0 -282
- package/src/ui/notice.tsx +0 -84
- package/src/ui/overlay.tsx +0 -277
- package/src/ui/pane-grid.tsx +0 -117
- package/src/ui/pane-group.tsx +0 -291
- package/src/ui/pane.tsx +0 -193
- package/src/ui/popover.tsx +0 -106
- package/src/ui/progress-bar.tsx +0 -83
- package/src/ui/prompt-dock.tsx +0 -145
- package/src/ui/radio.tsx +0 -150
- package/src/ui/resizable.tsx +0 -693
- package/src/ui/scroll-area.tsx +0 -26
- package/src/ui/segmented.tsx +0 -109
- package/src/ui/select.tsx +0 -168
- package/src/ui/separator.tsx +0 -10
- package/src/ui/settings-group.tsx +0 -67
- package/src/ui/skeleton.tsx +0 -73
- package/src/ui/slider.tsx +0 -178
- package/src/ui/status.tsx +0 -48
- package/src/ui/switch.tsx +0 -119
- package/src/ui/tabs.tsx +0 -168
- package/src/ui/textarea.tsx +0 -21
- package/src/ui/tooltip.tsx +0 -118
- package/src/utils/cn.ts +0 -30
- package/src/wire/chunk.ts +0 -248
- package/src/wire/consume.ts +0 -599
- package/src/wire/diagnostics.ts +0 -727
- package/src/wire/encode-probe.ts +0 -214
- package/src/wire/encode.ts +0 -947
- package/src/wire/files.ts +0 -342
- package/src/wire/formats/anthropic.ts +0 -274
- package/src/wire/formats/openai.ts +0 -228
- package/src/wire/index.ts +0 -95
- package/src/wire/media-types.ts +0 -344
- package/src/wire/read.ts +0 -396
- package/src/wire/sink-helpers.ts +0 -50
- package/src/wire/sse.ts +0 -153
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ The element bundle is a self-contained ES module — load it directly from [jsDe
|
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
<!-- x-release-please-start-version -->
|
|
78
|
-
The URLs above track the **latest** release — handy for trying things out. **For production, pin an exact version** (e.g. `@kitn.ai/ui@0.
|
|
78
|
+
The URLs above track the **latest** release — handy for trying things out. **For production, pin an exact version** (e.g. `@kitn.ai/ui@0.29.0/dist/kai.es.js`): pinned URLs are immutable and cached far more aggressively, and — since this package is pre-1.0 — pinning shields you from breaking changes in a future minor release.
|
|
79
79
|
<!-- x-release-please-end -->
|
|
80
80
|
|
|
81
81
|
> **Pin `0.25.0` or newer.** Every version from `0.14.1` through `0.24.0` is covered by a [critical security advisory](https://github.com/kitn-ai/ui/security/advisories) and is deprecated on npm. `npm install` warns you about a deprecated version; **a CDN fetch does not**, so an old pinned URL in a page keeps serving the vulnerable bundle silently.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public `@kitn.ai/ui/construct` export surface (dist/construct.js).
|
|
3
|
+
*
|
|
4
|
+
* Zod stays the single source of truth for the construct format (see
|
|
5
|
+
* schema.ts's header) — this re-export is what lets a BUILD-TIME consumer
|
|
6
|
+
* (create-kai's wizard, Task 2 of this round) validate a construct against the
|
|
7
|
+
* exact same schema the `kai` CLI and the MCP `construct` tool use, without
|
|
8
|
+
* hand-deriving a second copy the way the reference harness had to for the
|
|
9
|
+
* card schemas (see verify-schemas-exported.mjs's header for that history).
|
|
10
|
+
*
|
|
11
|
+
* Deliberately NOT added to the existing `./schemas` entry: that entry's
|
|
12
|
+
* source documents a size budget it holds itself to, and zod does not fit it.
|
|
13
|
+
* `./construct` is its own exports key for exactly that reason.
|
|
14
|
+
*/
|
|
15
|
+
export { ConstructSchema, validateConstruct, CONSTRUCT_SCHEMA_URL, type Construct, type ConstructProblem, type ValidationOutcome, } from './schema.js';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CONSTRUCT_SCHEMA_URL = "https://ui.kitn.ai/schemas/construct/v1.json";
|
|
3
|
+
export declare const ConstructSchema: z.ZodObject<{
|
|
4
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
layout: z.ZodEnum<{
|
|
7
|
+
custom: "custom";
|
|
8
|
+
widget: "widget";
|
|
9
|
+
fullscreen: "fullscreen";
|
|
10
|
+
aside: "aside";
|
|
11
|
+
split: "split";
|
|
12
|
+
}>;
|
|
13
|
+
provider: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
mode: z.ZodLiteral<"mock">;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
mode: z.ZodLiteral<"endpoint">;
|
|
17
|
+
url: z.ZodString;
|
|
18
|
+
wire: z.ZodEnum<{
|
|
19
|
+
openai: "openai";
|
|
20
|
+
anthropic: "anthropic";
|
|
21
|
+
}>;
|
|
22
|
+
}, z.core.$strict>], "mode">;
|
|
23
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
26
|
+
unreadColor: z.ZodOptional<z.ZodString>;
|
|
27
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
28
|
+
light: "light";
|
|
29
|
+
dark: "dark";
|
|
30
|
+
system: "system";
|
|
31
|
+
}>>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
header: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
title: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strict>>;
|
|
36
|
+
empty: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
title: z.ZodString;
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
home: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
greeting: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
title: z.ZodOptional<z.ZodString>;
|
|
44
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>>;
|
|
46
|
+
recentConversation: z.ZodOptional<z.ZodLiteral<true>>;
|
|
47
|
+
newConversation: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
label: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
label: z.ZodString;
|
|
52
|
+
href: z.ZodOptional<z.ZodString>;
|
|
53
|
+
description: z.ZodOptional<z.ZodString>;
|
|
54
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strict>>>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
capabilities: z.ZodOptional<z.ZodObject<{
|
|
58
|
+
starters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
|
+
attachments: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
accept: z.ZodArray<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
history: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
persistence: z.ZodEnum<{
|
|
64
|
+
endpoint: "endpoint";
|
|
65
|
+
none: "none";
|
|
66
|
+
local: "local";
|
|
67
|
+
}>;
|
|
68
|
+
url: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
reasoning: z.ZodOptional<z.ZodEnum<{
|
|
71
|
+
full: "full";
|
|
72
|
+
compact: "compact";
|
|
73
|
+
off: "off";
|
|
74
|
+
}>>;
|
|
75
|
+
reasoningOpen: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
conversations: z.ZodOptional<z.ZodLiteral<true>>;
|
|
77
|
+
}, z.core.$strict>>;
|
|
78
|
+
cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
81
|
+
}, z.core.$strict>>>;
|
|
82
|
+
slots: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
widget: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
"bottom-end": "bottom-end";
|
|
86
|
+
"bottom-start": "bottom-start";
|
|
87
|
+
"top-end": "top-end";
|
|
88
|
+
"top-start": "top-start";
|
|
89
|
+
}>>;
|
|
90
|
+
launcherIcon: z.ZodOptional<z.ZodString>;
|
|
91
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export type Construct = z.infer<typeof ConstructSchema>;
|
|
95
|
+
export interface ConstructProblem {
|
|
96
|
+
/** Dotted path into the construct, '' for the root. */
|
|
97
|
+
path: string;
|
|
98
|
+
message: string;
|
|
99
|
+
}
|
|
100
|
+
export type ValidationOutcome = {
|
|
101
|
+
ok: true;
|
|
102
|
+
construct: Construct;
|
|
103
|
+
} | {
|
|
104
|
+
ok: false;
|
|
105
|
+
problems: ConstructProblem[];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Validate one construct. The ONLY doorway to codegen: a failure never reaches
|
|
109
|
+
* generation — the problems go back to the author/agent with paths and reasons.
|
|
110
|
+
*/
|
|
111
|
+
export declare function validateConstruct(input: unknown): ValidationOutcome;
|
package/dist/construct-cli.es.js
CHANGED
|
@@ -1211,12 +1211,12 @@ function writeProject(files, dir) {
|
|
|
1211
1211
|
return overwritten;
|
|
1212
1212
|
}
|
|
1213
1213
|
const defaultIo = { log: (s) => console.log(s), error: (s) => console.error(s) };
|
|
1214
|
-
const USAGE = `usage: kai <command
|
|
1214
|
+
const USAGE = `usage: npx @kitn.ai/ui <command> (or \`kai <command>\` once @kitn.ai/ui is installed)
|
|
1215
1215
|
|
|
1216
1216
|
kai validate <construct.json> check a construct, print problems with paths
|
|
1217
1217
|
kai eject <construct.json> <outDir> write the generated Solid project (it's yours)
|
|
1218
|
-
kai dev <construct.json> live preview with reload-on-edit
|
|
1219
|
-
kai compile <construct.json> [outDir] one self-registering .js
|
|
1218
|
+
kai dev <construct.json> live preview with reload-on-edit
|
|
1219
|
+
kai compile <construct.json> [outDir] one self-registering .js
|
|
1220
1220
|
`;
|
|
1221
1221
|
function homeRecentConversationWarning(construct) {
|
|
1222
1222
|
if (construct.home?.recentConversation && !construct.capabilities?.conversations) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// GENERATED by scripts/emit-subpath-dts.mjs — do not edit.
|
|
2
|
+
// Sibling declarations for dist/construct.js, so that RELATIVE imports
|
|
3
|
+
// of this bundle (which bypass package.json "exports") still resolve to types.
|
|
4
|
+
// Without this, tsc resolves the path to the .js and reports TS7016.
|
|
5
|
+
export * from './agent-tooling/construct/public.js';
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
const I = ["http:", "https:", "mailto:"];
|
|
3
|
+
function v(t) {
|
|
4
|
+
try {
|
|
5
|
+
return new URL(t, "http://_invalid_base").protocol;
|
|
6
|
+
} catch {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function r(t) {
|
|
11
|
+
const o = v(t);
|
|
12
|
+
return o !== void 0 && I.includes(o);
|
|
13
|
+
}
|
|
14
|
+
const k = "https://ui.kitn.ai/schemas/construct/v1.json", y = /^[a-z][a-z0-9]*-[a-z0-9-]+$/, w = e.discriminatedUnion("mode", [
|
|
15
|
+
e.object({ mode: e.literal("mock") }).strict(),
|
|
16
|
+
e.object({
|
|
17
|
+
mode: e.literal("endpoint"),
|
|
18
|
+
/** The CONSUMER's chat route. Kit parses, consumer fetches. */
|
|
19
|
+
url: e.string().min(1),
|
|
20
|
+
wire: e.enum(["openai", "anthropic"])
|
|
21
|
+
}).strict()
|
|
22
|
+
]), j = e.object({
|
|
23
|
+
$schema: e.string().optional(),
|
|
24
|
+
/** The emitted tag: <acme-support>. Must satisfy customElements.define. */
|
|
25
|
+
name: e.string().regex(y, 'must be a valid custom-element tag: lowercase, with a hyphen (e.g. "acme-support")'),
|
|
26
|
+
// Widened progressively: fullscreen/aside/split landed in Task 12, custom in Task 13.
|
|
27
|
+
layout: e.enum(["widget", "fullscreen", "aside", "split", "custom"]),
|
|
28
|
+
provider: w,
|
|
29
|
+
/** Plain (unsigned) identity passthrough — no signing/auth infra (owner
|
|
30
|
+
* ruling, 2026-08-26: signed JWT/HMAC identity is later additive
|
|
31
|
+
* vocabulary, not this field). TOP-LEVEL, not nested under `provider`:
|
|
32
|
+
* local history scoping (`capabilities.history.persistence: 'local'`)
|
|
33
|
+
* needs userId independent of provider mode — nesting it inside the
|
|
34
|
+
* provider union would make it silently inert for `mode: 'mock'` +
|
|
35
|
+
* local history, a real and common combination. Threaded as the
|
|
36
|
+
* `x-kai-user-id` header on every emitted fetch to the CONSUMER's own
|
|
37
|
+
* backend (the endpoint provider's chat POST, history's endpoint
|
|
38
|
+
* GET/PUT), and folded into the localStorage key for `local` history so
|
|
39
|
+
* different users on the same browser profile don't share one thread.
|
|
40
|
+
* Constrained to printable-ASCII (no CR/LF, no non-ISO-8859-1 code
|
|
41
|
+
* points) beyond the usual construct-authored-text escaping: this value
|
|
42
|
+
* reaches an HTTP HEADER VALUE, not just a JS string literal, and
|
|
43
|
+
* `fetch()` throws at RUNTIME on a header value containing CR/LF or
|
|
44
|
+
* outside ISO-8859-1 — a bad userId would surface as an opaque crash in
|
|
45
|
+
* the CONSUMER's generated app, not a construct-validation error. Reject
|
|
46
|
+
* loudly here instead, where the author gets a path + message. */
|
|
47
|
+
userId: e.string().min(1).regex(
|
|
48
|
+
/^[\x20-\x7E]+$/,
|
|
49
|
+
"must be printable ASCII with no line breaks (it becomes an HTTP header value)"
|
|
50
|
+
).optional(),
|
|
51
|
+
theme: e.object({
|
|
52
|
+
/** Any CSS color; becomes --kai-color-primary on the host. */
|
|
53
|
+
accent: e.string().optional(),
|
|
54
|
+
/** Any CSS color; becomes --kai-color-unread on the host (owner
|
|
55
|
+
* ruling, 2026-08-26 — the unread-indicator round). Same treatment
|
|
56
|
+
* as `accent` in every way that matters for safety: construct-
|
|
57
|
+
* authored/untrusted text, carried to the emitted facade via
|
|
58
|
+
* `ctx.element.style.setProperty('--kai-color-unread',
|
|
59
|
+
* JSON.stringify(...))` — never string-interpolated into CSS
|
|
60
|
+
* text — so it can never break out into a new declaration or rule
|
|
61
|
+
* (see emitElement's doc on why `accent` uses setProperty at all).
|
|
62
|
+
* Unlike `accent`, this has no paired -foreground to compute: the
|
|
63
|
+
* three surfaces that read --color-unread (the conversation-list
|
|
64
|
+
* row dot, the header toggle's badge, Dock's own closed-launcher
|
|
65
|
+
* badge) are all small filled dots with no text sitting ON them, so
|
|
66
|
+
* there is nothing to contrast-pair — the value is set and used
|
|
67
|
+
* as-is. */
|
|
68
|
+
unreadColor: e.string().optional(),
|
|
69
|
+
mode: e.enum(["light", "dark", "system"]).default("system")
|
|
70
|
+
}).strict().optional(),
|
|
71
|
+
/** Construct-wide header chrome, valid on every layout (not layout-scoped
|
|
72
|
+
* like `widget`, and not a capability toggle — a header is a construct-
|
|
73
|
+
* wide fact, like `theme`). Rendered inside ChatThread's own built-in
|
|
74
|
+
* header bar; a logo/icon projects through the kit's EXISTING
|
|
75
|
+
* `header-start` named slot (`slots` vocabulary above), not a second
|
|
76
|
+
* image-prop convention here. */
|
|
77
|
+
header: e.object({
|
|
78
|
+
/** Rendered in ChatThread's built-in header bar (left side). Construct-
|
|
79
|
+
* authored/untrusted text, like theme.accent/provider.url — JSON.stringify'd
|
|
80
|
+
* at its one emit site, never a raw JSX attribute string. */
|
|
81
|
+
title: e.string().min(1).optional()
|
|
82
|
+
}).strict().optional(),
|
|
83
|
+
/** Greeting shown while the thread is empty (no messages yet) — the
|
|
84
|
+
* proven "welcome screen" pattern (Intercom-class): title + optional
|
|
85
|
+
* description + optional icon above, with `capabilities.starters`'
|
|
86
|
+
* chips and the composer still rendering below (ChatThread's `empty`
|
|
87
|
+
* REPLACE slot only stands in for the empty MESSAGE LIST — see
|
|
88
|
+
* chat-thread.tsx's own doc comment on `empty` — so the chips are
|
|
89
|
+
* never lost). Construct-wide like `header`, not a capability: it's a
|
|
90
|
+
* fact about the empty state, not a toggleable affordance.
|
|
91
|
+
* `title`/`description` are construct-authored/untrusted text, like
|
|
92
|
+
* `header.title`/`theme.accent`/`provider.url` — JSON.stringify'd at
|
|
93
|
+
* their one emit site, never a raw JSX attribute string. `icon` is a
|
|
94
|
+
* URL reaching an `<img src>` sink in emitted code, exactly like
|
|
95
|
+
* `widget.launcherIcon` — same `isSafeUrl` policy, same superRefine
|
|
96
|
+
* shape, below. */
|
|
97
|
+
empty: e.object({
|
|
98
|
+
title: e.string().min(1),
|
|
99
|
+
description: e.string().min(1).optional(),
|
|
100
|
+
icon: e.string().min(1).optional()
|
|
101
|
+
}).strict().optional(),
|
|
102
|
+
/** Home screen (spec 2026-08-27, H-1..H-5): Intercom-style landing view behind
|
|
103
|
+
* a Home/Messages tab bar. PRESENCE of `home` enables the tab chrome (H-4) —
|
|
104
|
+
* no `enabled` boolean, like `header`/`empty`. Every sub-key optional;
|
|
105
|
+
* `home: {}` still means "tabs on, defaults". Never requires another
|
|
106
|
+
* capability (H-3): the recent card simply renders nothing without
|
|
107
|
+
* `capabilities.conversations` (the CLI warns — see cli.ts). All strings are
|
|
108
|
+
* construct-authored/untrusted: JSON.stringify'd at every emit site; hrefs
|
|
109
|
+
* and URL-shaped icons through isSafeUrl in superRefine below. */
|
|
110
|
+
home: e.object({
|
|
111
|
+
greeting: e.object({ title: e.string().min(1).optional(), subtitle: e.string().min(1).optional() }).strict().optional(),
|
|
112
|
+
recentConversation: e.literal(!0).optional(),
|
|
113
|
+
newConversation: e.object({ label: e.string().min(1).optional() }).strict().optional(),
|
|
114
|
+
links: e.array(
|
|
115
|
+
e.object({
|
|
116
|
+
label: e.string().min(1),
|
|
117
|
+
href: e.string().min(1).optional(),
|
|
118
|
+
description: e.string().min(1).optional(),
|
|
119
|
+
/** renderIcon name (e.g. 'book-open') or a safe URL — the icon NAME
|
|
120
|
+
* list is renderIcon's own vocabulary, never restated here; unknown
|
|
121
|
+
* names warn loudly at DEV runtime. */
|
|
122
|
+
icon: e.string().min(1).optional()
|
|
123
|
+
}).strict()
|
|
124
|
+
).optional()
|
|
125
|
+
}).strict().optional(),
|
|
126
|
+
// Capability vocabulary, widened one field at a time by later tasks.
|
|
127
|
+
capabilities: e.object({
|
|
128
|
+
/** Starter prompts shown on the empty thread; clicking one sends it.
|
|
129
|
+
* 1-6 non-empty strings — construct-authored text, escaped like
|
|
130
|
+
* `theme.accent`/`provider.url` at every emit interpolation site. */
|
|
131
|
+
starters: e.array(e.string().min(1)).min(1).max(6).optional(),
|
|
132
|
+
/** Enables the paperclip attach affordance; accept is a non-empty
|
|
133
|
+
* list of media types/globs, e.g. ["image/*", "application/pdf"] —
|
|
134
|
+
* WHETHER stays with the construct author (this field), HOW stays
|
|
135
|
+
* with the kit (ChatThread's own attach/accept props, threaded
|
|
136
|
+
* through by codegen). */
|
|
137
|
+
attachments: e.object({
|
|
138
|
+
/** Accept-list of media types/globs, e.g. ["image/*", "application/pdf"]. */
|
|
139
|
+
accept: e.array(e.string().min(1)).min(1)
|
|
140
|
+
}).strict().optional(),
|
|
141
|
+
/** Conversation persistence. `none` (default, nothing emitted): the
|
|
142
|
+
* thread lives only in memory for the tab's lifetime. `local`:
|
|
143
|
+
* persisted to this browser's localStorage, keyed by the construct's
|
|
144
|
+
* tag — a mechanism decision (WHERE); what to retain and for how
|
|
145
|
+
* long stays an app decision (component-scope-boundary), so no
|
|
146
|
+
* retention count/quota lands here. `endpoint`: the CONSUMER's own
|
|
147
|
+
* thread route (GET returns ChatMessage[], PUT stores them) —
|
|
148
|
+
* requires `url`; `url` is rejected for any other persistence
|
|
149
|
+
* (superRefine below, both directions loud). */
|
|
150
|
+
history: e.object({
|
|
151
|
+
persistence: e.enum(["none", "local", "endpoint"]),
|
|
152
|
+
/** endpoint persistence only: the CONSUMER's thread routes (GET returns
|
|
153
|
+
* ChatMessage[], PUT stores them). Refined below. */
|
|
154
|
+
url: e.string().min(1).optional()
|
|
155
|
+
}).strict().optional(),
|
|
156
|
+
/** How the model's thinking (reasoning parts) renders. `'full'`
|
|
157
|
+
* (the default when omitted — see codegen.ts's emitReasoningProp)
|
|
158
|
+
* is the collapsible "Thinking" disclosure, shimmering while it
|
|
159
|
+
* streams. `'compact'` shows only a shimmer/typing loader while
|
|
160
|
+
* reasoning streams, with no expandable detail. `'off'` hides
|
|
161
|
+
* reasoning entirely. This is HOW an existing medium fact (the
|
|
162
|
+
* model's thinking) displays — the kit's call — so it maps straight
|
|
163
|
+
* onto ChatThread's own `reasoning` prop; there is no app-layer
|
|
164
|
+
* quota or retention decision hiding in it. Left `.optional()`
|
|
165
|
+
* rather than `.default('full')`, matching every sibling field in
|
|
166
|
+
* this object: a zod `.default()` here would make `reasoning`
|
|
167
|
+
* REQUIRED on the inferred input type (z.infer is the output type),
|
|
168
|
+
* breaking every `capabilities: {...}` object literal in this file
|
|
169
|
+
* and its tests that doesn't mention it. */
|
|
170
|
+
reasoning: e.enum(["full", "compact", "off"]).optional(),
|
|
171
|
+
/** Seeds the reasoning disclosure open AND keeps it tracking the
|
|
172
|
+
* stream (open while streaming, closes when it settles) — the
|
|
173
|
+
* pre-Task-19f `full` behavior. Default false/absent: the panel
|
|
174
|
+
* starts closed (just the "Thinking" shimmer chip) and only opens
|
|
175
|
+
* on click — the current default (owner ruling, 2026-08-26).
|
|
176
|
+
* Meaningless when `reasoning` is `'compact'` (no expandable
|
|
177
|
+
* content exists) or `'off'` (nothing renders); rejected on both,
|
|
178
|
+
* loudly, below. */
|
|
179
|
+
reasoningOpen: e.boolean().optional(),
|
|
180
|
+
/** Turns on the prior-conversations list (C-1..C-9 of the
|
|
181
|
+
* conversations design). `true` only — there is no `false` form,
|
|
182
|
+
* matching this schema's other presence-only capability flags.
|
|
183
|
+
* Requires `capabilities.history.persistence` to be `local` or
|
|
184
|
+
* `endpoint` (superRefine below, loud): a conversation list with
|
|
185
|
+
* nowhere to persist conversations is not a coherent construct.
|
|
186
|
+
* WHAT persists (this field, plus history) stays construct
|
|
187
|
+
* vocabulary; HOW it persists (the ConversationStore adapter,
|
|
188
|
+
* localStorage vs. a fetch endpoint) is codegen's call, never
|
|
189
|
+
* vocabulary here (C-3 — no transport-layer vocabulary). */
|
|
190
|
+
conversations: e.literal(!0).optional()
|
|
191
|
+
}).strict().optional(),
|
|
192
|
+
/** Named generative-UI card definitions the model can emit as tool calls,
|
|
193
|
+
* rendered in the thread. Top-level (not a capability): a card is
|
|
194
|
+
* something the construct's model can DO at any point once a card is
|
|
195
|
+
* declared, not a thread-affordance toggle like starters/attachments/
|
|
196
|
+
* reasoning. Reuses the kit's own card-tool projection end to end
|
|
197
|
+
* (`cardTools`/`toOpenAITools`/`toAnthropicTools`, `@kitn.ai/ui/schemas`)
|
|
198
|
+
* — never a second one authored here. `schema` is validated structurally
|
|
199
|
+
* only; deep card validation (incl. `x-kai-format` mask hints) is the
|
|
200
|
+
* kit's own card contract at render time. */
|
|
201
|
+
cards: e.array(
|
|
202
|
+
e.object({
|
|
203
|
+
/** Tool-facing card name, e.g. "refund_approval". */
|
|
204
|
+
name: e.string().regex(/^[a-z][a-z0-9_]*$/),
|
|
205
|
+
/** The kit's card schema JSON (incl. x-kai-format mask hints).
|
|
206
|
+
* Validated structurally here; deep card validation is the kit's
|
|
207
|
+
* own card contract at render time. */
|
|
208
|
+
schema: e.record(e.string(), e.unknown())
|
|
209
|
+
}).strict()
|
|
210
|
+
).min(1).optional(),
|
|
211
|
+
/** Named `<slot>` projection points the emitted web component exposes —
|
|
212
|
+
* the format's ONLY escape hatch (named slots, no code-in-JSON). Each
|
|
213
|
+
* name must be a valid HTML slot-attribute value AND a legible
|
|
214
|
+
* identifier: kebab-case, starting with a letter (the same shape as a
|
|
215
|
+
* CSS custom-ident) — `slot name="Header!"` is rejected, not sanitized,
|
|
216
|
+
* matching the format's loud-rejection discipline everywhere else.
|
|
217
|
+
* 1-8 entries, no duplicates (superRefine below — a regex alone can't
|
|
218
|
+
* see across array entries). `layout: 'custom'` requires at least one
|
|
219
|
+
* declared slot (superRefine below): `custom` IS the slots grain — a
|
|
220
|
+
* `custom` layout with nothing to project into is not meaningfully
|
|
221
|
+
* different from `fullscreen`. */
|
|
222
|
+
slots: e.array(e.string().regex(/^[a-z][a-z0-9-]*$/, "slot names must be kebab-case, starting with a letter")).min(1).max(8).optional(),
|
|
223
|
+
/** Layout-scoped FAB chrome, `layout: 'widget'` only (superRefine below).
|
|
224
|
+
* Purely additive sibling to `layout` (widen-never-restructure) — mirrors
|
|
225
|
+
* Dock's own props verbatim, threaded through by codegen's emitLayoutOpen. */
|
|
226
|
+
widget: e.object({
|
|
227
|
+
/** Which corner. Mirrors Dock's own DockPosition enum verbatim — not a
|
|
228
|
+
* new left/right binary. Omitted keeps Dock's own default (bottom-end). */
|
|
229
|
+
position: e.enum(["bottom-end", "bottom-start", "top-end", "top-start"]).optional(),
|
|
230
|
+
/** An image URL for the closed-state launcher glyph, replacing Dock's
|
|
231
|
+
* built-in chat-bubble icon. Construct-authored/untrusted text, like
|
|
232
|
+
* theme.accent and provider.url — escaped the same way at its one emit site. */
|
|
233
|
+
launcherIcon: e.string().min(1).optional(),
|
|
234
|
+
/** Seed Dock's open state at mount. Uncontrolled — never steals focus (Dock's
|
|
235
|
+
* own focus contract, dock.tsx). Omitted keeps Dock's own default (closed). */
|
|
236
|
+
defaultOpen: e.boolean().optional()
|
|
237
|
+
}).strict().optional()
|
|
238
|
+
}).strict().superRefine((t, o) => {
|
|
239
|
+
var c, p, d, m, u, h, g;
|
|
240
|
+
if (t.slots) {
|
|
241
|
+
const a = /* @__PURE__ */ new Set();
|
|
242
|
+
t.slots.forEach((s, b) => {
|
|
243
|
+
a.has(s) && o.addIssue({
|
|
244
|
+
code: e.ZodIssueCode.custom,
|
|
245
|
+
path: ["slots", b],
|
|
246
|
+
message: `duplicate slot name "${s}"`
|
|
247
|
+
}), a.add(s);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
if (t.layout === "custom" && (!t.slots || t.slots.length === 0) && o.addIssue({
|
|
251
|
+
code: e.ZodIssueCode.custom,
|
|
252
|
+
path: ["slots"],
|
|
253
|
+
message: '"custom" layout requires at least one declared slot — custom IS the slots grain'
|
|
254
|
+
}), t.layout === "split" && t.slots) {
|
|
255
|
+
const a = t.slots.indexOf("pane");
|
|
256
|
+
a !== -1 && o.addIssue({
|
|
257
|
+
code: e.ZodIssueCode.custom,
|
|
258
|
+
path: ["slots", a],
|
|
259
|
+
message: `"pane" collides with the "split" layout's own fixed <slot name="pane"> — choose a different slot name`
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
t.widget && t.layout !== "widget" && o.addIssue({
|
|
263
|
+
code: e.ZodIssueCode.custom,
|
|
264
|
+
path: ["widget"],
|
|
265
|
+
message: '"widget" is only valid on layout: "widget"'
|
|
266
|
+
}), (c = t.widget) != null && c.launcherIcon && !r(t.widget.launcherIcon) && o.addIssue({
|
|
267
|
+
code: e.ZodIssueCode.custom,
|
|
268
|
+
path: ["widget", "launcherIcon"],
|
|
269
|
+
message: "launcherIcon must be an http(s)/mailto or relative URL — no javascript:/data: schemes"
|
|
270
|
+
}), (p = t.empty) != null && p.icon && !r(t.empty.icon) && o.addIssue({
|
|
271
|
+
code: e.ZodIssueCode.custom,
|
|
272
|
+
path: ["empty", "icon"],
|
|
273
|
+
message: "icon must be an http(s)/mailto or relative URL — no javascript:/data: schemes"
|
|
274
|
+
});
|
|
275
|
+
const i = (d = t.capabilities) == null ? void 0 : d.reasoning;
|
|
276
|
+
((m = t.capabilities) == null ? void 0 : m.reasoningOpen) !== void 0 && (i === "compact" || i === "off") && o.addIssue({
|
|
277
|
+
code: e.ZodIssueCode.custom,
|
|
278
|
+
path: ["capabilities", "reasoningOpen"],
|
|
279
|
+
message: '"reasoningOpen" only applies when reasoning is "full" or omitted — "compact"/"off" have no disclosure to open'
|
|
280
|
+
});
|
|
281
|
+
const n = (u = t.capabilities) == null ? void 0 : u.history;
|
|
282
|
+
(h = t.capabilities) != null && h.conversations && (!n || n.persistence === "none") && o.addIssue({
|
|
283
|
+
code: e.ZodIssueCode.custom,
|
|
284
|
+
path: ["capabilities", "conversations"],
|
|
285
|
+
message: '"conversations" requires capabilities.history.persistence to be "local" or "endpoint" — a conversation list needs somewhere to persist conversations'
|
|
286
|
+
});
|
|
287
|
+
const f = /^[a-zA-Z][a-zA-Z0-9+.-]*:|^\/\//;
|
|
288
|
+
for (const [a, s] of (((g = t.home) == null ? void 0 : g.links) ?? []).entries())
|
|
289
|
+
s.href && !r(s.href) && o.addIssue({
|
|
290
|
+
code: e.ZodIssueCode.custom,
|
|
291
|
+
path: ["home", "links", a, "href"],
|
|
292
|
+
message: "href must be an http(s)/mailto or relative URL — no javascript:/data: schemes"
|
|
293
|
+
}), s.icon && f.test(s.icon) && !r(s.icon) && o.addIssue({
|
|
294
|
+
code: e.ZodIssueCode.custom,
|
|
295
|
+
path: ["home", "links", a, "icon"],
|
|
296
|
+
message: "icon must be a kit icon name or an http(s)/relative URL — no javascript:/data: schemes"
|
|
297
|
+
});
|
|
298
|
+
n && (n.persistence === "endpoint" && !n.url && o.addIssue({
|
|
299
|
+
code: e.ZodIssueCode.custom,
|
|
300
|
+
path: ["capabilities", "history", "url"],
|
|
301
|
+
message: '"endpoint" persistence requires a url'
|
|
302
|
+
}), n.persistence !== "endpoint" && n.url !== void 0 && o.addIssue({
|
|
303
|
+
code: e.ZodIssueCode.custom,
|
|
304
|
+
path: ["capabilities", "history", "url"],
|
|
305
|
+
message: 'url is only valid with "endpoint" persistence'
|
|
306
|
+
}));
|
|
307
|
+
});
|
|
308
|
+
function S(t) {
|
|
309
|
+
const o = j.safeParse(t);
|
|
310
|
+
return o.success ? { ok: !0, construct: o.data } : {
|
|
311
|
+
ok: !1,
|
|
312
|
+
problems: o.error.issues.flatMap((i) => i.code === "unrecognized_keys" ? i.keys.map((l) => ({
|
|
313
|
+
path: [...i.path.map(String), l].join("."),
|
|
314
|
+
message: `"${l}" is not construct vocabulary`
|
|
315
|
+
})) : [
|
|
316
|
+
{
|
|
317
|
+
path: i.path.map(String).join("."),
|
|
318
|
+
message: i.message
|
|
319
|
+
}
|
|
320
|
+
])
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
export {
|
|
324
|
+
k as CONSTRUCT_SCHEMA_URL,
|
|
325
|
+
j as ConstructSchema,
|
|
326
|
+
S as validateConstruct
|
|
327
|
+
};
|