@takimcizgisi/ajan 0.2.5 → 0.3.0

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.

Potentially problematic release.


This version of @takimcizgisi/ajan might be problematic. Click here for more details.

Files changed (71) hide show
  1. package/LICENSE +227 -674
  2. package/README.md +243 -305
  3. package/ajan-logo.txt +2 -0
  4. package/dist/config/configManager.js +122 -19
  5. package/dist/config/types.d.ts +37 -0
  6. package/dist/core/agent.d.ts +1 -1
  7. package/dist/core/agent.js +25 -4
  8. package/dist/discord/presence.d.ts +65 -0
  9. package/dist/discord/presence.js +401 -0
  10. package/dist/engine/llama.d.ts +5 -0
  11. package/dist/engine/llama.js +19 -5
  12. package/dist/engine/modelManager.d.ts +0 -1
  13. package/dist/engine/modelManager.js +0 -8
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +1 -0
  16. package/dist/service.js +0 -1
  17. package/dist/tools/playground.d.ts +4 -0
  18. package/dist/tools/playground.js +125 -0
  19. package/dist/tools/registry.d.ts +0 -1
  20. package/dist/tools/registry.js +5 -4
  21. package/dist/tools/taskComplete.js +16 -4
  22. package/dist/tools/terminal.js +12 -12
  23. package/dist/utils/paths.d.ts +1 -0
  24. package/dist/utils/paths.js +29 -11
  25. package/package.json +78 -106
  26. package/scripts/build-vscode.mjs +28 -0
  27. package/scripts/ensure-tgz.mjs +27 -0
  28. package/scripts/install-vscode.mjs +236 -0
  29. package/scripts/release.mjs +19 -0
  30. package/scripts/smoke-new-tools.ts +79 -0
  31. package/scripts/smoke-tools.ts +201 -0
  32. package/src/vscode/LICENSE +674 -0
  33. package/src/vscode/README.md +54 -0
  34. package/src/vscode/media/assets/Anton.ttf +0 -0
  35. package/src/vscode/media/chat.js +634 -0
  36. package/src/vscode/media/style.css +767 -0
  37. package/src/vscode/out/extension.js +598 -0
  38. package/src/vscode/package.json +243 -0
  39. package/dist/cli/index.d.ts +0 -2
  40. package/dist/cli/index.js +0 -741
  41. package/dist/cli/tui.d.ts +0 -145
  42. package/dist/cli/tui.js +0 -1003
  43. package/dist/electron/main.d.ts +0 -1
  44. package/dist/electron/main.js +0 -364
  45. package/dist/electron/preload.d.ts +0 -1
  46. package/dist/electron/preload.js +0 -67
  47. package/dist/utils/clipboard.d.ts +0 -2
  48. package/dist/utils/clipboard.js +0 -40
  49. package/dist/utils/lock.d.ts +0 -12
  50. package/dist/utils/lock.js +0 -68
  51. package/dist/utils/sacGuard.d.ts +0 -4
  52. package/dist/utils/sacGuard.js +0 -47
  53. package/dist/utils/spinner.d.ts +0 -10
  54. package/dist/utils/spinner.js +0 -32
  55. package/src/gui/assets/image/logo.svg +0 -1
  56. package/src/gui/assets/image/opencode.svg +0 -18
  57. package/src/gui/css/style.css +0 -430
  58. package/src/gui/html/chat.html +0 -34
  59. package/src/gui/html/downloads.html +0 -11
  60. package/src/gui/html/hakkinda.html +0 -26
  61. package/src/gui/html/index.html +0 -82
  62. package/src/gui/html/projects.html +0 -12
  63. package/src/gui/html/settings.html +0 -4
  64. package/src/gui/js/app.js +0 -197
  65. package/src/gui/js/chat.js +0 -434
  66. package/src/gui/js/downloads.js +0 -172
  67. package/src/gui/js/hakkinda.js +0 -16
  68. package/src/gui/js/projects.js +0 -113
  69. package/src/gui/js/settings.js +0 -177
  70. /package/src/{gui/assets/image → vscode/media/assets}/AJAN_LOGO.svg +0 -0
  71. /package/src/{gui/assets/image → vscode/media/assets}/ajan.png +0 -0
