@gowelle/stint-agent 1.2.11 → 1.2.13

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.
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-QQP6IASS.js";
6
6
  import {
7
7
  authService
8
- } from "./chunk-VDEABQNS.js";
8
+ } from "./chunk-MNCP4JFA.js";
9
9
  import "./chunk-XHXSWLUC.js";
10
10
 
11
11
  // src/components/StatusDashboard.tsx
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  apiService
3
- } from "./chunk-5A4NLDIM.js";
4
- import "./chunk-VDEABQNS.js";
3
+ } from "./chunk-4ECPXVXN.js";
4
+ import "./chunk-MNCP4JFA.js";
5
5
  import "./chunk-XHXSWLUC.js";
6
6
  export {
7
7
  apiService
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  authService
3
- } from "./chunk-VDEABQNS.js";
3
+ } from "./chunk-MNCP4JFA.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.11";
103
+ var AGENT_VERSION = "1.2.13";
104
104
  var ApiServiceImpl = class {
105
105
  sessionId = null;
106
106
  circuitBreaker = new CircuitBreaker({
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  apiService
3
- } from "./chunk-5A4NLDIM.js";
3
+ } from "./chunk-4ECPXVXN.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-VDEABQNS.js";
10
+ } from "./chunk-MNCP4JFA.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-7BKPBTV2.js");
310
- const response = await apiService2.request("/broadcasting/auth", {
309
+ const { apiService: apiService2 } = await import("./api-DF4GJHID.js");
310
+ const response = await apiService2.request("/api/broadcasting/auth", {
311
311
  method: "POST",
312
312
  body: JSON.stringify({
313
313
  socket_id: socketId,
@@ -71,7 +71,7 @@ var AuthServiceImpl = class {
71
71
  return null;
72
72
  }
73
73
  try {
74
- const { apiService } = await import("./api-7BKPBTV2.js");
74
+ const { apiService } = await import("./api-DF4GJHID.js");
75
75
  const user = await apiService.getCurrentUser();
76
76
  logger.info("auth", `Token validated for user: ${user.email}`);
77
77
  return user;
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  commitQueue,
4
4
  websocketService
5
- } from "../chunk-GTQFEK4Q.js";
5
+ } from "../chunk-GR56NPJ6.js";
6
6
  import {
7
7
  apiService
8
- } from "../chunk-5A4NLDIM.js";
8
+ } from "../chunk-4ECPXVXN.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-VDEABQNS.js";
17
+ } from "../chunk-MNCP4JFA.js";
18
18
  import {
19
19
  notify
20
20
  } from "../chunk-HUQ7VJO6.js";
@@ -29,7 +29,9 @@ import "dotenv/config";
29
29
  var PollingServiceImpl = class {
30
30
  interval = null;
31
31
  knownCommitIds = /* @__PURE__ */ new Set();
32
+ knownProjects = /* @__PURE__ */ new Map();
32
33
  commitApprovedHandlers = [];
34
+ projectUpdatedHandlers = [];
33
35
  isFirstRun = true;
34
36
  isPolling = false;
35
37
  /**
@@ -63,6 +65,13 @@ var PollingServiceImpl = class {
63
65
  onCommitApproved(handler) {
64
66
  this.commitApprovedHandlers.push(handler);
65
67
  }
68
+ /**
69
+ * Register handler for project updated event
70
+ * @param handler - Function to call when a project is updated
71
+ */
72
+ onProjectUpdated(handler) {
73
+ this.projectUpdatedHandlers.push(handler);
74
+ }
66
75
  /**
67
76
  * Poll for updates
68
77
  */
@@ -82,6 +91,16 @@ var PollingServiceImpl = class {
82
91
  const apiProjects = await apiService.getLinkedProjects();
83
92
  const projects = apiProjects.filter((p) => projectIds.includes(p.id));
84
93
  for (const project of projects) {
94
+ const cachedProject = this.knownProjects.get(project.id);
95
+ if (cachedProject) {
96
+ if (cachedProject.updatedAt !== project.updatedAt) {
97
+ if (!this.isFirstRun) {
98
+ logger.info("polling", `Project update detected: ${project.id}`);
99
+ this.notifyProjectUpdated(project);
100
+ }
101
+ }
102
+ }
103
+ this.knownProjects.set(project.id, project);
85
104
  try {
86
105
  const commits = await apiService.getPendingCommits(project.id);
87
106
  for (const commit of commits) {
@@ -89,7 +108,7 @@ var PollingServiceImpl = class {
89
108
  this.knownCommitIds.add(commit.id);
90
109
  if (!this.isFirstRun) {
91
110
  logger.info("polling", `New pending commit detected: ${commit.id}`);
92
- this.notifyHandlers(commit, project);
111
+ this.notifyCommitApproved(commit, project);
93
112
  }
94
113
  }
95
114
  }
@@ -104,7 +123,7 @@ var PollingServiceImpl = class {
104
123
  this.isPolling = false;
105
124
  }
106
125
  }
107
- notifyHandlers(commit, project) {
126
+ notifyCommitApproved(commit, project) {
108
127
  this.commitApprovedHandlers.forEach((handler) => {
109
128
  try {
110
129
  handler(commit, project);
@@ -113,6 +132,15 @@ var PollingServiceImpl = class {
113
132
  }
114
133
  });
115
134
  }
135
+ notifyProjectUpdated(project) {
136
+ this.projectUpdatedHandlers.forEach((handler) => {
137
+ try {
138
+ handler(project);
139
+ } catch (error) {
140
+ logger.error("polling", "Error in project updated handler", error);
141
+ }
142
+ });
143
+ }
116
144
  };
117
145
  var pollingService = new PollingServiceImpl();
118
146
 
@@ -375,6 +403,13 @@ Project: ${project.name}`
375
403
  message: project.name
376
404
  });
377
405
  });
406
+ pollingService.onProjectUpdated((project) => {
407
+ logger.info("daemon", `Project updated (via polling): ${project.id} - ${project.name}`);
408
+ notify({
409
+ title: "Project Updated",
410
+ message: project.name
411
+ });
412
+ });
378
413
  websocketService.onDisconnect(() => {
379
414
  logger.warn("daemon", "WebSocket disconnected, will attempt to reconnect");
380
415
  });
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  commitQueue,
4
4
  websocketService
5
- } from "./chunk-GTQFEK4Q.js";
5
+ } from "./chunk-GR56NPJ6.js";
6
6
  import {
7
7
  apiService
8
- } from "./chunk-5A4NLDIM.js";
8
+ } from "./chunk-4ECPXVXN.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-VDEABQNS.js";
20
+ } from "./chunk-MNCP4JFA.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-S3YOQ7IH.js");
626
+ const { StatusDashboard } = await import("./StatusDashboard-DB5NN4MB.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.11";
2006
+ var AGENT_VERSION = "1.2.13";
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:")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gowelle/stint-agent",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "Local agent for Stint - Project Assistant",
5
5
  "author": "Gowelle John <gowelle.john@icloud.com>",
6
6
  "license": "MIT",