@lexicallayer/cli 0.1.4 → 0.1.6
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/bin/index.js +48 -2
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -95,8 +95,54 @@ async function calibrate() {
|
|
|
95
95
|
const verifyRes = await requestJSON(`${ENGINE_BASE_URL}/api/session/verify/${sessionId}`);
|
|
96
96
|
if (verifyRes?.session?.approved) {
|
|
97
97
|
approved = true;
|
|
98
|
+
const adapterFile = verifyRes.session.adapter_filename || "user_steered_rank16.safetensors";
|
|
98
99
|
log("\n\x1b[32m✓ Başarılı! Kullanıcı Studio üzerinden ağırlıkları onayladı ve kilitledi.\x1b[0m");
|
|
99
|
-
log(`Bağlanan Adaptör: \x1b[36m${
|
|
100
|
+
log(`Bağlanan Adaptör: \x1b[36m${adapterFile}\x1b[0m`);
|
|
101
|
+
|
|
102
|
+
// Generate a ready-to-use Agent Layer file directly in the developer's project
|
|
103
|
+
const fs = require("fs");
|
|
104
|
+
const path = require("path");
|
|
105
|
+
const os = require("os");
|
|
106
|
+
|
|
107
|
+
let targetDir = path.join(process.cwd(), ".lexicallayer");
|
|
108
|
+
try {
|
|
109
|
+
if (!fs.existsSync(targetDir)) {
|
|
110
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
111
|
+
}
|
|
112
|
+
} catch {
|
|
113
|
+
// If running in System32 or restricted directory, fallback to user home directory
|
|
114
|
+
targetDir = path.join(os.homedir(), ".lexicallayer");
|
|
115
|
+
if (!fs.existsSync(targetDir)) {
|
|
116
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const agentLayerCode = `// Otomatik Üretilen LexicalLayer Agent Katmanı
|
|
121
|
+
const { LexicalLayer } = require("@lexicallayer/sdk");
|
|
122
|
+
|
|
123
|
+
const layer = new LexicalLayer({
|
|
124
|
+
agentName: "${sessionPayload.agent_name}",
|
|
125
|
+
adapterFile: "${adapterFile}"
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Bu fonksiyonu agent'ınızın OpenAI/Claude/LangChain client'ına sarın:
|
|
130
|
+
* const steeredOpenAI = wrapAgentWithUserStyle(openai);
|
|
131
|
+
*/
|
|
132
|
+
function wrapAgentWithUserStyle(agentClient) {
|
|
133
|
+
return layer.wrapOpenAI(agentClient);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = { layer, wrapAgentWithUserStyle };
|
|
137
|
+
`;
|
|
138
|
+
const layerFilePath = path.join(targetDir, "layer.js");
|
|
139
|
+
fs.writeFileSync(layerFilePath, agentLayerCode, "utf-8");
|
|
140
|
+
|
|
141
|
+
console.log(`\n\x1b[35m[LexicalLayer Entegrasyonu Tamamlandı]\x1b[0m`);
|
|
142
|
+
console.log(`📂 Agent Katman Dosyanız Hazırlandı: \x1b[33m${layerFilePath}\x1b[0m`);
|
|
143
|
+
console.log(`\n\x1b[32mAgent Kodunuzda Kullanmak İçin Tek Satır:\x1b[0m`);
|
|
144
|
+
console.log(`\x1b[36mconst { wrapAgentWithUserStyle } = require("${layerFilePath.replace(/\\/g, "/")}");\x1b[0m`);
|
|
145
|
+
console.log(`\x1b[36mconst myAgent = wrapAgentWithUserStyle(openai);\x1b[0m\n`);
|
|
100
146
|
log("\x1b[32mAgent'ınız artık kullanıcının özgün üslubu ve ağırlıkları ile çalışmaya hazır!\x1b[0m");
|
|
101
147
|
process.exit(0);
|
|
102
148
|
}
|
|
@@ -158,7 +204,7 @@ if (command === "calibrate") {
|
|
|
158
204
|
} else if (command === "chat") {
|
|
159
205
|
startChat();
|
|
160
206
|
} else if (command === "--version" || command === "-v") {
|
|
161
|
-
console.log("0.1.
|
|
207
|
+
console.log("0.1.6");
|
|
162
208
|
} else {
|
|
163
209
|
console.log(`
|
|
164
210
|
LexicalLayer CLI
|