opencode-subagent-magazine 1.1.2 → 1.1.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/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/index.js +11 -13
- package/dist/tui.js +1859 -0
- package/package.json +6 -3
- package/src/_version.ts +1 -1
- package/src/index.tsx +11 -13
package/dist/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PLUGIN_VERSION = "1.1.
|
|
1
|
+
export declare const PLUGIN_VERSION = "1.1.3";
|
package/dist/_version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// auto-generated
|
|
2
|
-
export const PLUGIN_VERSION = "1.1.
|
|
2
|
+
export const PLUGIN_VERSION = "1.1.3";
|
package/dist/index.js
CHANGED
|
@@ -198,8 +198,7 @@ function safeErrorMsg(err) {
|
|
|
198
198
|
// ===================================================================
|
|
199
199
|
// Sidebar component
|
|
200
200
|
// ===================================================================
|
|
201
|
-
//
|
|
202
|
-
// 当用户在子 session 内部时,handleSessionEnd 可通过此缓存找到父 session 的 entries。
|
|
201
|
+
// 模块级缓存:各 session 的 entry 状态独立存储,不随当前视图切换而清除。
|
|
203
202
|
const globalEntryCache = new Map();
|
|
204
203
|
function SubAgentPanel(props) {
|
|
205
204
|
const t = (key) => I18N[props.lang()][key] ?? key;
|
|
@@ -283,8 +282,8 @@ function SubAgentPanel(props) {
|
|
|
283
282
|
const setEntryMap = (arg) => {
|
|
284
283
|
setEntryMapRaw((prev) => {
|
|
285
284
|
const next = typeof arg === "function" ? arg(prev) : arg;
|
|
286
|
-
//
|
|
287
|
-
//
|
|
285
|
+
// entry 状态落定(done/error)时立即持久化到 KV,跳过常规 debounce,
|
|
286
|
+
// 确保跨视图的状态一致性。
|
|
288
287
|
let needsImmediateFlush = false;
|
|
289
288
|
for (const [id, entry] of next) {
|
|
290
289
|
const prevEntry = prev.get(id);
|
|
@@ -305,7 +304,7 @@ function SubAgentPanel(props) {
|
|
|
305
304
|
else {
|
|
306
305
|
persistEntries(props.sessionId, next);
|
|
307
306
|
}
|
|
308
|
-
//
|
|
307
|
+
// 同步到模块级缓存,供其他视图读取当前 session 的最新状态
|
|
309
308
|
globalEntryCache.set(props.sessionId, new Map(next));
|
|
310
309
|
return next;
|
|
311
310
|
});
|
|
@@ -678,21 +677,20 @@ function SubAgentPanel(props) {
|
|
|
678
677
|
}
|
|
679
678
|
return changed ? next : prev;
|
|
680
679
|
});
|
|
681
|
-
//
|
|
682
|
-
//
|
|
683
|
-
// 通过全局缓存(切换前保留的父 session entries)查找并更新,再同步回 KV。
|
|
680
|
+
// 当子代理所属的父 session 与当前视图不同时,通过模块级缓存定位
|
|
681
|
+
// 并更新父 session 的 entry 状态,随后写回 KV。
|
|
684
682
|
try {
|
|
685
683
|
const sessionObj = props.api.state.session.get(sid);
|
|
686
684
|
const parentSid = sessionObj?.parentID;
|
|
687
685
|
if (parentSid && parentSid !== props.sessionId) {
|
|
688
|
-
//
|
|
686
|
+
// 优先从模块级缓存获取父 session 的 entries,不受当前视图切换影响
|
|
689
687
|
const parentCache = globalEntryCache.get(parentSid);
|
|
690
688
|
const nowTs = Date.now();
|
|
691
689
|
let found = false;
|
|
692
690
|
if (parentCache) {
|
|
693
691
|
found = tryMatchAndUpdate(parentCache, sid, status, nowTs);
|
|
694
692
|
}
|
|
695
|
-
// 缓存未命中时回退到 KV
|
|
693
|
+
// 缓存未命中时回退到 KV 读取
|
|
696
694
|
if (!found) {
|
|
697
695
|
const data = loadSessionData();
|
|
698
696
|
const rec = data[parentSid];
|
|
@@ -700,14 +698,14 @@ function SubAgentPanel(props) {
|
|
|
700
698
|
const fallbackMap = new Map(rec.entries.map((e) => [e.id, e]));
|
|
701
699
|
found = tryMatchAndUpdate(fallbackMap, sid, status, nowTs);
|
|
702
700
|
if (found) {
|
|
703
|
-
//
|
|
701
|
+
// 回退命中后写入 KV 并回填缓存
|
|
704
702
|
data[parentSid] = { ...rec, ts: nowTs, entries: [...fallbackMap.values()] };
|
|
705
703
|
saveSessionData(data);
|
|
706
704
|
globalEntryCache.set(parentSid, fallbackMap);
|
|
707
705
|
}
|
|
708
706
|
}
|
|
709
707
|
}
|
|
710
|
-
//
|
|
708
|
+
// 将模块级缓存中的最新状态同步到 KV
|
|
711
709
|
if (found && parentCache) {
|
|
712
710
|
const data = loadSessionData();
|
|
713
711
|
data[parentSid] = { ...data[parentSid], ts: nowTs, entries: [...parentCache.values()] };
|
|
@@ -838,7 +836,7 @@ function SubAgentPanel(props) {
|
|
|
838
836
|
// scan uses setEntryMapRaw — ephemeral data, not persisted to kv.
|
|
839
837
|
// Only event-driven changes (handlePartUpdated, handleSessionEnd) persist.
|
|
840
838
|
setEntryMapRaw((prev) => {
|
|
841
|
-
//
|
|
839
|
+
// 优先从模块级缓存加载,KV 仅作缓存未命中时的回退
|
|
842
840
|
const next = switched
|
|
843
841
|
? new Map(globalEntryCache.get(sid) ?? loadEntries(sid))
|
|
844
842
|
: new Map(prev);
|