@fayz-ai/app-builder 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -0
  3. package/dist/admin/AdminAppBuilder.d.ts +11 -0
  4. package/dist/admin/AdminAppBuilder.d.ts.map +1 -0
  5. package/dist/admin/agent-surface.d.ts +18 -0
  6. package/dist/admin/agent-surface.d.ts.map +1 -0
  7. package/dist/admin/options.d.ts +22 -0
  8. package/dist/admin/options.d.ts.map +1 -0
  9. package/dist/admin/target.d.ts +20 -0
  10. package/dist/admin/target.d.ts.map +1 -0
  11. package/dist/chunk-45SFS6FV.js +721 -0
  12. package/dist/chunk-45SFS6FV.js.map +1 -0
  13. package/dist/components/AppBuilder.d.ts +12 -0
  14. package/dist/components/AppBuilder.d.ts.map +1 -0
  15. package/dist/components/BuilderCanvas.d.ts +9 -0
  16. package/dist/components/BuilderCanvas.d.ts.map +1 -0
  17. package/dist/components/BuilderChrome.d.ts +25 -0
  18. package/dist/components/BuilderChrome.d.ts.map +1 -0
  19. package/dist/components/BuilderEmpty.d.ts +7 -0
  20. package/dist/components/BuilderEmpty.d.ts.map +1 -0
  21. package/dist/components/PagePicker.d.ts +20 -0
  22. package/dist/components/PagePicker.d.ts.map +1 -0
  23. package/dist/components/PublishButton.d.ts +9 -0
  24. package/dist/components/PublishButton.d.ts.map +1 -0
  25. package/dist/hooks/useBuilderFrame.d.ts +22 -0
  26. package/dist/hooks/useBuilderFrame.d.ts.map +1 -0
  27. package/dist/index.d.ts +15 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +3 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/lib/bridge.d.ts +38 -0
  32. package/dist/lib/bridge.d.ts.map +1 -0
  33. package/dist/lib/cn.d.ts +4 -0
  34. package/dist/lib/cn.d.ts.map +1 -0
  35. package/dist/lib/pages.d.ts +29 -0
  36. package/dist/lib/pages.d.ts.map +1 -0
  37. package/dist/lib/url.d.ts +9 -0
  38. package/dist/lib/url.d.ts.map +1 -0
  39. package/dist/plugin.d.ts +12 -0
  40. package/dist/plugin.d.ts.map +1 -0
  41. package/dist/plugin.js +277 -0
  42. package/dist/plugin.js.map +1 -0
  43. package/dist/types.d.ts +107 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/package.json +71 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Faya Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @fayz-ai/app-builder
