@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,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview HTML rendering. Produces the SPA shell (`/preview/shell/:sid`) and
|
|
3
|
+
* individual page documents (`/preview/page/:sid/:pageId`). Under opaque-origin
|
|
4
|
+
* sandboxing, the iframe cannot fetch parent-origin endpoints — Tailwind Play
|
|
5
|
+
* is inlined, link interception is injected. As of v2.13.1, API calls are
|
|
6
|
+
* rewritten by the path-rewrite runtime (Sprint 2) and proxied through
|
|
7
|
+
* `/preview/api/:sid/*` to the real NowAPI gateway. No mock runtime.
|
|
8
|
+
*/
|
|
9
|
+
import type { StoredApi, StoredSession } from "./session-store.js";
|
|
10
|
+
export declare function loadTailwindInline(path: string): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Path-rewrite runtime (v2.13.1): rewrites every `/api/*` fetch and form
|
|
13
|
+
* action inside the preview iframe to `/preview/api/:sid/*` so the browser
|
|
14
|
+
* routes them to the backend same-origin proxy. Never fabricates data —
|
|
15
|
+
* failures surface as real HTTP errors (see memory
|
|
16
|
+
* `feedback_no_mock_preview`).
|
|
17
|
+
*
|
|
18
|
+
* Injected as the first inline script in `<head>` so it wins before any
|
|
19
|
+
* AI-generated code reads `window.fetch`.
|
|
20
|
+
*/
|
|
21
|
+
declare function buildPathRewriteScript(sid: string): string;
|
|
22
|
+
export { buildPathRewriteScript };
|
|
23
|
+
/**
|
|
24
|
+
* Render a single page document. Injects Tailwind Play inline, the
|
|
25
|
+
* path-rewrite runtime (replaces the old mock runtime — v2.13.1), the
|
|
26
|
+
* session bridge, and the link interceptor. AI-generated HTML is trusted
|
|
27
|
+
* in shape but sandboxed by opaque origin.
|
|
28
|
+
*
|
|
29
|
+
* `apis` currently informs upstream allowlist enforcement on the proxy
|
|
30
|
+
* side (see `proxy.ts`); it is kept in the signature as future-proofing
|
|
31
|
+
* even though path rewriting itself is session-id-driven.
|
|
32
|
+
*/
|
|
33
|
+
export declare function renderPage(sid: string, pageHtml: string, _apis: StoredApi[], tailwindInline: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Render the SPA shell wrapping all project pages. Inner frames reference
|
|
36
|
+
* `/preview/page/:sid/:pageId` via src, not srcdoc — same opaque-origin
|
|
37
|
+
* isolation with normal HTTP fetch semantics (CSP allows self).
|
|
38
|
+
*/
|
|
39
|
+
export declare function renderShell(sid: string, sess: StoredSession): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StoredApi } from "./session-store.js";
|
|
2
|
+
export interface PreviewRoutesOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Allowed studio origin for CORS + `frame-ancestors` CSP.
|
|
5
|
+
* Accepts either a single origin (`http://localhost:3200`) or a
|
|
6
|
+
* space-separated list when multiple loopback forms should coexist
|
|
7
|
+
* (`http://localhost:3200 http://127.0.0.1:3200`) — common in local dev
|
|
8
|
+
* where `localhost` and `127.0.0.1` are treated as different origins.
|
|
9
|
+
* CORS `Access-Control-Allow-Origin` always uses the first token.
|
|
10
|
+
*/
|
|
11
|
+
studioOrigin: string;
|
|
12
|
+
tailwindPath: string;
|
|
13
|
+
sessionTtlMs?: number;
|
|
14
|
+
maxSessions?: number;
|
|
15
|
+
/**
|
|
16
|
+
* NowAPI gateway base URL for the preview same-origin proxy (v2.13.1).
|
|
17
|
+
* Populated from `UIBOT_NOWAPI_URL` env; when absent, iframe `/api/*`
|
|
18
|
+
* calls fail with `gateway-url-missing` (no mock fallback, per memory
|
|
19
|
+
* `feedback_no_mock_preview`).
|
|
20
|
+
*/
|
|
21
|
+
nowapiUrl?: string;
|
|
22
|
+
/** `UIBOT_NOWAPI_API_KEY` env, injected as `Authorization: Bearer <key>`. */
|
|
23
|
+
nowapiApiKey?: string;
|
|
24
|
+
/** Server-held maximum NowAPI allowlist. Empty means fail-closed. */
|
|
25
|
+
serverAllowlist?: StoredApi[];
|
|
26
|
+
}
|
|
27
|
+
export declare function createPreviewRoutes(options: PreviewRoutesOptions): (req: Request) => Promise<Response | null>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory TTL-based session store for preview payloads.
|
|
3
|
+
* Each session holds the serialized project + sessionRole needed to render
|
|
4
|
+
* the preview shell and individual pages.
|
|
5
|
+
*
|
|
6
|
+
* v2.13.1 removed `mockEnabled` and `StoredApi.mock`: previews now always
|
|
7
|
+
* proxy through `/preview/api/:sid/*` to the real NowAPI gateway (see
|
|
8
|
+
* `proxy.ts`). Keeping those fields would be dead code and contradict
|
|
9
|
+
* the memory `feedback_no_mock_preview` freeze.
|
|
10
|
+
*/
|
|
11
|
+
export type SessionRole = "anon" | "admin" | "user";
|
|
12
|
+
export interface StoredPage {
|
|
13
|
+
pageId: string;
|
|
14
|
+
title: string;
|
|
15
|
+
route: string;
|
|
16
|
+
html?: string;
|
|
17
|
+
yaml?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface StoredApi {
|
|
20
|
+
id: string;
|
|
21
|
+
method: string;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
export interface StoredProject {
|
|
25
|
+
name: string;
|
|
26
|
+
homePageId?: string | null;
|
|
27
|
+
pages: StoredPage[];
|
|
28
|
+
apis: StoredApi[];
|
|
29
|
+
}
|
|
30
|
+
export interface StoredSession {
|
|
31
|
+
project: StoredProject;
|
|
32
|
+
sessionRole: SessionRole;
|
|
33
|
+
createdAt: number;
|
|
34
|
+
}
|
|
35
|
+
export interface SessionStoreOptions {
|
|
36
|
+
ttlMs: number;
|
|
37
|
+
max: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function createSessionStore(options: SessionStoreOptions): {
|
|
40
|
+
get(id: string): StoredSession | undefined;
|
|
41
|
+
set(id: string, session: Omit<StoredSession, "createdAt">): void;
|
|
42
|
+
delete(id: string): void;
|
|
43
|
+
size(): number;
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Catalog, ComponentArtifact, CompileResult, UIBotSpec } from "@uibot/contracts";
|
|
2
|
+
import type { GapResolutionInstallResult, GapResolutionServices } from "./gap-orchestrator.js";
|
|
3
|
+
export interface RequestComponentInput {
|
|
4
|
+
missingType: string;
|
|
5
|
+
context?: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface UIBotHubClient {
|
|
8
|
+
requestComponent(input: RequestComponentInput): Promise<ComponentArtifact>;
|
|
9
|
+
}
|
|
10
|
+
export interface HttpHubClientOptions {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
requestedBy?: string;
|
|
14
|
+
priority?: "low" | "normal" | "high";
|
|
15
|
+
pollIntervalMs?: number;
|
|
16
|
+
maxPollAttempts?: number;
|
|
17
|
+
fetchImpl?: typeof fetch;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateGapRecoveryServicesOptions {
|
|
20
|
+
compile(spec: UIBotSpec, catalog: Catalog): Promise<CompileResult> | CompileResult;
|
|
21
|
+
hubClient: UIBotHubClient;
|
|
22
|
+
installArtifact(artifact: ComponentArtifact): Promise<GapResolutionInstallResult>;
|
|
23
|
+
}
|
|
24
|
+
export declare function createGapRecoveryServices(options: CreateGapRecoveryServicesOptions): GapResolutionServices;
|
|
25
|
+
export declare function createHttpHubClient(options: HttpHubClientOptions): UIBotHubClient;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from "./compose-system-prompt.js";
|
|
2
|
+
export * from "./ui-craft-baseline.js";
|
|
3
|
+
export * from "./composition.js";
|
|
4
|
+
export * from "./discovery-protocol.js";
|
|
5
|
+
export * from "./grounded-brief.js";
|
|
6
|
+
export * from "./context-service.js";
|
|
7
|
+
export * from "./gap-orchestrator.js";
|
|
8
|
+
export * from "./hub-client.js";
|
|
9
|
+
export * from "./live-runtime-adapter.js";
|
|
10
|
+
export * from "./prompt.js";
|
|
11
|
+
export * from "./runtime.js";
|
|
12
|
+
export * from "./studio-compose-context.js";
|
|
13
|
+
export * from "./studio-http.js";
|
|
14
|
+
export * from "./studio-compose-http.js";
|
|
15
|
+
export * from "./studio-artifact-export-http.js";
|
|
16
|
+
export * from "./studio-design-md-export-http.js";
|
|
17
|
+
export * from "./studio-resource-index-http.js";
|
|
18
|
+
export * from "./studio-spec-recover-http.js";
|
|
19
|
+
export * from "./studio-spec-sync-http.js";
|
|
20
|
+
export * from "./studio-project-design-http.js";
|
|
21
|
+
export * from "./studio-project-specs.js";
|
|
22
|
+
export * from "./resource-apply.js";
|
|
23
|
+
export * from "./playground-session-http.js";
|
|
24
|
+
export * from "./creation-store.js";
|
|
25
|
+
export * from "./creation-legacy-flat-spec.js";
|
|
26
|
+
export * from "./creation-domains.js";
|
|
27
|
+
export * from "./creation-http.js";
|
|
28
|
+
export * from "./creation-brand.js";
|
|
29
|
+
export * from "./studio.js";
|
|
30
|
+
export * from "./studio-pages/index.js";
|
|
31
|
+
export * from "./studio-logo.js";
|
|
32
|
+
export * from "./html-preview/index.js";
|