@shipers-dev/multi 0.4.2 → 0.4.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/dist/index.js CHANGED
@@ -5381,7 +5381,7 @@ var LOG_PATH = join(MULTI_DIR, "logs", "agent.log");
5381
5381
  var SKILLS_DIR = join(MULTI_DIR, "skills");
5382
5382
  var STOP_PATH = join(MULTI_DIR, "stop.flag");
5383
5383
  var TASKS_DB_PATH = join(MULTI_DIR, "tasks.db");
5384
- var VERSION = "0.4.2";
5384
+ var VERSION = "0.4.3";
5385
5385
  var COMMANDS = {
5386
5386
  setup: "Register this device with a workspace",
5387
5387
  connect: "Connect device to realtime hub and execute assigned tasks",
@@ -5776,16 +5776,21 @@ async function handleRunTask(apiUrl, deviceId, task, detected) {
5776
5776
  let liveBody = "";
5777
5777
  let hadError = false;
5778
5778
  let hasAssistantText = false;
5779
- const ensureLiveComment = async () => {
5779
+ let liveCommentPromise = null;
5780
+ const ensureLiveComment = () => {
5780
5781
  if (liveCommentId)
5781
- return;
5782
- const res = await apiClient.post(`${apiUrl}/api/issues/${issueId}/comments`, {
5783
- author_type: "agent",
5784
- author_id: task.agent_id,
5785
- author_name: "agent",
5786
- body: "\u2026"
5787
- });
5788
- liveCommentId = res.data?.id;
5782
+ return Promise.resolve();
5783
+ if (!liveCommentPromise) {
5784
+ liveCommentPromise = apiClient.post(`${apiUrl}/api/issues/${issueId}/comments`, {
5785
+ author_type: "agent",
5786
+ author_id: task.agent_id,
5787
+ author_name: "agent",
5788
+ body: "\u2026"
5789
+ }).then((res) => {
5790
+ liveCommentId = res.data?.id;
5791
+ });
5792
+ }
5793
+ return liveCommentPromise;
5789
5794
  };
5790
5795
  const patchLive = async (body) => {
5791
5796
  if (!liveCommentId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipers-dev/multi",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "multi-agent": "./dist/index.js"
package/src/index.ts CHANGED
@@ -16,7 +16,7 @@ const LOG_PATH = join(MULTI_DIR, 'logs', 'agent.log');
16
16
  const SKILLS_DIR = join(MULTI_DIR, 'skills');
17
17
  const STOP_PATH = join(MULTI_DIR, 'stop.flag');
18
18
  const TASKS_DB_PATH = join(MULTI_DIR, 'tasks.db');
19
- const VERSION = '0.4.2';
19
+ const VERSION = '0.4.3';
20
20
 
21
21
  const COMMANDS = {
22
22
  setup: 'Register this device with a workspace',
@@ -397,13 +397,16 @@ async function handleRunTask(apiUrl: string, deviceId: string, task: any, detect
397
397
  let liveBody = '';
398
398
  let hadError = false;
399
399
  let hasAssistantText = false;
400
-
401
- const ensureLiveComment = async () => {
402
- if (liveCommentId) return;
403
- const res = await apiClient.post<any>(`${apiUrl}/api/issues/${issueId}/comments`, {
404
- author_type: 'agent', author_id: task.agent_id, author_name: 'agent', body: '…',
405
- });
406
- liveCommentId = res.data?.id;
400
+ let liveCommentPromise: Promise<void> | null = null;
401
+
402
+ const ensureLiveComment = (): Promise<void> => {
403
+ if (liveCommentId) return Promise.resolve();
404
+ if (!liveCommentPromise) {
405
+ liveCommentPromise = apiClient.post<any>(`${apiUrl}/api/issues/${issueId}/comments`, {
406
+ author_type: 'agent', author_id: task.agent_id, author_name: 'agent', body: '…',
407
+ }).then(res => { liveCommentId = res.data?.id; });
408
+ }
409
+ return liveCommentPromise;
407
410
  };
408
411
  const patchLive = async (body: string) => {
409
412
  if (!liveCommentId) return;