@gowelle/stint-agent 1.2.55 → 1.2.57

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,10 +2,10 @@ import {
2
2
  gitService,
3
3
  projectService,
4
4
  validatePidFile
5
- } from "./chunk-BBZYUT3H.js";
5
+ } from "./chunk-3MQX6TV5.js";
6
6
  import {
7
7
  authService
8
- } from "./chunk-QSE5SQ7W.js";
8
+ } from "./chunk-46ZVI2XN.js";
9
9
 
10
10
  // src/components/StatusDashboard.tsx
11
11
  import { useState, useEffect } from "react";
@@ -0,0 +1,7 @@
1
+ import {
2
+ apiService
3
+ } from "./chunk-HPJT3JQ7.js";
4
+ import "./chunk-46ZVI2XN.js";
5
+ export {
6
+ apiService
7
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  config,
3
3
  logger
4
- } from "./chunk-QSE5SQ7W.js";
4
+ } from "./chunk-46ZVI2XN.js";
5
5
 
6
6
  // src/services/git.ts
7
7
  import simpleGit from "simple-git";
@@ -358,7 +358,7 @@ var AuthServiceImpl = class {
358
358
  return null;
359
359
  }
360
360
  try {
361
- const { apiService } = await import("./api-ITHJGTWR.js");
361
+ const { apiService } = await import("./api-NBOMNUU6.js");
362
362
  const user = await apiService.getCurrentUser();
363
363
  logger.info("auth", `Token validated for user: ${user.email}`);
364
364
  return user;
@@ -2,7 +2,7 @@ import {
2
2
  authService,
3
3
  config,
4
4
  logger
5
- } from "./chunk-QSE5SQ7W.js";
5
+ } from "./chunk-46ZVI2XN.js";
6
6
 
7
7
  // src/utils/circuit-breaker.ts
