forked from nexu-io/open-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreasonix.ts
More file actions
76 lines (66 loc) · 2.76 KB
/
Copy pathreasonix.ts
File metadata and controls
76 lines (66 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os from 'node:os';
import path from 'node:path';
import { detectAcpModels, DEFAULT_MODEL_OPTION } from './shared.js';
import type { RuntimeAgentDef } from '../types.js';
// Design instructions injected into Reasonix's ACP system prompt via
// REASONIX_ACP_SYSTEM_APPEND. This ensures the model follows OpenDesign's
// design workflow (artifact output, design system, skill instructions)
// instead of treating every request as a pure coding task.
const DESIGN_INSTRUCTIONS = `# OpenDesign integration — MUST follow
You are running inside OpenDesign, a design tool. The user message contains
design context (system prompt, skill instructions, design system tokens).
Follow these rules:
1. **Output format**: Wrap your HTML output in <artifact> tags:
<artifact>
<!DOCTYPE html>
<html>...</html>
</artifact>
2. **Design system**: The user message includes a design system with colors,
typography, spacing, and component patterns. Apply them consistently.
3. **Skill workflow**: The user message includes a skill (SKILL.md) with
specific workflow instructions. Follow the skill's steps in order.
4. **No code fences**: Do NOT wrap HTML in \`\`\`html code fences.
Output raw HTML inside <artifact> tags only.
5. **Single file**: Output a complete, self-contained HTML file with all
CSS and JS inline. No external dependencies.
6. **Language**: Match the language of the user's prompt.`;
/** Resolve Reasonix's home directory, respecting REASONIX_HOME if already set. */
function reasonixHome(): string {
if (process.env.REASONIX_HOME) return process.env.REASONIX_HOME;
if (process.platform === 'win32') {
const appData = process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming');
return path.join(appData, 'reasonix');
}
return path.join(os.homedir(), '.reasonix');
}
export const reasonixAgentDef = {
id: 'reasonix',
name: 'DeepSeek Reasonix',
bin: 'reasonix',
fallbackBins: ['dsnix'],
versionArgs: ['--version'],
fetchModels: async (resolvedBin, env) =>
detectAcpModels({
bin: resolvedBin,
args: ['acp'],
env,
timeoutMs: 15_000,
defaultModelOption: DEFAULT_MODEL_OPTION,
}),
buildArgs: () => ['acp'],
streamFormat: 'acp-json-rpc',
mcpDiscovery: 'mature-acp',
externalMcpInjection: 'acp-merge',
acpMcpEnvFormat: 'map',
env: {
REASONIX_ACP_SYSTEM_APPEND: DESIGN_INSTRUCTIONS,
REASONIX_HOME: reasonixHome(),
},
fallbackModels: [
DEFAULT_MODEL_OPTION,
{ id: 'deepseek-v4-pro', label: 'deepseek-v4-pro' },
{ id: 'deepseek-v4-flash', label: 'deepseek-v4-flash' },
],
installUrl: 'https://github.com/esengine/DeepSeek-Reasonix',
docsUrl: 'https://esengine.github.io/DeepSeek-Reasonix/',
} satisfies RuntimeAgentDef;