@uibot/application 0.0.0-stage → 0.2.1
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/dist/collection-application.d.ts +3 -0
- package/dist/collection-application.js +25 -0
- package/dist/compose-system-prompt.d.ts +104 -0
- package/dist/composition.d.ts +24 -0
- package/dist/context-service.d.ts +42 -0
- package/dist/creation-annotations.d.ts +5 -0
- package/dist/creation-assets.d.ts +15 -0
- package/dist/creation-brand-http.d.ts +9 -0
- package/dist/creation-brand.d.ts +25 -0
- package/dist/creation-copy.d.ts +11 -0
- package/dist/creation-domains.d.ts +25 -0
- package/dist/creation-facts.d.ts +8 -0
- package/dist/creation-http-helpers.d.ts +35 -0
- package/dist/creation-http.d.ts +99 -0
- package/dist/creation-layout.d.ts +4 -0
- package/dist/creation-legacy-flat-spec.d.ts +42 -0
- package/dist/creation-prompt.d.ts +33 -0
- package/dist/creation-requirements.d.ts +6 -0
- package/dist/creation-routes.d.ts +26 -0
- package/dist/creation-runner.d.ts +20 -0
- package/dist/creation-schema-ids.d.ts +6 -0
- package/dist/creation-spec-prompt.d.ts +3 -0
- package/dist/creation-store.d.ts +121 -0
- package/dist/creation-theme-http.d.ts +13 -0
- package/dist/creation-theme.d.ts +16 -0
- package/dist/creation-web-data-prompt.d.ts +15 -0
- package/dist/discovery-protocol.d.ts +25 -0
- package/dist/gap-orchestrator.d.ts +19 -0
- package/dist/grounded-brief.d.ts +37 -0
- package/dist/html-preview/config.d.ts +14 -0
- package/dist/html-preview/index.d.ts +11 -0
- package/dist/html-preview/link-interceptor.d.ts +10 -0
- package/dist/html-preview/proxy.d.ts +57 -0
- package/dist/html-preview/render.d.ts +39 -0
- package/dist/html-preview/routes.d.ts +27 -0
- package/dist/html-preview/session-store.d.ts +44 -0
- package/dist/hub-client.d.ts +25 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +819 -0
- package/dist/live-runtime-adapter.d.ts +11 -0
- package/dist/playground-session-http.d.ts +24 -0
- package/dist/prompt.d.ts +17 -0
- package/dist/resource-apply.d.ts +18 -0
- package/dist/runtime.d.ts +37 -0
- package/dist/studio-artifact-export-http.d.ts +52 -0
- package/dist/studio-compose-context.d.ts +47 -0
- package/dist/studio-compose-http.d.ts +31 -0
- package/dist/studio-design-http.d.ts +164 -0
- package/dist/studio-design-md-export-http.d.ts +11 -0
- package/dist/studio-http-shared.d.ts +34 -0
- package/dist/studio-http.d.ts +359 -0
- package/dist/studio-logo.d.ts +24 -0
- package/dist/studio-pages/agents-page.d.ts +48 -0
- package/dist/studio-pages/catalog-page.d.ts +22 -0
- package/dist/studio-pages/design-md-page.d.ts +55 -0
- package/dist/studio-pages/evolution-page.d.ts +111 -0
- package/dist/studio-pages/governance-page.d.ts +65 -0
- package/dist/studio-pages/index.d.ts +82 -0
- package/dist/studio-pages/models-page.d.ts +76 -0
- package/dist/studio-pages/operations-page.d.ts +61 -0
- package/dist/studio-pages/overview-page.d.ts +90 -0
- package/dist/studio-pages/plugins-page.d.ts +36 -0
- package/dist/studio-pages/shared.d.ts +25 -0
- package/dist/studio-pages/skills-page.d.ts +59 -0
- package/dist/studio-pages/spec-page.d.ts +33 -0
- package/dist/studio-project-design-http.d.ts +41 -0
- package/dist/studio-project-specs.d.ts +11 -0
- package/dist/studio-resource-index-http.d.ts +17 -0
- package/dist/studio-spec-recover-http.d.ts +45 -0
- package/dist/studio-spec-sync-http.d.ts +43 -0
- package/dist/studio.d.ts +64 -0
- package/dist/ui-craft-baseline.d.ts +14 -0
- package/package.json +49 -4
- package/README.md +0 -3
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import type { ModelGenerateRequest, ModelGenerateResult, PlaygroundProjectContext, SkillEvolutionProposal, SkillReflectionRecord, SkillRegressionRecord, AgentMessageContent } from "@uibot/contracts";
|
|
2
|
+
import { type ModelStreamEvent, type HttpHeadersInit } from "./studio-http-shared.js";
|
|
3
|
+
import { type UIBotStudioService, type UIBotStudioSnapshot, type UIBotStudioTimelineEvent } from "./studio.js";
|
|
4
|
+
export interface CreateUIBotStudioHttpHandlerOptions<TRuntime = unknown, TModels = unknown, TDiagnostics = unknown, TTimeline extends readonly UIBotStudioTimelineEvent[] = readonly UIBotStudioTimelineEvent[], TGovernance = unknown, TOperations = unknown> {
|
|
5
|
+
service: UIBotStudioService<TRuntime, TModels, TDiagnostics, TTimeline, TGovernance, TOperations>;
|
|
6
|
+
path?: string;
|
|
7
|
+
cacheControl?: string;
|
|
8
|
+
headers?: HttpHeadersInit;
|
|
9
|
+
}
|
|
10
|
+
export declare function createUIBotStudioHttpHandler<TRuntime = unknown, TModels = unknown, TDiagnostics = unknown, TTimeline extends readonly UIBotStudioTimelineEvent[] = readonly UIBotStudioTimelineEvent[], TGovernance = unknown, TOperations = unknown>(options: CreateUIBotStudioHttpHandlerOptions<TRuntime, TModels, TDiagnostics, TTimeline, TGovernance, TOperations>): (request: Request) => Promise<Response>;
|
|
11
|
+
export type UIBotStudioHttpSnapshot = UIBotStudioSnapshot;
|
|
12
|
+
export interface CreateUIBotStudioGenerateHandlerOptions {
|
|
13
|
+
generate: (request: ModelGenerateRequest) => Promise<ModelGenerateResult>;
|
|
14
|
+
path?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createUIBotStudioGenerateHandler(options: CreateUIBotStudioGenerateHandlerOptions): (request: Request) => Promise<Response>;
|
|
17
|
+
export interface CreateUIBotStudioGenerateStreamHandlerOptions {
|
|
18
|
+
generateStream: (request: ModelGenerateRequest) => AsyncIterable<ModelStreamEvent>;
|
|
19
|
+
path?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional resolver for design-md content. When provided and the request
|
|
22
|
+
* body contains a `designMdId` field, the resolved body is appended to the
|
|
23
|
+
* `system` prompt under a "## Design Style Guide" heading.
|
|
24
|
+
*
|
|
25
|
+
* Prefer `composeSystemPrompt` (v2.45+) which already injects design-md via
|
|
26
|
+
* the shared spine; this hook remains for callers that only need a single id.
|
|
27
|
+
*/
|
|
28
|
+
getDesignMd?: (id: string) => {
|
|
29
|
+
title: string;
|
|
30
|
+
body: string;
|
|
31
|
+
} | null;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Prefer `composeSystemPrompt` — full-catalog dump without ranking.
|
|
34
|
+
*/
|
|
35
|
+
getCatalogPrompt?: () => string;
|
|
36
|
+
/**
|
|
37
|
+
* Shared generation spine (v2.45+). When provided, replaces getCatalogPrompt /
|
|
38
|
+
* getDesignMd injection with intent-ranked composeSystemPrompt output.
|
|
39
|
+
*/
|
|
40
|
+
composeSystemPrompt?: (input: {
|
|
41
|
+
intent: string;
|
|
42
|
+
designMdId?: string;
|
|
43
|
+
}) => {
|
|
44
|
+
text: string;
|
|
45
|
+
trace?: {
|
|
46
|
+
designMdIds: string[];
|
|
47
|
+
projectDesignPath: string | null;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
getConsumerSpecs?: () => Array<{
|
|
51
|
+
rel: string;
|
|
52
|
+
pageId: string;
|
|
53
|
+
path: string;
|
|
54
|
+
title: string;
|
|
55
|
+
yaml?: string;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export declare function createUIBotStudioGenerateStreamHandler(options: CreateUIBotStudioGenerateStreamHandlerOptions): (request: Request) => Promise<Response>;
|
|
59
|
+
/**
|
|
60
|
+
* Mirror of AgentStreamEvent from @uibot/agents — inlined to avoid making
|
|
61
|
+
* application depend on the agents package (prevents circular deps).
|
|
62
|
+
*/
|
|
63
|
+
type AgentRunStreamEvent = {
|
|
64
|
+
type: "reasoning";
|
|
65
|
+
chunk: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: "content";
|
|
68
|
+
chunk: string;
|
|
69
|
+
} | {
|
|
70
|
+
type: "tool-call";
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
input: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: "tool-result";
|
|
76
|
+
callId: string;
|
|
77
|
+
output: string;
|
|
78
|
+
} | {
|
|
79
|
+
type: "skill-selected";
|
|
80
|
+
skillId: string;
|
|
81
|
+
trigger: string;
|
|
82
|
+
} | {
|
|
83
|
+
type: "subagent-delegated";
|
|
84
|
+
name: string;
|
|
85
|
+
} | {
|
|
86
|
+
type: "step";
|
|
87
|
+
stepIndex: number;
|
|
88
|
+
} | {
|
|
89
|
+
type: "done";
|
|
90
|
+
finishReason: string;
|
|
91
|
+
inputTokens?: number;
|
|
92
|
+
outputTokens?: number;
|
|
93
|
+
} | {
|
|
94
|
+
type: "error";
|
|
95
|
+
message: string;
|
|
96
|
+
};
|
|
97
|
+
export interface AgentRunRequest {
|
|
98
|
+
agentId: string;
|
|
99
|
+
messages: Array<{
|
|
100
|
+
role: "user" | "assistant" | "system";
|
|
101
|
+
content: AgentMessageContent;
|
|
102
|
+
}>;
|
|
103
|
+
/** Playground generation target. Spec remains the default real-project path. */
|
|
104
|
+
mode?: "spec" | "prototype" | "deck";
|
|
105
|
+
/** Compact project digest from the Playground client. */
|
|
106
|
+
projectDigest?: string;
|
|
107
|
+
/** Optional design-md id selected in Studio. */
|
|
108
|
+
designMdId?: string;
|
|
109
|
+
/** Additional prompt context assembled by the HTTP boundary. */
|
|
110
|
+
additionalContext?: string;
|
|
111
|
+
/** Playground mode: custom system prompt (with digest) that overrides the agent's default. */
|
|
112
|
+
systemPrompt?: string;
|
|
113
|
+
/** Playground mode: project entities/apis/pages used to create server-side tools. */
|
|
114
|
+
projectContext?: PlaygroundProjectContext;
|
|
115
|
+
/** Playground mode: model ID to use via modelFactory. */
|
|
116
|
+
modelId?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface CreateUIBotStudioAgentRunHandlerOptions {
|
|
119
|
+
/**
|
|
120
|
+
* Function that accepts an agent run request and an optional AbortSignal,
|
|
121
|
+
* and returns an async iterable of AgentRunStreamEvent.
|
|
122
|
+
* Typically wired to `runAgent` from `@uibot/agents`.
|
|
123
|
+
*/
|
|
124
|
+
runAgent: (request: AgentRunRequest, signal?: AbortSignal) => AsyncIterable<AgentRunStreamEvent>;
|
|
125
|
+
/**
|
|
126
|
+
* Called when the agent selects a skill (i.e. emits a `skill-selected` event).
|
|
127
|
+
* Use this to record usage without adding a dependency on @uibot/skills:
|
|
128
|
+
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* onSkillSelected: ({ skillId, trigger, intent }) => {
|
|
131
|
+
* usageStore.recordInvocation(skillId, { ... });
|
|
132
|
+
* usageStore.updateScoring(skillId, "render-ok");
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
onSkillSelected?: (event: {
|
|
137
|
+
skillId: string;
|
|
138
|
+
trigger: string;
|
|
139
|
+
agentId: string;
|
|
140
|
+
intent: string;
|
|
141
|
+
}) => void;
|
|
142
|
+
getDesignMd?: (id: string) => {
|
|
143
|
+
title: string;
|
|
144
|
+
body: string;
|
|
145
|
+
} | null;
|
|
146
|
+
/**
|
|
147
|
+
* Shared generation spine (v2.45+). Injected into additionalContext so ranked
|
|
148
|
+
* resources reach both agent and playground modes.
|
|
149
|
+
*/
|
|
150
|
+
composeSystemPrompt?: (input: {
|
|
151
|
+
intent: string;
|
|
152
|
+
designMdId?: string;
|
|
153
|
+
}) => {
|
|
154
|
+
text: string;
|
|
155
|
+
trace?: {
|
|
156
|
+
designMdIds: string[];
|
|
157
|
+
projectDesignPath: string | null;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
getConsumerSpecs?: () => Array<{
|
|
161
|
+
rel: string;
|
|
162
|
+
pageId: string;
|
|
163
|
+
path: string;
|
|
164
|
+
title: string;
|
|
165
|
+
yaml?: string;
|
|
166
|
+
}>;
|
|
167
|
+
/** URL path for the handler. Defaults to /api/studio/agents/run/stream */
|
|
168
|
+
path?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Factory for an SSE endpoint that streams agent execution events.
|
|
172
|
+
*
|
|
173
|
+
* Wire with `runAgent` from `@uibot/agents`:
|
|
174
|
+
* ```ts
|
|
175
|
+
* createUIBotStudioAgentRunHandler({
|
|
176
|
+
* runAgent: (req, signal) => runAgent({ ...req, signal }, { agentRegistry, skillRegistry }),
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* Events emitted (text/event-stream):
|
|
181
|
+
* reasoning, content, tool-call, tool-result, skill-selected, subagent-delegated, step, done, error
|
|
182
|
+
*
|
|
183
|
+
* Supports AbortController: client disconnect aborts the upstream agent run.
|
|
184
|
+
*/
|
|
185
|
+
export declare function createUIBotStudioAgentRunHandler(options: CreateUIBotStudioAgentRunHandlerOptions): (request: Request) => Promise<Response>;
|
|
186
|
+
/** Minimal view model returned by GET /api/studio/skills */
|
|
187
|
+
export interface StudioSkillSummary {
|
|
188
|
+
id: string;
|
|
189
|
+
title: string;
|
|
190
|
+
version: string;
|
|
191
|
+
tags: string[];
|
|
192
|
+
category?: import("@uibot/contracts").SkillCategory;
|
|
193
|
+
avgScore: number;
|
|
194
|
+
}
|
|
195
|
+
/** Full skill detail returned by GET /api/studio/skills/:id */
|
|
196
|
+
export interface StudioSkillDetail extends StudioSkillSummary {
|
|
197
|
+
body: string;
|
|
198
|
+
/** Last ≤30 invocation scores (1 = success, 0 = failure), oldest first. */
|
|
199
|
+
recentSignals?: number[];
|
|
200
|
+
}
|
|
201
|
+
export interface StudioDesignMdSummary {
|
|
202
|
+
id: string;
|
|
203
|
+
title: string;
|
|
204
|
+
category: string;
|
|
205
|
+
tags: string[];
|
|
206
|
+
/** Full markdown body of the design style guide. */
|
|
207
|
+
body: string;
|
|
208
|
+
/**
|
|
209
|
+
* Registry merge layer (v2.13+). Indicates whether the entry was auto-
|
|
210
|
+
* imported (e.g. from tailwind.config.ts), hand-written by the user, or
|
|
211
|
+
* is an explicit user-level override of an auto entry.
|
|
212
|
+
* Optional field — pre-v2.13 snapshot producers omit it.
|
|
213
|
+
*/
|
|
214
|
+
layer?: "auto" | "user" | "override";
|
|
215
|
+
/**
|
|
216
|
+
* Absolute filesystem path of the source file that produced this entry
|
|
217
|
+
* (v2.13+). Auto-layer entries carry the originating config file
|
|
218
|
+
* (`tailwind.config.ts`, `tokens.json`, etc.); user-written `.md`
|
|
219
|
+
* entries leave this undefined.
|
|
220
|
+
*/
|
|
221
|
+
sourcePath?: string;
|
|
222
|
+
}
|
|
223
|
+
export interface StudioAgentSummary {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
description: string;
|
|
227
|
+
allowedSkills: string[];
|
|
228
|
+
}
|
|
229
|
+
export type SkillSignal = "render-ok" | "render-fail" | "user-thumb-up" | "user-thumb-down";
|
|
230
|
+
export interface CreateUIBotStudioResourcesHandlerOptions {
|
|
231
|
+
skills?: {
|
|
232
|
+
list: () => StudioSkillSummary[];
|
|
233
|
+
get: (id: string) => StudioSkillDetail | null;
|
|
234
|
+
/** Optional: handle a user signal (👍/👎) for a skill */
|
|
235
|
+
signal?: (id: string, signal: SkillSignal, extra?: {
|
|
236
|
+
intent?: string;
|
|
237
|
+
context?: string;
|
|
238
|
+
}) => void;
|
|
239
|
+
/** Optional: return recent failure-diagnostic reflections (most recent first) */
|
|
240
|
+
listReflections?: (id: string, limit?: number) => SkillReflectionRecord[];
|
|
241
|
+
/** Optional: return regression cases (active-only when `status === "active"`) */
|
|
242
|
+
listRegressions?: (id: string, status?: "active" | "all") => SkillRegressionRecord[];
|
|
243
|
+
};
|
|
244
|
+
designMd?: {
|
|
245
|
+
list: () => StudioDesignMdSummary[];
|
|
246
|
+
/** Optional: handle a user signal for a design-md entry */
|
|
247
|
+
signal?: (id: string, signal: SkillSignal, extra?: {
|
|
248
|
+
intent?: string;
|
|
249
|
+
context?: string;
|
|
250
|
+
}) => void;
|
|
251
|
+
};
|
|
252
|
+
agents?: {
|
|
253
|
+
list: () => StudioAgentSummary[];
|
|
254
|
+
};
|
|
255
|
+
evolution?: {
|
|
256
|
+
listProposals: () => SkillEvolutionProposal[];
|
|
257
|
+
/** Optional: approve a proposal by id; return false if not found */
|
|
258
|
+
approve?: (id: string) => boolean | Promise<boolean>;
|
|
259
|
+
/** Optional: rollback a proposal by id; return false if not found */
|
|
260
|
+
rollback?: (id: string) => boolean | Promise<boolean>;
|
|
261
|
+
};
|
|
262
|
+
/** Base path prefix. Defaults to "/api/studio" */
|
|
263
|
+
basePath?: string;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Factory for read-only Studio resource endpoints:
|
|
267
|
+
*
|
|
268
|
+
* - `GET {base}/skills` → `{ skills: StudioSkillSummary[] }`
|
|
269
|
+
* - `GET {base}/skills/:id` → `StudioSkillDetail`
|
|
270
|
+
* - `GET {base}/design-md` → `{ designMds: StudioDesignMdSummary[] }`
|
|
271
|
+
* - `GET {base}/agents` → `{ agents: StudioAgentSummary[] }`
|
|
272
|
+
* - `GET {base}/evolution/proposals` → `{ proposals: StudioEvolutionProposalRow[] }`
|
|
273
|
+
* (raw proposals projected via `toProposalRow` so the response shape matches
|
|
274
|
+
* the `/evolution` page's SSR pre-seed and live onMount fetch interchangeably)
|
|
275
|
+
*
|
|
276
|
+
* Each resource is opt-in via the `options` object. Un-wired routes return 404.
|
|
277
|
+
* Registries are injected via callbacks (DI) — no direct import of skill/agent packages.
|
|
278
|
+
*/
|
|
279
|
+
export declare function createUIBotStudioResourcesHandler(options: CreateUIBotStudioResourcesHandlerOptions): (request: Request) => Promise<Response>;
|
|
280
|
+
export interface DesignMdScanImporterError {
|
|
281
|
+
source: string;
|
|
282
|
+
code: string;
|
|
283
|
+
message: string;
|
|
284
|
+
}
|
|
285
|
+
export interface DesignMdScanResult {
|
|
286
|
+
entries: Array<{
|
|
287
|
+
id: string;
|
|
288
|
+
title: string;
|
|
289
|
+
category: string;
|
|
290
|
+
tags: string[];
|
|
291
|
+
body: string;
|
|
292
|
+
layer?: "auto" | "user" | "override";
|
|
293
|
+
sourcePath?: string;
|
|
294
|
+
}>;
|
|
295
|
+
errors: DesignMdScanImporterError[];
|
|
296
|
+
}
|
|
297
|
+
export type DesignMdScanKind = "tailwind" | "tokens" | "css";
|
|
298
|
+
export interface CreateUIBotStudioDesignMdScanHandlerOptions {
|
|
299
|
+
/**
|
|
300
|
+
* Scan implementation. Must not execute untrusted user code — typical
|
|
301
|
+
* choice is `scanAutoDesignMd` from `@uibot/design-md-importer`.
|
|
302
|
+
* The handler is framework-neutral and accepts any function matching
|
|
303
|
+
* this shape so callers keep control over which scanners run.
|
|
304
|
+
*/
|
|
305
|
+
scanAutoDesignMd: (args: {
|
|
306
|
+
projectRoot: string;
|
|
307
|
+
enabled?: DesignMdScanKind[];
|
|
308
|
+
}) => DesignMdScanResult;
|
|
309
|
+
/**
|
|
310
|
+
* Registry instance whose `addAll` receives the freshly-scanned entries
|
|
311
|
+
* stamped as `layer: "auto"`. Injected via DI so the application layer
|
|
312
|
+
* does not need a runtime dep on `@uibot/design-md`.
|
|
313
|
+
*/
|
|
314
|
+
registry: {
|
|
315
|
+
addAll: (entries: DesignMdScanResult["entries"], options?: {
|
|
316
|
+
layer?: "auto" | "user" | "override";
|
|
317
|
+
}) => void;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Allowed root directory. Any `projectRoot` in the request body must
|
|
321
|
+
* resolve to a path beneath `allowedRoot`; otherwise the handler
|
|
322
|
+
* returns 403. Typically this is `UIBOT_AGENT_ROOT_DIR`.
|
|
323
|
+
*/
|
|
324
|
+
allowedRoot: string;
|
|
325
|
+
/**
|
|
326
|
+
* Warn threshold in milliseconds. When a scan completes but exceeds
|
|
327
|
+
* this duration, `errors` receives an extra `{code: "scan-slow"}`
|
|
328
|
+
* entry so the UI can surface the slow scan to the user.
|
|
329
|
+
* Default: 10_000 (10s). Set to 0 to disable.
|
|
330
|
+
*/
|
|
331
|
+
slowWarnMs?: number;
|
|
332
|
+
/** Base path prefix. Defaults to "/api/studio" */
|
|
333
|
+
basePath?: string;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Factory for the Design-MD auto scan endpoint:
|
|
337
|
+
*
|
|
338
|
+
* - `POST {base}/design-md/scan` → `{ scanned, durationMs, errors }`
|
|
339
|
+
*
|
|
340
|
+
* Request body (JSON, all fields optional):
|
|
341
|
+
* ```json
|
|
342
|
+
* { "projectRoot": "/abs/path", "sources": ["tailwind", "tokens", "css"] }
|
|
343
|
+
* ```
|
|
344
|
+
*
|
|
345
|
+
* Security contract (v2.13):
|
|
346
|
+
* - `projectRoot` must resolve to a subdirectory of `allowedRoot`, else
|
|
347
|
+
* returns 403 with a structured JSON error. When omitted, defaults to
|
|
348
|
+
* `allowedRoot` itself.
|
|
349
|
+
* - Scanners never execute user code (AST-literal / JSON-parse / regex
|
|
350
|
+
* only — enforced by the `@uibot/design-md-importer` contract).
|
|
351
|
+
* - Handler never returns fabricated / mock data; any scan failure
|
|
352
|
+
* propagates into `errors[]` as a structured entry.
|
|
353
|
+
*
|
|
354
|
+
* On success the handler also `addAll`s the entries into the configured
|
|
355
|
+
* `registry` with `{ layer: "auto" }`, so the next generate call
|
|
356
|
+
* immediately sees the freshly-scanned tokens.
|
|
357
|
+
*/
|
|
358
|
+
export declare function createUIBotStudioDesignMdScanHandler(options: CreateUIBotStudioDesignMdScanHandlerOptions): (request: Request) => Promise<Response>;
|
|
359
|
+
export * from "./studio-design-http.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ImageGenerationService, LogoAssetManifest, LogoGenerateRequest, LogoExportOptions, LogoExportRequest, LogoExportTargetDescriptor } from "@uibot/contracts";
|
|
2
|
+
export interface LogoAssetStore {
|
|
3
|
+
list(): Promise<LogoAssetManifest[]>;
|
|
4
|
+
read(id: string): Promise<{
|
|
5
|
+
manifest: LogoAssetManifest;
|
|
6
|
+
bytes: Uint8Array;
|
|
7
|
+
referencePath: string;
|
|
8
|
+
}>;
|
|
9
|
+
save(input: LogoGenerateRequest, prompt: string, image: Awaited<ReturnType<ImageGenerationService["generate"]>>): Promise<LogoAssetManifest>;
|
|
10
|
+
}
|
|
11
|
+
export interface LogoAssetExporter {
|
|
12
|
+
targets(): LogoExportTargetDescriptor[];
|
|
13
|
+
preview(bytes: Uint8Array, options: LogoExportOptions, file: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
14
|
+
export(bytes: Uint8Array, manifest: LogoAssetManifest, options: LogoExportRequest, signal?: AbortSignal): Promise<Array<{
|
|
15
|
+
path: string;
|
|
16
|
+
content: Uint8Array | string;
|
|
17
|
+
}>>;
|
|
18
|
+
}
|
|
19
|
+
export declare function composeLogoPrompt(input: LogoGenerateRequest): string;
|
|
20
|
+
export declare function createUIBotStudioLogoHandler(options: {
|
|
21
|
+
images: ImageGenerationService;
|
|
22
|
+
store: LogoAssetStore;
|
|
23
|
+
exporter?: LogoAssetExporter;
|
|
24
|
+
}): (request: Request) => Promise<Response | null>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CompiledUIBotSpec } from "@uibot/contracts";
|
|
2
|
+
/** A single agent row, mirrored from `snapshot.agents.agents[*]`
|
|
3
|
+
* ({@link UIBotStudioAgentEntry} in studio.ts). */
|
|
4
|
+
export interface StudioAgentInput {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
defaultModel?: string;
|
|
9
|
+
allowedSkills: string[];
|
|
10
|
+
capabilityRefs: string[];
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** The `/agents` page data slice. Mirrors `UIBotStudioAgentsSummary` so the
|
|
14
|
+
* integration step can wire `snapshot.agents` straight in. */
|
|
15
|
+
export interface StudioAgentsInput {
|
|
16
|
+
totals: {
|
|
17
|
+
total: number;
|
|
18
|
+
enabled: number;
|
|
19
|
+
};
|
|
20
|
+
agents: StudioAgentInput[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Build the `/agents` dogfood page.
|
|
24
|
+
*
|
|
25
|
+
* Blocks used:
|
|
26
|
+
* - `BadgeGroup` — totals summary (enabled / total) as status chips.
|
|
27
|
+
* - `SplitMasterDetail` — master list of agents (select → detail panel), with
|
|
28
|
+
* the agent name as title and the default model as subtitle.
|
|
29
|
+
* - `SearchableTable` — `_contains` search across agent `name`, listing
|
|
30
|
+
* name / model / skill-count / status. Drives the visible roster; the
|
|
31
|
+
* master/detail split provides the drill-down.
|
|
32
|
+
* - `KeyValueGrid` — the selected agent's id / description / default model /
|
|
33
|
+
* skill-count / capability-count.
|
|
34
|
+
* - `BadgeGroup` — the selected agent's allowed-skill chips and capability-ref
|
|
35
|
+
* chips.
|
|
36
|
+
*
|
|
37
|
+
* Pure display: data is injected server-side and `__computed` (filtered roster +
|
|
38
|
+
* selected agent) is pre-seeded so the SSR first paint matches the client mount
|
|
39
|
+
* recompute (no flash). No `onMount` fetch — everything lives in the snapshot.
|
|
40
|
+
*
|
|
41
|
+
* Expressiveness note: the legacy page's "Try in Playground" link
|
|
42
|
+
* (`/playground?agent=<id>`) is a per-row navigation affordance. It is preserved
|
|
43
|
+
* here via a `Link` block (variant: button) in the detail panel whose `href` is
|
|
44
|
+
* bound to the selected agent id — a real `<a href>`, matching the legacy markup
|
|
45
|
+
* exactly. (The `Button` block in this codebase is render-only and dispatches no
|
|
46
|
+
* action, so Link is the correct declarative nav primitive.)
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildAgentsPage(input: StudioAgentsInput): CompiledUIBotSpec;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CompiledUIBotSpec } from "@uibot/contracts";
|
|
2
|
+
/** A single catalog component row, as exposed by the runtime snapshot. */
|
|
3
|
+
export interface StudioCatalogComponentInput {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
category?: string;
|
|
7
|
+
level?: string;
|
|
8
|
+
source?: string;
|
|
9
|
+
propCount?: number;
|
|
10
|
+
slotCount?: number;
|
|
11
|
+
tags?: string[];
|
|
12
|
+
}
|
|
13
|
+
/** The `/catalog` page data slice (runtime.catalog). */
|
|
14
|
+
export type StudioCatalogInput = StudioCatalogComponentInput[];
|
|
15
|
+
/**
|
|
16
|
+
* Build the `/catalog` dogfood page: a searchable component table on top and a
|
|
17
|
+
* master/detail split (component list → description + metadata badges) below.
|
|
18
|
+
*
|
|
19
|
+
* `computed.filtered` is a query-aware `_filter` over the catalog; `selected`
|
|
20
|
+
* is a `_find` by component name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildCatalogPage(catalog: StudioCatalogInput): CompiledUIBotSpec;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CompiledUIBotSpec } from "@uibot/contracts";
|
|
2
|
+
/**
|
|
3
|
+
* A single design-md entry, mirrored from the snapshot `designMds` slot
|
|
4
|
+
* (`UIBotStudioDesignMdsSummary.designMds`).
|
|
5
|
+
*
|
|
6
|
+
* NOTE (data gap): the snapshot slot only carries `id/title/category/tags`.
|
|
7
|
+
* The legacy hand-written page additionally fetched `body` / `layer` /
|
|
8
|
+
* `sourcePath` from `/api/design-md` to power the detail body preview. Those
|
|
9
|
+
* fields are optional here so the builder can surface them when a richer
|
|
10
|
+
* snapshot (or an onMount-loaded payload) provides them, and degrade to the
|
|
11
|
+
* id/title/category/tags the v4 snapshot guarantees otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export interface StudioDesignMdEntryInput {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
category: string;
|
|
17
|
+
tags: string[];
|
|
18
|
+
/** Full markdown body (optional; not present in the v4 snapshot slot). */
|
|
19
|
+
body?: string;
|
|
20
|
+
/** Registry merge layer (optional; v2.13+ servers only). */
|
|
21
|
+
layer?: "auto" | "user" | "override";
|
|
22
|
+
/** Source config path for auto-scanned entries (optional). */
|
|
23
|
+
sourcePath?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The `/design-md` page data slice (snapshot.designMds). */
|
|
26
|
+
export interface StudioDesignMdInput {
|
|
27
|
+
totals: {
|
|
28
|
+
total: number;
|
|
29
|
+
};
|
|
30
|
+
designMds: StudioDesignMdEntryInput[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build the `/design-md` dogfood page.
|
|
34
|
+
*
|
|
35
|
+
* Blocks used:
|
|
36
|
+
* - `BadgeGroup` — the distinct tag chips, rendered as a clickable tag filter
|
|
37
|
+
* surface (selecting a tag sets `tagFilter`).
|
|
38
|
+
* - `StatGrid` — KPI cards (total files / distinct tags / distinct categories).
|
|
39
|
+
* - `SearchableTable` — the design-md entries, `_contains` search across
|
|
40
|
+
* title/id/category/tags; the rows are first narrowed by the active tag
|
|
41
|
+
* filter (`filteredByTag`), then by the search needle (`filteredEntries`).
|
|
42
|
+
* - `SplitMasterDetail` — entry drill-down (title list → category / layer /
|
|
43
|
+
* tags BadgeGroup + KeyValueGrid + body preview), driven by `selectedId`.
|
|
44
|
+
*
|
|
45
|
+
* Declarative tag filter: the tag chips are static `BadgeGroup` items. The
|
|
46
|
+
* `tagFilter` state is empty by default, and `filteredByTag` keeps every row
|
|
47
|
+
* whose joined `tagsText` `_contains` the active tag (empty needle ⇒ pass-all),
|
|
48
|
+
* so a "no tag selected" view shows everything without an extra `_eq` branch.
|
|
49
|
+
*
|
|
50
|
+
* The tag-filtered rows, the searchable-table rows, and the master/detail
|
|
51
|
+
* selection are all pre-seeded into `__computed` server-side so the SSR first
|
|
52
|
+
* paint matches the client mount recompute (no flash). Empty tagFilter + empty
|
|
53
|
+
* search ⇒ filters pass everything; `selectedEntry` is the first entry.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildDesignMdPage(input: StudioDesignMdInput): CompiledUIBotSpec;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { CompiledUIBotSpec } from "@uibot/contracts";
|
|
2
|
+
/** Lifecycle status of a single skill-evolution proposal. */
|
|
3
|
+
export type StudioEvolutionProposalStatus = "pending" | "accepted" | "rejected" | "rolled-back";
|
|
4
|
+
/**
|
|
5
|
+
* A single skill-evolution proposal, mirrored from the
|
|
6
|
+
* `/api/studio/evolution/proposals` response (`EvolutionProposal` in the studio
|
|
7
|
+
* API client). The fields here are the subset the page renders + groups on.
|
|
8
|
+
*/
|
|
9
|
+
export interface StudioEvolutionProposalInput {
|
|
10
|
+
id: string;
|
|
11
|
+
skillId: string;
|
|
12
|
+
fromVersion: string;
|
|
13
|
+
status: StudioEvolutionProposalStatus;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
failureTriggerCount: number;
|
|
16
|
+
deltaScore?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Flattened row shape consumed by the `/evolution` SearchableTable.
|
|
20
|
+
*
|
|
21
|
+
* This is the *single* shape used in three places that must stay
|
|
22
|
+
* interchangeable:
|
|
23
|
+
* 1. the SSR pre-seed (`seedProposalRows` / `proposalsResponse.proposals`),
|
|
24
|
+
* 2. the `liveProposals` / `filteredProposals` computed slices, and
|
|
25
|
+
* 3. the `GET /api/studio/evolution/proposals` HTTP response.
|
|
26
|
+
*
|
|
27
|
+
* `deltaScore` is pre-formatted to a display string (e.g. `"+1.2%"`) here so
|
|
28
|
+
* the table renders the same value whether the rows came from the SSR seed or
|
|
29
|
+
* a live onMount fetch — the raw `SkillEvolutionProposal.deltaScore` (a bare
|
|
30
|
+
* `number`) is never sent to the table.
|
|
31
|
+
*/
|
|
32
|
+
export interface StudioEvolutionProposalRow {
|
|
33
|
+
id: string;
|
|
34
|
+
skillId: string;
|
|
35
|
+
fromVersion: string;
|
|
36
|
+
status: StudioEvolutionProposalStatus;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
failureTriggerCount: number;
|
|
39
|
+
/** Pre-formatted delta score, e.g. `"+1.2%"` / `"-0.5%"` / `"—"`. */
|
|
40
|
+
deltaScore: string;
|
|
41
|
+
statusTone: "success" | "warning" | "error" | "info";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Project a raw proposal (`SkillEvolutionProposal` from the server, or the
|
|
45
|
+
* page-input subset) into the flat {@link StudioEvolutionProposalRow} the
|
|
46
|
+
* SearchableTable consumes. Shared by the page SSR seed and the studio HTTP
|
|
47
|
+
* evolution endpoint so the live fetch and the pre-seed are byte-for-byte
|
|
48
|
+
* interchangeable.
|
|
49
|
+
*/
|
|
50
|
+
export declare function toProposalRow(p: StudioEvolutionProposalInput): StudioEvolutionProposalRow;
|
|
51
|
+
/**
|
|
52
|
+
* The `/evolution` page data slice.
|
|
53
|
+
*
|
|
54
|
+
* NOTE: there is no dedicated `evolution` slot on the studio snapshot — the live
|
|
55
|
+
* proposal list is fetched at runtime from `/api/studio/evolution/proposals` via
|
|
56
|
+
* `lifecycle.onMount`. This `input` therefore carries an *optional* server-side
|
|
57
|
+
* seed (`proposals`) used only to pre-render the kanban / trend / table for the
|
|
58
|
+
* SSR first paint; when omitted the page mounts empty and the onMount fetch
|
|
59
|
+
* populates the searchable table.
|
|
60
|
+
*/
|
|
61
|
+
export interface StudioEvolutionInput {
|
|
62
|
+
/** Optional SSR pre-seed; the live source-of-truth is the onMount fetch. */
|
|
63
|
+
proposals?: StudioEvolutionProposalInput[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build the `/evolution` dogfood page.
|
|
67
|
+
*
|
|
68
|
+
* Blocks used:
|
|
69
|
+
* - `StatGrid` — proposal totals per lifecycle state (pending / accepted /
|
|
70
|
+
* rejected / rolled-back) as KPI cards.
|
|
71
|
+
* - `BadgeGroup` — quick status summary badges (tone per state).
|
|
72
|
+
* - `KanbanBoard` — proposals grouped into Pending / Accepted / Rejected /
|
|
73
|
+
* Rolled-back columns; each proposal becomes a card (title = skillId,
|
|
74
|
+
* subtitle = fromVersion + age, badge = failure count).
|
|
75
|
+
* - `TrendChart` — delta-score trend across proposals (generation order), so the
|
|
76
|
+
* reviewer can eyeball whether evolution is improving scores over time.
|
|
77
|
+
* - `SearchableTable` — proposal table with `_contains` search across
|
|
78
|
+
* skillId / status / fromVersion.
|
|
79
|
+
*
|
|
80
|
+
* ### Live data via lifecycle.onMount
|
|
81
|
+
* The proposal list is snapshot-external, so the page fetches it at mount with a
|
|
82
|
+
* `Request` action against the HTTP studio connection:
|
|
83
|
+
*
|
|
84
|
+
* onMount: Request → /api/studio/evolution/proposals (GET) → state.proposalsResponse
|
|
85
|
+
*
|
|
86
|
+
* The HTTP driver stores the parsed JSON body (`{ proposals: [...] }`) into
|
|
87
|
+
* `proposalsResponse`; the `liveProposals` computed extracts `.proposals` and
|
|
88
|
+
* feeds the searchable table so it live-refreshes after mount. The kanban + trend
|
|
89
|
+
* + stat cards are derived from the server pre-seed (`input.proposals`) because
|
|
90
|
+
* the engine has no array-projection operator (see expressiveness gap below).
|
|
91
|
+
*
|
|
92
|
+
* ### Expressiveness gaps (recorded, not yet spec-able)
|
|
93
|
+
* 1. **Array projection.** The engine operators (`_filter` / `_find`) *select*
|
|
94
|
+
* array items but cannot *reshape* them. Kanban cards (`column` / `title` /
|
|
95
|
+
* `subtitle` / `badge`) and the trend `series.points` therefore must be
|
|
96
|
+
* pre-computed in TypeScript and pre-seeded; they reflect the SSR snapshot and
|
|
97
|
+
* do **not** live-update from the onMount fetch. Only the SearchableTable
|
|
98
|
+
* (which consumes raw proposal fields directly) refreshes from the fetch.
|
|
99
|
+
* 2. **Approve / reject / rollback mutations.** These are per-row POST actions
|
|
100
|
+
* (`/proposals/:id/approve|rollback`) that, on success, must re-run the fetch
|
|
101
|
+
* to refresh the board. SearchableTable has no per-row action-button slot in
|
|
102
|
+
* the current block catalog, and there is no spec-able way to template a
|
|
103
|
+
* `:id` path segment from the clicked row into a `Request` payload. The legacy
|
|
104
|
+
* page's Approve / Rollback buttons + diff dialog are therefore **not yet
|
|
105
|
+
* migrated**; this page surfaces the proposals read-only. Mutations remain in
|
|
106
|
+
* the legacy fallback until the catalog gains a row-action block + a
|
|
107
|
+
* row-scoped Request payload binding.
|
|
108
|
+
* 3. **Diff dialog.** The legacy `proposedBody` diff modal (Dialog block +
|
|
109
|
+
* selected-row body preview) is also deferred for the same row-action reason.
|
|
110
|
+
*/
|
|
111
|
+
export declare function buildEvolutionPage(input: StudioEvolutionInput): CompiledUIBotSpec;
|