2
+
3
+ > **Status: preview (experimental).** The surface is real; the code view, publish and chat are contracts with minimal implementations. API may change without notice.
4
+
5
+ > The app-builder surface: a window bar, the app running inside it, and the seams for seeing the code, publishing, and talking to whoever is doing the work.
6
+
7
+ [![npm](https://img.shields.io/npm/v/@fayz-ai/app-builder.svg)](https://www.npmjs.com/package/@fayz-ai/app-builder)
8
+ [![license](https://img.shields.io/npm/l/@fayz-ai/app-builder.svg)](https://github.com/FayaLabs/fayz-sdk/blob/main/LICENSE)
9
+
10
+ The Fayz editor and an admin app need the same thing: the window chrome, the live app inside it, the conversation beside it, and a publish button. Writing that twice is the mistake this package exists to avoid. One surface, two hosts — the editor keeps its container lifecycle and its chat, the admin keeps its shell and its assistant, and both mount the same component.
11
+
12
+ ## Two doors
13
+
14
+ - **`.`** — the surface. **No `@fayz-ai/*` dependency at all**: React, lucide-react and shadcn tokens, which both hosts already have. This is the door the Fayz editor imports.
15
+ - **`./plugin`** — `createAppBuilderPlugin()`, how the SDK admin mounts it. Pulls `@fayz-ai/core`, `@fayz-ai/admin` and `@fayz-ai/ui` as **optional** peers, so importing the surface never drags the admin in.
16
+
17
+ ## Install
18
+ ```bash
19
+ npm install @fayz-ai/app-builder
20
+ ```
21
+ Peer deps: `react`, `react-dom`, `lucide-react`. Optional peers (only for `./plugin`): `@fayz-ai/core`, `@fayz-ai/admin`, `@fayz-ai/ui`.
22
+
23
+ ## The surface
24
+ ```tsx
25
+ import { AppBuilder } from '@fayz-ai/app-builder'
26
+
27
+ <AppBuilder
28
+ target={{ name: 'Artorius', url: containerPreviewUrl, liveUrl }}
29
+ chat={<YourChatColumn />}
30
+ chatContract={{ send: (message, element) => yourChat.send(message, element) }}
31
+ publish={{ state, publish }}
32
+ onClose={goBack}
33
+ onToggleChat={toggleChat}
34
+ onToggleWide={toggleSidebar}
35
+ slots={{ chromeEnd: <YourTabs />, belowCanvas: <YourTerminal /> }}
36
+ />
37
+ ```
38
+
39
+ Preview and code are **one surface in two states** (`mode`), not two components: pass a `code` slot and the switch appears; omit it and it does not exist. The chat is never drawn here — it varies per host — but `chatContract` is how "change this block" gets from the canvas into whatever conversation the host mounted. `publish` is the same button in both hosts with each one's transport behind it; without a contract it renders disabled and says why.
40
+
41
+ ## The admin
42
+ ```tsx
43
+ import { createAppBuilderPlugin } from '@fayz-ai/app-builder/plugin'
44
+
45
+ plugins: [createAppBuilderPlugin({ sandboxUrl: import.meta.env.VITE_APP_BUILDER_SANDBOX_URL })]
46
+ ```
47
+ Mounts an `immersive` route (no nav entry — the door is the "Seu site" widget), resolves the target from the tenant's site row, opens the shell's assistant rail, and publishes `builder_navigate` / `builder_reload` / `builder_set_viewport` / `builder_request_change` to the agent.
48
+
49
+ ## Part of the Fayz SDK
50
+ Roadmap: the element-picker overlay (the protocol is already wired on both sides), a real code surface, and the Fayz editor swapping its `components/preview/` tree for this one.
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import type { AppBuilderPluginOptions } from './options';
3
+ /**
4
+ * The admin's wiring of the surface: where the target comes from, what the
5
+ * window buttons do here, and which colleague is on duty. Everything in this
6
+ * file is host-specific — the surface itself knows none of it.
7
+ */
8
+ export declare function AdminAppBuilder({ options }: {
9
+ options?: AppBuilderPluginOptions;
10
+ }): React.JSX.Element;
11
+ //# sourceMappingURL=AdminAppBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdminAppBuilder.d.ts","sourceRoot":"","sources":["../../src/admin/AdminAppBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAc9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAMxD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAAE,qBA2GjF"}
@@ -0,0 +1,18 @@
1
+ import type { BuilderTarget, BuilderViewport } from '../types';
2
+ export interface BuilderAgentSurfaceDeps {
3
+ target: BuilderTarget;
4
+ currentPath: string;
5
+ viewport: BuilderViewport;
6
+ actions: {
7
+ navigate: (path: string) => void;
8
+ reload: () => void;
9
+ setViewport: (viewport: BuilderViewport) => void;
10
+ };
11
+ onRequestChange?: (input: {
12
+ projectId: string;
13
+ path: string;
14
+ instruction: string;
15
+ }) => Promise<string> | string;
16
+ }
17
+ export declare function useBuilderAgentSurface(deps: BuilderAgentSurfaceDeps): void;
18
+ //# sourceMappingURL=agent-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-surface.d.ts","sourceRoot":"","sources":["../../src/admin/agent-surface.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAkC9D,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,aAAa,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE;QACP,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;QAChC,MAAM,EAAE,MAAM,IAAI,CAAA;QAClB,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAA;KACjD,CAAA;IACD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;CAChH;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI,CA6F1E"}
@@ -0,0 +1,22 @@
1
+ import type { PluginScope, VerticalId } from '@fayz-ai/core';
2
+ import type { BuilderLabels } from '../types';
3
+ export interface AppBuilderPluginOptions {
4
+ route?: string;
5
+ navLabel?: string;
6
+ scope?: PluginScope;
7
+ verticalId?: VerticalId;
8
+ /** Address of the running preview container; else VITE_APP_BUILDER_SANDBOX_URL. */
9
+ sandboxUrl?: string;
10
+ /** Where a natural-language change request goes. Absent = not connected. */
11
+ onRequestChange?: (input: {
12
+ projectId: string;
13
+ path: string;
14
+ instruction: string;
15
+ }) => Promise<string> | string;
16
+ /** Publish what is on the canvas. Absent leaves the button disabled and honest. */
17
+ onPublish?: (input: {
18
+ projectId: string;
19
+ }) => Promise<void> | void;
20
+ labels?: BuilderLabels;
21
+ }
22
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/admin/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;IAC/G,mFAAmF;IACnF,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAClE,MAAM,CAAC,EAAE,aAAa,CAAA;CACvB"}
@@ -0,0 +1,20 @@
1
+ import type { BuilderTarget } from '../types';
2
+ export interface AdminTargetOptions {
3
+ /** Address of the running preview container, when the host knows it. */
4
+ sandboxUrl?: string;
5
+ }
6
+ /**
7
+ * The tenant's default site row, as a builder target.
8
+ *
9
+ * The canvas is THE APP — the running preview container — never the platform's
10
+ * editor: embedding the editor would put its chat inside ours and hand the
11
+ * merchant two conversations for one question. With no sandbox address known it
12
+ * falls back to the published site, which is still the app, just yesterday's.
13
+ */
14
+ export interface AdminTargetState {
15
+ target: BuilderTarget | null;
16
+ /** The tenant's projects have not answered yet — "none" is not the answer. */
17
+ loading: boolean;
18
+ }
19
+ export declare function useAdminBuilderTarget(options?: AdminTargetOptions): AdminTargetState;
20
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/admin/target.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAOD;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5B,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,gBAAgB,CA8BpF"}