@@ -1 +0,0 @@
1
- export {};
@@ -1,364 +0,0 @@
1
- import { app, BrowserWindow, ipcMain, shell } from "electron";
2
- import { join, dirname } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { readFileSync, existsSync, mkdirSync } from "node:fs";
5
- import { execSync } from "node:child_process";
6
- import { homedir } from "node:os";
7
- import { AjanService } from "../service.js";
8
- import { getDataDir } from "../utils/paths.js";
9
- import { acquireLock, releaseLock } from "../utils/lock.js";
10
- const isDev = process.argv.includes("--dev");
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = dirname(__filename);
13
- let mainWindow = null;
14
- let service = null;
15
- let isMaximized = false;
16
- function getVersion() {
17
- try {
18
- const pkg = JSON.parse(readFileSync(join(__dirname, "..", "..", "package.json"), "utf8"));
19
- return pkg.version ?? "0.0.0";
20
- }
21
- catch {
22
- return "0.0.0";
23
- }
24
- }
25
- function getGuiPath() {
26
- return join(__dirname, "..", "..", "src", "gui");
27
- }
28
- function createService() {
29
- if (service)
30
- return;
31
- service = new AjanService({
32
- onTextChunk: (text) => mainWindow?.webContents.send("agent:text-chunk", text),
33
- onThinkingChunk: (text) => mainWindow?.webContents.send("agent:thinking-chunk", text),
34
- onToolCall: (name, params) => mainWindow?.webContents.send("agent:tool-call", name, params),
35
- onToolResult: (name, ok, output) => mainWindow?.webContents.send("agent:tool-result", name, ok, output),
36
- onStepStart: (step, maxSteps) => mainWindow?.webContents.send("agent:step-start", step, maxSteps),
37
- onComplete: (response) => mainWindow?.webContents.send("agent:complete", response),
38
- onError: (error) => mainWindow?.webContents.send("agent:error", error.message),
39
- onContextTrimmed: () => { },
40
- onModelLoadProgress: (pct) => mainWindow?.webContents.send("agent:load-progress", pct),
41
- onModelLoadComplete: () => mainWindow?.webContents.send("agent:load-complete")
42
- });
43
- }
44
- function createWindow() {
45
- mainWindow = new BrowserWindow({
46
- width: 1200,
47
- height: 800,
48
- minWidth: 800,
49
- minHeight: 600,
50
- frame: false,
51
- titleBarStyle: "hidden",
52
- backgroundColor: "#202020",
53
- webPreferences: {
54
- preload: join(__dirname, "preload.js"),
55
- contextIsolation: true,
56
- nodeIntegration: false,
57
- sandbox: false
58
- },
59
- icon: join(getGuiPath(), "assets", "image", "ajan.png"),
60
- title: `AJAN AI v${getVersion()}`
61
- });
62
- mainWindow.loadFile(join(getGuiPath(), "html", "index.html"));
63
- if (isDev) {
64
- mainWindow.webContents.openDevTools({ mode: "detach" });
65
- }
66
- mainWindow.on("closed", () => {
67
- mainWindow = null;
68
- });
69
- mainWindow.on("maximize", () => {
70
- isMaximized = true;
71
- mainWindow?.webContents.send("window:maximized-changed", true);
72
- });
73
- mainWindow.on("unmaximize", () => {
74
- isMaximized = false;
75
- mainWindow?.webContents.send("window:maximized-changed", false);
76
- });
77
- mainWindow.webContents.on("did-finish-load", () => {
78
- if (mainWindow?.isMaximized()) {
79
- isMaximized = true;
80
- mainWindow.webContents.send("window:maximized-changed", true);
81
- }
82
- restoreLastSession();
83
- });
84
- mainWindow.webContents.on("console-message", (_event, level, message, line, sourceId) => {
85
- const line2 = `[renderer:${level}] ${sourceId}:${line} ${message}\n`;
86
- console.log(line2.trimEnd());
87
- try {
88
- const fsmod = require("node:fs");
89
- fsmod.appendFileSync(require("node:path").join(require("node:os").homedir(), ".ajan", "renderer.log"), line2);
90
- }
91
- catch { /* empty */ }
92
- });
93
- mainWindow.webContents.on("preload-error", (_event, preloadPath, error) => {
94
- console.log(`[preload-error] ${preloadPath}: ${error.message}`);
95
- });
96
- mainWindow.webContents.setWindowOpenHandler(({ url }) => {
97
- shell.openExternal(url);
98
- return { action: "deny" };
99
- });
100
- }
101
- async function restoreLastSession() {
102
- try {
103
- if (!service)
104
- return;
105
- const sessions = await service.listSessions();
106
- const last = sessions[0];
107
- if (!last)
108
- return;
109
- mainWindow?.webContents.send("agent:session-restore", {
110
- id: last.id,
111
- title: last.title,
112
- messages: last.messages,
113
- createdAt: last.createdAt,
114
- updatedAt: last.updatedAt
115
- });
116
- }
117
- catch { /* empty */ }
118
- }
119
- function setupIpc() {
120
- // Agent: send
121
- ipcMain.handle("agent:send", async (_event, message, modelId) => {
122
- if (!service)
123
- return { ok: false, error: "Servis başlatılamadı" };
124
- return await service.sendMessage(message, modelId || undefined);
125
- });
126
- // Agent: abort
127
- ipcMain.handle("agent:abort", () => {
128
- service?.abort();
129
- return { ok: true };
130
- });
131
- // Agent: reset
132
- ipcMain.handle("agent:reset", () => {
133
- service?.reset();
134
- return { ok: true };
135
- });
136
- // Agent: status
137
- ipcMain.handle("agent:status", () => {
138
- return { active: service?.isActive ?? false, contextStats: service?.getContextStats() ?? null };
139
- });
140
- // Config
141
- ipcMain.handle("app:version", () => getVersion());
142
- ipcMain.handle("config:get", () => {
143
- return service?.getConfig() ?? {};
144
- });
145
- ipcMain.handle("config:set", async (_event, newConfig) => {
146
- if (!service)
147
- return { ok: false, error: "Servis başlatılamadı" };
148
- await service.setConfig(newConfig);
149
- return { ok: true };
150
- });
151
- // Model
152
- ipcMain.handle("model:info", () => {
153
- return service?.getModelInfo() ?? { modelId: "", name: "Bilinmeyen", installed: false };
154
- });
155
- ipcMain.handle("model:list", () => {
156
- return service?.listModels() ?? [];
157
- });
158
- ipcMain.handle("model:install", async (_event, id) => {
159
- if (!service)
160
- return { ok: false, error: "Servis başlatılamadı" };
161
- return await service.installModel(id);
162
- });
163
- ipcMain.handle("model:remove", async (_event, id) => {
164
- if (!service)
165
- return { ok: false, error: "Servis başlatılamadı" };
166
- return await service.removeModel(id);
167
- });
168
- ipcMain.handle("model:use", async (_event, id) => {
169
- if (!service)
170
- return { ok: false, error: "Servis başlatılamadı" };
171
- return await service.useModel(id);
172
- });
173
- ipcMain.handle("model:refresh", async () => {
174
- if (!service)
175
- return { ok: false, error: "Servis başlatılamadı" };
176
- return await service.refreshModels();
177
- });
178
- // Project
179
- ipcMain.handle("project:list", () => {
180
- return service?.listProjects() ?? [];
181
- });
182
- ipcMain.handle("project:add", async (_event, path) => {
183
- if (!service)
184
- return { ok: false, error: "Servis başlatılamadı" };
185
- return await service.addProject(path);
186
- });
187
- ipcMain.handle("project:remove", async (_event, path) => {
188
- if (!service)
189
- return { ok: false, error: "Servis başlatılamadı" };
190
- return await service.removeProject(path);
191
- });
192
- ipcMain.handle("project:set-active", async (_event, path) => {
193
- if (!service)
194
- return { ok: false, error: "Servis başlatılamadı" };
195
- return await service.setActiveProject(path);
196
- });
197
- ipcMain.handle("project:pick-dir", async () => {
198
- const { dialog } = await import("electron");
199
- const result = await dialog.showOpenDialog(mainWindow, { properties: ["openDirectory"] });
200
- return result.canceled ? null : (result.filePaths[0] ?? null);
201
- });
202
- ipcMain.handle("project:exists", async (_event, path) => {
203
- try {
204
- const { statSync } = await import("node:fs");
205
- return statSync(path).isDirectory();
206
- }
207
- catch {
208
- return false;
209
- }
210
- });
211
- // Session
212
- ipcMain.handle("session:list", async () => {
213
- return service?.listSessions() ?? [];
214
- });
215
- ipcMain.handle("session:load", async (_event, id) => {
216
- if (!service)
217
- return { ok: false, error: "Servis başlatılamadı" };
218
- const data = await service.loadSession(id);
219
- if (!data)
220
- return { ok: false, error: "Oturum bulunamadı" };
221
- return { ok: true, data };
222
- });
223
- ipcMain.handle("session:save", async (_event, session) => {
224
- if (!service)
225
- return { ok: false, error: "Servis başlatılamadı" };
226
- await service.saveSession(session);
227
- return { ok: true };
228
- });
229
- ipcMain.handle("session:new", () => {
230
- service?.reset();
231
- return { ok: true };
232
- });
233
- ipcMain.handle("session:generate-id", () => {
234
- return service?.generateSessionId() ?? String(Date.now());
235
- });
236
- ipcMain.handle("session:get-history", () => {
237
- return service?.getChatHistory() ?? [];
238
- });
239
- // System
240
- ipcMain.handle("system:gpu", async () => {
241
- try {
242
- const gpus = await service?.detectGpu() ?? [];
243
- return { gpus };
244
- }
245
- catch {
246
- return { gpus: [] };
247
- }
248
- });
249
- ipcMain.handle("system:cwd", () => {
250
- return { cwd: process.cwd() };
251
- });
252
- ipcMain.handle("system:notes", async () => {
253
- const { readFileSync: readFs } = await import("node:fs");
254
- const notesPath = join(getDataDir(), "notes.json");
255
- try {
256
- return JSON.parse(readFs(notesPath, "utf8"));
257
- }
258
- catch {
259
- return [];
260
- }
261
- });
262
- ipcMain.handle("system:notes:add", async (_event, text) => {
263
- const { readFileSync: readFs, writeFileSync: writeFs } = await import("node:fs");
264
- const notesPath = join(getDataDir(), "notes.json");
265
- let notes = [];
266
- try {
267
- notes = JSON.parse(readFs(notesPath, "utf8"));
268
- }
269
- catch { /* empty */ }
270
- notes.push({ text, createdAt: new Date().toISOString() });
271
- writeFs(notesPath, JSON.stringify(notes, null, 2), "utf8");
272
- return { ok: true };
273
- });
274
- // Window controls
275
- ipcMain.handle("window:minimize", () => mainWindow?.minimize());
276
- ipcMain.handle("window:maximize", () => {
277
- if (mainWindow?.isMaximized())
278
- mainWindow.unmaximize();
279
- else
280
- mainWindow?.maximize();
281
- });
282
- ipcMain.handle("window:close", () => mainWindow?.close());
283
- ipcMain.handle("window:is-maximized", () => isMaximized);
284
- // GUI file reader
285
- ipcMain.handle("gui:read-file", (_event, relativePath) => {
286
- try {
287
- const guiPath = getGuiPath();
288
- const filePath = join(guiPath, relativePath);
289
- if (!filePath.startsWith(guiPath)) {
290
- return { ok: false, error: "Yasak yol" };
291
- }
292
- const content = readFileSync(filePath, "utf8");
293
- return { ok: true, content };
294
- }
295
- catch (err) {
296
- return { ok: false, error: err.message };
297
- }
298
- });
299
- // Windows shortcut
300
- ipcMain.handle("gui:create-shortcut", () => {
301
- try {
302
- const projRoot = join(__dirname, "..", "..");
303
- const electronExe = join(projRoot, "node_modules", "electron", "dist", "electron.exe");
304
- const targetJs = join(projRoot, "dist", "electron", "main.js");
305
- if (!existsSync(electronExe)) {
306
- return { ok: false, error: "electron.exe bulunamadı" };
307
- }
308
- const desktopPath = join(homedir(), "Desktop");
309
- const startMenuPath = join(homedir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs");
310
- const makeShortcut = (dir, name) => {
311
- const lnkPath = join(dir, `${name}.lnk`);
312
- const ps = [
313
- `$ws = New-Object -ComObject WScript.Shell`,
314
- `$s = $ws.CreateShortcut('${lnkPath.replace(/'/g, "''")}')`,
315
- `$s.TargetPath = '${electronExe.replace(/'/g, "''")}'`,
316
- `$s.Arguments = '${targetJs.replace(/'/g, "''")}'`,
317
- `$s.WorkingDirectory = '${projRoot.replace(/'/g, "''")}'`,
318
- `$s.Description = 'AJAN AI Yerel Asistan'`,
319
- `$s.Save()`
320
- ].join("; ");
321
- execSync(`powershell -NoProfile -Command "${ps}"`, { stdio: "pipe" });
322
- };
323
- makeShortcut(desktopPath, "AJAN AI");
324
- const ajanStartDir = join(startMenuPath, "AJAN AI");
325
- if (!existsSync(ajanStartDir)) {
326
- mkdirSync(ajanStartDir, { recursive: true });
327
- }
328
- makeShortcut(ajanStartDir, "AJAN AI");
329
- return { ok: true };
330
- }
331
- catch (err) {
332
- return { ok: false, error: err.message };
333
- }
334
- });
335
- }
336
- // ── App Lifecycle ──
337
- app.whenReady().then(() => {
338
- const lock = acquireLock("gui");
339
- if (!lock.ok) {
340
- console.log(lock.error);
341
- app.quit();
342
- return;
343
- }
344
- createService();
345
- setupIpc();
346
- createWindow();
347
- app.on("activate", () => {
348
- if (BrowserWindow.getAllWindows().length === 0)
349
- createWindow();
350
- });
351
- });
352
- app.on("window-all-closed", async () => {
353
- await service?.dispose();
354
- service = null;
355
- releaseLock();
356
- if (process.platform !== "darwin")
357
- app.quit();
358
- });
359
- app.on("before-quit", async () => {
360
- await service?.dispose();
361
- service = null;
362
- releaseLock();
363
- });
364
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- export {};
@@ -1,67 +0,0 @@
1
- import { contextBridge, ipcRenderer } from "electron";
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
- function onIpc(channel, cb) {
4
- const handler = (_event, ...args) => cb(...args);
5
- ipcRenderer.on(channel, handler);
6
- return () => { ipcRenderer.removeListener(channel, handler); };
7
- }
8
- contextBridge.exposeInMainWorld("ajan", {
9
- // ── Agent ──
10
- sendMessage: (message, model) => ipcRenderer.invoke("agent:send", message, model),
11
- abort: () => ipcRenderer.invoke("agent:abort"),
12
- reset: () => ipcRenderer.invoke("agent:reset"),
13
- getStatus: () => ipcRenderer.invoke("agent:status"),
14
- // ── Agent Events ──
15
- onTextChunk: (cb) => onIpc("agent:text-chunk", cb),
16
- onThinkingChunk: (cb) => onIpc("agent:thinking-chunk", cb),
17
- onToolCall: (cb) => onIpc("agent:tool-call", cb),
18
- onToolResult: (cb) => onIpc("agent:tool-result", cb),
19
- onStepStart: (cb) => onIpc("agent:step-start", cb),
20
- onComplete: (cb) => onIpc("agent:complete", cb),
21
- onError: (cb) => onIpc("agent:error", cb),
22
- onLoadProgress: (cb) => onIpc("agent:load-progress", cb),
23
- onLoadComplete: (cb) => onIpc("agent:load-complete", cb),
24
- // ── Config ──
25
- getConfig: () => ipcRenderer.invoke("config:get"),
26
- setConfig: (config) => ipcRenderer.invoke("config:set", config),
27
- // ── Model ──
28
- getModelInfo: () => ipcRenderer.invoke("model:info"),
29
- listModels: () => ipcRenderer.invoke("model:list"),
30
- installModel: (id) => ipcRenderer.invoke("model:install", id),
31
- removeModel: (id) => ipcRenderer.invoke("model:remove", id),
32
- useModel: (id) => ipcRenderer.invoke("model:use", id),
33
- refreshModels: () => ipcRenderer.invoke("model:refresh"),
34
- // ── Project ──
35
- listProjects: () => ipcRenderer.invoke("project:list"),
36
- addProject: (path) => ipcRenderer.invoke("project:add", path),
37
- removeProject: (path) => ipcRenderer.invoke("project:remove", path),
38
- setActiveProject: (path) => ipcRenderer.invoke("project:set-active", path),
39
- pickDir: () => ipcRenderer.invoke("project:pick-dir"),
40
- projectExists: (path) => ipcRenderer.invoke("project:exists", path),
41
- // ── App ──
42
- getVersion: () => ipcRenderer.invoke("app:version"),
43
- // ── Session ──
44
- listSessions: () => ipcRenderer.invoke("session:list"),
45
- loadSession: (id) => ipcRenderer.invoke("session:load", id),
46
- saveSession: (session) => ipcRenderer.invoke("session:save", session),
47
- newSession: () => ipcRenderer.invoke("session:new"),
48
- generateSessionId: () => ipcRenderer.invoke("session:generate-id"),
49
- getChatHistory: () => ipcRenderer.invoke("session:get-history"),
50
- onSessionRestore: (cb) => onIpc("agent:session-restore", cb),
51
- // ── System ──
52
- getGpuInfo: () => ipcRenderer.invoke("system:gpu"),
53
- getCwd: () => ipcRenderer.invoke("system:cwd"),
54
- getNotes: () => ipcRenderer.invoke("system:notes"),
55
- addNote: (text) => ipcRenderer.invoke("system:notes:add", text),
56
- // ── GUI Files ──
57
- readGuiFile: (relativePath) => ipcRenderer.invoke("gui:read-file", relativePath),
58
- createShortcut: () => ipcRenderer.invoke("gui:create-shortcut"),
59
- // ── Window Events ──
60
- onMaximized: (cb) => onIpc("window:maximized-changed", cb),
61
- isMaximized: () => ipcRenderer.invoke("window:is-maximized"),
62
- // ── Window Controls ──
63
- minimize: () => ipcRenderer.invoke("window:minimize"),
64
- maximize: () => ipcRenderer.invoke("window:maximize"),
65
- close: () => ipcRenderer.invoke("window:close")
66
- });
67
- //# sourceMappingURL=preload.js.map
@@ -1,2 +0,0 @@
1
- /** Metni pano'ya kopyalar. Windows'ta PowerShell Set-Clipboard, diğerlerinde dosya fallback. */
2
- export declare function copyToClipboard(text: string): Promise<string>;
@@ -1,40 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { writeFileSync, mkdirSync } from "node:fs";
3
- import { join } from "node:path";
4
- import { getCacheDir } from "./paths.js";
5
- /** Metni pano'ya kopyalar. Windows'ta PowerShell Set-Clipboard, diğerlerinde dosya fallback. */
6
- export function copyToClipboard(text) {
7
- if (process.platform === "win32") {
8
- const b64 = Buffer.from(text, "utf16le").toString("base64");
9
- const script = `Set-Clipboard -Value ([System.Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('${b64}')))`;
10
- return new Promise((resolve) => {
11
- const child = spawn("powershell", ["-NoProfile", "-Command", script], {
12
- windowsHide: true,
13
- stdio: "ignore"
14
- });
15
- let failed = false;
16
- child.on("error", () => {
17
- failed = true;
18
- resolve(fallbackCopy(text));
19
- });
20
- child.on("close", () => {
21
- if (!failed)
22
- resolve("Pano'ya kopyalandı (Windows).");
23
- });
24
- });
25
- }
26
- return Promise.resolve(fallbackCopy(text));
27
- }
28
- function fallbackCopy(text) {
29
- try {
30
- const dir = getCacheDir();
31
- mkdirSync(dir, { recursive: true });
32
- const file = join(dir, "clipboard.txt");
33
- writeFileSync(file, text, "utf8");
34
- return `Panoya kopyalanamadı; içerik şuraya yazıldı: ${file}`;
35
- }
36
- catch {
37
- return "Panoya kopyalama desteklenmiyor.";
38
- }
39
- }
40
- //# sourceMappingURL=clipboard.js.map
@@ -1,12 +0,0 @@
1
- interface LockData {
2
- pid: number;
3
- type: "gui" | "tui";
4
- startedAt: string;
5
- }
6
- export declare function acquireLock(type: "gui" | "tui"): {
7
- ok: boolean;
8
- error?: string;
9
- };
10
- export declare function releaseLock(): void;
11
- export declare function getLockInfo(): LockData | null;
12
- export {};
@@ -1,68 +0,0 @@
1
- import { readFileSync, writeFileSync, unlinkSync, existsSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { getDataDir } from "./paths.js";
4
- function getLockPath() {
5
- return join(getDataDir(), "ajan.lock");
6
- }
7
- function isProcessAlive(pid) {
8
- try {
9
- process.kill(pid, 0);
10
- return true;
11
- }
12
- catch {
13
- return false;
14
- }
15
- }
16
- export function acquireLock(type) {
17
- const lockPath = getLockPath();
18
- if (existsSync(lockPath)) {
19
- try {
20
- const data = JSON.parse(readFileSync(lockPath, "utf8"));
21
- if (isProcessAlive(data.pid)) {
22
- const runningType = data.type.toUpperCase();
23
- return {
24
- ok: false,
25
- error: `AJAN ${runningType} zaten çalışıyor (PID: ${data.pid}).\nAynı anda yalnızca bir arayüz çalışabilir.`
26
- };
27
- }
28
- // Stale lock — process ölü, temizle
29
- }
30
- catch {
31
- // Bozuk lock dosyası, sil
32
- }
33
- try {
34
- unlinkSync(lockPath);
35
- }
36
- catch { /* empty */ }
37
- }
38
- const lockData = {
39
- pid: process.pid,
40
- type,
41
- startedAt: new Date().toISOString()
42
- };
43
- writeFileSync(lockPath, JSON.stringify(lockData, null, 2), "utf8");
44
- return { ok: true };
45
- }
46
- export function releaseLock() {
47
- const lockPath = getLockPath();
48
- try {
49
- if (existsSync(lockPath)) {
50
- const data = JSON.parse(readFileSync(lockPath, "utf8"));
51
- if (data.pid === process.pid) {
52
- unlinkSync(lockPath);
53
- }
54
- }
55
- }
56
- catch { /* empty */ }
57
- }
58
- export function getLockInfo() {
59
- const lockPath = getLockPath();
60
- try {
61
- if (existsSync(lockPath)) {
62
- return JSON.parse(readFileSync(lockPath, "utf8"));
63
- }
64
- }
65
- catch { /* empty */ }
66
- return null;
67
- }
68
- //# sourceMappingURL=lock.js.map
@@ -1,4 +0,0 @@
1
- export type SacState = "kapali" | "engelleme" | "degerlendirme" | "yok";
2
- export declare function getSacState(): Promise<SacState>;
3
- export declare function describeSacState(state: SacState): string;
4
- export declare function isSacBlocking(state: SacState): boolean;
@@ -1,47 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- const REG_PATH = "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\CI\\Policy";
3
- const REG_NAME = "VerifiedAndReputablePolicyState";
4
- function execPowerShell(command, timeoutMs = 180000) {
5
- return new Promise((resolve) => {
6
- execFile("powershell.exe", ["-NoProfile", "-Command", command], { timeout: timeoutMs, windowsHide: true }, (err, stdout) => {
7
- let code = 0;
8
- if (err) {
9
- const c = err.code;
10
- code = typeof c === "number" ? c : err.killed ? 124 : 1;
11
- }
12
- resolve({ code, stdout: String(stdout ?? "") });
13
- });
14
- });
15
- }
16
- export async function getSacState() {
17
- if (process.platform !== "win32")
18
- return "yok";
19
- const { code, stdout } = await execPowerShell(`(Get-ItemProperty -LiteralPath '${REG_PATH}' -Name '${REG_NAME}' -ErrorAction SilentlyContinue).${REG_NAME}`);
20
- const raw = stdout.trim().split(/\r?\n/).pop()?.trim() ?? "";
21
- if (code !== 0 || raw === "")
22
- return "yok";
23
- const value = raw.startsWith("0x") || raw.startsWith("0X") ? parseInt(raw, 16) : Number(raw);
24
- if (value === 1)
25
- return "engelleme";
26
- if (value === 2)
27
- return "degerlendirme";
28
- if (value === 0)
29
- return "kapali";
30
- return "yok";
31
- }
32
- export function describeSacState(state) {
33
- switch (state) {
34
- case "engelleme":
35
- return "açık (engelleme modu)";
36
- case "degerlendirme":
37
- return "değerlendirme modu";
38
- case "kapali":
39
- return "kapalı";
40
- default:
41
- return "yok / desteklenmiyor";
42
- }
43
- }
44
- export function isSacBlocking(state) {
45
- return process.platform === "win32" && state === "engelleme";
46
- }
47
- //# sourceMappingURL=sacGuard.js.map
@@ -1,10 +0,0 @@
1
- export declare class Spinner {
2
- private readonly interval;
3
- private frame;
4
- readonly startedAt: number;
5
- private readonly text;
6
- constructor(text: string);
7
- private render;
8
- /** Spinner'ı durdurur; finalText verilirse satırı o metinle bitirir, verilmezse satırı temizler. */
9
- finish(finalText?: string): void;
10
- }
@@ -1,32 +0,0 @@
1
- export class Spinner {
2
- interval;
3
- frame = 0;
4
- startedAt;
5
- text;
6
- constructor(text) {
7
- this.text = text;
8
- this.startedAt = Date.now();
9
- process.stdout.write(`${text} `);
10
- this.interval = setInterval(() => this.render(), 120);
11
- }
12
- render() {
13
- const width = 8;
14
- const fill = this.frame % (width + 1);
15
- const bar = fill === width
16
- ? `[${"=".repeat(width)}]`
17
- : `[${"=".repeat(fill)}>${" ".repeat(width - fill - 1)}]`;
18
- this.frame++;
19
- process.stdout.write(`\r${this.text} ${bar}`);
20
- }
21
- /** Spinner'ı durdurur; finalText verilirse satırı o metinle bitirir, verilmezse satırı temizler. */
22
- finish(finalText) {
23
- clearInterval(this.interval);
24
- if (finalText) {
25
- process.stdout.write(`\r${finalText}\n`);
26
- }
27
- else {
28
- process.stdout.write("\r\x1b[2K");
29
- }
30
- }
31
- }
32
- //# sourceMappingURL=spinner.js.map
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500" zoomAndPan="magnify" viewBox="0 0 375 175.5" height="234" preserveAspectRatio="xMidYMid meet" version="1.0"><defs><g/><clipPath id="5de57a9a76"><path d="M 0.53125 5 L 374.464844 5 L 374.464844 170 L 0.53125 170 Z M 0.53125 5 " clip-rule="nonzero"/></clipPath><clipPath id="5f2663e074"><rect x="0" width="375" y="0" height="165"/></clipPath></defs><g clip-path="url(#5de57a9a76)"><g transform="matrix(1, 0, 0, 1, 0.000000000000000111, 5)"><g clip-path="url(#5f2663e074)"><g fill="#ffffff" fill-opacity="1"><g transform="translate(0.758612, 132.097827)"><g><path d="M 83.25 0 L 71.765625 -29.390625 L 25.96875 -29.390625 L 14.40625 0 L 0.28125 0 L 41.3125 -100.515625 L 56.78125 -100.515625 L 97.171875 0 Z M 48.875 -90.25 L 48.234375 -88.25 C 47.035156 -84.300781 45.273438 -79.238281 42.953125 -73.0625 L 30.109375 -40.015625 L 67.703125 -40.015625 L 54.796875 -73.203125 C 53.460938 -76.484375 52.128906 -80.191406 50.796875 -84.328125 Z M 48.875 -90.25 "/></g></g></g><g fill="#ffffff" fill-opacity="1"><g transform="translate(98.207384, 132.097827)"><g><path d="M 32.609375 1.421875 C 15.578125 1.421875 5.46875 -7.375 2.28125 -24.96875 L 15.625 -27.1875 C 16.476562 -21.664062 18.398438 -17.359375 21.390625 -14.265625 C 24.390625 -11.171875 28.148438 -9.625 32.671875 -9.625 C 37.617188 -9.625 41.519531 -11.320312 44.375 -14.71875 C 47.226562 -18.125 48.65625 -23.109375 48.65625 -29.671875 L 48.65625 -89.390625 L 29.328125 -89.390625 L 29.328125 -100.515625 L 62.203125 -100.515625 L 62.203125 -29.96875 C 62.203125 -20.21875 59.5625 -12.546875 54.28125 -6.953125 C 49.007812 -1.367188 41.785156 1.421875 32.609375 1.421875 Z M 32.609375 1.421875 "/></g></g></g><g fill="#ffffff" fill-opacity="1"><g transform="translate(171.258295, 132.097827)"><g><path d="M 83.25 0 L 71.765625 -29.390625 L 25.96875 -29.390625 L 14.40625 0 L 0.28125 0 L 41.3125 -100.515625 L 56.78125 -100.515625 L 97.171875 0 Z M 48.875 -90.25 L 48.234375 -88.25 C 47.035156 -84.300781 45.273438 -79.238281 42.953125 -73.0625 L 30.109375 -40.015625 L 67.703125 -40.015625 L 54.796875 -73.203125 C 53.460938 -76.484375 52.128906 -80.191406 50.796875 -84.328125 Z M 48.875 -90.25 "/></g></g></g><g fill="#ffffff" fill-opacity="1"><g transform="translate(268.707067, 132.097827)"><g><path d="M 77.1875 0 L 23.40625 -85.609375 L 23.75 -78.6875 L 24.109375 -66.78125 L 24.109375 0 L 11.984375 0 L 11.984375 -100.515625 L 27.828125 -100.515625 L 82.1875 -14.34375 C 81.613281 -23.664062 81.328125 -30.414062 81.328125 -34.59375 L 81.328125 -100.515625 L 93.59375 -100.515625 L 93.59375 0 Z M 77.1875 0 "/></g></g></g></g></g></g></svg>