@radaros/queue 0.3.8 → 0.3.9

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -26
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22,9 +22,7 @@ var AgentQueue = class {
22
22
  connection: config.connection
23
23
  });
24
24
  } catch {
25
- throw new Error(
26
- "bullmq and ioredis are required for AgentQueue. Install them: npm install bullmq ioredis"
27
- );
25
+ throw new Error("bullmq and ioredis are required for AgentQueue. Install them: npm install bullmq ioredis");
28
26
  }
29
27
  }
30
28
  async enqueueAgentRun(opts) {
@@ -40,11 +38,7 @@ var AgentQueue = class {
40
38
  if (opts.delay !== void 0) jobOpts.delay = opts.delay;
41
39
  if (opts.attempts !== void 0) jobOpts.attempts = opts.attempts;
42
40
  if (opts.repeat) jobOpts.repeat = opts.repeat;
43
- const job = await this.queue.add(
44
- `agent:${opts.agentName}`,
45
- payload,
46
- jobOpts
47
- );
41
+ const job = await this.queue.add(`agent:${opts.agentName}`, payload, jobOpts);
48
42
  return { jobId: job.id };
49
43
  }
50
44
  async enqueueWorkflow(opts) {
@@ -56,11 +50,7 @@ var AgentQueue = class {
56
50
  };
57
51
  const jobOpts = {};
58
52
  if (opts.priority !== void 0) jobOpts.priority = opts.priority;
59
- const job = await this.queue.add(
60
- `workflow:${opts.workflowName}`,
61
- payload,
62
- jobOpts
63
- );
53
+ const job = await this.queue.add(`workflow:${opts.workflowName}`, payload, jobOpts);
64
54
  return { jobId: job.id };
65
55
  }
66
56
  async getJobStatus(jobId) {
@@ -117,14 +107,10 @@ var AgentWorker = class {
117
107
  if (payload.type === "agent") {
118
108
  const agent = config.agentRegistry[payload.agentName];
119
109
  if (!agent) {
120
- throw new Error(
121
- `Agent "${payload.agentName}" not found in registry`
122
- );
110
+ throw new Error(`Agent "${payload.agentName}" not found in registry`);
123
111
  }
124
- const onChunk = (evt) => {
125
- job.updateProgress(
126
- typeof job.progress === "number" ? job.progress + 1 : 1
127
- );
112
+ const onChunk = (_evt) => {
113
+ job.updateProgress(typeof job.progress === "number" ? job.progress + 1 : 1);
128
114
  };
129
115
  agent.eventBus.on("run.stream.chunk", onChunk);
130
116
  try {
@@ -140,9 +126,7 @@ var AgentWorker = class {
140
126
  if (payload.type === "workflow") {
141
127
  const workflow = config.workflowRegistry?.[payload.workflowName];
142
128
  if (!workflow) {
143
- throw new Error(
144
- `Workflow "${payload.workflowName}" not found in registry`
145
- );
129
+ throw new Error(`Workflow "${payload.workflowName}" not found in registry`);
146
130
  }
147
131
  const result = await workflow.run({
148
132
  sessionId: payload.sessionId
@@ -157,9 +141,7 @@ var AgentWorker = class {
157
141
  }
158
142
  );
159
143
  } catch {
160
- throw new Error(
161
- "bullmq and ioredis are required for AgentWorker. Install them: npm install bullmq ioredis"
162
- );
144
+ throw new Error("bullmq and ioredis are required for AgentWorker. Install them: npm install bullmq ioredis");
163
145
  }
164
146
  }
165
147
  start() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radaros/queue",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "typescript": "^5.6.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@radaros/core": "^0.3.8",
27
+ "@radaros/core": "^0.3.9",
28
28
  "bullmq": "^5.0.0",
29
29
  "ioredis": "^5.0.0"
30
30
  },