@naisys/hub 3.0.0-beta.40 → 3.0.0-beta.41

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.
@@ -1,6 +1,6 @@
1
1
  import { AgentPeekRequestSchema, AgentRunCommandRequestSchema, AgentRunPauseRequestSchema, AgentStartInboundSchema, AgentStopRequestSchema, HubEvents, } from "@naisys/hub-protocol";
2
2
  /** Handles agent_start requests by routing them to the least-loaded eligible host */
3
- export function createHubAgentService(naisysServer, { hubDb }, logService, heartbeatService, sendMailService, hostRegistrar, runtimeKeyService) {
3
+ export function createHubAgentService(naisysServer, { hubDb }, logService, heartbeatService, sendMailService, hostRegistrar, runtimeKeyService, configService) {
4
4
  const { issueRuntimeApiKey, revokeRuntimeApiKey } = runtimeKeyService;
5
5
  /** Find the least-loaded eligible host for a given user */
6
6
  async function findBestHost(startUserId) {
@@ -235,12 +235,16 @@ export function createHubAgentService(naisysServer, { hubDb }, logService, heart
235
235
  });
236
236
  async function sendTaskMail(startUserId, requesterUserId, taskDescription) {
237
237
  try {
238
+ const mailEnabled = !!configService.getConfig().config?.mailServiceEnabled;
238
239
  await sendMailService.sendMail({
239
240
  fromUserId: requesterUserId,
240
241
  recipientUserIds: [startUserId],
241
- subject: "Agent Start", // Agent will send a 'Session Completed' mail when session is completed
242
- body: taskDescription,
243
- kind: "mail",
242
+ // Agent will send a 'Session Completed' message when session is completed
243
+ subject: mailEnabled ? "Agent Start" : "",
244
+ body: mailEnabled
245
+ ? taskDescription
246
+ : `Agent Start: ${taskDescription}`,
247
+ kind: mailEnabled ? "mail" : "chat",
244
248
  });
245
249
  }
246
250
  catch (err) {
package/dist/naisysHub.js CHANGED
@@ -89,7 +89,7 @@ export const startHub = async (startupType, startSupervisor, plugins, startupAge
89
89
  // Register hub send mail service (pure mail sending, no auto-start logic)
90
90
  const sendMailService = createHubSendMailService(naisysServer, hubDatabaseService, heartbeatService, redactionService);
91
91
  // Register hub agent service for agent_start requests routed to target hosts
92
- const agentService = createHubAgentService(naisysServer, hubDatabaseService, logService, heartbeatService, sendMailService, hostRegistrar, runtimeKeyService);
92
+ const agentService = createHubAgentService(naisysServer, hubDatabaseService, logService, heartbeatService, sendMailService, hostRegistrar, runtimeKeyService, configService);
93
93
  // Register hub mail service for mail events from NAISYS instances
94
94
  const mailService = createHubMailService(naisysServer, hubDatabaseService, logService, heartbeatService, sendMailService, agentService, costService, configService);
95
95
  /**
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@naisys/hub",
3
- "version": "3.0.0-beta.40",
3
+ "version": "3.0.0-beta.41",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@naisys/hub",
9
- "version": "3.0.0-beta.40",
9
+ "version": "3.0.0-beta.41",
10
10
  "dependencies": {
11
- "@naisys/common": "3.0.0-beta.40",
12
- "@naisys/common-node": "3.0.0-beta.40",
13
- "@naisys/hub-database": "3.0.0-beta.40",
14
- "@naisys/hub-protocol": "3.0.0-beta.40",
11
+ "@naisys/common": "3.0.0-beta.41",
12
+ "@naisys/common-node": "3.0.0-beta.41",
13
+ "@naisys/hub-database": "3.0.0-beta.41",
14
+ "@naisys/hub-protocol": "3.0.0-beta.41",
15
15
  "commander": "^14.0.3",
16
16
  "dotenv": "^17.3.1",
17
17
  "fastify": "^5.8.2",
@@ -24,7 +24,7 @@
24
24
  "node": ">=22.0.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@naisys/supervisor": "3.0.0-beta.40"
27
+ "@naisys/supervisor": "3.0.0-beta.41"
28
28
  },
29
29
  "peerDependenciesMeta": {
30
30
  "@naisys/supervisor": {
@@ -189,32 +189,32 @@
189
189
  "license": "MIT"
190
190
  },
191
191
  "node_modules/@naisys/common": {
192
- "version": "3.0.0-beta.40",
193
- "resolved": "https://registry.npmjs.org/@naisys/common/-/common-3.0.0-beta.40.tgz",
194
- "integrity": "sha512-qHXg14eU+DBz97iFoWdkx1Bn6Y6eminvB0Gbsu7u0iIFEDVXXUqnq4o0qBobHoS8g7OBTqTHtyiRkuECQIwhEQ==",
192
+ "version": "3.0.0-beta.41",
193
+ "resolved": "https://registry.npmjs.org/@naisys/common/-/common-3.0.0-beta.41.tgz",
194
+ "integrity": "sha512-TuaJbDPsNkqTM7HCcMjGM6g9SvwohkEcOSieWAsl4z4uSOvlfYd064vjCmJkhjPNwXTiKYd3OAj23HD1adv0cg==",
195
195
  "dependencies": {
196
196
  "semver": "^7.7.4",
197
197
  "zod": "^4.3.6"
198
198
  }
199
199
  },
200
200
  "node_modules/@naisys/common-node": {
201
- "version": "3.0.0-beta.40",
202
- "resolved": "https://registry.npmjs.org/@naisys/common-node/-/common-node-3.0.0-beta.40.tgz",
203
- "integrity": "sha512-+ACXA1oBPv/2YFaw1zyKMMZPUPtpSRntMwR0PBxz1DhXxTV5IgWjRHusxqr0Eh+fd17HqrpRvBw1Mp86kwAXyQ==",
201
+ "version": "3.0.0-beta.41",
202
+ "resolved": "https://registry.npmjs.org/@naisys/common-node/-/common-node-3.0.0-beta.41.tgz",
203
+ "integrity": "sha512-Zmxs6kwIWdIXlZuoCuUhGiu3pky5wDZv62YsoN3N11xLRt0CB0M6jsU8n2kygSHxvjV3qZ+HXEB8GdNTUDuY3Q==",
204
204
  "dependencies": {
205
- "@naisys/common": "3.0.0-beta.40",
205
+ "@naisys/common": "3.0.0-beta.41",
206
206
  "better-sqlite3": "^12.6.2",
207
207
  "js-yaml": "^4.1.1",
208
208
  "pino": "^10.3.1"
209
209
  }
210
210
  },
211
211
  "node_modules/@naisys/hub-database": {
212
- "version": "3.0.0-beta.40",
213
- "resolved": "https://registry.npmjs.org/@naisys/hub-database/-/hub-database-3.0.0-beta.40.tgz",
214
- "integrity": "sha512-Esavfu3plu4n1UymgyVkXpeLYNGC4UXtoS+QNnkvjVjZM7IGuFG5iDz37P6GFOAZA9Ir6sImES1iz0uK8D0Kxg==",
212
+ "version": "3.0.0-beta.41",
213
+ "resolved": "https://registry.npmjs.org/@naisys/hub-database/-/hub-database-3.0.0-beta.41.tgz",
214
+ "integrity": "sha512-p87AlaYVn7YT3Rw2o22+KDvRtYJWXOPDiVVUcyt4pNdB3xcqezVkf9a9LdqhqvE7hkzWaBGJsXDEDl3ILX6H5Q==",
215
215
  "dependencies": {
216
- "@naisys/common": "3.0.0-beta.40",
217
- "@naisys/common-node": "3.0.0-beta.40",
216
+ "@naisys/common": "3.0.0-beta.41",
217
+ "@naisys/common-node": "3.0.0-beta.41",
218
218
  "@prisma/adapter-better-sqlite3": "^7.5.0",
219
219
  "@prisma/client": "^7.5.0",
220
220
  "better-sqlite3": "^12.6.2",
@@ -222,11 +222,11 @@
222
222
  }
223
223
  },
224
224
  "node_modules/@naisys/hub-protocol": {
225
- "version": "3.0.0-beta.40",
226
- "resolved": "https://registry.npmjs.org/@naisys/hub-protocol/-/hub-protocol-3.0.0-beta.40.tgz",
227
- "integrity": "sha512-JlCOwypcAm8YbxZTVwszXPkaa89j3bJpJZi7uc5Cd+oXLbbJmCS1KpVgjQwdzU9TpacX8D0FkPk6gsoRT6fi5w==",
225
+ "version": "3.0.0-beta.41",
226
+ "resolved": "https://registry.npmjs.org/@naisys/hub-protocol/-/hub-protocol-3.0.0-beta.41.tgz",
227
+ "integrity": "sha512-pTh7zBSWF+S2/hLG07m/BLlQxXwxzl/LLWF3LnHOXlwjIvByS3VKsTp0K2Slo3H/qHKz41q8sE66HNpjdHezPA==",
228
228
  "dependencies": {
229
- "@naisys/common": "3.0.0-beta.40",
229
+ "@naisys/common": "3.0.0-beta.41",
230
230
  "zod": "^4.3.6"
231
231
  }
232
232
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naisys/hub",
3
- "version": "3.0.0-beta.40",
3
+ "version": "3.0.0-beta.41",
4
4
  "description": "NAISYS Hub - Adds persistence and multi-instance coordination to NAISYS",
5
5
  "type": "module",
6
6
  "main": "dist/naisysHub.js",
@@ -32,7 +32,7 @@
32
32
  "!dist/**/*.d.ts.map"
33
33
  ],
34
34
  "peerDependencies": {
35
- "@naisys/supervisor": "3.0.0-beta.40"
35
+ "@naisys/supervisor": "3.0.0-beta.41"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "@naisys/supervisor": {
@@ -40,10 +40,10 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@naisys/common": "3.0.0-beta.40",
44
- "@naisys/common-node": "3.0.0-beta.40",
45
- "@naisys/hub-database": "3.0.0-beta.40",
46
- "@naisys/hub-protocol": "3.0.0-beta.40",
43
+ "@naisys/common": "3.0.0-beta.41",
44
+ "@naisys/common-node": "3.0.0-beta.41",
45
+ "@naisys/hub-database": "3.0.0-beta.41",
46
+ "@naisys/hub-protocol": "3.0.0-beta.41",
47
47
  "commander": "^14.0.3",
48
48
  "dotenv": "^17.3.1",
49
49
  "fastify": "^5.8.2",