@dorokuma/herdsman-pi 0.6.1 → 0.6.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dorokuma/herdsman-pi",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Pi extension bridge for Herdsman agent history. Forked from @ryonakae/shepherd.",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/index.ts CHANGED
@@ -524,7 +524,20 @@ export function createHerdsmanPiExtension(options: ExtensionOptions = {}) {
524
524
  state.currentScope?.herdrSessionName === message.params.herdrSessionName &&
525
525
  state.currentScope.workspaceId === message.params.workspaceId
526
526
  ) {
527
- state.latestContext = message.params.context ?? undefined;
527
+ const next = message.params.context ?? undefined;
528
+ const retain = (snapshot: AgentWorkspaceContextSnapshot | undefined) =>
529
+ snapshot
530
+ ? {
531
+ ...snapshot,
532
+ agents: snapshot.agents.filter((agent) => {
533
+ const nextAgent = next?.agents.find((candidate) => candidate.paneId === agent.paneId);
534
+ if (!nextAgent) return false;
535
+ return !agent.id || !nextAgent.id || agent.id === nextAgent.id;
536
+ }),
537
+ }
538
+ : undefined;
539
+ state.latestContext = next;
540
+ state.pinnedContext = retain(state.pinnedContext);
528
541
  }
529
542
  return;
530
543
  }