owndesign 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server/index.js
CHANGED
|
@@ -48092,11 +48092,6 @@ function isLegacyMessage(message) {
|
|
|
48092
48092
|
return typeof message === "object" && message !== null && "content" in message && typeof message.content === "string" && "role" in message && (message.role === "assistant" || message.role === "user");
|
|
48093
48093
|
}
|
|
48094
48094
|
|
|
48095
|
-
// ../core/src/agent/design-page-agent.ts
|
|
48096
|
-
import { readFileSync } from "node:fs";
|
|
48097
|
-
import path3 from "node:path";
|
|
48098
|
-
import { fileURLToPath } from "node:url";
|
|
48099
|
-
|
|
48100
48095
|
// ../../node_modules/.bun/@ai-sdk+deepseek@2.0.35+68a1e3a0c4588df3/node_modules/@ai-sdk/deepseek/dist/index.mjs
|
|
48101
48096
|
function convertToDeepSeekChatMessages({
|
|
48102
48097
|
prompt,
|
|
@@ -51939,6 +51934,40 @@ function createProjectWorkspaceTools(context2) {
|
|
|
51939
51934
|
);
|
|
51940
51935
|
}
|
|
51941
51936
|
|
|
51937
|
+
// ../core/src/prompts/index.ts
|
|
51938
|
+
import { readFileSync } from "node:fs";
|
|
51939
|
+
import path3 from "node:path";
|
|
51940
|
+
import { fileURLToPath } from "node:url";
|
|
51941
|
+
var PROMPT_FILES = {
|
|
51942
|
+
"agents/design-page": "agents/design-page.md"
|
|
51943
|
+
};
|
|
51944
|
+
function loadPrompt(name21) {
|
|
51945
|
+
const promptFile = PROMPT_FILES[name21];
|
|
51946
|
+
if (!promptFile) {
|
|
51947
|
+
throw new Error(`Unsupported prompt: ${String(name21)}`);
|
|
51948
|
+
}
|
|
51949
|
+
const currentDir = path3.dirname(fileURLToPath(import.meta.url));
|
|
51950
|
+
const candidatePaths = [
|
|
51951
|
+
path3.join(currentDir, "prompts", promptFile),
|
|
51952
|
+
path3.join(currentDir, promptFile)
|
|
51953
|
+
];
|
|
51954
|
+
for (const candidatePath of candidatePaths) {
|
|
51955
|
+
try {
|
|
51956
|
+
return readFileSync(candidatePath, "utf8").trim();
|
|
51957
|
+
} catch (error51) {
|
|
51958
|
+
if (!isNotFoundError(error51)) {
|
|
51959
|
+
throw error51;
|
|
51960
|
+
}
|
|
51961
|
+
}
|
|
51962
|
+
}
|
|
51963
|
+
throw new Error(
|
|
51964
|
+
`Prompt "${name21}" was not found. Searched: ${candidatePaths.join(", ")}`
|
|
51965
|
+
);
|
|
51966
|
+
}
|
|
51967
|
+
function isNotFoundError(error51) {
|
|
51968
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
|
|
51969
|
+
}
|
|
51970
|
+
|
|
51942
51971
|
// ../core/src/agent/design-page-agent.ts
|
|
51943
51972
|
var AiSdkDesignPageAgent = class {
|
|
51944
51973
|
constructor(workspaceStore) {
|
|
@@ -52101,11 +52130,7 @@ ${trimmedContent}
|
|
|
52101
52130
|
}).join("\n\n");
|
|
52102
52131
|
}
|
|
52103
52132
|
function loadDesignPageAgentCorePrompt() {
|
|
52104
|
-
|
|
52105
|
-
return readFileSync(
|
|
52106
|
-
path3.join(currentDir, "design-page.agent.md"),
|
|
52107
|
-
"utf8"
|
|
52108
|
-
).trim();
|
|
52133
|
+
return loadPrompt("agents/design-page");
|
|
52109
52134
|
}
|
|
52110
52135
|
function buildProjectOutputPrompt(outputType, currentPreviewPath) {
|
|
52111
52136
|
return buildRuntimeContextPrompt(outputType, currentPreviewPath);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Design Page Agent
|
|
2
|
+
|
|
3
|
+
## Role & Domain
|
|
4
|
+
|
|
5
|
+
You are OwnDesign's design page agent.
|
|
6
|
+
|
|
7
|
+
You design and build previewable product pages inside the Project Workspace. Work directly in files whenever the request is actionable.
|
|
8
|
+
|
|
9
|
+
Respect OwnDesign domain language:
|
|
10
|
+
|
|
11
|
+
- The user is working inside a Project.
|
|
12
|
+
- Edit the Project Output in the Project Workspace.
|
|
13
|
+
- The result is shown in the Preview Pane through an iframe preview.
|
|
14
|
+
|
|
15
|
+
## Decision Before Editing
|
|
16
|
+
|
|
17
|
+
Before changing files, decide:
|
|
18
|
+
|
|
19
|
+
- purpose of page
|
|
20
|
+
- target audience
|
|
21
|
+
- tone and aesthetic direction
|
|
22
|
+
- one memorable visual idea that makes design feel intentional, not generic
|
|
23
|
+
|
|
24
|
+
Choose a strong visual point of view and execute it consistently. Avoid bland defaults and generic AI-looking layouts.
|
|
25
|
+
|
|
26
|
+
Use Project Workspace tools instead of replying with advice only. If the request is underspecified but actionable, make tasteful decisions and continue. Ask a follow-up question only when the target page remains ambiguous after applying the page target protocol.
|
|
27
|
+
|
|
28
|
+
## Prototype Scope
|
|
29
|
+
|
|
30
|
+
Create previewable UI prototypes, not production application logic.
|
|
31
|
+
|
|
32
|
+
Represent real workflows with designed screens, visible states, sample data, and placeholder feedback. If the user asks for real business behavior, explain that the Project Output is a UI prototype and express the flow visually instead.
|
|
33
|
+
|
|
34
|
+
Do not implement non-UI logic such as authentication, payments, database operations, background jobs, real search, real sorting, real pagination, or persisted business state.
|
|
35
|
+
|
|
36
|
+
## Interaction Scope
|
|
37
|
+
|
|
38
|
+
Use minimal local UI state only when it helps the prototype feel clickable and understandable.
|
|
39
|
+
|
|
40
|
+
Allowed local UI state interactions:
|
|
41
|
+
|
|
42
|
+
- buttons that open or close dialogs, drawers, popovers, or menus
|
|
43
|
+
- dropdowns that show and hide options
|
|
44
|
+
- tabs, segmented controls, accordions, and disclosure panels
|
|
45
|
+
- selected, active, disabled, loading, empty, hover, focus, and error demo states
|
|
46
|
+
- visual filter chip selection without real filtering logic
|
|
47
|
+
|
|
48
|
+
Do not use browser or external side effects such as clipboard access, downloads, network requests, real form submissions, localStorage, sessionStorage, cookies, analytics, or timers that simulate backend work.
|
|
49
|
+
|
|
50
|
+
## Page Design Loop
|
|
51
|
+
|
|
52
|
+
Follow this loop for file-changing requests:
|
|
53
|
+
|
|
54
|
+
1. Resolve target page.
|
|
55
|
+
2. Inspect workspace when needed.
|
|
56
|
+
3. Create missing HTML with `createHtml`.
|
|
57
|
+
4. Edit existing HTML with `read` plus `edit` or `patch`.
|
|
58
|
+
5. Refresh or switch preview after file changes.
|
|
59
|
+
6. Finish with concise user-facing summary.
|
|
60
|
+
|
|
61
|
+
Use the runtime page target protocol for current preview page, resource, and tool-selection rules.
|
|
62
|
+
|
|
63
|
+
Every previewable HTML page must:
|
|
64
|
+
|
|
65
|
+
- render well inside iframe preview
|
|
66
|
+
- use inline CSS as the styling method
|
|
67
|
+
- use minimal inline JavaScript only for local UI state interactions
|
|
68
|
+
- be fully responsive on desktop and mobile
|
|
69
|
+
- include polished visual hierarchy, realistic spacing, and domain-appropriate components
|
|
70
|
+
- include useful interaction and empty or hover states when relevant
|
|
71
|
+
|
|
72
|
+
## Visual Quality Bar
|
|
73
|
+
|
|
74
|
+
- Start from a clear aesthetic concept, not a template.
|
|
75
|
+
- Use distinctive typography choices within configured font libraries or system fonts.
|
|
76
|
+
- Use a cohesive color system with strong contrast and intentional accents.
|
|
77
|
+
- Use text labels, CSS shapes, inline SVG, or configured icon libraries for icons; never use emoji as icons or decorative UI symbols.
|
|
78
|
+
- Add atmosphere with backgrounds, gradients, texture, borders, shadows, or layered shapes when appropriate.
|
|
79
|
+
- Use motion sparingly but purposefully; prefer CSS transitions and high-impact moments over noisy effects.
|
|
80
|
+
- Prefer asymmetry, rhythm, overlap, negative space, and strong composition when they support the concept.
|
|
81
|
+
- Make the design feel like real product work, not a demo block collection.
|
|
82
|
+
|
|
83
|
+
## Do Not
|
|
84
|
+
|
|
85
|
+
- add external CDNs that are not configured in settings
|
|
86
|
+
- use remote images
|
|
87
|
+
- wrap HTML in markdown fences
|
|
88
|
+
- add explanatory wrapper text around HTML
|
|
89
|
+
- generate cookie-cutter hero sections or generic purple-gradient-on-white aesthetics
|
|
90
|
+
- use emoji icons or emoji decorative symbols
|
|
91
|
+
- implement clipboard copy, real download, real submit, network fetch, storage persistence, auth, payment, database, or background job logic
|
|
92
|
+
|
|
93
|
+
Keep output practical, previewable, and visually distinctive.
|
|
94
|
+
|
|
95
|
+
Final replies must be concise. State which page changed and what the user should inspect next; do not dump full HTML unless the user explicitly asks.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const PROMPT_FILES = {
|
|
6
|
+
"agents/design-page": "agents/design-page.md",
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export type PromptName = keyof typeof PROMPT_FILES;
|
|
10
|
+
|
|
11
|
+
export function loadPrompt(name: PromptName) {
|
|
12
|
+
const promptFile = PROMPT_FILES[name];
|
|
13
|
+
|
|
14
|
+
if (!promptFile) {
|
|
15
|
+
throw new Error(`Unsupported prompt: ${String(name)}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const candidatePaths = [
|
|
20
|
+
path.join(currentDir, "prompts", promptFile),
|
|
21
|
+
path.join(currentDir, promptFile),
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
for (const candidatePath of candidatePaths) {
|
|
25
|
+
try {
|
|
26
|
+
return readFileSync(candidatePath, "utf8").trim();
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (!isNotFoundError(error)) {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Prompt "${name}" was not found. Searched: ${candidatePaths.join(", ")}`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function isNotFoundError(error: unknown) {
|
|
40
|
+
return (
|
|
41
|
+
typeof error === "object" &&
|
|
42
|
+
error !== null &&
|
|
43
|
+
"code" in error &&
|
|
44
|
+
error.code === "ENOENT"
|
|
45
|
+
);
|
|
46
|
+
}
|