8
8
  var CircuitBreaker = class {
@@ -100,7 +100,7 @@ var CircuitBreaker = class {
100
100
  };
101
101
 
102
102
  // src/services/api.ts
103
- var AGENT_VERSION = "1.2.55";
103
+ var AGENT_VERSION = "1.2.57";
104
104
  var ApiServiceImpl = class {
105
105
  sessionId = null;
106
106
  circuitBreaker = new CircuitBreaker({
@@ -139,6 +139,41 @@ var ApiServiceImpl = class {
139
139
  Accept: "application/json"
140
140
  };
141
141
  }
142
+ /**
143
+ * Internal request execution without circuit breaker
144
+ */
145
+ async executeRequest(endpoint, options = {}, timeoutMs = 3e4) {
146
+ const url = `${config.getApiUrl()}${endpoint}`;
147
+ const headers = await this.getHeaders();
148
+ const controller = new AbortController();
149
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
150
+ try {
151
+ const response = await fetch(url, {
152
+ ...options,
153
+ headers: {
154
+ ...headers,
155
+ ...options.headers
156
+ },
157
+ signal: controller.signal
158
+ });
159
+ if (!response.ok) {
160
+ const errorText = await response.text();
161
+ throw new Error(
162
+ `API request failed: ${response.status} ${errorText}`
163
+ );
164
+ }
165
+ return await response.json();
166
+ } catch (error) {
167
+ if (error.name === "AbortError") {
168
+ throw new Error(
169
+ `Request to ${endpoint} timed out after ${timeoutMs}ms`
170
+ );
171
+ }
172
+ throw error;
173
+ } finally {
174
+ clearTimeout(timeoutId);
175
+ }
176
+ }
142
177
  /**
143
178
  * Make an HTTP request to the API with circuit breaker protection
144
179
  * @param endpoint - API endpoint path (e.g., '/api/user')
@@ -148,37 +183,12 @@ var ApiServiceImpl = class {
148
183
  * @throws Error if request fails, times out, or circuit breaker is open
149
184
  */
150
185
  async request(endpoint, options = {}, timeoutMs = 3e4) {
151
- const url = `${config.getApiUrl()}${endpoint}`;
152
- const headers = await this.getHeaders();
153
186
  return this.circuitBreaker.execute(async () => {
154
- const controller = new AbortController();
155
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
156
187
  try {
157
- const response = await fetch(url, {
158
- ...options,
159
- headers: {
160
- ...headers,
161
- ...options.headers
162
- },
163
- signal: controller.signal
164
- });
165
- if (!response.ok) {
166
- const errorText = await response.text();
167
- throw new Error(
168
- `API request failed: ${response.status} ${errorText}`
169
- );
170
- }
171
- return await response.json();
188
+ return await this.executeRequest(endpoint, options, timeoutMs);
172
189
  } catch (error) {
173
- if (error.name === "AbortError") {
174
- throw new Error(
175
- `Request to ${endpoint} timed out after ${timeoutMs}ms`
176
- );
177
- }
178
190
  logger.error("api", `Request to ${endpoint} failed`, error);
179
191
  throw error;
180
- } finally {
181
- clearTimeout(timeoutId);
182
192
  }
183
193
  });
184
194
  }
@@ -511,7 +521,7 @@ var ApiServiceImpl = class {
511
521
  async streamCommitOutput(commitId, output) {
512
522
  if (!output) return;
513
523
  try {
514
- await this.request(`/api/agent/commits/${commitId}/stream`, {
524
+ await this.executeRequest(`/api/agent/commits/${commitId}/stream`, {
515
525
  method: "POST",
516
526
  body: JSON.stringify({ output }),
517
527
  headers: {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  apiService
3
- } from "./chunk-UY2E6E3G.js";
3
+ } from "./chunk-HPJT3JQ7.js";
4
4
  import {
5
5
  gitService,
6
6
  projectService
7
- } from "./chunk-BBZYUT3H.js";
7
+ } from "./chunk-3MQX6TV5.js";
8
8
  import {
9
9
  authService,
10
10
  config,
11
11
  logger
12
- } from "./chunk-QSE5SQ7W.js";
12
+ } from "./chunk-46ZVI2XN.js";
13
13
 
14
14
  // src/services/package-detector.ts
15
15
  import fs from "fs";
@@ -597,6 +597,10 @@ var OutputBuffer = class {
597
597
  if (!this.buffer) {
598
598
  return;
599
599
  }
600
+ if (!this.buffer.trim()) {
601
+ this.buffer = "";
602
+ return;
603
+ }
600
604
  const chunk = this.buffer;
601
605
  this.buffer = "";
602
606
  this.lastSendTime = Date.now();
@@ -1498,7 +1502,7 @@ var WebSocketServiceImpl = class {
1498
1502
  "websocket",
1499
1503
  `Commit ${commit.id} marked as large, fetching full details...`
1500
1504
  );
1501
- const { apiService: apiService2 } = await import("./api-ITHJGTWR.js");
1505
+ const { apiService: apiService2 } = await import("./api-NBOMNUU6.js");
1502
1506
  const fullCommit = await apiService2.getCommit(commit.id);
1503
1507
  commit = {
1504
1508
  ...commit,
@@ -4,21 +4,21 @@ import {
4
4
  notify,
5
5
  packageDetector,
6
6
  websocketService
7
- } from "../chunk-HL7BI2HT.js";
7
+ } from "../chunk-R26LSZF3.js";
8
8
  import {
9
9
  apiService
10
- } from "../chunk-UY2E6E3G.js";
10
+ } from "../chunk-HPJT3JQ7.js";
11
11
  import {
12
12
  gitService,
13
13
  projectService,
14
14
  removePidFile,
15
15
  writePidFile
16
- } from "../chunk-BBZYUT3H.js";
16
+ } from "../chunk-3MQX6TV5.js";
17
17
  import {
18
18
  authService,
19
19
  config,
20
20
  logger
21
- } from "../chunk-QSE5SQ7W.js";
21
+ } from "../chunk-46ZVI2XN.js";
22
22
 
23
23
  // src/daemon/runner.ts
24
24
  import "dotenv/config";
@@ -196,7 +196,15 @@ var FileWatcher = class {
196
196
  const packageInfo = await Promise.all(
197
197
  rawPackageInfo.map((p) => packageDetector.checkPublicationStatus(p))
198
198
  );
199
- const diff = await gitService.getDiff(projectPath);
199
+ let diff = await gitService.getDiff(projectPath);
200
+ const MAX_DIFF_SIZE = 100 * 1024;
201
+ if (diff.length > MAX_DIFF_SIZE) {
202
+ logger.warn(
203
+ "watcher",
204
+ `Diff too large (${diff.length} bytes), truncating...`
205
+ );
206
+ diff = diff.substring(0, MAX_DIFF_SIZE) + "\n...diff truncated due to size limit...";
207
+ }
200
208
  const response = await apiService.syncProject(
201
209
  projectId,
202
210
  repoInfo,
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  commitQueue,
4
4
  packageDetector,
5
5
  websocketService
6
- } from "./chunk-HL7BI2HT.js";
6
+ } from "./chunk-R26LSZF3.js";
7
7
  import {
8
8
  apiService
9
- } from "./chunk-UY2E6E3G.js";
9
+ } from "./chunk-HPJT3JQ7.js";
10
10
  import {
11
11
  getPidFilePath,
12
12
  gitService,
@@ -15,14 +15,14 @@ import {
15
15
  projectService,
16
16
  spawnDetached,
17
17
  validatePidFile
18
- } from "./chunk-BBZYUT3H.js";
18
+ } from "./chunk-3MQX6TV5.js";
19
19
  import {
20
20
  __commonJS,
21
21
  __toESM,
22
22
  authService,
23
23
  config,
24
24
  logger
25
- } from "./chunk-QSE5SQ7W.js";
25
+ } from "./chunk-46ZVI2XN.js";
26
26
 
27
27
  // node_modules/semver/internal/constants.js
28
28
  var require_constants = __commonJS({
@@ -2658,7 +2658,7 @@ function registerStatusCommand(program2) {
2658
2658
  try {
2659
2659
  const { render } = await import("ink");
2660
2660
  const { createElement } = await import("react");
2661
- const { StatusDashboard } = await import("./StatusDashboard-WUA32UIT.js");
2661
+ const { StatusDashboard } = await import("./StatusDashboard-VRS5ISJB.js");
2662
2662
  render(createElement(StatusDashboard, { cwd }));
2663
2663
  return;
2664
2664
  } catch (error) {
@@ -5056,7 +5056,7 @@ function displayLocalProjects(entries) {
5056
5056
 
5057
5057
  // src/commands/about.ts
5058
5058
  import chalk17 from "chalk";
5059
- var AGENT_VERSION = "1.2.55";
5059
+ var AGENT_VERSION = "1.2.57";
5060
5060
  function registerAboutCommand(program2) {
5061
5061
  program2.command("about").description("Display information about Stint Agent").action(() => {
5062
5062
  console.log();
@@ -5097,7 +5097,7 @@ function registerAboutCommand(program2) {
5097
5097
  }
5098
5098
 
5099
5099
  // src/index.ts
5100
- var AGENT_VERSION2 = "1.2.55";
5100
+ var AGENT_VERSION2 = "1.2.57";
5101
5101
  var program = new Command3();
5102
5102
  program.name("stint").description("Stint Agent - Local daemon for Stint Project Assistant").version(AGENT_VERSION2, "-v, --version", "output the current version").addHelpText(
5103
5103
  "after",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gowelle/stint-agent",
3
- "version": "1.2.55",
3
+ "version": "1.2.57",
4
4
  "description": "Local agent for Stint - Project Assistant",
5
5
  "author": "Gowelle John <gowelle.john@icloud.com>",
6
6
  "license": "MIT",
@@ -100,4 +100,4 @@
100
100
  "esbuild"
101
101
  ]
102
102
  }
103
- }
103
+ }
@@ -1,7 +0,0 @@
1
- import {
2
- apiService
3
- } from "./chunk-UY2E6E3G.js";
4
- import "./chunk-QSE5SQ7W.js";
5
- export {
6
- apiService
7
- };