@gowelle/stint-agent 1.2.17 → 1.2.19

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.
@@ -2,11 +2,10 @@ import {
2
2
  gitService,
3
3
  projectService,
4
4
  validatePidFile
5
- } from "./chunk-QQP6IASS.js";
5
+ } from "./chunk-NVQIKLOA.js";
6
6
  import {
7
7
  authService
8
- } from "./chunk-ES33YYVA.js";
9
- import "./chunk-XHXSWLUC.js";
8
+ } from "./chunk-HZ4K7EPF.js";
10
9
 
11
10
  // src/components/StatusDashboard.tsx
12
11
  import { useState, useEffect } from "react";
@@ -0,0 +1,7 @@
1
+ import {
2
+ apiService
3
+ } from "./chunk-6LQKDEQR.js";
4
+ import "./chunk-HZ4K7EPF.js";
5
+ export {
6
+ apiService
7
+ };
@@ -1,10 +1,8 @@
1
1
  import {
2
- authService
3
- } from "./chunk-ES33YYVA.js";
4
- import {
2
+ authService,
5
3
  config,
6
4
  logger
7
- } from "./chunk-XHXSWLUC.js";
5
+ } from "./chunk-HZ4K7EPF.js";
8
6
 
9
7
  // src/utils/circuit-breaker.ts
10
8
  var CircuitBreaker = class {
@@ -100,7 +98,7 @@ var CircuitBreaker = class {
100
98
  };
101
99
 
102
100
  // src/services/api.ts
103
- var AGENT_VERSION = "1.2.17";
101
+ var AGENT_VERSION = "1.2.19";
104
102
  var ApiServiceImpl = class {
105
103
  sessionId = null;
106
104
  circuitBreaker = new CircuitBreaker({
@@ -1,3 +1,29 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
1
27
  // src/utils/config.ts
2
28
  import Conf from "conf";
3
29
  import { createHash } from "crypto";
@@ -19,7 +45,9 @@ var DEFAULT_CONFIG = {
19
45
  projects: {},
20
46
  notifications: {
21
47
  enabled: true
22
- }
48
+ },
49
+ autoCheckUpdates: true,
50
+ lastUpdateCheck: null
23
51
  };
24
52
  var ConfigManager = class {
25
53
  conf;
@@ -214,7 +242,97 @@ var Logger = class {
214
242
  };
215
243
  var logger = new Logger();
216
244
 
245
+ // src/utils/crypto.ts
246
+ import crypto from "crypto";
247
+ import os3 from "os";
248
+ function getMachineKey() {
249
+ const machineInfo = `${os3.hostname()}-${os3.platform()}-${os3.arch()}`;
250
+ return crypto.createHash("sha256").update(machineInfo).digest();
251
+ }
252
+ var ALGORITHM = "aes-256-gcm";
253
+ var IV_LENGTH = 16;
254
+ var AUTH_TAG_LENGTH = 16;
255
+ function encrypt(text) {
256
+ const key = getMachineKey();
257
+ const iv = crypto.randomBytes(IV_LENGTH);
258
+ const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
259
+ let encrypted = cipher.update(text, "utf8", "hex");
260
+ encrypted += cipher.final("hex");
261
+ const authTag = cipher.getAuthTag();
262
+ return iv.toString("hex") + authTag.toString("hex") + encrypted;
263
+ }
264
+ function decrypt(encryptedText) {
265
+ const key = getMachineKey();
266
+ const iv = Buffer.from(encryptedText.slice(0, IV_LENGTH * 2), "hex");
267
+ const authTag = Buffer.from(
268
+ encryptedText.slice(IV_LENGTH * 2, (IV_LENGTH + AUTH_TAG_LENGTH) * 2),
269
+ "hex"
270
+ );
271
+ const encrypted = encryptedText.slice((IV_LENGTH + AUTH_TAG_LENGTH) * 2);
272
+ const decipher = crypto.createDecipheriv(ALGORITHM, key, iv);
273
+ decipher.setAuthTag(authTag);
274
+ let decrypted = decipher.update(encrypted, "hex", "utf8");
275
+ decrypted += decipher.final("utf8");
276
+ return decrypted;
277
+ }
278
+
279
+ // src/services/auth.ts
280
+ var AuthServiceImpl = class {
281
+ async saveToken(token) {
282
+ try {
283
+ const encryptedToken = encrypt(token);
284
+ config.setToken(encryptedToken);
285
+ logger.info("auth", "Token saved successfully");
286
+ } catch (error) {
287
+ logger.error("auth", "Failed to save token", error);
288
+ throw error;
289
+ }
290
+ }
291
+ async getToken() {
292
+ try {
293
+ const encryptedToken = config.getToken();
294
+ if (!encryptedToken) {
295
+ return null;
296
+ }
297
+ return decrypt(encryptedToken);
298
+ } catch (error) {
299
+ logger.error("auth", "Failed to decrypt token", error);
300
+ return null;
301
+ }
302
+ }
303
+ async clearToken() {
304
+ config.clearToken();
305
+ logger.info("auth", "Token cleared");
306
+ }
307
+ async validateToken() {
308
+ const token = await this.getToken();
309
+ if (!token) {
310
+ return null;
311
+ }
312
+ try {
313
+ const { apiService } = await import("./api-76OMVWNR.js");
314
+ const user = await apiService.getCurrentUser();
315
+ logger.info("auth", `Token validated for user: ${user.email}`);
316
+ return user;
317
+ } catch (error) {
318
+ logger.warn("auth", "Token validation failed");
319
+ logger.error("auth", "Failed to validate token", error);
320
+ return null;
321
+ }
322
+ }
323
+ getMachineId() {
324
+ return config.getMachineId();
325
+ }
326
+ getMachineName() {
327
+ return config.getMachineName();
328
+ }
329
+ };
330
+ var authService = new AuthServiceImpl();
331
+
217
332
  export {
333
+ __commonJS,
334
+ __toESM,
218
335
  config,
219
- logger
336
+ logger,
337
+ authService
220
338
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  config,
3
3
  logger
4
- } from "./chunk-XHXSWLUC.js";
4
+ } from "./chunk-HZ4K7EPF.js";
5
5
 
6
6
  // src/services/git.ts
7
7
  import simpleGit from "simple-git";