@tbrandenburg/node-red-agents 0.3.1 → 0.3.3
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/nodes/agent/agent.js +7 -5
- package/package.json +1 -1
package/nodes/agent/agent.js
CHANGED
|
@@ -173,7 +173,7 @@ module.exports = function (RED) {
|
|
|
173
173
|
// active/queued numbers, no separate polling needed) and a
|
|
174
174
|
// timestamp (so external aggregation/history doesn't have to rely
|
|
175
175
|
// on message-arrival time).
|
|
176
|
-
function lifecycleEnvelope(msg, executionId, payload, agentName) {
|
|
176
|
+
function lifecycleEnvelope(msg, executionId, payload, agentName, cwd) {
|
|
177
177
|
return {
|
|
178
178
|
_msgid: msg._msgid,
|
|
179
179
|
topic: msg.topic,
|
|
@@ -182,6 +182,7 @@ module.exports = function (RED) {
|
|
|
182
182
|
runtime: node.runtime,
|
|
183
183
|
agentId: node.id,
|
|
184
184
|
agentName,
|
|
185
|
+
cwd,
|
|
185
186
|
executionId,
|
|
186
187
|
active: node.scheduler.activeCount,
|
|
187
188
|
queued: node.scheduler.queuedCount,
|
|
@@ -189,8 +190,8 @@ module.exports = function (RED) {
|
|
|
189
190
|
};
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
function emitEvent(send, msg, executionId, type, agentName) {
|
|
193
|
-
send([null, lifecycleEnvelope(msg, executionId, { type }, agentName)]);
|
|
193
|
+
function emitEvent(send, msg, executionId, type, agentName, cwd) {
|
|
194
|
+
send([null, lifecycleEnvelope(msg, executionId, { type }, agentName, cwd)]);
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
// The actual work for one execution. Only ever invoked by the
|
|
@@ -207,11 +208,11 @@ module.exports = function (RED) {
|
|
|
207
208
|
resolved,
|
|
208
209
|
executionId,
|
|
209
210
|
onEvent: (event) => {
|
|
210
|
-
send([null, lifecycleEnvelope(msg, executionId, event, resolved.agentName)]);
|
|
211
|
+
send([null, lifecycleEnvelope(msg, executionId, event, resolved.agentName, resolved.cwd)]);
|
|
211
212
|
},
|
|
212
213
|
onStatus: (status) => {
|
|
213
214
|
if (status === "running") {
|
|
214
|
-
emitEvent(send, msg, executionId, "running", resolved.agentName);
|
|
215
|
+
emitEvent(send, msg, executionId, "running", resolved.agentName, resolved.cwd);
|
|
215
216
|
} else {
|
|
216
217
|
// Terminal (completed/failed/timeout): stash rather
|
|
217
218
|
// than emit immediately -- the scheduler hasn't
|
|
@@ -296,6 +297,7 @@ module.exports = function (RED) {
|
|
|
296
297
|
item.executionId,
|
|
297
298
|
item.finalStatus,
|
|
298
299
|
item.resolved.agentName,
|
|
300
|
+
item.resolved.cwd,
|
|
299
301
|
);
|
|
300
302
|
}
|
|
301
303
|
updateStatus();
|