@fefeding/aicmd 0.1.14 → 0.1.16

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/README.zh.md +1 -1
  3. package/bin/aicmd.js +19 -1
  4. package/dist/public/rolldown-runtime.js +1 -5
  5. package/dist/public/views.css +253 -253
  6. package/dist/public/views.js +189 -49
  7. package/dist/server/service/ai.service.d.ts +5 -0
  8. package/dist/server/service/ai.service.d.ts.map +1 -1
  9. package/dist/server/service/ai.service.js +69 -2
  10. package/dist/server/service/ai.service.js.map +1 -1
  11. package/dist/server/service/ai.service.ts +66 -2
  12. package/dist/server/service/batch.service.d.ts.map +1 -1
  13. package/dist/server/service/batch.service.js +5 -0
  14. package/dist/server/service/batch.service.js.map +1 -1
  15. package/dist/server/service/batch.service.ts +5 -0
  16. package/dist/server/service/connection.service.d.ts +5 -0
  17. package/dist/server/service/connection.service.d.ts.map +1 -1
  18. package/dist/server/service/connection.service.js +72 -3
  19. package/dist/server/service/connection.service.js.map +1 -1
  20. package/dist/server/service/connection.service.ts +70 -3
  21. package/dist/server/service/monitor.service.d.ts +5 -0
  22. package/dist/server/service/monitor.service.d.ts.map +1 -1
  23. package/dist/server/service/monitor.service.js +100 -3
  24. package/dist/server/service/monitor.service.js.map +1 -1
  25. package/dist/server/service/monitor.service.ts +72 -3
  26. package/dist/server/service/ssh.service.d.ts.map +1 -1
  27. package/dist/server/service/ssh.service.js +3 -2
  28. package/dist/server/service/ssh.service.js.map +1 -1
  29. package/dist/server/service/ssh.service.ts +3 -2
  30. package/dist/server/utils/security.d.ts +15 -0
  31. package/dist/server/utils/security.d.ts.map +1 -0
  32. package/dist/server/utils/security.js +186 -0
  33. package/dist/server/utils/security.js.map +1 -0
  34. package/dist/server/utils/security.ts +133 -0
  35. package/dist/server/utils/shell.d.ts +8 -0
  36. package/dist/server/utils/shell.d.ts.map +1 -0
  37. package/dist/server/utils/shell.js +73 -0
  38. package/dist/server/utils/shell.js.map +1 -0
  39. package/dist/server/utils/shell.ts +43 -0
  40. package/electron/main.js +30 -5
  41. package/electron/preload.js +22 -12
  42. package/package.json +2 -1
  43. package/server.js +113 -21
package/README.md CHANGED
@@ -68,7 +68,7 @@ An AI-powered web SSH terminal that combines a full-featured terminal emulator w
68
68
 
69
69
  ## Screenshot
70
70
 
71
- ![AICmd Screenshot](./screenshot.png)
71
+ ![AICmd Screenshot](./screenshot.jpeg)
72
72
 
73
73
  ## Tech Stack
74
74
 
package/README.zh.md CHANGED
@@ -68,7 +68,7 @@
68
68
 
69
69
  ## 截图
70
70
 
71
- ![AICmd Screenshot](./screenshot.png)
71
+ ![AICmd Screenshot](./screenshot.jpeg)
72
72
 
73
73
  ## 技术栈
74
74
 
package/bin/aicmd.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const crypto = require('crypto');
3
4
  const { exec, spawn } = require('child_process');
4
5
  const path = require('path');
5
6
  const fs = require('fs');
@@ -65,6 +66,21 @@ const readPid = () => {
65
66
  const f = getDataPath('aicmd.server.pid');
66
67
  return fs.existsSync(f) ? parseInt(fs.readFileSync(f, 'utf8')) : null;
67
68
  };
69
+ const getAccessToken = () => {
70
+ if (process.env.AICMD_ACCESS_TOKEN) return process.env.AICMD_ACCESS_TOKEN;
71
+ ensureDataDir();
72
+ const f = getDataPath('access-token');
73
+ try {
74
+ if (fs.existsSync(f)) {
75
+ const token = fs.readFileSync(f, 'utf8').trim();
76
+ if (token) return token;
77
+ }
78
+ } catch { /* ignore */ }
79
+ const token = crypto.randomBytes(32).toString('base64url');
80
+ fs.writeFileSync(f, token, { encoding: 'utf8', mode: 0o600 });
81
+ try { fs.chmodSync(f, 0o600); } catch { /* ignore */ }
82
+ return token;
83
+ };
68
84
  const writePid = (pid) => {
69
85
  ensureDataDir();
70
86
  fs.writeFileSync(getDataPath('aicmd.server.pid'), pid.toString());
@@ -151,9 +167,11 @@ async function startProject() {
151
167
  child.unref();
152
168
  writePid(child.pid);
153
169
 
170
+ const accessToken = getAccessToken();
171
+ const startUrl = `http://localhost:${port}/?token=${encodeURIComponent(accessToken)}`;
154
172
  console.log('Server started with PID:', child.pid);
155
173
  console.log(`aicmd is running at http://localhost:${port}`);
156
- openBrowser(`http://localhost:${port}`);
174
+ openBrowser(startUrl);
157
175
  }
158
176
 
159
177
  function stopProject() {
@@ -30,9 +30,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  value: mod,
31
31
  enumerable: true
32
32
  }) : target, mod));
33
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
34
- if (typeof require !== "undefined") return require.apply(this, arguments);
35
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
36
- });
37
33
  //#endregion
38
- export { __toESM as a, __require as i, __esmMin as n, __exportAll as r, __commonJSMin as t };
34
+ export { __toESM as i, __esmMin as n, __exportAll as r, __commonJSMin as t };