@henryqw/pi-herdr-done 0.5.1 → 0.5.2
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/extensions/done.ts +4 -6
- package/package.json +1 -1
package/extensions/done.ts
CHANGED
|
@@ -64,15 +64,13 @@ export default function herdrDoneExtension(pi: ExtensionAPI): void {
|
|
|
64
64
|
const listing = await herdr.json(["tab", "list"], { cwd: ctx.cwd });
|
|
65
65
|
const tabs = (listing.result as { tabs?: TabEntry[] } | undefined)?.tabs;
|
|
66
66
|
if (!Array.isArray(tabs)) throw new Error("herdr tab list returned no tabs.");
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
.map((tab) => [tab.tab_id, tab]));
|
|
67
|
+
const validTabs = tabs.filter((tab): tab is TabEntry & { tab_id: string } => typeof tab.tab_id === "string");
|
|
68
|
+
const tabsById = new Map(validTabs.map((tab) => [tab.tab_id, tab]));
|
|
70
69
|
if (tabsById.get(tabId)?.workspace_id !== workspaceId) {
|
|
71
70
|
throw new Error(`Herdr tab ${tabId} does not belong to workspace ${workspaceId}.`);
|
|
72
71
|
}
|
|
73
|
-
siblingTabIds =
|
|
74
|
-
.filter((tab)
|
|
75
|
-
typeof tab.tab_id === "string" && tab.tab_id !== tabId && tab.workspace_id === workspaceId)
|
|
72
|
+
siblingTabIds = validTabs
|
|
73
|
+
.filter((tab) => tab.tab_id !== tabId && tab.workspace_id === workspaceId)
|
|
76
74
|
.map((tab) => tab.tab_id);
|
|
77
75
|
const blockers = dependentIds.filter((id) => tabsById.get(id)?.workspace_id !== workspaceId);
|
|
78
76
|
if (blockers.length > 0) {
|