better-opencode-async-agents 0.4.1 → 0.5.1

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 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAMpE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE;IACR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,CACP,SAAS,EAAE,gBAAgB,GAAG,YAAY,GAAG,gBAAgB,EAC7D,IAAI,EAAE,cAAc,KACjB,IAAI,CAAC;CACX,GACA,IAAI,CA2BN;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAO7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,MAAM,SAAI,GAAG,MAAM,CAkBzF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAexE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAalE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CA8B7D;AAGD,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM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B,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAalE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CA8B7D;AAGD,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,GACzD,OAAO,CAAC,MAAM,CAAC,CA8CjB"}
package/dist/index.js CHANGED
@@ -909,23 +909,28 @@ function setTaskStatus(task, status, options) {
909
909
  }
910
910
  function shortId(sessionId, minLen = 8) {
911
911
  if (!sessionId.startsWith("ses_")) {
912
- return sessionId.slice(0, minLen + 4);
912
+ return sessionId.slice(0, minLen);
913
913
  }
914
914
  const suffix = sessionId.slice(4);
915
- return `ses_${suffix.slice(0, minLen)}`;
915
+ return suffix.slice(0, minLen);
916
916
  }
917
917
  function uniqueShortId(sessionId, siblingIds, minLen = 8) {
918
918
  if (!sessionId.startsWith("ses_")) {
919
- return sessionId.slice(0, minLen + 4);
919
+ return sessionId.slice(0, minLen);
920
920
  }
921
921
  const suffix = sessionId.slice(4);
922
922
  for (let len = minLen;len <= suffix.length; len++) {
923
- const candidate = `ses_${suffix.slice(0, len)}`;
924
- const hasClash = siblingIds.some((otherId) => otherId !== sessionId && otherId.startsWith(candidate));
923
+ const candidate = suffix.slice(0, len);
924
+ const hasClash = siblingIds.some((otherId) => {
925
+ if (otherId === sessionId)
926
+ return false;
927
+ const otherSuffix = otherId.startsWith("ses_") ? otherId.slice(4) : otherId;
928
+ return otherSuffix.startsWith(candidate);
929
+ });
925
930
  if (!hasClash)
926
931
  return candidate;
927
932
  }
928
- return sessionId;
933
+ return suffix;
929
934
  }
930
935
  function formatDuration(startStr, endStr) {
931
936
  const start = new Date(startStr);
@@ -1117,7 +1122,7 @@ function showProgressToast(allTasks, animationFrame, client, getTasksArray) {
1117
1122
  toolsStr = prevTools.length > 0 ? ` - ${prevTools.join(" > ")} > 「${lastTool}」` : ` - 「${lastTool}」`;
1118
1123
  }
1119
1124
  const callCount = task.progress?.toolCalls ?? 0;
1120
- const callsStr = callCount > 0 ? ` [${callCount} calls]` : "";
1125
+ const callsStr = callCount > 0 ? ` [\uD83D\uDD27 ${callCount}]` : "";
1121
1126
  taskLines.push(`${spinner} [${shortId(task.sessionID)}] ${task.agent}: ${task.description} (${duration})${toolsStr}${callsStr}`);
1122
1127
  }
1123
1128
  const batchCompleted = batchTasks.filter((t) => t.status === "completed" || t.status === "error" || t.status === "cancelled").sort((a, b) => {
@@ -1831,9 +1836,10 @@ class BackgroundManager {
1831
1836
  return this.tasks.get(id);
1832
1837
  }
1833
1838
  findTasksByPrefix(prefix) {
1839
+ const normalizedPrefix = prefix.startsWith("ses_") ? prefix : `ses_${prefix}`;
1834
1840
  const matching = [];
1835
1841
  for (const [id] of this.tasks) {
1836
- if (id.startsWith(prefix)) {
1842
+ if (id.startsWith(normalizedPrefix)) {
1837
1843
  const task = this.tasks.get(id);
1838
1844
  if (task) {
1839
1845
  matching.push(task);
@@ -1846,6 +1852,10 @@ class BackgroundManager {
1846
1852
  if (this.tasks.has(idOrPrefix)) {
1847
1853
  return idOrPrefix;
1848
1854
  }
1855
+ const withPrefix = idOrPrefix.startsWith("ses_") ? idOrPrefix : `ses_${idOrPrefix}`;
1856
+ if (withPrefix !== idOrPrefix && this.tasks.has(withPrefix)) {
1857
+ return withPrefix;
1858
+ }
1849
1859
  const matching = this.findTasksByPrefix(idOrPrefix);
1850
1860
  if (matching.length === 0) {
1851
1861
  return null;
@@ -1864,7 +1874,12 @@ class BackgroundManager {
1864
1874
  if (persistedIds.includes(idOrPrefix)) {
1865
1875
  return idOrPrefix;
1866
1876
  }
1867
- const matching = persistedIds.filter((id) => id.startsWith(idOrPrefix)).map((id) => ({ id, task: persisted[id] })).filter((item) => item.task !== undefined).sort((a, b) => new Date(b.task.createdAt).getTime() - new Date(a.task.createdAt).getTime());
1877
+ const withPrefix = idOrPrefix.startsWith("ses_") ? idOrPrefix : `ses_${idOrPrefix}`;
1878
+ if (withPrefix !== idOrPrefix && persistedIds.includes(withPrefix)) {
1879
+ return withPrefix;
1880
+ }
1881
+ const normalizedPrefix = idOrPrefix.startsWith("ses_") ? idOrPrefix : `ses_${idOrPrefix}`;
1882
+ const matching = persistedIds.filter((id) => id.startsWith(normalizedPrefix)).map((id) => ({ id, task: persisted[id] })).filter((item) => item.task !== undefined).sort((a, b) => new Date(b.task.createdAt).getTime() - new Date(a.task.createdAt).getTime());
1868
1883
  if (matching.length > 0 && matching[0]) {
1869
1884
  return matching[0].id;
1870
1885
  }
@@ -15176,5 +15191,5 @@ export {
15176
15191
  plugin as default
15177
15192
  };
15178
15193
 
15179
- //# debugId=A899C06A316CFC2964756E2164756E21
15194
+ //# debugId=A03BD4C041472DD164756E2164756E21
15180
15195
  //# sourceMappingURL=index.js.map