@gowelle/stint-agent 1.2.9 → 1.2.11
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/dist/{StatusDashboard-CTTUQ7ZI.js → StatusDashboard-S3YOQ7IH.js} +1 -1
- package/dist/{api-DI7QRN2Z.js → api-7BKPBTV2.js} +2 -2
- package/dist/{chunk-244PGFSI.js → chunk-5A4NLDIM.js} +4 -3
- package/dist/{chunk-6GHUSTW3.js → chunk-GTQFEK4Q.js} +6 -6
- package/dist/{chunk-HSWWPFRO.js → chunk-VDEABQNS.js} +1 -1
- package/dist/daemon/runner.js +110 -4
- package/dist/index.js +5 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
authService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VDEABQNS.js";
|
|
4
4
|
import {
|
|
5
5
|
config,
|
|
6
6
|
logger
|
|
@@ -100,7 +100,7 @@ var CircuitBreaker = class {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
// src/services/api.ts
|
|
103
|
-
var AGENT_VERSION = "1.2.
|
|
103
|
+
var AGENT_VERSION = "1.2.11";
|
|
104
104
|
var ApiServiceImpl = class {
|
|
105
105
|
sessionId = null;
|
|
106
106
|
circuitBreaker = new CircuitBreaker({
|
|
@@ -123,7 +123,8 @@ var ApiServiceImpl = class {
|
|
|
123
123
|
}
|
|
124
124
|
return {
|
|
125
125
|
Authorization: `Bearer ${token}`,
|
|
126
|
-
"Content-Type": "application/json"
|
|
126
|
+
"Content-Type": "application/json",
|
|
127
|
+
"Accept": "application/json"
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
apiService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5A4NLDIM.js";
|
|
4
4
|
import {
|
|
5
5
|
gitService,
|
|
6
6
|
projectService
|
|
7
7
|
} from "./chunk-QQP6IASS.js";
|
|
8
8
|
import {
|
|
9
9
|
authService
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VDEABQNS.js";
|
|
11
11
|
import {
|
|
12
12
|
notify
|
|
13
13
|
} from "./chunk-HUQ7VJO6.js";
|
|
@@ -306,8 +306,8 @@ var WebSocketServiceImpl = class {
|
|
|
306
306
|
* Get authentication signature for private channel from Laravel backend
|
|
307
307
|
*/
|
|
308
308
|
async getChannelAuth(channel, socketId) {
|
|
309
|
-
const { apiService: apiService2 } = await import("./api-
|
|
310
|
-
const response = await apiService2.request("/
|
|
309
|
+
const { apiService: apiService2 } = await import("./api-7BKPBTV2.js");
|
|
310
|
+
const response = await apiService2.request("/broadcasting/auth", {
|
|
311
311
|
method: "POST",
|
|
312
312
|
body: JSON.stringify({
|
|
313
313
|
socket_id: socketId,
|
|
@@ -381,8 +381,8 @@ var WebSocketServiceImpl = class {
|
|
|
381
381
|
logger.error("websocket", "Connection is unauthorized - authentication token may be invalid or expired");
|
|
382
382
|
const { notify: notify2 } = await import("./notify-R6CUXTEF.js");
|
|
383
383
|
notify2({
|
|
384
|
-
title: "Stint Agent -
|
|
385
|
-
message:
|
|
384
|
+
title: "Stint Agent - Connection Issue",
|
|
385
|
+
message: "WebSocket authentication failed. Notifications may be delayed (falling back to polling)."
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
388
|
} catch (parseError) {
|
|
@@ -71,7 +71,7 @@ var AuthServiceImpl = class {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
try {
|
|
74
|
-
const { apiService } = await import("./api-
|
|
74
|
+
const { apiService } = await import("./api-7BKPBTV2.js");
|
|
75
75
|
const user = await apiService.getCurrentUser();
|
|
76
76
|
logger.info("auth", `Token validated for user: ${user.email}`);
|
|
77
77
|
return user;
|
package/dist/daemon/runner.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
commitQueue,
|
|
4
4
|
websocketService
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-GTQFEK4Q.js";
|
|
6
6
|
import {
|
|
7
7
|
apiService
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-5A4NLDIM.js";
|
|
9
9
|
import {
|
|
10
10
|
gitService,
|
|
11
11
|
projectService,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "../chunk-QQP6IASS.js";
|
|
15
15
|
import {
|
|
16
16
|
authService
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-VDEABQNS.js";
|
|
18
18
|
import {
|
|
19
19
|
notify
|
|
20
20
|
} from "../chunk-HUQ7VJO6.js";
|
|
@@ -25,6 +25,97 @@ import {
|
|
|
25
25
|
// src/daemon/runner.ts
|
|
26
26
|
import "dotenv/config";
|
|
27
27
|
|
|
28
|
+
// src/services/polling.ts
|
|
29
|
+
var PollingServiceImpl = class {
|
|
30
|
+
interval = null;
|
|
31
|
+
knownCommitIds = /* @__PURE__ */ new Set();
|
|
32
|
+
commitApprovedHandlers = [];
|
|
33
|
+
isFirstRun = true;
|
|
34
|
+
isPolling = false;
|
|
35
|
+
/**
|
|
36
|
+
* Start polling for pending commits
|
|
37
|
+
* @param intervalMs - Polling interval in milliseconds (default: 10000)
|
|
38
|
+
*/
|
|
39
|
+
start(intervalMs = 1e4) {
|
|
40
|
+
if (this.interval) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
logger.info("polling", `Starting polling service (interval: ${intervalMs}ms)`);
|
|
44
|
+
this.poll();
|
|
45
|
+
this.interval = setInterval(() => {
|
|
46
|
+
this.poll();
|
|
47
|
+
}, intervalMs);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Stop polling
|
|
51
|
+
*/
|
|
52
|
+
stop() {
|
|
53
|
+
if (this.interval) {
|
|
54
|
+
clearInterval(this.interval);
|
|
55
|
+
this.interval = null;
|
|
56
|
+
logger.info("polling", "Stopping polling service");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Register handler for commit approved event
|
|
61
|
+
* @param handler - Function to call when a commit is approved where it was previously unknown
|
|
62
|
+
*/
|
|
63
|
+
onCommitApproved(handler) {
|
|
64
|
+
this.commitApprovedHandlers.push(handler);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Poll for updates
|
|
68
|
+
*/
|
|
69
|
+
async poll() {
|
|
70
|
+
if (this.isPolling) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.isPolling = true;
|
|
74
|
+
try {
|
|
75
|
+
const linkedProjects = projectService.getAllLinkedProjects();
|
|
76
|
+
const projectIds = Object.values(linkedProjects).map((p) => p.projectId);
|
|
77
|
+
if (projectIds.length === 0) {
|
|
78
|
+
this.isFirstRun = false;
|
|
79
|
+
this.isPolling = false;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const apiProjects = await apiService.getLinkedProjects();
|
|
83
|
+
const projects = apiProjects.filter((p) => projectIds.includes(p.id));
|
|
84
|
+
for (const project of projects) {
|
|
85
|
+
try {
|
|
86
|
+
const commits = await apiService.getPendingCommits(project.id);
|
|
87
|
+
for (const commit of commits) {
|
|
88
|
+
if (!this.knownCommitIds.has(commit.id)) {
|
|
89
|
+
this.knownCommitIds.add(commit.id);
|
|
90
|
+
if (!this.isFirstRun) {
|
|
91
|
+
logger.info("polling", `New pending commit detected: ${commit.id}`);
|
|
92
|
+
this.notifyHandlers(commit, project);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
logger.debug("polling", `Failed to poll project ${project.id}: ${error.message}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.isFirstRun = false;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
logger.error("polling", "Poll cycle failed", error);
|
|
103
|
+
} finally {
|
|
104
|
+
this.isPolling = false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
notifyHandlers(commit, project) {
|
|
108
|
+
this.commitApprovedHandlers.forEach((handler) => {
|
|
109
|
+
try {
|
|
110
|
+
handler(commit, project);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
logger.error("polling", "Error in commit approved handler", error);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var pollingService = new PollingServiceImpl();
|
|
118
|
+
|
|
28
119
|
// src/daemon/watcher.ts
|
|
29
120
|
import fs from "fs";
|
|
30
121
|
var FileWatcher = class {
|
|
@@ -257,6 +348,15 @@ async function startDaemon() {
|
|
|
257
348
|
notify({
|
|
258
349
|
title: "Commit Approved",
|
|
259
350
|
message: `${commit.message}
|
|
351
|
+
Project: ${project.name}`
|
|
352
|
+
});
|
|
353
|
+
commitQueue.addToQueue(commit, project);
|
|
354
|
+
});
|
|
355
|
+
pollingService.onCommitApproved((commit, project) => {
|
|
356
|
+
logger.info("daemon", `Commit approved (via polling): ${commit.id} for project ${project.name}`);
|
|
357
|
+
notify({
|
|
358
|
+
title: "Commit Approved",
|
|
359
|
+
message: `${commit.message}
|
|
260
360
|
Project: ${project.name}`
|
|
261
361
|
});
|
|
262
362
|
commitQueue.addToQueue(commit, project);
|
|
@@ -304,8 +404,14 @@ Priority: ${suggestion.priority}`,
|
|
|
304
404
|
});
|
|
305
405
|
setupSignalHandlers();
|
|
306
406
|
startHeartbeat();
|
|
307
|
-
|
|
407
|
+
logger.info("daemon", "Initializing projects...");
|
|
308
408
|
const linkedProjects = projectService.getAllLinkedProjects();
|
|
409
|
+
Object.values(linkedProjects).forEach((project) => {
|
|
410
|
+
logger.info("daemon", `Linked project: ${project.projectId}`);
|
|
411
|
+
fileWatcher.watchProject(project.projectId);
|
|
412
|
+
});
|
|
413
|
+
pollingService.start();
|
|
414
|
+
logger.info("daemon", "Daemon started successfully");
|
|
309
415
|
const projectEntries = Object.entries(linkedProjects);
|
|
310
416
|
if (projectEntries.length > 0) {
|
|
311
417
|
logger.info("daemon", `Syncing ${projectEntries.length} linked project(s) on startup...`);
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
commitQueue,
|
|
4
4
|
websocketService
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GTQFEK4Q.js";
|
|
6
6
|
import {
|
|
7
7
|
apiService
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5A4NLDIM.js";
|
|
9
9
|
import {
|
|
10
10
|
getPidFilePath,
|
|
11
11
|
gitService,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-QQP6IASS.js";
|
|
18
18
|
import {
|
|
19
19
|
authService
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VDEABQNS.js";
|
|
21
21
|
import "./chunk-HUQ7VJO6.js";
|
|
22
22
|
import {
|
|
23
23
|
config,
|
|
@@ -623,7 +623,7 @@ function registerStatusCommand(program2) {
|
|
|
623
623
|
try {
|
|
624
624
|
const { render } = await import("ink");
|
|
625
625
|
const { createElement } = await import("react");
|
|
626
|
-
const { StatusDashboard } = await import("./StatusDashboard-
|
|
626
|
+
const { StatusDashboard } = await import("./StatusDashboard-S3YOQ7IH.js");
|
|
627
627
|
render(createElement(StatusDashboard, { cwd }));
|
|
628
628
|
return;
|
|
629
629
|
} catch (error) {
|
|
@@ -2003,7 +2003,7 @@ function registerDoctorCommand(program2) {
|
|
|
2003
2003
|
}
|
|
2004
2004
|
|
|
2005
2005
|
// src/index.ts
|
|
2006
|
-
var AGENT_VERSION = "1.2.
|
|
2006
|
+
var AGENT_VERSION = "1.2.11";
|
|
2007
2007
|
var program = new Command();
|
|
2008
2008
|
program.name("stint").description("Stint Agent - Local daemon for Stint Project Assistant").version(AGENT_VERSION, "-v, --version", "output the current version").addHelpText("after", `
|
|
2009
2009
|
${chalk13.bold("Examples:")}
|