chatroom-cli 1.119.2 → 1.119.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
@@ -47792,12 +47792,32 @@ async function processTasksUpdate(taskService, configurationService, pass, isTas
47792
47792
  });
47793
47793
  if (!full || !slot?.harnessSessionId)
47794
47794
  return { kind: "task-unavailable" };
47795
+ const delivery = {
47796
+ chatroomId: task.chatroomId,
47797
+ role: task.agentConfig.role,
47798
+ taskId: task.taskId,
47799
+ harnessSessionId: slot.harnessSessionId
47800
+ };
47801
+ options.onTaskDeliveryStarted?.(delivery);
47795
47802
  let delivered;
47796
- await taskService.deliverNativeTask(full, slot.harnessSessionId, (result) => {
47797
- delivered = result;
47798
- });
47799
- if (!delivered)
47803
+ try {
47804
+ await taskService.deliverNativeTask(full, slot.harnessSessionId, (result) => {
47805
+ delivered = result;
47806
+ });
47807
+ } catch (error51) {
47808
+ options.onTaskDeliveryFailed?.({
47809
+ ...delivery,
47810
+ reason: "injection_not_confirmed"
47811
+ });
47812
+ throw error51;
47813
+ }
47814
+ if (!delivered) {
47815
+ options.onTaskDeliveryFailed?.({
47816
+ ...delivery,
47817
+ reason: "injection_not_confirmed"
47818
+ });
47800
47819
  return { kind: "failed", reason: "injection_not_confirmed" };
47820
+ }
47801
47821
  return { kind: "delivered", delivered };
47802
47822
  }
47803
47823
  };
@@ -48165,12 +48185,23 @@ class AgentWorkManager {
48165
48185
  return [];
48166
48186
  return processTasksUpdate(this.deliveryTaskService, this.deps.configurationService, pass, ({ chatroomId, role, taskId }) => this.deps.agentTaskState.get({ chatroomId, role })?.taskId === taskId, {
48167
48187
  tasks,
48188
+ onTaskDeliveryStarted: (args2) => this.recordTaskDeliveryStarted(args2),
48189
+ onTaskDeliveryFailed: (args2) => this.recordTaskDeliveryFailed(args2),
48168
48190
  onTaskDelivered: (args2) => {
48169
48191
  this.recordTaskDelivered(args2);
48170
48192
  onTaskDelivered?.(args2);
48171
48193
  }
48172
48194
  }, this.deps.acquireNativeDeliverySlot);
48173
48195
  }
48196
+ recordTaskDeliveryStarted(args2) {
48197
+ this.deps.agentTaskState.start(args2);
48198
+ }
48199
+ recordTaskDeliveryFailed(args2) {
48200
+ const key = { chatroomId: args2.chatroomId, role: args2.role };
48201
+ if (this.deps.agentTaskState.get(key)?.taskId === args2.taskId) {
48202
+ this.deps.agentTaskState.clear(key);
48203
+ }
48204
+ }
48174
48205
  recordTaskDelivered(args2) {
48175
48206
  this.deps.agentTaskState.start(args2);
48176
48207
  }
@@ -136096,4 +136127,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
136096
136127
  });
136097
136128
  program2.parse();
136098
136129
 
136099
- //# debugId=35DA39C4D925D97464756E2164756E21
136130
+ //# debugId=90995C9AB254B6D464756E2164756E21