@agimon-ai/doompi-style-system 0.0.1-alpha.100
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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/apiContracts.cjs +118 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +52 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +113 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/cli.cjs +242 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.mts +4 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +239 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/designCheck-7P9r9ijq.mjs +475 -0
- package/dist/designCheck-7P9r9ijq.mjs.map +1 -0
- package/dist/designCheck-zx4PsRvE.cjs +495 -0
- package/dist/designCheck-zx4PsRvE.cjs.map +1 -0
- package/dist/extensions/pi.cjs +94 -0
- package/dist/extensions/pi.cjs.map +1 -0
- package/dist/extensions/pi.d.mts +5 -0
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +87 -0
- package/dist/extensions/pi.mjs.map +1 -0
- package/dist/extensions/server.cjs +136 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +131 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +942 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.mts +171 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/dist/storyPreview-D-hGhlig.cjs +371 -0
- package/dist/storyPreview-D-hGhlig.cjs.map +1 -0
- package/dist/storyPreview-Dhejqhos.mjs +357 -0
- package/dist/storyPreview-Dhejqhos.mjs.map +1 -0
- package/package.json +132 -0
- package/skills/design-workflow/SKILL.md +84 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_rolldown_runtime = require("../rolldown-runtime-VH7oDXx4.cjs");
|
|
6
|
+
let node_fs = require("node:fs");
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
|
+
let _agimon_ai_doompi_core_piExtension = require("@agimon-ai/doompi-core/piExtension");
|
|
10
|
+
let _agimon_ai_doompi_core_extensionFile = require("@agimon-ai/doompi-core/extensionFile");
|
|
11
|
+
let node_url = require("node:url");
|
|
12
|
+
let _agimon_ai_doompi_core_skills = require("@agimon-ai/doompi-core/skills");
|
|
13
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts
|
|
14
|
+
const DESIGN_SOURCE = "@agimon-ai/doompi-style-system";
|
|
15
|
+
const MAX_SEEN_TOOL_CALLS = 256;
|
|
16
|
+
const UI_FILE_PATTERN = /\.(?:css|less|sass|scss|jsx|tsx|vue|svelte)$/u;
|
|
17
|
+
function packageRoot() {
|
|
18
|
+
let directory = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
19
|
+
while (!(0, node_fs.existsSync)(node_path.default.join(directory, "package.json"))) {
|
|
20
|
+
const parent = node_path.default.dirname(directory);
|
|
21
|
+
if (parent === directory) throw new Error("Style-system resources are unavailable.");
|
|
22
|
+
directory = parent;
|
|
23
|
+
}
|
|
24
|
+
return directory;
|
|
25
|
+
}
|
|
26
|
+
function styleSystemSkillDirectory() {
|
|
27
|
+
return node_path.default.join(packageRoot(), "skills");
|
|
28
|
+
}
|
|
29
|
+
function contained(root, candidate) {
|
|
30
|
+
const relative = node_path.default.relative(root, candidate);
|
|
31
|
+
return relative === "" || !relative.startsWith(`..${node_path.default.sep}`) && relative !== ".." && !node_path.default.isAbsolute(relative);
|
|
32
|
+
}
|
|
33
|
+
function sourcePath(input, cwd) {
|
|
34
|
+
const value = input.path;
|
|
35
|
+
if (typeof value !== "string" || value.trim() === "" || !UI_FILE_PATTERN.test(value)) return void 0;
|
|
36
|
+
const root = node_path.default.resolve(cwd);
|
|
37
|
+
const candidate = node_path.default.resolve(root, value);
|
|
38
|
+
return contained(root, candidate) ? candidate : void 0;
|
|
39
|
+
}
|
|
40
|
+
function registerSkillSource(context) {
|
|
41
|
+
context.inject([_agimon_ai_doompi_core_skills.DOOM_SKILL_SOURCES_SERVICE], (skillContext) => {
|
|
42
|
+
const contribution = (0, _agimon_ai_doompi_core_skills.requireDoomSkillSourcesService)(skillContext).register({
|
|
43
|
+
source: DESIGN_SOURCE,
|
|
44
|
+
directories: [styleSystemSkillDirectory()]
|
|
45
|
+
});
|
|
46
|
+
return () => contribution.dispose();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function createStyleSystemPiRoot() {
|
|
50
|
+
const seen = /* @__PURE__ */ new Set();
|
|
51
|
+
let reminded = false;
|
|
52
|
+
const toolResult = async (event, context) => {
|
|
53
|
+
if (event.isError || reminded || seen.has(event.toolCallId)) return void 0;
|
|
54
|
+
seen.add(event.toolCallId);
|
|
55
|
+
if (seen.size > MAX_SEEN_TOOL_CALLS) seen.delete(seen.values().next().value);
|
|
56
|
+
if (event.toolName !== "edit" && event.toolName !== "write") return void 0;
|
|
57
|
+
if (sourcePath(event.input, context.cwd) === void 0) return void 0;
|
|
58
|
+
reminded = true;
|
|
59
|
+
return { content: [...event.content, {
|
|
60
|
+
type: "text",
|
|
61
|
+
text: "Design source changed. Use the design skill and CLI to check existing components and tokens; run the readiness check before requesting approval."
|
|
62
|
+
}] };
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
value: { toolResult },
|
|
66
|
+
services: [registerSkillSource]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.cli.ts
|
|
71
|
+
var root_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)(() => createStyleSystemPiRoot());
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/tool-result.cli.ts
|
|
74
|
+
var tool_result_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineCliHook)((context) => context.root.toolResult);
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region generated/pi.ts
|
|
77
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
78
|
+
const extension = (0, _agimon_ai_doompi_core_piExtension.definePiExtension)("@agimon-ai/doompi-style-system", async (context) => {
|
|
79
|
+
const scopeSession = await root_cli_default(context);
|
|
80
|
+
const contextSession = {
|
|
81
|
+
...context,
|
|
82
|
+
root: scopeSession.value
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
...(0, _agimon_ai_doompi_core_extensionFile.composeRootHooks)(scopeSession),
|
|
86
|
+
events: { tool_result: at(tool_result_cli_default, contextSession) },
|
|
87
|
+
services: [...scopeSession.services ?? []]
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.default = extension;
|
|
92
|
+
exports.extension = extension;
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=pi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.cjs","names":["path","fileURLToPath","existsSync","DOOM_SKILL_SOURCES_SERVICE","requireDoomSkillSourcesService","defineRoot","defineCliHook","definePiExtension","rootSession","composeRootHooks","hookToolResult"],"sources":["../../src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/tool-result.cli.ts","../../generated/pi.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\nimport { DOOM_SKILL_SOURCES_SERVICE, requireDoomSkillSourcesService } from '@agimon-ai/doompi-core/skills';\n\ntype PiContext = PiPluginContext<unknown>['context'];\n\nconst DESIGN_SOURCE = '@agimon-ai/doompi-style-system';\nconst MAX_SEEN_TOOL_CALLS = 256;\nconst UI_FILE_PATTERN = /\\.(?:css|less|sass|scss|jsx|tsx|vue|svelte)$/u;\n\nexport interface StyleSystemPiScope {\n readonly toolResult: NonNullable<PiEventHandlers['tool_result']>;\n}\n\nfunction packageRoot(): string {\n let directory = path.dirname(fileURLToPath(import.meta.url));\n while (!existsSync(path.join(directory, 'package.json'))) {\n const parent = path.dirname(directory);\n if (parent === directory) throw new Error('Style-system resources are unavailable.');\n directory = parent;\n }\n return directory;\n}\n\nexport function styleSystemSkillDirectory(): string {\n return path.join(packageRoot(), 'skills');\n}\n\nfunction contained(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));\n}\n\nfunction sourcePath(input: Record<string, unknown>, cwd: string): string | undefined {\n const value = input.path;\n if (typeof value !== 'string' || value.trim() === '' || !UI_FILE_PATTERN.test(value)) return undefined;\n const root = path.resolve(cwd);\n const candidate = path.resolve(root, value);\n return contained(root, candidate) ? candidate : undefined;\n}\n\nfunction registerSkillSource(context: PiContext): void {\n context.inject([DOOM_SKILL_SOURCES_SERVICE], (skillContext) => {\n const contribution = requireDoomSkillSourcesService(skillContext).register({\n source: DESIGN_SOURCE,\n directories: [styleSystemSkillDirectory()],\n });\n return () => contribution.dispose();\n });\n}\n\nexport function createStyleSystemPiRoot(): {\n value: StyleSystemPiScope;\n services: readonly [typeof registerSkillSource];\n} {\n const seen = new Set<string>();\n let reminded = false;\n const toolResult: NonNullable<PiEventHandlers['tool_result']> = async (event, context) => {\n if (event.isError || reminded || seen.has(event.toolCallId)) return undefined;\n seen.add(event.toolCallId);\n if (seen.size > MAX_SEEN_TOOL_CALLS) seen.delete(seen.values().next().value!);\n if (event.toolName !== 'edit' && event.toolName !== 'write') return undefined;\n if (sourcePath(event.input, context.cwd) === undefined) return undefined;\n reminded = true;\n return {\n content: [\n ...event.content,\n {\n type: 'text' as const,\n text: 'Design source changed. Use the design skill and CLI to check existing components and tokens; run the readiness check before requesting approval.',\n },\n ],\n };\n };\n return { value: { toolResult }, services: [registerSkillSource] };\n}\n\nexport default createStyleSystemPiRoot;\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\n\nimport createStyleSystemPiRoot from './_lib/piRoot';\n\nexport default defineRoot(() => createStyleSystemPiRoot());\n","import { defineCliHook, type WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { StyleSystemPiScope } from '../_lib/piRoot';\n\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, StyleSystemPiScope>): PiEventHandlers['tool_result'] =>\n context.root.toolResult,\n);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport hookToolResult from '../src/extensions/workspaces/sessions/(backend)/hook/tool-result.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof hookToolResult>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-style-system', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n events: {\n tool_result: at(hookToolResult, contextSession) as NonNullable<PiPluginContributions['events']>['tool_result'],\n },\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;AASA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAMxB,SAAS,cAAsB;CAC7B,IAAI,YAAYA,UAAAA,QAAK,SAAA,GAAQC,SAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B,CAAC;CAC3D,OAAO,EAAA,GAACC,QAAAA,WAAAA,CAAWF,UAAAA,QAAK,KAAK,WAAW,cAAc,CAAC,GAAG;EACxD,MAAM,SAASA,UAAAA,QAAK,QAAQ,SAAS;EACrC,IAAI,WAAW,WAAW,MAAM,IAAI,MAAM,yCAAyC;EACnF,YAAY;CACd;CACA,OAAO;AACT;AAEA,SAAgB,4BAAoC;CAClD,OAAOA,UAAAA,QAAK,KAAK,YAAY,GAAG,QAAQ;AAC1C;AAEA,SAAS,UAAU,MAAc,WAA4B;CAC3D,MAAM,WAAWA,UAAAA,QAAK,SAAS,MAAM,SAAS;CAC9C,OAAO,aAAa,MAAO,CAAC,SAAS,WAAW,KAAKA,UAAAA,QAAK,KAAK,KAAK,aAAa,QAAQ,CAACA,UAAAA,QAAK,WAAW,QAAQ;AACpH;AAEA,SAAS,WAAW,OAAgC,KAAiC;CACnF,MAAM,QAAQ,MAAM;CACpB,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,MAAM,CAAC,gBAAgB,KAAK,KAAK,GAAG,OAAO,KAAA;CAC7F,MAAM,OAAOA,U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,GAAYC,mCAAAA,kBAAAA,CAAoC,kCAAkC,OAAO,YAAY;CAChH,MAAM,eAAe,MAAMC,iBAAY,OAAO;CAC9C,MAAM,iBAAiB;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,qCAAAA,iBAAAA,CAAiB,YAAY;EAChC,QAAQ,EACN,aAAa,GAAGC,yBAAgB,cAAc,EAChD;EACA,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";qBAiBa,+DAAS"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { definePiExtension } from "@agimon-ai/doompi-core/piExtension";
|
|
4
|
+
import { composeRootHooks, defineCliHook, defineRoot } from "@agimon-ai/doompi-core/extensionFile";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { DOOM_SKILL_SOURCES_SERVICE, requireDoomSkillSourcesService } from "@agimon-ai/doompi-core/skills";
|
|
7
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts
|
|
8
|
+
const DESIGN_SOURCE = "@agimon-ai/doompi-style-system";
|
|
9
|
+
const MAX_SEEN_TOOL_CALLS = 256;
|
|
10
|
+
const UI_FILE_PATTERN = /\.(?:css|less|sass|scss|jsx|tsx|vue|svelte)$/u;
|
|
11
|
+
function packageRoot() {
|
|
12
|
+
let directory = path.dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
while (!existsSync(path.join(directory, "package.json"))) {
|
|
14
|
+
const parent = path.dirname(directory);
|
|
15
|
+
if (parent === directory) throw new Error("Style-system resources are unavailable.");
|
|
16
|
+
directory = parent;
|
|
17
|
+
}
|
|
18
|
+
return directory;
|
|
19
|
+
}
|
|
20
|
+
function styleSystemSkillDirectory() {
|
|
21
|
+
return path.join(packageRoot(), "skills");
|
|
22
|
+
}
|
|
23
|
+
function contained(root, candidate) {
|
|
24
|
+
const relative = path.relative(root, candidate);
|
|
25
|
+
return relative === "" || !relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative);
|
|
26
|
+
}
|
|
27
|
+
function sourcePath(input, cwd) {
|
|
28
|
+
const value = input.path;
|
|
29
|
+
if (typeof value !== "string" || value.trim() === "" || !UI_FILE_PATTERN.test(value)) return void 0;
|
|
30
|
+
const root = path.resolve(cwd);
|
|
31
|
+
const candidate = path.resolve(root, value);
|
|
32
|
+
return contained(root, candidate) ? candidate : void 0;
|
|
33
|
+
}
|
|
34
|
+
function registerSkillSource(context) {
|
|
35
|
+
context.inject([DOOM_SKILL_SOURCES_SERVICE], (skillContext) => {
|
|
36
|
+
const contribution = requireDoomSkillSourcesService(skillContext).register({
|
|
37
|
+
source: DESIGN_SOURCE,
|
|
38
|
+
directories: [styleSystemSkillDirectory()]
|
|
39
|
+
});
|
|
40
|
+
return () => contribution.dispose();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function createStyleSystemPiRoot() {
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
let reminded = false;
|
|
46
|
+
const toolResult = async (event, context) => {
|
|
47
|
+
if (event.isError || reminded || seen.has(event.toolCallId)) return void 0;
|
|
48
|
+
seen.add(event.toolCallId);
|
|
49
|
+
if (seen.size > MAX_SEEN_TOOL_CALLS) seen.delete(seen.values().next().value);
|
|
50
|
+
if (event.toolName !== "edit" && event.toolName !== "write") return void 0;
|
|
51
|
+
if (sourcePath(event.input, context.cwd) === void 0) return void 0;
|
|
52
|
+
reminded = true;
|
|
53
|
+
return { content: [...event.content, {
|
|
54
|
+
type: "text",
|
|
55
|
+
text: "Design source changed. Use the design skill and CLI to check existing components and tokens; run the readiness check before requesting approval."
|
|
56
|
+
}] };
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
value: { toolResult },
|
|
60
|
+
services: [registerSkillSource]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.cli.ts
|
|
65
|
+
var root_cli_default = defineRoot(() => createStyleSystemPiRoot());
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/tool-result.cli.ts
|
|
68
|
+
var tool_result_cli_default = defineCliHook((context) => context.root.toolResult);
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region generated/pi.ts
|
|
71
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
72
|
+
const extension = definePiExtension("@agimon-ai/doompi-style-system", async (context) => {
|
|
73
|
+
const scopeSession = await root_cli_default(context);
|
|
74
|
+
const contextSession = {
|
|
75
|
+
...context,
|
|
76
|
+
root: scopeSession.value
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
...composeRootHooks(scopeSession),
|
|
80
|
+
events: { tool_result: at(tool_result_cli_default, contextSession) },
|
|
81
|
+
services: [...scopeSession.services ?? []]
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
//#endregion
|
|
85
|
+
export { extension as default, extension };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=pi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.mjs","names":["rootSession","hookToolResult"],"sources":["../../src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/tool-result.cli.ts","../../generated/pi.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\nimport { DOOM_SKILL_SOURCES_SERVICE, requireDoomSkillSourcesService } from '@agimon-ai/doompi-core/skills';\n\ntype PiContext = PiPluginContext<unknown>['context'];\n\nconst DESIGN_SOURCE = '@agimon-ai/doompi-style-system';\nconst MAX_SEEN_TOOL_CALLS = 256;\nconst UI_FILE_PATTERN = /\\.(?:css|less|sass|scss|jsx|tsx|vue|svelte)$/u;\n\nexport interface StyleSystemPiScope {\n readonly toolResult: NonNullable<PiEventHandlers['tool_result']>;\n}\n\nfunction packageRoot(): string {\n let directory = path.dirname(fileURLToPath(import.meta.url));\n while (!existsSync(path.join(directory, 'package.json'))) {\n const parent = path.dirname(directory);\n if (parent === directory) throw new Error('Style-system resources are unavailable.');\n directory = parent;\n }\n return directory;\n}\n\nexport function styleSystemSkillDirectory(): string {\n return path.join(packageRoot(), 'skills');\n}\n\nfunction contained(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));\n}\n\nfunction sourcePath(input: Record<string, unknown>, cwd: string): string | undefined {\n const value = input.path;\n if (typeof value !== 'string' || value.trim() === '' || !UI_FILE_PATTERN.test(value)) return undefined;\n const root = path.resolve(cwd);\n const candidate = path.resolve(root, value);\n return contained(root, candidate) ? candidate : undefined;\n}\n\nfunction registerSkillSource(context: PiContext): void {\n context.inject([DOOM_SKILL_SOURCES_SERVICE], (skillContext) => {\n const contribution = requireDoomSkillSourcesService(skillContext).register({\n source: DESIGN_SOURCE,\n directories: [styleSystemSkillDirectory()],\n });\n return () => contribution.dispose();\n });\n}\n\nexport function createStyleSystemPiRoot(): {\n value: StyleSystemPiScope;\n services: readonly [typeof registerSkillSource];\n} {\n const seen = new Set<string>();\n let reminded = false;\n const toolResult: NonNullable<PiEventHandlers['tool_result']> = async (event, context) => {\n if (event.isError || reminded || seen.has(event.toolCallId)) return undefined;\n seen.add(event.toolCallId);\n if (seen.size > MAX_SEEN_TOOL_CALLS) seen.delete(seen.values().next().value!);\n if (event.toolName !== 'edit' && event.toolName !== 'write') return undefined;\n if (sourcePath(event.input, context.cwd) === undefined) return undefined;\n reminded = true;\n return {\n content: [\n ...event.content,\n {\n type: 'text' as const,\n text: 'Design source changed. Use the design skill and CLI to check existing components and tokens; run the readiness check before requesting approval.',\n },\n ],\n };\n };\n return { value: { toolResult }, services: [registerSkillSource] };\n}\n\nexport default createStyleSystemPiRoot;\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\n\nimport createStyleSystemPiRoot from './_lib/piRoot';\n\nexport default defineRoot(() => createStyleSystemPiRoot());\n","import { defineCliHook, type WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport type { StyleSystemPiScope } from '../_lib/piRoot';\n\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, StyleSystemPiScope>): PiEventHandlers['tool_result'] =>\n context.root.toolResult,\n);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport hookToolResult from '../src/extensions/workspaces/sessions/(backend)/hook/tool-result.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof hookToolResult>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-style-system', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n events: {\n tool_result: at(hookToolResult, contextSession) as NonNullable<PiPluginContributions['events']>['tool_result'],\n },\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;AASA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAMxB,SAAS,cAAsB;CAC7B,IAAI,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;CAC3D,OAAO,CAAC,WAAW,KAAK,KAAK,WAAW,cAAc,CAAC,GAAG;EACxD,MAAM,SAAS,KAAK,QAAQ,SAAS;EACrC,IAAI,WAAW,WAAW,MAAM,IAAI,MAAM,yCAAyC;EACnF,YAAY;CACd;CACA,OAAO;AACT;AAEA,SAAgB,4BAAoC;CAClD,OAAO,KAAK,KAAK,YAAY,GAAG,QAAQ;AAC1C;AAEA,SAAS,UAAU,MAAc,WAA4B;CAC3D,MAAM,WAAW,KAAK,SAAS,MAAM,SAAS;CAC9C,OAAO,aAAa,MAAO,CAAC,SAAS,WAAW,KAAK,KAAK,KAAK,KAAK,aAAa,QAAQ,CAAC,KAAK,WAAW,QAAQ;AACpH;AAEA,SAAS,WAAW,OAAgC,KAAiC;CACnF,MAAM,QAAQ,MAAM;CACpB,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,MAAM,CAAC,gBAAgB,KAAK,KAAK,GAAG,OAAO,KAAA;CAC7F,MAAM,OAAO,KAAK,QAAQ,GAAG;CAC7B,MAAM,YAAY,KAAK,QAAQ,MAAM,KAAK;CAC1C,OAAO,UAAU,MAAM,SAAS,IAAI,YAAY,KAAA;AAClD;AAEA,SAAS,oBAAoB,SAA0B;CACrD,QAAQ,OAAO,CAAC,0BAA0B,IAAI,iBAAiB;EAC7D,MAAM,eAAe,+BAA+B,YAAY,CAAC,CAAC,SAAS;GACzE,QAAQ;GACR,aAAa,CAAC,0BAA0B,CAAC;EAC3C,CAAC;EACD,aAAa,aAAa,QAA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
|
|
5
|
+
const require_storyPreview = require("../storyPreview-D-hGhlig.cjs");
|
|
6
|
+
let _agimon_ai_doompi_core_extensionFile = require("@agimon-ai/doompi-core/extensionFile");
|
|
7
|
+
let _agimon_ai_doompi_core_serverFacet = require("@agimon-ai/doompi-core/serverFacet");
|
|
8
|
+
let hono = require("hono");
|
|
9
|
+
let _agimon_ai_doompi_core_web = require("@agimon-ai/doompi-core/web");
|
|
10
|
+
//#region src/types/apiRoutes.ts
|
|
11
|
+
var apiRoutes_default = (0, _agimon_ai_doompi_core_web.defineApiRoutes)({
|
|
12
|
+
metadata: {
|
|
13
|
+
method: "POST",
|
|
14
|
+
path: "/metadata",
|
|
15
|
+
response: (0, _agimon_ai_doompi_core_web.apiResponse)()
|
|
16
|
+
},
|
|
17
|
+
build: {
|
|
18
|
+
method: "POST",
|
|
19
|
+
path: "/build",
|
|
20
|
+
response: (0, _agimon_ai_doompi_core_web.apiResponse)()
|
|
21
|
+
},
|
|
22
|
+
image: {
|
|
23
|
+
method: "POST",
|
|
24
|
+
path: "/image",
|
|
25
|
+
response: (0, _agimon_ai_doompi_core_web.apiResponse)()
|
|
26
|
+
},
|
|
27
|
+
dispose: {
|
|
28
|
+
method: "DELETE",
|
|
29
|
+
path: "/artifact",
|
|
30
|
+
response: (0, _agimon_ai_doompi_core_web.apiResponse)()
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/services/previewApi/index.ts
|
|
35
|
+
function createPreviewApi(workspaceRoot, previews = new require_storyPreview.StoryPreviewService(workspaceRoot)) {
|
|
36
|
+
const app = new hono.Hono();
|
|
37
|
+
app.post(apiRoutes_default.metadata.path, async (context) => {
|
|
38
|
+
let request;
|
|
39
|
+
try {
|
|
40
|
+
request = await context.req.json();
|
|
41
|
+
} catch {
|
|
42
|
+
return context.json({ error: "The story metadata request body is not JSON." }, 400);
|
|
43
|
+
}
|
|
44
|
+
if (request === null || typeof request !== "object" || typeof request.storyPath !== "string" || request.appPath !== void 0 && typeof request.appPath !== "string") return context.json({ error: "Story metadata requires a storyPath." }, 400);
|
|
45
|
+
try {
|
|
46
|
+
return context.json(await previews.metadata(request));
|
|
47
|
+
} catch (reason) {
|
|
48
|
+
return context.json({ error: reason instanceof Error ? reason.message : "Unable to read story metadata." }, 400);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
app.post(apiRoutes_default.build.path, async (context) => {
|
|
52
|
+
let request;
|
|
53
|
+
try {
|
|
54
|
+
request = await context.req.json();
|
|
55
|
+
} catch {
|
|
56
|
+
return context.json({ error: "The preview request body is not JSON." }, 400);
|
|
57
|
+
}
|
|
58
|
+
if (request === null || typeof request !== "object" || typeof request.appPath !== "string" || typeof request.storyPath !== "string" || typeof request.storyExport !== "string" || request.darkMode !== void 0 && typeof request.darkMode !== "boolean") return context.json({ error: "A preview requires appPath, storyPath, and an exact storyExport." }, 400);
|
|
59
|
+
try {
|
|
60
|
+
return context.json(await previews.build(request));
|
|
61
|
+
} catch (reason) {
|
|
62
|
+
return context.json({ error: reason instanceof Error ? reason.message : "Unable to build the story preview." }, 400);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
app.post(apiRoutes_default.image.path, async (context) => {
|
|
66
|
+
let request;
|
|
67
|
+
try {
|
|
68
|
+
request = await context.req.json();
|
|
69
|
+
} catch {
|
|
70
|
+
return context.json({ error: "The image request body is not JSON." }, 400);
|
|
71
|
+
}
|
|
72
|
+
if (request === null || typeof request !== "object" || typeof request.appPath !== "string" || typeof request.storyPath !== "string" || typeof request.storyExport !== "string" || request.darkMode !== void 0 && typeof request.darkMode !== "boolean") return context.json({ error: "An image export requires appPath, storyPath, and an exact storyExport." }, 400);
|
|
73
|
+
try {
|
|
74
|
+
return context.json(await previews.exportImage(request));
|
|
75
|
+
} catch (reason) {
|
|
76
|
+
return context.json({ error: reason instanceof Error ? reason.message : "Unable to export the story image." }, 400);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
app.delete(apiRoutes_default.dispose.path, async (context) => {
|
|
80
|
+
let request;
|
|
81
|
+
try {
|
|
82
|
+
request = await context.req.json();
|
|
83
|
+
} catch {
|
|
84
|
+
return context.json({ error: "The dispose request body is not JSON." }, 400);
|
|
85
|
+
}
|
|
86
|
+
if (request === null || typeof request !== "object" || typeof request.handle !== "string") return context.json({ error: "A preview handle is required." }, 400);
|
|
87
|
+
return context.json({ disposed: await previews.dispose(request.handle) });
|
|
88
|
+
});
|
|
89
|
+
return app;
|
|
90
|
+
}
|
|
91
|
+
const api = {
|
|
92
|
+
basePath: "style-system-preview",
|
|
93
|
+
start(context) {
|
|
94
|
+
if (context.workspaceRoot === void 0) throw new Error("Style-system preview requires a workspace-scoped session.");
|
|
95
|
+
const service = new require_storyPreview.StoryPreviewService(context.workspaceRoot);
|
|
96
|
+
const previews = createPreviewApi(context.workspaceRoot, service);
|
|
97
|
+
return {
|
|
98
|
+
fetch: (request) => previews.fetch(request),
|
|
99
|
+
close: () => service.disposeAll()
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
105
|
+
var root_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)(() => ({ value: { api: [api] } }));
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/extensions/workspaces/sessions/(backend)/api/style-system-preview/route.server.ts
|
|
108
|
+
var route_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)((context) => context.root.api[0]);
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region generated/server.ts
|
|
111
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
112
|
+
const facet = (0, _agimon_ai_doompi_core_serverFacet.defineServerPlugin)({
|
|
113
|
+
name: "@agimon-ai/doompi-style-system",
|
|
114
|
+
session: async (context) => {
|
|
115
|
+
const scopeSession = await root_server_default(context);
|
|
116
|
+
const contextSession = {
|
|
117
|
+
...context,
|
|
118
|
+
root: scopeSession.value
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
...(0, _agimon_ai_doompi_core_extensionFile.composeRootHooks)(scopeSession),
|
|
122
|
+
get api() {
|
|
123
|
+
return [at(route_server_default, contextSession)];
|
|
124
|
+
},
|
|
125
|
+
services: [...scopeSession.services ?? []],
|
|
126
|
+
get activities() {
|
|
127
|
+
return [...scopeSession.activities ?? []];
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
//#endregion
|
|
133
|
+
exports.default = facet;
|
|
134
|
+
exports.facet = facet;
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["defineApiRoutes","apiResponse","StoryPreviewService","Hono","routes","defineRoot","defineRoute","defineServerPlugin","rootSession","composeRootHooks","apiRoute"],"sources":["../../src/types/apiRoutes.ts","../../src/services/previewApi/index.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/style-system-preview/route.server.ts","../../generated/server.ts"],"sourcesContent":["import { apiResponse, defineApiRoutes } from '@agimon-ai/doompi-core/web';\n\nimport type {\n BuildStoryPreviewView,\n DisposeStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataView,\n} from './previewApi';\n\nexport default defineApiRoutes({\n metadata: {\n method: 'POST',\n path: '/metadata',\n response: apiResponse<StoryPreviewMetadataView>(),\n },\n build: {\n method: 'POST',\n path: '/build',\n response: apiResponse<BuildStoryPreviewView>(),\n },\n image: {\n method: 'POST',\n path: '/image',\n response: apiResponse<ExportStoryPreviewImageView>(),\n },\n dispose: {\n method: 'DELETE',\n path: '/artifact',\n response: apiResponse<DisposeStoryPreviewView>(),\n },\n});\n","import type { DoomApi, DoomApiContext, DoomApiHandler } from '@agimon-ai/doompi-core/packageApi';\nimport { Hono } from 'hono';\n\nimport routes from '../../types/apiRoutes';\nimport type {\n BuildStoryPreviewRequest,\n DisposeStoryPreviewRequest,\n ExportStoryPreviewImageRequest,\n StoryPreviewMetadataRequest,\n} from '../../types/previewApi';\nimport { StoryPreviewService } from '../storyPreview';\n\nexport function createPreviewApi(workspaceRoot: string, previews = new StoryPreviewService(workspaceRoot)): Hono {\n const app = new Hono();\n\n app.post(routes.metadata.path, async (context) => {\n let request: StoryPreviewMetadataRequest;\n try {\n request = (await context.req.json()) as StoryPreviewMetadataRequest;\n } catch {\n return context.json({ error: 'The story metadata request body is not JSON.' }, 400);\n }\n if (\n request === null ||\n typeof request !== 'object' ||\n typeof request.storyPath !== 'string' ||\n (request.appPath !== undefined && typeof request.appPath !== 'string')\n ) {\n return context.json({ error: 'Story metadata requires a storyPath.' }, 400);\n }\n try {\n return context.json(await previews.metadata(request));\n } catch (reason) {\n return context.json({ error: reason instanceof Error ? reason.message : 'Unable to read story metadata.' }, 400);\n }\n });\n\n app.post(routes.build.path, async (context) => {\n let request: BuildStoryPreviewRequest;\n try {\n request = (await context.req.json()) as BuildStoryPreviewRequest;\n } catch {\n return context.json({ error: 'The preview request body is not JSON.' }, 400);\n }\n if (\n request === null ||\n typeof request !== 'object' ||\n typeof request.appPath !== 'string' ||\n typeof request.storyPath !== 'string' ||\n typeof request.storyExport !== 'string' ||\n (request.darkMode !== undefined && typeof request.darkMode !== 'boolean')\n ) {\n return context.json({ error: 'A preview requires appPath, storyPath, and an exact storyExport.' }, 400);\n }\n try {\n return context.json(await previews.build(request));\n } catch (reason) {\n return context.json(\n { error: reason instanceof Error ? reason.message : 'Unable to build the story preview.' },\n 400,\n );\n }\n });\n\n app.post(routes.image.path, async (context) => {\n let request: ExportStoryPreviewImageRequest;\n try {\n request = (await context.req.json()) as ExportStoryPreviewImageRequest;\n } catch {\n return context.json({ error: 'The image request body is not JSON.' }, 400);\n }\n if (\n request === null ||\n typeof request !== 'object' ||\n typeof request.appPath !== 'string' ||\n typeof request.storyPath !== 'string' ||\n typeof request.storyExport !== 'string' ||\n (request.darkMode !== undefined && typeof request.darkMode !== 'boolean')\n ) {\n return context.json({ error: 'An image export requires appPath, storyPath, and an exact storyExport.' }, 400);\n }\n try {\n return context.json(await previews.exportImage(request));\n } catch (reason) {\n return context.json(\n { error: reason instanceof Error ? reason.message : 'Unable to export the story image.' },\n 400,\n );\n }\n });\n\n app.delete(routes.dispose.path, async (context) => {\n let request: DisposeStoryPreviewRequest;\n try {\n request = (await context.req.json()) as DisposeStoryPreviewRequest;\n } catch {\n return context.json({ error: 'The dispose request body is not JSON.' }, 400);\n }\n if (request === null || typeof request !== 'object' || typeof request.handle !== 'string') {\n return context.json({ error: 'A preview handle is required.' }, 400);\n }\n return context.json({ disposed: await previews.dispose(request.handle) });\n });\n\n return app;\n}\n\nexport const api: DoomApi = {\n basePath: 'style-system-preview',\n start(context: DoomApiContext): DoomApiHandler {\n if (context.workspaceRoot === undefined)\n throw new Error('Style-system preview requires a workspace-scoped session.');\n const service = new StoryPreviewService(context.workspaceRoot);\n const previews = createPreviewApi(context.workspaceRoot, service);\n return { fetch: (request) => previews.fetch(request), close: () => service.disposeAll() };\n },\n};\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\n\nimport { api } from '../../../../services/previewApi';\n\nexport default defineRoot(() => ({ value: { api: [api] } }));\n","import { defineRoute, type WithRoot } from '@agimon-ai/doompi-core/extensionFile';\n\ntype Root = Awaited<ReturnType<typeof import('../../root.server').default>>['value'];\n\nexport default defineRoute((context: WithRoot<unknown, Root>) => context.root.api[0]);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/style-system-preview/route.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-style-system',\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;;;AASA,IAAA,qBAAA,GAAeA,2BAAAA,gBAAAA,CAAgB;CAC7B,UAAU;EACR,QAAQ;EACR,MAAM;EACN,WAAA,GAAUC,2BAAAA,YAAAA,CAAsC;CAClD;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,WAAA,GAAUA,2BAAAA,YAAAA,CAAmC;CAC/C;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,WAAA,GAAUA,2BAAAA,YAAAA,CAAyC;CACrD;CACA,SAAS;EACP,QAAQ;EACR,MAAM;EACN,WAAA,GAAUA,2BAAAA,YAAAA,CAAqC;CACjD;AACF,CAAC;;;AClBD,SAAgB,iBAAiB,eAAuB,WAAW,IAAIC,qBAAAA,oBAAoB,aAAa,GAAS;CAC/G,MAAM,MAAM,IAAIC,KAAAA,KAAK;CAErB,IAAI,KAAKC,kBAAO,SAAS,MAAM,OAAO,YAAY;EAChD,IAAI;EACJ,IAAI;GACF,UAAW,MAAM,QAAQ,IAAI,KAAK;EACpC,QAAQ;GACN,OAAO,QAAQ,KAAK,EAAE,OAAO,+CAA+C,GAAG,GAAG;EACpF;EACA,IACE,YAAY,QACZ,OAAO,YAAY,YACnB,OAAO,QAAQ,cAAc,YAC5B,QAAQ,YAAY,KAAA,KAAa,OAAO,QAAQ,YAAY,UAE7D,OAAO,QAAQ,KAAK,EAAE,OAAO,uCAAuC,GAAG,GAAG;EAE5E,I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M,eAAe,MAAMC,oBAAY,OAAO;EAC9C,MAAM,iBAAiB;GAAE,GAAG;GAAS,MAAM,aAAa;EAAM;EAC9D,OAAO;GACL,IAAA,GAAGC,qCAAAA,iBAAAA,CAAiB,YAAY;GAChC,IAAI,MAAsC;IAAE,OAAO,CAAC,GAAGC,sBAAU,cAAc,CAAC;GAAG;GACnF,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAWa,oDAAK"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { t as StoryPreviewService } from "../storyPreview-Dhejqhos.mjs";
|
|
2
|
+
import { composeRootHooks, defineRoot, defineRoute } from "@agimon-ai/doompi-core/extensionFile";
|
|
3
|
+
import { defineServerPlugin } from "@agimon-ai/doompi-core/serverFacet";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
|
+
import { apiResponse, defineApiRoutes } from "@agimon-ai/doompi-core/web";
|
|
6
|
+
//#region src/types/apiRoutes.ts
|
|
7
|
+
var apiRoutes_default = defineApiRoutes({
|
|
8
|
+
metadata: {
|
|
9
|
+
method: "POST",
|
|
10
|
+
path: "/metadata",
|
|
11
|
+
response: apiResponse()
|
|
12
|
+
},
|
|
13
|
+
build: {
|
|
14
|
+
method: "POST",
|
|
15
|
+
path: "/build",
|
|
16
|
+
response: apiResponse()
|
|
17
|
+
},
|
|
18
|
+
image: {
|
|
19
|
+
method: "POST",
|
|
20
|
+
path: "/image",
|
|
21
|
+
response: apiResponse()
|
|
22
|
+
},
|
|
23
|
+
dispose: {
|
|
24
|
+
method: "DELETE",
|
|
25
|
+
path: "/artifact",
|
|
26
|
+
response: apiResponse()
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/services/previewApi/index.ts
|
|
31
|
+
function createPreviewApi(workspaceRoot, previews = new StoryPreviewService(workspaceRoot)) {
|
|
32
|
+
const app = new Hono();
|
|
33
|
+
app.post(apiRoutes_default.metadata.path, async (context) => {
|
|
34
|
+
let request;
|
|
35
|
+
try {
|
|
36
|
+
request = await context.req.json();
|
|
37
|
+
} catch {
|
|
38
|
+
return context.json({ error: "The story metadata request body is not JSON." }, 400);
|
|
39
|
+
}
|
|
40
|
+
if (request === null || typeof request !== "object" || typeof request.storyPath !== "string" || request.appPath !== void 0 && typeof request.appPath !== "string") return context.json({ error: "Story metadata requires a storyPath." }, 400);
|
|
41
|
+
try {
|
|
42
|
+
return context.json(await previews.metadata(request));
|
|
43
|
+
} catch (reason) {
|
|
44
|
+
return context.json({ error: reason instanceof Error ? reason.message : "Unable to read story metadata." }, 400);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
app.post(apiRoutes_default.build.path, async (context) => {
|
|
48
|
+
let request;
|
|
49
|
+
try {
|
|
50
|
+
request = await context.req.json();
|
|
51
|
+
} catch {
|
|
52
|
+
return context.json({ error: "The preview request body is not JSON." }, 400);
|
|
53
|
+
}
|
|
54
|
+
if (request === null || typeof request !== "object" || typeof request.appPath !== "string" || typeof request.storyPath !== "string" || typeof request.storyExport !== "string" || request.darkMode !== void 0 && typeof request.darkMode !== "boolean") return context.json({ error: "A preview requires appPath, storyPath, and an exact storyExport." }, 400);
|
|
55
|
+
try {
|
|
56
|
+
return context.json(await previews.build(request));
|
|
57
|
+
} catch (reason) {
|
|
58
|
+
return context.json({ error: reason instanceof Error ? reason.message : "Unable to build the story preview." }, 400);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
app.post(apiRoutes_default.image.path, async (context) => {
|
|
62
|
+
let request;
|
|
63
|
+
try {
|
|
64
|
+
request = await context.req.json();
|
|
65
|
+
} catch {
|
|
66
|
+
return context.json({ error: "The image request body is not JSON." }, 400);
|
|
67
|
+
}
|
|
68
|
+
if (request === null || typeof request !== "object" || typeof request.appPath !== "string" || typeof request.storyPath !== "string" || typeof request.storyExport !== "string" || request.darkMode !== void 0 && typeof request.darkMode !== "boolean") return context.json({ error: "An image export requires appPath, storyPath, and an exact storyExport." }, 400);
|
|
69
|
+
try {
|
|
70
|
+
return context.json(await previews.exportImage(request));
|
|
71
|
+
} catch (reason) {
|
|
72
|
+
return context.json({ error: reason instanceof Error ? reason.message : "Unable to export the story image." }, 400);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
app.delete(apiRoutes_default.dispose.path, async (context) => {
|
|
76
|
+
let request;
|
|
77
|
+
try {
|
|
78
|
+
request = await context.req.json();
|
|
79
|
+
} catch {
|
|
80
|
+
return context.json({ error: "The dispose request body is not JSON." }, 400);
|
|
81
|
+
}
|
|
82
|
+
if (request === null || typeof request !== "object" || typeof request.handle !== "string") return context.json({ error: "A preview handle is required." }, 400);
|
|
83
|
+
return context.json({ disposed: await previews.dispose(request.handle) });
|
|
84
|
+
});
|
|
85
|
+
return app;
|
|
86
|
+
}
|
|
87
|
+
const api = {
|
|
88
|
+
basePath: "style-system-preview",
|
|
89
|
+
start(context) {
|
|
90
|
+
if (context.workspaceRoot === void 0) throw new Error("Style-system preview requires a workspace-scoped session.");
|
|
91
|
+
const service = new StoryPreviewService(context.workspaceRoot);
|
|
92
|
+
const previews = createPreviewApi(context.workspaceRoot, service);
|
|
93
|
+
return {
|
|
94
|
+
fetch: (request) => previews.fetch(request),
|
|
95
|
+
close: () => service.disposeAll()
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
101
|
+
var root_server_default = defineRoot(() => ({ value: { api: [api] } }));
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/extensions/workspaces/sessions/(backend)/api/style-system-preview/route.server.ts
|
|
104
|
+
var route_server_default = defineRoute((context) => context.root.api[0]);
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region generated/server.ts
|
|
107
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
108
|
+
const facet = defineServerPlugin({
|
|
109
|
+
name: "@agimon-ai/doompi-style-system",
|
|
110
|
+
session: async (context) => {
|
|
111
|
+
const scopeSession = await root_server_default(context);
|
|
112
|
+
const contextSession = {
|
|
113
|
+
...context,
|
|
114
|
+
root: scopeSession.value
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
...composeRootHooks(scopeSession),
|
|
118
|
+
get api() {
|
|
119
|
+
return [at(route_server_default, contextSession)];
|
|
120
|
+
},
|
|
121
|
+
services: [...scopeSession.services ?? []],
|
|
122
|
+
get activities() {
|
|
123
|
+
return [...scopeSession.activities ?? []];
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
//#endregion
|
|
129
|
+
export { facet as default, facet };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["routes","rootSession","apiRoute"],"sources":["../../src/types/apiRoutes.ts","../../src/services/previewApi/index.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/style-system-preview/route.server.ts","../../generated/server.ts"],"sourcesContent":["import { apiResponse, defineApiRoutes } from '@agimon-ai/doompi-core/web';\n\nimport type {\n BuildStoryPreviewView,\n DisposeStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataView,\n} from './previewApi';\n\nexport default defineApiRoutes({\n metadata: {\n method: 'POST',\n path: '/metadata',\n response: apiResponse<StoryPreviewMetadataView>(),\n },\n build: {\n method: 'POST',\n path: '/build',\n response: apiResponse<BuildStoryPreviewView>(),\n },\n image: {\n method: 'POST',\n path: '/image',\n response: apiResponse<ExportStoryPreviewImageView>(),\n },\n dispose: {\n method: 'DELETE',\n path: '/artifact',\n response: apiResponse<DisposeStoryPreviewView>(),\n },\n});\n","import type { DoomApi, DoomApiContext, DoomApiHandler } from '@agimon-ai/doompi-core/packageApi';\nimport { Hono } from 'hono';\n\nimport routes from '../../types/apiRoutes';\nimport type {\n BuildStoryPreviewRequest,\n DisposeStoryPreviewRequest,\n ExportStoryPreviewImageRequest,\n StoryPreviewMetadataRequest,\n} from '../../types/previewApi';\nimport { StoryPreviewService } from '../storyPreview';\n\nexport function createPreviewApi(workspaceRoot: string, previews = new StoryPreviewService(workspaceRoot)): Hono {\n const app = new Hono();\n\n app.post(routes.metadata.path, async (context) => {\n let request: StoryPreviewMetadataRequest;\n try {\n request = (await context.req.json()) as StoryPreviewMetadataRequest;\n } catch {\n return context.json({ error: 'The story metadata request body is not JSON.' }, 400);\n }\n if (\n request === null ||\n typeof request !== 'object' ||\n typeof request.storyPath !== 'string' ||\n (request.appPath !== undefined && typeof request.appPath !== 'string')\n ) {\n return context.json({ error: 'Story metadata requires a storyPath.' }, 400);\n }\n try {\n return context.json(await previews.metadata(request));\n } catch (reason) {\n return context.json({ error: reason instanceof Error ? reason.message : 'Unable to read story metadata.' }, 400);\n }\n });\n\n app.post(routes.build.path, async (context) => {\n let request: BuildStoryPreviewRequest;\n try {\n request = (await context.req.json()) as BuildStoryPreviewRequest;\n } catch {\n return context.json({ error: 'The preview request body is not JSON.' }, 400);\n }\n if (\n request === null ||\n typeof request !== 'object' ||\n typeof request.appPath !== 'string' ||\n typeof request.storyPath !== 'string' ||\n typeof request.storyExport !== 'string' ||\n (request.darkMode !== undefined && typeof request.darkMode !== 'boolean')\n ) {\n return context.json({ error: 'A preview requires appPath, storyPath, and an exact storyExport.' }, 400);\n }\n try {\n return context.json(await previews.build(request));\n } catch (reason) {\n return context.json(\n { error: reason instanceof Error ? reason.message : 'Unable to build the story preview.' },\n 400,\n );\n }\n });\n\n app.post(routes.image.path, async (context) => {\n let request: ExportStoryPreviewImageRequest;\n try {\n request = (await context.req.json()) as ExportStoryPreviewImageRequest;\n } catch {\n return context.json({ error: 'The image request body is not JSON.' }, 400);\n }\n if (\n request === null ||\n typeof request !== 'object' ||\n typeof request.appPath !== 'string' ||\n typeof request.storyPath !== 'string' ||\n typeof request.storyExport !== 'string' ||\n (request.darkMode !== undefined && typeof request.darkMode !== 'boolean')\n ) {\n return context.json({ error: 'An image export requires appPath, storyPath, and an exact storyExport.' }, 400);\n }\n try {\n return context.json(await previews.exportImage(request));\n } catch (reason) {\n return context.json(\n { error: reason instanceof Error ? reason.message : 'Unable to export the story image.' },\n 400,\n );\n }\n });\n\n app.delete(routes.dispose.path, async (context) => {\n let request: DisposeStoryPreviewRequest;\n try {\n request = (await context.req.json()) as DisposeStoryPreviewRequest;\n } catch {\n return context.json({ error: 'The dispose request body is not JSON.' }, 400);\n }\n if (request === null || typeof request !== 'object' || typeof request.handle !== 'string') {\n return context.json({ error: 'A preview handle is required.' }, 400);\n }\n return context.json({ disposed: await previews.dispose(request.handle) });\n });\n\n return app;\n}\n\nexport const api: DoomApi = {\n basePath: 'style-system-preview',\n start(context: DoomApiContext): DoomApiHandler {\n if (context.workspaceRoot === undefined)\n throw new Error('Style-system preview requires a workspace-scoped session.');\n const service = new StoryPreviewService(context.workspaceRoot);\n const previews = createPreviewApi(context.workspaceRoot, service);\n return { fetch: (request) => previews.fetch(request), close: () => service.disposeAll() };\n },\n};\n","import { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\n\nimport { api } from '../../../../services/previewApi';\n\nexport default defineRoot(() => ({ value: { api: [api] } }));\n","import { defineRoute, type WithRoot } from '@agimon-ai/doompi-core/extensionFile';\n\ntype Root = Awaited<ReturnType<typeof import('../../root.server').default>>['value'];\n\nexport default defineRoute((context: WithRoot<unknown, Root>) => context.root.api[0]);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/style-system-preview/route.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-style-system',\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;AASA,IAAA,oBAAe,gBAAgB;CAC7B,UAAU;EACR,QAAQ;EACR,MAAM;EACN,UAAU,YAAsC;CAClD;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,UAAU,YAAmC;CAC/C;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,UAAU,YAAyC;CACrD;CACA,SAAS;EACP,QAAQ;EACR,MAAM;EACN,UAAU,YAAqC;CACjD;AACF,CAAC;;;AClBD,SAAgB,iBAAiB,eAAuB,WAAW,IAAI,oBAAoB,aAAa,GAAS;CAC/G,MAAM,MAAM,IAAI,KAAK;CAErB,IAAI,KAAKA,kBAAO,SAAS,MAAM,OAAO,YAAY;EAChD,IAAI;EACJ,IAAI;GACF,UAAW,MAAM,QAAQ,IAAI,KAAK;EACpC,QAAQ;GACN,OAAO,QAAQ,KAAK,EAAE,OAAO,+CAA+C,GAAG,GAAG;EACpF;EACA,IACE,YAAY,QACZ,OAAO,YAAY,YACnB,OAAO,QAAQ,cAAc,YAC5B,QAAQ,YAAY,KAAA,KAAa,OAAO,QAAQ,YAAY,UAE7D,OAAO,QAAQ,KAAK,EAAE,OAAO,uCAAuC,GAAG,GAAG;EAE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