@ambitresearch/genie 1.3.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/README.md +15 -0
- package/dist/auth/bearer.d.ts +49 -0
- package/dist/auth/bearer.d.ts.map +1 -0
- package/dist/auth/bearer.js +159 -0
- package/dist/auth/bearer.js.map +1 -0
- package/dist/auth/oauth/authorize.d.ts +19 -0
- package/dist/auth/oauth/authorize.d.ts.map +1 -0
- package/dist/auth/oauth/authorize.js +111 -0
- package/dist/auth/oauth/authorize.js.map +1 -0
- package/dist/auth/oauth/config.d.ts +10 -0
- package/dist/auth/oauth/config.d.ts.map +1 -0
- package/dist/auth/oauth/config.js +16 -0
- package/dist/auth/oauth/config.js.map +1 -0
- package/dist/auth/oauth/dcr.d.ts +15 -0
- package/dist/auth/oauth/dcr.d.ts.map +1 -0
- package/dist/auth/oauth/dcr.js +38 -0
- package/dist/auth/oauth/dcr.js.map +1 -0
- package/dist/auth/oauth/jwt.d.ts +13 -0
- package/dist/auth/oauth/jwt.d.ts.map +1 -0
- package/dist/auth/oauth/jwt.js +46 -0
- package/dist/auth/oauth/jwt.js.map +1 -0
- package/dist/auth/oauth/metadata.d.ts +9 -0
- package/dist/auth/oauth/metadata.d.ts.map +1 -0
- package/dist/auth/oauth/metadata.js +19 -0
- package/dist/auth/oauth/metadata.js.map +1 -0
- package/dist/auth/oauth/router.d.ts +32 -0
- package/dist/auth/oauth/router.d.ts.map +1 -0
- package/dist/auth/oauth/router.js +159 -0
- package/dist/auth/oauth/router.js.map +1 -0
- package/dist/auth/oauth/store.d.ts +55 -0
- package/dist/auth/oauth/store.d.ts.map +1 -0
- package/dist/auth/oauth/store.js +63 -0
- package/dist/auth/oauth/store.js.map +1 -0
- package/dist/auth/oauth/token.d.ts +21 -0
- package/dist/auth/oauth/token.d.ts.map +1 -0
- package/dist/auth/oauth/token.js +77 -0
- package/dist/auth/oauth/token.js.map +1 -0
- package/dist/auth/oidc/group-policy.d.ts +43 -0
- package/dist/auth/oidc/group-policy.d.ts.map +1 -0
- package/dist/auth/oidc/group-policy.js +54 -0
- package/dist/auth/oidc/group-policy.js.map +1 -0
- package/dist/auth/oidc/verifier.d.ts +42 -0
- package/dist/auth/oidc/verifier.d.ts.map +1 -0
- package/dist/auth/oidc/verifier.js +145 -0
- package/dist/auth/oidc/verifier.js.map +1 -0
- package/dist/auth/token-cli.d.ts +9 -0
- package/dist/auth/token-cli.d.ts.map +1 -0
- package/dist/auth/token-cli.js +98 -0
- package/dist/auth/token-cli.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +149 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/redact.d.ts +20 -0
- package/dist/config/redact.d.ts.map +1 -0
- package/dist/config/redact.js +77 -0
- package/dist/config/redact.js.map +1 -0
- package/dist/config/secrets.d.ts +100 -0
- package/dist/config/secrets.d.ts.map +1 -0
- package/dist/config/secrets.js +130 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/framework/html.d.ts +103 -0
- package/dist/framework/html.d.ts.map +1 -0
- package/dist/framework/html.js +271 -0
- package/dist/framework/html.js.map +1 -0
- package/dist/framework/interface.d.ts +130 -0
- package/dist/framework/interface.d.ts.map +1 -0
- package/dist/framework/interface.js +112 -0
- package/dist/framework/interface.js.map +1 -0
- package/dist/framework/react.d.ts +133 -0
- package/dist/framework/react.d.ts.map +1 -0
- package/dist/framework/react.js +243 -0
- package/dist/framework/react.js.map +1 -0
- package/dist/framework/vue.d.ts +99 -0
- package/dist/framework/vue.d.ts.map +1 -0
- package/dist/framework/vue.js +375 -0
- package/dist/framework/vue.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/client.d.ts +81 -0
- package/dist/llm/client.d.ts.map +1 -0
- package/dist/llm/client.js +141 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/component-response.d.ts +111 -0
- package/dist/llm/component-response.d.ts.map +1 -0
- package/dist/llm/component-response.js +167 -0
- package/dist/llm/component-response.js.map +1 -0
- package/dist/llm/generated-files.d.ts +10 -0
- package/dist/llm/generated-files.d.ts.map +1 -0
- package/dist/llm/generated-files.js +26 -0
- package/dist/llm/generated-files.js.map +1 -0
- package/dist/llm/prompts/CHANGELOG.md +70 -0
- package/dist/llm/prompts/generate-component.system.md +99 -0
- package/dist/llm/prompts/refine-component.system.md +112 -0
- package/dist/llm/prompts.d.ts +66 -0
- package/dist/llm/prompts.d.ts.map +1 -0
- package/dist/llm/prompts.js +78 -0
- package/dist/llm/prompts.js.map +1 -0
- package/dist/llm/retry.d.ts +183 -0
- package/dist/llm/retry.d.ts.map +1 -0
- package/dist/llm/retry.js +475 -0
- package/dist/llm/retry.js.map +1 -0
- package/dist/llm/schema.d.ts +129 -0
- package/dist/llm/schema.d.ts.map +1 -0
- package/dist/llm/schema.js +147 -0
- package/dist/llm/schema.js.map +1 -0
- package/dist/llm/validate.d.ts +107 -0
- package/dist/llm/validate.d.ts.map +1 -0
- package/dist/llm/validate.js +174 -0
- package/dist/llm/validate.js.map +1 -0
- package/dist/manifest/compiler.d.ts +112 -0
- package/dist/manifest/compiler.d.ts.map +1 -0
- package/dist/manifest/compiler.js +306 -0
- package/dist/manifest/compiler.js.map +1 -0
- package/dist/manifest/ensure.d.ts +46 -0
- package/dist/manifest/ensure.d.ts.map +1 -0
- package/dist/manifest/ensure.js +49 -0
- package/dist/manifest/ensure.js.map +1 -0
- package/dist/manifest/index.d.ts +13 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +13 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/middleware/plan-guard.d.ts +167 -0
- package/dist/middleware/plan-guard.d.ts.map +1 -0
- package/dist/middleware/plan-guard.js +190 -0
- package/dist/middleware/plan-guard.js.map +1 -0
- package/dist/plans/index.d.ts +71 -0
- package/dist/plans/index.d.ts.map +1 -0
- package/dist/plans/index.js +252 -0
- package/dist/plans/index.js.map +1 -0
- package/dist/schemas/component.schema.json +114 -0
- package/dist/server.d.ts +96 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +258 -0
- package/dist/server.js.map +1 -0
- package/dist/store/empty-manifest.d.ts +58 -0
- package/dist/store/empty-manifest.d.ts.map +1 -0
- package/dist/store/empty-manifest.js +59 -0
- package/dist/store/empty-manifest.js.map +1 -0
- package/dist/store/git-host.d.ts +120 -0
- package/dist/store/git-host.d.ts.map +1 -0
- package/dist/store/git-host.js +796 -0
- package/dist/store/git-host.js.map +1 -0
- package/dist/store/index.d.ts +5 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +4 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/interface.d.ts +322 -0
- package/dist/store/interface.d.ts.map +1 -0
- package/dist/store/interface.js +100 -0
- package/dist/store/interface.js.map +1 -0
- package/dist/store/kit-files.d.ts +88 -0
- package/dist/store/kit-files.d.ts.map +1 -0
- package/dist/store/kit-files.js +199 -0
- package/dist/store/kit-files.js.map +1 -0
- package/dist/store/local.d.ts +70 -0
- package/dist/store/local.d.ts.map +1 -0
- package/dist/store/local.js +651 -0
- package/dist/store/local.js.map +1 -0
- package/dist/store/manifest.d.ts +44 -0
- package/dist/store/manifest.d.ts.map +1 -0
- package/dist/store/manifest.js +116 -0
- package/dist/store/manifest.js.map +1 -0
- package/dist/store/viewer-assets.d.ts +20 -0
- package/dist/store/viewer-assets.d.ts.map +1 -0
- package/dist/store/viewer-assets.js +118 -0
- package/dist/store/viewer-assets.js.map +1 -0
- package/dist/sync/anchor.d.ts +125 -0
- package/dist/sync/anchor.d.ts.map +1 -0
- package/dist/sync/anchor.js +210 -0
- package/dist/sync/anchor.js.map +1 -0
- package/dist/sync/index.d.ts +15 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +15 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/orchestrator.d.ts +160 -0
- package/dist/sync/orchestrator.d.ts.map +1 -0
- package/dist/sync/orchestrator.js +288 -0
- package/dist/sync/orchestrator.js.map +1 -0
- package/dist/tools/bind_kit.d.ts +29 -0
- package/dist/tools/bind_kit.d.ts.map +1 -0
- package/dist/tools/bind_kit.js +70 -0
- package/dist/tools/bind_kit.js.map +1 -0
- package/dist/tools/conjure.d.ts +141 -0
- package/dist/tools/conjure.d.ts.map +1 -0
- package/dist/tools/conjure.js +655 -0
- package/dist/tools/conjure.js.map +1 -0
- package/dist/tools/conjure_screen.d.ts +174 -0
- package/dist/tools/conjure_screen.d.ts.map +1 -0
- package/dist/tools/conjure_screen.js +458 -0
- package/dist/tools/conjure_screen.js.map +1 -0
- package/dist/tools/create_kit.d.ts +32 -0
- package/dist/tools/create_kit.d.ts.map +1 -0
- package/dist/tools/create_kit.js +131 -0
- package/dist/tools/create_kit.js.map +1 -0
- package/dist/tools/create_project.d.ts +267 -0
- package/dist/tools/create_project.d.ts.map +1 -0
- package/dist/tools/create_project.js +546 -0
- package/dist/tools/create_project.js.map +1 -0
- package/dist/tools/delete_files.d.ts +93 -0
- package/dist/tools/delete_files.d.ts.map +1 -0
- package/dist/tools/delete_files.js +276 -0
- package/dist/tools/delete_files.js.map +1 -0
- package/dist/tools/delete_project.d.ts +43 -0
- package/dist/tools/delete_project.d.ts.map +1 -0
- package/dist/tools/delete_project.js +118 -0
- package/dist/tools/delete_project.js.map +1 -0
- package/dist/tools/get_kit.d.ts +28 -0
- package/dist/tools/get_kit.d.ts.map +1 -0
- package/dist/tools/get_kit.js +95 -0
- package/dist/tools/get_kit.js.map +1 -0
- package/dist/tools/get_project.d.ts +37 -0
- package/dist/tools/get_project.d.ts.map +1 -0
- package/dist/tools/get_project.js +71 -0
- package/dist/tools/get_project.js.map +1 -0
- package/dist/tools/list_components.d.ts +42 -0
- package/dist/tools/list_components.d.ts.map +1 -0
- package/dist/tools/list_components.js +125 -0
- package/dist/tools/list_components.js.map +1 -0
- package/dist/tools/list_files.d.ts +32 -0
- package/dist/tools/list_files.d.ts.map +1 -0
- package/dist/tools/list_files.js +109 -0
- package/dist/tools/list_files.js.map +1 -0
- package/dist/tools/list_kits.d.ts +14 -0
- package/dist/tools/list_kits.d.ts.map +1 -0
- package/dist/tools/list_kits.js +41 -0
- package/dist/tools/list_kits.js.map +1 -0
- package/dist/tools/list_projects.d.ts +23 -0
- package/dist/tools/list_projects.d.ts.map +1 -0
- package/dist/tools/list_projects.js +66 -0
- package/dist/tools/list_projects.js.map +1 -0
- package/dist/tools/plan.d.ts +16 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +146 -0
- package/dist/tools/plan.js.map +1 -0
- package/dist/tools/preview.d.ts +289 -0
- package/dist/tools/preview.d.ts.map +1 -0
- package/dist/tools/preview.js +672 -0
- package/dist/tools/preview.js.map +1 -0
- package/dist/tools/read_file.d.ts +40 -0
- package/dist/tools/read_file.d.ts.map +1 -0
- package/dist/tools/read_file.js +114 -0
- package/dist/tools/read_file.js.map +1 -0
- package/dist/tools/refine.d.ts +220 -0
- package/dist/tools/refine.d.ts.map +1 -0
- package/dist/tools/refine.js +501 -0
- package/dist/tools/refine.js.map +1 -0
- package/dist/tools/validate.d.ts +74 -0
- package/dist/tools/validate.d.ts.map +1 -0
- package/dist/tools/validate.js +224 -0
- package/dist/tools/validate.js.map +1 -0
- package/dist/tools/write_files.d.ts +158 -0
- package/dist/tools/write_files.d.ts.map +1 -0
- package/dist/tools/write_files.js +541 -0
- package/dist/tools/write_files.js.map +1 -0
- package/dist/transport.d.ts +77 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +448 -0
- package/dist/transport.js.map +1 -0
- package/dist/ui/card-asset-broker.d.ts +42 -0
- package/dist/ui/card-asset-broker.d.ts.map +1 -0
- package/dist/ui/card-asset-broker.js +479 -0
- package/dist/ui/card-asset-broker.js.map +1 -0
- package/dist/ui/grid-resource.d.ts +252 -0
- package/dist/ui/grid-resource.d.ts.map +1 -0
- package/dist/ui/grid-resource.js +680 -0
- package/dist/ui/grid-resource.js.map +1 -0
- package/dist/ui/viewer-static/index.html +95 -0
- package/dist/ui/viewer-static/viewer.css +451 -0
- package/dist/ui/viewer-static/viewer.js +1405 -0
- package/dist/validate/full-scan.d.ts +87 -0
- package/dist/validate/full-scan.d.ts.map +1 -0
- package/dist/validate/full-scan.js +299 -0
- package/dist/validate/full-scan.js.map +1 -0
- package/dist/validate/index.d.ts +15 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +18 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/marker.d.ts +89 -0
- package/dist/validate/marker.d.ts.map +1 -0
- package/dist/validate/marker.js +87 -0
- package/dist/validate/marker.js.map +1 -0
- package/dist/validate/phash.d.ts +135 -0
- package/dist/validate/phash.d.ts.map +1 -0
- package/dist/validate/phash.js +307 -0
- package/dist/validate/phash.js.map +1 -0
- package/dist/validate/render.d.ts +38 -0
- package/dist/validate/render.d.ts.map +1 -0
- package/dist/validate/render.js +155 -0
- package/dist/validate/render.js.map +1 -0
- package/dist/watch/index.d.ts +12 -0
- package/dist/watch/index.d.ts.map +1 -0
- package/dist/watch/index.js +12 -0
- package/dist/watch/index.js.map +1 -0
- package/dist/watch/watcher.d.ts +65 -0
- package/dist/watch/watcher.d.ts.map +1 -0
- package/dist/watch/watcher.js +238 -0
- package/dist/watch/watcher.js.map +1 -0
- package/package.json +70 -0
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ProjectStore } from "./tools/create_project.js";
|
|
3
|
+
import { type ConjureDeps } from "./tools/conjure.js";
|
|
4
|
+
import { type PreviewLocality, type ViewerBooter } from "./tools/preview.js";
|
|
5
|
+
import type { KitStore } from "./store/interface.js";
|
|
6
|
+
import { type TransportKind } from "./transport.js";
|
|
7
|
+
/** Server identity. The package manifest is Release Please's version source of truth. */
|
|
8
|
+
export declare const SERVER_INFO: {
|
|
9
|
+
readonly name: "genie";
|
|
10
|
+
readonly version: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Build the genie MCP server.
|
|
14
|
+
*
|
|
15
|
+
* M0 ships an *empty but bootable* server: it negotiates the MCP handshake,
|
|
16
|
+
* advertises capabilities, and answers `tools/list` — but the only tool is a
|
|
17
|
+
* built-in `ping` health check. The real surfaces arrive in later milestones:
|
|
18
|
+
* - M1: genie's 19 core tools (13 kit verbs + 6 project verbs) (`mcp__genie__*`)
|
|
19
|
+
* - M2: generation tools (conjure, refine) via the configured LLM endpoint
|
|
20
|
+
* - M3: @genie marker validator + manifest compiler
|
|
21
|
+
* - M4: the ui://genie/grid MCP-Apps resource + Vite viewer
|
|
22
|
+
*
|
|
23
|
+
* Keeping this a single factory means every transport (stdio, HTTP) shares one
|
|
24
|
+
* registration — see transport.ts.
|
|
25
|
+
*/
|
|
26
|
+
export interface CreateServerOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Transport used by an embedder that connects the returned server directly.
|
|
29
|
+
* Pass `"http"` for Streamable HTTP so preview never opens a browser on the
|
|
30
|
+
* server machine. {@link startTransport} records its own resolved kind when
|
|
31
|
+
* the built-in transport launcher is used.
|
|
32
|
+
*/
|
|
33
|
+
transportKind?: TransportKind;
|
|
34
|
+
/** Whether the viewer URL is reachable from the host running the MCP client. */
|
|
35
|
+
previewLocality?: PreviewLocality;
|
|
36
|
+
/** Injectable preview viewer seam for embedders and transport-level tests. */
|
|
37
|
+
previewBooter?: ViewerBooter;
|
|
38
|
+
projectsRoot?: string;
|
|
39
|
+
kitsRoot?: string;
|
|
40
|
+
reportsDir?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Injectable kit backend (AC1 / DRO-523; kit-file verbs added in
|
|
43
|
+
* M1-14a-1a / DRO-540). When supplied, the kit verbs route through this store
|
|
44
|
+
* instead of the default `LocalFsKitStore(kitsRoot)`:
|
|
45
|
+
* - metadata: `create_kit`, `get_kit`, `list_kits`, `list_components`,
|
|
46
|
+
* plus `conjure_screen`'s explicit-kitId validation and `bind_kit`'s
|
|
47
|
+
* kit-existence check (via `KitStore.getKit`/`listKits`/`createKit`/…);
|
|
48
|
+
* - files: `read_file`, `list_files`, `delete_files` (via
|
|
49
|
+
* `KitStore.readFile`/`listFiles`/`deleteFile`).
|
|
50
|
+
* Defaulting to LocalFs keeps every existing caller (`createServer()`,
|
|
51
|
+
* `createServer({ kitsRoot })`) byte-for-byte unchanged, so injecting a
|
|
52
|
+
* `GitHostKitStore` points the whole kit surface at the git host.
|
|
53
|
+
*
|
|
54
|
+
* Remaining holdout (tracked, deliberately out of scope here): `write_files`
|
|
55
|
+
* still binds to `kitsRoot` + the on-disk plan registry — its atomic
|
|
56
|
+
* rename-to-temp / streaming / rollback transaction doesn't map onto the
|
|
57
|
+
* git-host REST model without its own design, so it is a sibling follow-up.
|
|
58
|
+
* The rich project family (`create_project`/`get_project`/`bind_kit` write
|
|
59
|
+
* side/`recordScreen`) also still uses the concrete fs-backed `ProjectStore`
|
|
60
|
+
* (see `projectStore` below); `delete_project` already routes through it
|
|
61
|
+
* (M1-14a-1 / DRO-531).
|
|
62
|
+
*/
|
|
63
|
+
kitStore?: KitStore;
|
|
64
|
+
/**
|
|
65
|
+
* Injectable project backend (AC1 / DRO-523). When supplied, the project
|
|
66
|
+
* family (`create_project`, `list_projects`, `get_project`, `bind_kit`, and
|
|
67
|
+
* `conjure_screen`'s project read/record) route through this store instead of
|
|
68
|
+
* the default `new ProjectStore(projectsRoot, kitStore)`. Defaulting to the
|
|
69
|
+
* LocalFs-backed `ProjectStore` keeps every existing caller unchanged.
|
|
70
|
+
*
|
|
71
|
+
* Same partial-seam caveat as `kitStore`: this is the concrete
|
|
72
|
+
* fs-backed `ProjectStore` class (create_project.ts), which owns blueprints,
|
|
73
|
+
* kitBindings, screens, and `canEdit` — capabilities the thin
|
|
74
|
+
* `GitHostProjectStore` in the store layer does NOT yet implement. So a
|
|
75
|
+
* git-host project backend that satisfies the full tool-surface contract is
|
|
76
|
+
* still to-build (tracked follow-up); this seam is what lets it be dropped in
|
|
77
|
+
* once it exists, and lets tests substitute a fake. `delete_project` now
|
|
78
|
+
* routes through this store too (M1-14a-1 / DRO-531); the kit-file verbs
|
|
79
|
+
* (`read_file`/`list_files`/`delete_files` via DRO-540, and `write_files` via
|
|
80
|
+
* M1-14a-1b / DRO-565) all now route through `kitStore` — no fs-native holdout
|
|
81
|
+
* remains.
|
|
82
|
+
*/
|
|
83
|
+
projectStore?: ProjectStore;
|
|
84
|
+
/**
|
|
85
|
+
* Injectable `conjure` dependencies (test seam only — e.g. a stubbed `chat`
|
|
86
|
+
* function so a smoke test can drive a genuinely SUCCESSFUL
|
|
87
|
+
* `conjure -> plan -> write_files -> preview` chain without a real network
|
|
88
|
+
* call, or explicitly the real default so the same test can also assert the
|
|
89
|
+
* live-endpoint path when `GENIE_LLM_*` is configured). Defaults to `{}`,
|
|
90
|
+
* which is `registerConjureTool`'s own default: the real endpoint via the
|
|
91
|
+
* lazily-imported LLM client.
|
|
92
|
+
*/
|
|
93
|
+
conjureDeps?: ConjureDeps;
|
|
94
|
+
}
|
|
95
|
+
export declare function createServer(options?: CreateServerOptions): McpServer;
|
|
96
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAE,YAAY,EAA6B,MAAM,2BAA2B,CAAC;AAMpF,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAW3E,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAkD,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpG,yFAAyF;AACzF,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gFAAgF;IAChF,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,SAAS,CA6PzE"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import packageJson from "../package.json" with { type: "json" };
|
|
4
|
+
import { ProjectStore, registerCreateProjectTool } from "./tools/create_project.js";
|
|
5
|
+
import { registerListProjectsTool } from "./tools/list_projects.js";
|
|
6
|
+
import { registerGetProjectTool } from "./tools/get_project.js";
|
|
7
|
+
import { registerDeleteProjectTool } from "./tools/delete_project.js";
|
|
8
|
+
import { registerBindKitTool } from "./tools/bind_kit.js";
|
|
9
|
+
import { LocalScaffoldScreenGenerator, registerConjureScreenTool } from "./tools/conjure_screen.js";
|
|
10
|
+
import { registerConjureTool } from "./tools/conjure.js";
|
|
11
|
+
import { registerRefineTool } from "./tools/refine.js";
|
|
12
|
+
import { registerCreateKit } from "./tools/create_kit.js";
|
|
13
|
+
import { registerReadFile } from "./tools/read_file.js";
|
|
14
|
+
import { registerValidate } from "./tools/validate.js";
|
|
15
|
+
import { registerListFilesTool } from "./tools/list_files.js";
|
|
16
|
+
import { registerListKits } from "./tools/list_kits.js";
|
|
17
|
+
import { registerListComponents } from "./tools/list_components.js";
|
|
18
|
+
import { registerPlan } from "./tools/plan.js";
|
|
19
|
+
import { registerDeleteFilesTool } from "./tools/delete_files.js";
|
|
20
|
+
import { registerWriteFilesTool } from "./tools/write_files.js";
|
|
21
|
+
import { MCP_APP_MIME, UI_EXTENSION_ID, registerPreviewTool, } from "./tools/preview.js";
|
|
22
|
+
import { normalizePreviewsBaseUrl, registerGridResource } from "./ui/grid-resource.js";
|
|
23
|
+
import { startCardAssetBroker } from "./ui/card-asset-broker.js";
|
|
24
|
+
import { LocalFsKitStore } from "./store/local.js";
|
|
25
|
+
import { registerGetKitTool } from "./tools/get_kit.js";
|
|
26
|
+
import { getServerTransportKind, registerServerDisposer } from "./transport.js";
|
|
27
|
+
/** Server identity. The package manifest is Release Please's version source of truth. */
|
|
28
|
+
export const SERVER_INFO = {
|
|
29
|
+
name: "genie",
|
|
30
|
+
version: packageJson.version,
|
|
31
|
+
};
|
|
32
|
+
export function createServer(options = {}) {
|
|
33
|
+
const server = new McpServer(SERVER_INFO, {
|
|
34
|
+
capabilities: {
|
|
35
|
+
extensions: {
|
|
36
|
+
[UI_EXTENSION_ID]: { mimeTypes: [MCP_APP_MIME] },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
instructions: "genie generates UI components against your own UI kit, inside your coding " +
|
|
40
|
+
"harness. (Scaffold build — the registered tools are ping, kit listing, kit component " +
|
|
41
|
+
"listing, kit creation, kit lookup, file listing, file reading, validation, project " +
|
|
42
|
+
"create/list/get/delete/bind_kit, conjure_screen, conjure (LLM component generation), " +
|
|
43
|
+
"refine (LLM component iteration — diff + updated files against existing kit source), " +
|
|
44
|
+
"plan creation (the capability-grant " +
|
|
45
|
+
"boundary for write/delete verbs), write_files, delete_files, and preview (returns the " +
|
|
46
|
+
"viewer URL + a local-only file:// fallback plus a ui://genie/grid resource pointer in " +
|
|
47
|
+
"_meta.ui.resourceUri). write_files and " +
|
|
48
|
+
"delete_files share one plan-boundary validation middleware — every call is checked " +
|
|
49
|
+
"for planId presence/existence/expiry and per-path glob membership before the tool " +
|
|
50
|
+
"handler runs.)",
|
|
51
|
+
});
|
|
52
|
+
// A single built-in tool. Registering it makes the SDK wire up the
|
|
53
|
+
// tools/list + tools/call handlers (they are lazy-initialized on first
|
|
54
|
+
// registration), so capability negotiation is honest from M0 onward.
|
|
55
|
+
// It also gives every harness a trivial "is genie alive?" probe.
|
|
56
|
+
server.registerTool("ping", {
|
|
57
|
+
title: "Ping",
|
|
58
|
+
description: "Health check — returns 'pong' and the server version. Confirms genie is " +
|
|
59
|
+
"connected and responding.",
|
|
60
|
+
inputSchema: {},
|
|
61
|
+
}, () => ({
|
|
62
|
+
content: [
|
|
63
|
+
{
|
|
64
|
+
type: "text",
|
|
65
|
+
text: `pong — ${SERVER_INFO.name} ${SERVER_INFO.version}`,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
}));
|
|
69
|
+
const projectsRoot = options.projectsRoot ??
|
|
70
|
+
process.env.GENIE_PROJECTS_ROOT ??
|
|
71
|
+
join(process.cwd(), ".genie", "projects");
|
|
72
|
+
// Resolve the kits root ONCE so every kit verb agrees on where kits live.
|
|
73
|
+
// `create_kit` (via LocalFsKitStore) writes here, `read_file` reads here, and
|
|
74
|
+
// `list_files` walks here — threading the same value into all of them (via the
|
|
75
|
+
// shared kitStore below) is what keeps them consistent.
|
|
76
|
+
const kitsRoot = options.kitsRoot ?? process.env.GENIE_KITS_ROOT ?? join(process.cwd(), ".genie", "kits");
|
|
77
|
+
// Shared instance: `bind_kit` (via ProjectStore) validates kitId through the
|
|
78
|
+
// same store `create_kit`/`get_kit` already write through, so a kit created
|
|
79
|
+
// in this process is immediately bindable without a second construction.
|
|
80
|
+
//
|
|
81
|
+
// AC1 (DRO-523): an injected `options.kitStore` overrides the default so an
|
|
82
|
+
// in-process MCP walk can be pointed at `GitHostKitStore` (or any KitStore).
|
|
83
|
+
// Absent injection, this is exactly the pre-seam `new LocalFsKitStore(kitsRoot)`.
|
|
84
|
+
const kitStore = options.kitStore ?? new LocalFsKitStore(kitsRoot);
|
|
85
|
+
// AC1 (DRO-523): an injected `options.projectStore` overrides the default so
|
|
86
|
+
// the project family can be pointed at an alternate backend. Absent injection
|
|
87
|
+
// this is exactly the pre-seam `new ProjectStore(projectsRoot, kitStore)` —
|
|
88
|
+
// sharing the same `kitStore` above so `bind_kit`/`conjure_screen` validate
|
|
89
|
+
// kitIds through the store `create_kit` writes to.
|
|
90
|
+
const projectStore = options.projectStore ?? new ProjectStore(projectsRoot, kitStore);
|
|
91
|
+
registerCreateProjectTool(server, projectStore);
|
|
92
|
+
registerListProjectsTool(server, projectStore);
|
|
93
|
+
registerGetProjectTool(server, projectStore);
|
|
94
|
+
// delete_project (M1-14a-1 / DRO-531): routes through the injected
|
|
95
|
+
// `projectStore` — the same instance the rest of the project family uses —
|
|
96
|
+
// instead of a raw `projectsRoot` path, so a non-LocalFs backend reaches this
|
|
97
|
+
// verb too. Persistence + read-only policy live in `ProjectStore.deleteProject`.
|
|
98
|
+
registerDeleteProjectTool(server, projectStore);
|
|
99
|
+
registerBindKitTool(server, projectStore);
|
|
100
|
+
// conjure_screen (M1-21): project-aware screen generation. The M1 generator is
|
|
101
|
+
// an offline deterministic scaffold (LocalScaffoldScreenGenerator) — no model
|
|
102
|
+
// call, so it runs in CI unchanged; M2 swaps in the real endpoint client
|
|
103
|
+
// behind the same ScreenGenerator seam. It shares the same projectStore
|
|
104
|
+
// (screen recording) and kitStore (explicit-kitId validation) the project and
|
|
105
|
+
// kit verbs already use.
|
|
106
|
+
registerConjureScreenTool(server, {
|
|
107
|
+
projectStore,
|
|
108
|
+
kitStore,
|
|
109
|
+
generator: new LocalScaffoldScreenGenerator(),
|
|
110
|
+
});
|
|
111
|
+
// conjure (M2-03): genie's headline verb — real LLM component generation
|
|
112
|
+
// against the caller's UI kit. Calls the configured OpenAI-compatible endpoint
|
|
113
|
+
// (M2-01 client) with a COMPONENT_SCHEMA json_schema response_format (M2-02),
|
|
114
|
+
// validates the reply with Ajv, and retries once on a validation failure. Pure
|
|
115
|
+
// generation: it does NOT write files (AC9) and takes no store — the default
|
|
116
|
+
// `chat` seam lazily imports the LLM client only on first call, so registering
|
|
117
|
+
// it here never requires GENIE_LLM_* to be set just to build the server.
|
|
118
|
+
registerConjureTool(server, options.conjureDeps);
|
|
119
|
+
// refine (M2-04): iterate on an existing component. Loads the component's
|
|
120
|
+
// current files from the kit (`kitStore.listFiles`/`readFile`), sends them plus
|
|
121
|
+
// a free-form instruction (and, for a canvas-style edit, an optional region
|
|
122
|
+
// rect rendered as a crop) to the configured endpoint behind the SAME
|
|
123
|
+
// request/validate/retry harness `conjure` uses, and returns a unified diff +
|
|
124
|
+
// the full updated files. The region crop uses Playwright as an OPTIONAL peer
|
|
125
|
+
// dependency (M3-02's validator setup) via a lazy import that degrades
|
|
126
|
+
// gracefully when absent, so registering it here never requires Playwright or
|
|
127
|
+
// GENIE_LLM_* to be set just to build the server.
|
|
128
|
+
registerRefineTool(server, { kitStore });
|
|
129
|
+
registerListKits(server, kitStore);
|
|
130
|
+
registerListComponents(server, kitStore);
|
|
131
|
+
registerCreateKit(server, kitStore);
|
|
132
|
+
registerGetKitTool(server, kitStore);
|
|
133
|
+
// M1 kit-file verbs. Re-plumbed onto the injected `kitStore` (M1-14a-1a /
|
|
134
|
+
// DRO-540): `read_file`, `list_files`, and `delete_files` now route through
|
|
135
|
+
// `KitStore.readFile`/`listFiles`/`deleteFile` instead of a raw `kitsRoot`
|
|
136
|
+
// path, so injecting a `GitHostKitStore` carries these verbs onto the git
|
|
137
|
+
// host too (not just the metadata verbs). The store owns MIME/encoding, the
|
|
138
|
+
// 256 KiB cap, SRI hashing, and `.genieignore`/default-dir exclusion; the
|
|
139
|
+
// tools keep plan-gating (delete_files) and request-shape guards.
|
|
140
|
+
registerReadFile(server, kitStore);
|
|
141
|
+
registerListFilesTool(server, kitStore);
|
|
142
|
+
// Plan capability-grant boundary (M1-07). Locks writes/deletes/localDir and
|
|
143
|
+
// issues a planId; write_files (below) validates every call against it via
|
|
144
|
+
// the M1-13 plan-guard middleware (`middleware/plan-guard.ts`).
|
|
145
|
+
// `plans/index.ts` owns its own persistence root (`${GENIE_HOME}/plans`) and
|
|
146
|
+
// TTL (`GENIE_PLAN_TTL`) internally, so there's no store instance to thread
|
|
147
|
+
// through here — the module singleton is shared across the guard and the
|
|
148
|
+
// plan tool.
|
|
149
|
+
registerPlan(server);
|
|
150
|
+
// write_files (M1-08; store-routed in M1-14a-1b / DRO-565): validates planId +
|
|
151
|
+
// writes-glob membership via the M1-13 plan-guard middleware (one shared seam
|
|
152
|
+
// with delete_files, below), then commits the batch atomically into the kit
|
|
153
|
+
// via the injected `kitStore.writeFiles(plan.kitId, ops)` — the same store the
|
|
154
|
+
// read/list/delete verbs route through. `plan.localDir` is now only the
|
|
155
|
+
// local SOURCE base for `localPath` reads; the kit is the write destination.
|
|
156
|
+
registerWriteFilesTool(server, kitStore);
|
|
157
|
+
// validate (D-A — one verb, two facets):
|
|
158
|
+
// • Counter-persistence facet (M1-12): persists caller-supplied validation
|
|
159
|
+
// counts + emits Prometheus metrics. No planId required (read-side).
|
|
160
|
+
// • Full-scan facet (M3-04 / DRO-260): when called WITHOUT `counts`, walks
|
|
161
|
+
// every `.html` in the kit through the injected `kitStore` and runs the
|
|
162
|
+
// @genie-marker / thin-render / variants-identical checks, returning
|
|
163
|
+
// structured findings and persisting the derived counters via the same
|
|
164
|
+
// path. The headless render uses Playwright as an OPTIONAL peer dependency
|
|
165
|
+
// (createDefaultRenderer degrades to marker-only when it is absent), so
|
|
166
|
+
// registering this here never requires Playwright to build/run the server.
|
|
167
|
+
registerValidate(server, {
|
|
168
|
+
reportsDir: options.reportsDir ??
|
|
169
|
+
process.env.GENIE_REPORTS_DIR ??
|
|
170
|
+
join(process.cwd(), ".genie", "reports"),
|
|
171
|
+
kitStore,
|
|
172
|
+
});
|
|
173
|
+
// Plan-gated destructive verb (M1-09): deletes are authorized by a plan's
|
|
174
|
+
// `deletes` globs and hit the SAME kit tree read_file/list_files read (via
|
|
175
|
+
// the shared `kitStore`, M1-14a-1a). Shares the M1-07 plan boundary and the
|
|
176
|
+
// M1-13 plan-guard middleware (`middleware/plan-guard.ts`) with write_files
|
|
177
|
+
// so the two verbs enforce plan authorization through one identical seam.
|
|
178
|
+
registerDeleteFilesTool(server, kitStore);
|
|
179
|
+
// Keep locality unresolved when an embedder has not selected its transport
|
|
180
|
+
// yet. `startTransport` records the actual kind before connecting, and both
|
|
181
|
+
// preview plus the lazy broker provider resolve against that runtime value.
|
|
182
|
+
const previewLocality = options.previewLocality ??
|
|
183
|
+
(options.transportKind === undefined
|
|
184
|
+
? undefined
|
|
185
|
+
: options.transportKind === "stdio"
|
|
186
|
+
? "local"
|
|
187
|
+
: "remote");
|
|
188
|
+
const mayNeedLocalCardBroker = options.transportKind !== "http" &&
|
|
189
|
+
options.previewLocality !== "remote" &&
|
|
190
|
+
normalizePreviewsBaseUrl(process.env.GENIE_PREVIEWS_BASE_URL) === undefined;
|
|
191
|
+
// Local stdio app surfaces share one loopback card-asset broker. Explicit
|
|
192
|
+
// remote/HTTP configurations omit the provider; an unresolved embedder gets
|
|
193
|
+
// a guarded provider that cannot bind until startup records local stdio.
|
|
194
|
+
let cardAssetBrokerPromise;
|
|
195
|
+
let cardAssetBrokerDisposed = false;
|
|
196
|
+
const getCardAssetBroker = mayNeedLocalCardBroker
|
|
197
|
+
? async () => {
|
|
198
|
+
if (cardAssetBrokerDisposed) {
|
|
199
|
+
throw new Error("Card asset broker provider is disposed.");
|
|
200
|
+
}
|
|
201
|
+
const transportKind = options.transportKind ?? getServerTransportKind(server);
|
|
202
|
+
const locality = options.previewLocality ?? (transportKind === "stdio" ? "local" : "remote");
|
|
203
|
+
if (transportKind !== "stdio" || locality !== "local") {
|
|
204
|
+
throw new Error("Card asset broker requires a local stdio transport.");
|
|
205
|
+
}
|
|
206
|
+
if (cardAssetBrokerPromise === undefined) {
|
|
207
|
+
const startup = startCardAssetBroker();
|
|
208
|
+
cardAssetBrokerPromise = startup;
|
|
209
|
+
// Preserve single-flight startup while allowing a transient bind
|
|
210
|
+
// failure to recover on the next preview/resource request.
|
|
211
|
+
void startup.catch(() => {
|
|
212
|
+
if (cardAssetBrokerPromise === startup)
|
|
213
|
+
cardAssetBrokerPromise = undefined;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return cardAssetBrokerPromise;
|
|
217
|
+
}
|
|
218
|
+
: undefined;
|
|
219
|
+
if (getCardAssetBroker !== undefined) {
|
|
220
|
+
registerServerDisposer(server, async () => {
|
|
221
|
+
cardAssetBrokerDisposed = true;
|
|
222
|
+
const startup = cardAssetBrokerPromise;
|
|
223
|
+
if (startup === undefined)
|
|
224
|
+
return;
|
|
225
|
+
const cardAssetBroker = await startup.catch(() => undefined);
|
|
226
|
+
await cardAssetBroker?.close();
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// preview (M4-05 / DRO-267): returns local viewer/file URLs only to local
|
|
230
|
+
// clients, and points ui://-capable hosts at the inline `ui://genie/grid`
|
|
231
|
+
// resource (registered by M4-06) via `_meta.ui.resourceUri`. Boots the Vite
|
|
232
|
+
// viewer on demand and reuses it across calls (its own ViewerRegistry),
|
|
233
|
+
// falling back to a local file URL or CSP-safe embedded manifest when needed.
|
|
234
|
+
// Bound to the same `kitsRoot` the kit verbs resolve against so a `kitId`
|
|
235
|
+
// maps to the same on-disk kit dir the viewer serves.
|
|
236
|
+
const previewRegistry = registerPreviewTool(server, {
|
|
237
|
+
kitsRoot,
|
|
238
|
+
transportKind: options.transportKind,
|
|
239
|
+
locality: previewLocality,
|
|
240
|
+
...(options.previewBooter !== undefined ? { booter: options.previewBooter } : {}),
|
|
241
|
+
...(getCardAssetBroker !== undefined ? { getCardAssetBroker } : {}),
|
|
242
|
+
});
|
|
243
|
+
registerServerDisposer(server, () => previewRegistry.closeAll());
|
|
244
|
+
// ui://genie/grid (M4-06 / DRO-268): the embedded MCP-Apps resource the
|
|
245
|
+
// `preview` tool's `_meta.ui.resourceUri` points at. A ui://-capable host
|
|
246
|
+
// (Claude, VS Code ≥Jan 2026, ChatGPT, Cursor) reads this resource and renders
|
|
247
|
+
// the card grid inline in its own sandboxed iframe. The handler compiles the
|
|
248
|
+
// requested kit's manifest (M3-03) and inlines it as
|
|
249
|
+
// `<script type="application/json" id="manifest">` so the iframe — whose CSP
|
|
250
|
+
// is `connect-src 'none'` — needs no fetch. Bound to the same `kitsRoot` as
|
|
251
|
+
// the kit verbs + `preview`, so a `kitId` resolves to the same on-disk kit.
|
|
252
|
+
registerGridResource(server, {
|
|
253
|
+
kitsRoot,
|
|
254
|
+
...(getCardAssetBroker !== undefined ? { getCardAssetBroker } : {}),
|
|
255
|
+
});
|
|
256
|
+
return server;
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,M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C,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Empty-manifest seed for `createKit` (DRO-764 AC3).
|
|
3
|
+
*
|
|
4
|
+
* A freshly created kit has zero components — the M3-03 compiler
|
|
5
|
+
* (`../manifest/compiler.ts`) hasn't run yet, and won't until a watcher
|
|
6
|
+
* cycle or an explicit call walks the kit's `components` tree. But the viewer's
|
|
7
|
+
* `file://` and localhost-Vite vehicles (unlike `ui://genie/grid`, which
|
|
8
|
+
* calls `compileManifest` live per request — see `../ui/grid-resource.ts`)
|
|
9
|
+
* only ever `fetch(".genie/manifest.json")` off disk (`static/viewer.js`'s
|
|
10
|
+
* `boot()`). A missing file there is a REJECTED fetch (browsers do not
|
|
11
|
+
* synthesize a 404 Response for a nonexistent `file://` resource — a
|
|
12
|
+
* network error is a rejected promise), which `boot()`'s `.catch` turns
|
|
13
|
+
* into the `.ds-error` "run the genie MCP server against this kit first"
|
|
14
|
+
* message — not the `.ds-empty` "no components yet" state AC3 requires.
|
|
15
|
+
*
|
|
16
|
+
* `create_kit` therefore seeds a valid, empty manifest at creation time —
|
|
17
|
+
* `{version: 1, name, generatedAt, groups: [], components: []}`, BYTE-SHAPE
|
|
18
|
+
* IDENTICAL to what `compileManifest` itself would produce for a kit whose
|
|
19
|
+
* `components/` directory doesn't exist yet (see
|
|
20
|
+
* `manifest/compiler.test.ts`'s "AC4: top-level shape" and "empty
|
|
21
|
+
* components/ dir" cases) — so this is a real, valid manifest snapshot, not
|
|
22
|
+
* a viewer-only special case, and the M3-03 compiler transparently
|
|
23
|
+
* overwrites it the moment any component is actually added.
|
|
24
|
+
*
|
|
25
|
+
* A tiny standalone literal builder — not a call into
|
|
26
|
+
* `../manifest/compiler.ts`'s `compileManifest` — deliberately: that
|
|
27
|
+
* function's job is walking the kit's `components` tree off disk, which for a
|
|
28
|
+
* brand-new kit (no such directory yet) is strictly more IO than a
|
|
29
|
+
* `createKit` call needs to pay just to learn "there are no components",
|
|
30
|
+
* and would introduce a `store/*` → `manifest/*` import direction with no
|
|
31
|
+
* corresponding need elsewhere in this file. Both branches are asserted
|
|
32
|
+
* byte-shape-identical by `empty-manifest.test.ts`, so they cannot silently
|
|
33
|
+
* drift apart.
|
|
34
|
+
*/
|
|
35
|
+
/** The exact empty-manifest envelope shape `compileManifest` emits for a kit
|
|
36
|
+
* with no `components/` directory yet (`manifest/compiler.ts`'s `Manifest`). */
|
|
37
|
+
export interface EmptyManifest {
|
|
38
|
+
version: 1;
|
|
39
|
+
name: string;
|
|
40
|
+
generatedAt: string;
|
|
41
|
+
groups: never[];
|
|
42
|
+
components: never[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build the empty-manifest envelope for a newly created kit (AC3). `name`
|
|
46
|
+
* should be the kit's own name (the same string `createKit` already
|
|
47
|
+
* received) — purely descriptive metadata: `static/viewer.js` never reads
|
|
48
|
+
* this top-level `name` field (only each card's own `name`), so its exact
|
|
49
|
+
* value has no rendering effect; it exists only so a manifest read back off
|
|
50
|
+
* disk looks like a normal compiler snapshot, not a hand-wired special case.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildEmptyManifest(name: string): EmptyManifest;
|
|
53
|
+
/** `buildEmptyManifest`, serialized exactly as `compiler.ts`'s
|
|
54
|
+
* `writeManifestAtomic` serializes a real compiled manifest (2-space
|
|
55
|
+
* indent, UTF-8) — so a byte-diff between a seeded and a freshly-compiled
|
|
56
|
+
* empty manifest is whitespace-only. */
|
|
57
|
+
export declare function serializeEmptyManifest(name: string): string;
|
|
58
|
+
//# sourceMappingURL=empty-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-manifest.d.ts","sourceRoot":"","sources":["../../src/store/empty-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;gFACgF;AAChF,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,UAAU,EAAE,KAAK,EAAE,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAQ9D;AAED;;;wCAGwC;AACxC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Empty-manifest seed for `createKit` (DRO-764 AC3).
|
|
3
|
+
*
|
|
4
|
+
* A freshly created kit has zero components — the M3-03 compiler
|
|
5
|
+
* (`../manifest/compiler.ts`) hasn't run yet, and won't until a watcher
|
|
6
|
+
* cycle or an explicit call walks the kit's `components` tree. But the viewer's
|
|
7
|
+
* `file://` and localhost-Vite vehicles (unlike `ui://genie/grid`, which
|
|
8
|
+
* calls `compileManifest` live per request — see `../ui/grid-resource.ts`)
|
|
9
|
+
* only ever `fetch(".genie/manifest.json")` off disk (`static/viewer.js`'s
|
|
10
|
+
* `boot()`). A missing file there is a REJECTED fetch (browsers do not
|
|
11
|
+
* synthesize a 404 Response for a nonexistent `file://` resource — a
|
|
12
|
+
* network error is a rejected promise), which `boot()`'s `.catch` turns
|
|
13
|
+
* into the `.ds-error` "run the genie MCP server against this kit first"
|
|
14
|
+
* message — not the `.ds-empty` "no components yet" state AC3 requires.
|
|
15
|
+
*
|
|
16
|
+
* `create_kit` therefore seeds a valid, empty manifest at creation time —
|
|
17
|
+
* `{version: 1, name, generatedAt, groups: [], components: []}`, BYTE-SHAPE
|
|
18
|
+
* IDENTICAL to what `compileManifest` itself would produce for a kit whose
|
|
19
|
+
* `components/` directory doesn't exist yet (see
|
|
20
|
+
* `manifest/compiler.test.ts`'s "AC4: top-level shape" and "empty
|
|
21
|
+
* components/ dir" cases) — so this is a real, valid manifest snapshot, not
|
|
22
|
+
* a viewer-only special case, and the M3-03 compiler transparently
|
|
23
|
+
* overwrites it the moment any component is actually added.
|
|
24
|
+
*
|
|
25
|
+
* A tiny standalone literal builder — not a call into
|
|
26
|
+
* `../manifest/compiler.ts`'s `compileManifest` — deliberately: that
|
|
27
|
+
* function's job is walking the kit's `components` tree off disk, which for a
|
|
28
|
+
* brand-new kit (no such directory yet) is strictly more IO than a
|
|
29
|
+
* `createKit` call needs to pay just to learn "there are no components",
|
|
30
|
+
* and would introduce a `store/*` → `manifest/*` import direction with no
|
|
31
|
+
* corresponding need elsewhere in this file. Both branches are asserted
|
|
32
|
+
* byte-shape-identical by `empty-manifest.test.ts`, so they cannot silently
|
|
33
|
+
* drift apart.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Build the empty-manifest envelope for a newly created kit (AC3). `name`
|
|
37
|
+
* should be the kit's own name (the same string `createKit` already
|
|
38
|
+
* received) — purely descriptive metadata: `static/viewer.js` never reads
|
|
39
|
+
* this top-level `name` field (only each card's own `name`), so its exact
|
|
40
|
+
* value has no rendering effect; it exists only so a manifest read back off
|
|
41
|
+
* disk looks like a normal compiler snapshot, not a hand-wired special case.
|
|
42
|
+
*/
|
|
43
|
+
export function buildEmptyManifest(name) {
|
|
44
|
+
return {
|
|
45
|
+
version: 1,
|
|
46
|
+
name,
|
|
47
|
+
generatedAt: new Date().toISOString(),
|
|
48
|
+
groups: [],
|
|
49
|
+
components: [],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** `buildEmptyManifest`, serialized exactly as `compiler.ts`'s
|
|
53
|
+
* `writeManifestAtomic` serializes a real compiled manifest (2-space
|
|
54
|
+
* indent, UTF-8) — so a byte-diff between a seeded and a freshly-compiled
|
|
55
|
+
* empty manifest is whitespace-only. */
|
|
56
|
+
export function serializeEmptyManifest(name) {
|
|
57
|
+
return JSON.stringify(buildEmptyManifest(name), null, 2);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=empty-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-manifest.js","sourceRoot":"","sources":["../../src/store/empty-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAYH;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO;QACL,OAAO,EAAE,CAAC;QACV,IAAI;QACJ,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC;AAED;;;wCAGwC;AACxC,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHostStore — shared adapter for any git host (GitHub / Gitea / GitLab).
|
|
3
|
+
*
|
|
4
|
+
* AC4: Uses a git-host SDK against an operator-configured base URL.
|
|
5
|
+
* plan = branch `plan/${planId}`, commit on `commitPlan`, no auto-merge.
|
|
6
|
+
* AC6: Honours its token from env (`GENIE_GIT_TOKEN`), fails fast with a
|
|
7
|
+
* clear error if missing.
|
|
8
|
+
*
|
|
9
|
+
* The adapter communicates with the git host via its HTTP REST API (Gitea is
|
|
10
|
+
* the reference instance). No git host is privileged in the abstraction and
|
|
11
|
+
* no provider URL is baked into the code.
|
|
12
|
+
*/
|
|
13
|
+
import type { FileOp, KitFileContent, KitFileEntry, KitId, KitMeta, KitStore, PlanId, ProjectId, ProjectMeta, ProjectStore, WriteOp } from "./interface.js";
|
|
14
|
+
export interface GitHostConfig {
|
|
15
|
+
/** Base URL of the git host API (e.g. "https://gitea.example.com/api/v1"). */
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
/** API token. If not provided, reads from GENIE_GIT_TOKEN env var. */
|
|
18
|
+
token?: string;
|
|
19
|
+
/** Owner / org name on the git host. */
|
|
20
|
+
owner: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Maps kits to repositories on the git host.
|
|
24
|
+
* A kitId is the repository name under the configured owner.
|
|
25
|
+
*/
|
|
26
|
+
export declare class GitHostKitStore implements KitStore {
|
|
27
|
+
private readonly baseUrl;
|
|
28
|
+
private readonly token;
|
|
29
|
+
private readonly owner;
|
|
30
|
+
private readonly kitMetaPath;
|
|
31
|
+
constructor(config: GitHostConfig);
|
|
32
|
+
private api;
|
|
33
|
+
private repoPath;
|
|
34
|
+
private readKitMeta;
|
|
35
|
+
private writeKitMeta;
|
|
36
|
+
/**
|
|
37
|
+
* Create a single file on the repo's default branch via one contents-API
|
|
38
|
+
* POST. Shares `writeKitMeta`'s "fresh repo, no prior content at this path"
|
|
39
|
+
* assumption — used by `createKit` for both `.kit.json` and (DRO-764) the
|
|
40
|
+
* viewer's static scaffold, all written into a repo `auto_init` just
|
|
41
|
+
* created moments earlier under names (`index.html`/`viewer.js`/
|
|
42
|
+
* `viewer.css`/`.kit.json`) that don't collide with a host's own auto-init
|
|
43
|
+
* output (README/LICENSE/.gitignore).
|
|
44
|
+
*/
|
|
45
|
+
private writeRepoFile;
|
|
46
|
+
listKits(): Promise<KitMeta[]>;
|
|
47
|
+
getKit(kitId: KitId): Promise<KitMeta>;
|
|
48
|
+
listFiles(kitId: KitId): Promise<KitFileEntry[]>;
|
|
49
|
+
listComponents(params: {
|
|
50
|
+
kitId: KitId;
|
|
51
|
+
group?: string;
|
|
52
|
+
}): Promise<import("./interface.js").ComponentEntry[]>;
|
|
53
|
+
/** Fetch repo metadata, mapping a 404 to NotFoundError("Kit"). */
|
|
54
|
+
private getRepo;
|
|
55
|
+
/**
|
|
56
|
+
* Read the kit's committed `.genieignore` (default branch) into active
|
|
57
|
+
* pattern lines. Absent file → no extra patterns (default-dir exclusion still
|
|
58
|
+
* applies via buildIgnoreMatcher).
|
|
59
|
+
*/
|
|
60
|
+
private readIgnorePatterns;
|
|
61
|
+
private listTree;
|
|
62
|
+
/**
|
|
63
|
+
* GET a single contents entry, mapping a 404 to NotFoundError("File").
|
|
64
|
+
* Encodes each path segment to handle spaces, #, ?, etc.
|
|
65
|
+
*/
|
|
66
|
+
private fetchContentEntry;
|
|
67
|
+
/** Fetch a file's raw bytes off the default branch (base64 or utf-8 payload). */
|
|
68
|
+
private fetchFileBytes;
|
|
69
|
+
readFile(kitId: KitId, path: string): Promise<KitFileContent>;
|
|
70
|
+
deleteFile(kitId: KitId, path: string): Promise<{
|
|
71
|
+
existed: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
writeFiles(kitId: KitId, ops: WriteOp[]): Promise<{
|
|
74
|
+
writtenPaths: string[];
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Fetch a path's current blob state on the default branch for a write:
|
|
78
|
+
* `{ existed: true, sha, contentB64 }` if present (needed to update AND to
|
|
79
|
+
* restore on rollback), `{ existed: false }` if absent (we'd be creating it).
|
|
80
|
+
* A directory at the path is treated as "not a writable file" and surfaces as
|
|
81
|
+
* absent — the subsequent write then fails and rolls back, matching LocalFs's
|
|
82
|
+
* directory-target refusal.
|
|
83
|
+
*/
|
|
84
|
+
private getContentForWrite;
|
|
85
|
+
/**
|
|
86
|
+
* Unwind a partially-applied writeFiles batch. For each committed file: if it
|
|
87
|
+
* pre-existed, PUT its captured content back; if we created it, DELETE it.
|
|
88
|
+
* Every step is attempted even if an earlier one fails — failures are
|
|
89
|
+
* collected and returned so the caller can raise RollbackIncompleteError
|
|
90
|
+
* rather than mask an incomplete restore.
|
|
91
|
+
*/
|
|
92
|
+
private unwriteFiles;
|
|
93
|
+
createKit(name: string, kitId?: string): Promise<KitMeta>;
|
|
94
|
+
openPlan(kitId: KitId, ops: FileOp[]): Promise<PlanId>;
|
|
95
|
+
commitPlan(kitId: KitId, planId: PlanId, ops: FileOp[]): Promise<void>;
|
|
96
|
+
closePlan(kitId: KitId, planId: PlanId): Promise<void>;
|
|
97
|
+
private applyOps;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Stores project metadata in a dedicated repo (`_genie-projects`) as JSON files.
|
|
101
|
+
* Each project is a file `projects/<projectId>.json`.
|
|
102
|
+
*/
|
|
103
|
+
export declare class GitHostProjectStore implements ProjectStore {
|
|
104
|
+
private readonly baseUrl;
|
|
105
|
+
private readonly token;
|
|
106
|
+
private readonly owner;
|
|
107
|
+
private readonly metaRepo;
|
|
108
|
+
constructor(config: GitHostConfig);
|
|
109
|
+
private api;
|
|
110
|
+
private projectPath;
|
|
111
|
+
private ensureMetaRepo;
|
|
112
|
+
listProjects(): Promise<ProjectMeta[]>;
|
|
113
|
+
getProject(projectId: ProjectId): Promise<ProjectMeta>;
|
|
114
|
+
createProject(name: string): Promise<ProjectMeta>;
|
|
115
|
+
deleteProject(projectId: ProjectId): Promise<void>;
|
|
116
|
+
bindKit(projectId: ProjectId, kitId: KitId): Promise<void>;
|
|
117
|
+
recordScreen(projectId: ProjectId, screenRef: string): Promise<void>;
|
|
118
|
+
private updateProjectMeta;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=git-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-host.d.ts","sourceRoot":"","sources":["../../src/store/git-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,YAAY,EACZ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,WAAW,EACX,YAAY,EACZ,OAAO,EACR,MAAM,gBAAgB,CAAC;AAwBxB,MAAM,WAAW,aAAa;IAC5B,8EA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