@hyperdreamer/pi-webui 1.10.3 → 1.10.4

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.
@@ -9,6 +9,7 @@ const CATEGORY_CLASS = {
9
9
  convention: "cat-teal",
10
10
  };
11
11
  const TRUNCATE_LENGTH = 120;
12
+ const MEMORY_GROUP_SELECTOR = "details.memory-group";
12
13
  export function categoryBadgeLabel(category) {
13
14
  return category ?? "uncategorized";
14
15
  }
@@ -102,6 +103,8 @@ class PiWebUiMemoryPanel extends _BaseElement {
102
103
  }
103
104
  /** Accept the core-owned memory state and render synchronously. */
104
105
  set memoryState(value) {
106
+ if (this.state === value)
107
+ return;
105
108
  this.state = value;
106
109
  this.render();
107
110
  }
@@ -116,9 +119,19 @@ class PiWebUiMemoryPanel extends _BaseElement {
116
119
  // No timers to clean up — the core controller owns that lifetime.
117
120
  }
118
121
  render() {
119
- this.root.innerHTML = `${panelStyles()}${renderPanelState(this.state)}`;
122
+ const expandedGroups = this.expandedMemoryGroups();
123
+ this.root.innerHTML = `${panelStyles()}${renderPanelState(this.state, expandedGroups)}`;
120
124
  this.attachEventListeners();
121
125
  }
126
+ expandedMemoryGroups() {
127
+ const expanded = new Set();
128
+ for (const group of this.root.querySelectorAll(MEMORY_GROUP_SELECTOR)) {
129
+ const scope = group.dataset["memoryGroup"];
130
+ if (group.open && isMemoryGroupScope(scope))
131
+ expanded.add(scope);
132
+ }
133
+ return expanded;
134
+ }
122
135
  attachEventListeners() {
123
136
  const retry = this.retry;
124
137
  if (retry === undefined)
@@ -128,7 +141,7 @@ class PiWebUiMemoryPanel extends _BaseElement {
128
141
  });
129
142
  }
130
143
  }
131
- export function renderPanelState(state) {
144
+ export function renderPanelState(state, expandedGroups = new Set()) {
132
145
  switch (state.kind) {
133
146
  case "unavailable":
134
147
  return `<section class="empty">Select a workspace.</section>`;
@@ -143,14 +156,18 @@ export function renderPanelState(state) {
143
156
  return `<section class="viewer">
144
157
  ${state.refreshError === undefined ? "" : `<div class="status warning">${escapeHtml(state.refreshError)}</div>`}
145
158
  ${renderMemoryGroupHtml({
159
+ scope: "global",
146
160
  title: "Global memory",
147
161
  entries: state.globalEntries,
148
162
  emptyMessage: "No global memories found.",
163
+ open: expandedGroups.has("global"),
149
164
  })}
150
165
  ${renderMemoryGroupHtml({
166
+ scope: "project",
151
167
  title: "Project-specific memory",
152
168
  entries: state.projectEntries,
153
169
  emptyMessage: "No project-specific memories found.",
170
+ open: expandedGroups.has("project"),
154
171
  ...(state.projectUnavailableMessage === undefined
155
172
  ? {}
156
173
  : { unavailableMessage: state.projectUnavailableMessage }),
@@ -169,7 +186,7 @@ function renderMemoryGroupHtml(options) {
169
186
  ? `<p class="memory-group-message">${escapeHtml(options.emptyMessage)}</p>`
170
187
  : `${hasPartialWarning ? `<p class="memory-group-message warning">${escapeHtml(options.unavailableMessage)}</p>` : ""}${options.entries.map((entry) => renderEntryHtml(entry)).join("")}`;
171
188
  return `
172
- <details class="memory-group">
189
+ <details class="memory-group" data-memory-group="${options.scope}"${options.open ? " open" : ""}>
173
190
  <summary>
174
191
  <svg class="memory-group-chevron" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m9 18 6-6-6-6"></path></svg>
175
192
  <span class="memory-group-title">${escapeHtml(options.title)}</span>
@@ -179,6 +196,9 @@ function renderMemoryGroupHtml(options) {
179
196
  </details>
180
197
  `;
181
198
  }
199
+ function isMemoryGroupScope(value) {
200
+ return value === "global" || value === "project";
201
+ }
182
202
  function panelStyles() {
183
203
  return `
184
204
  <style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperdreamer/pi-webui",
3
- "version": "1.10.3",
3
+ "version": "1.10.4",
4
4
  "description": "Web UI for persistent Pi Coding Agent sessions in real workspaces.",
5
5
  "license": "MIT",
6
6
  "author": "Federico Jaramillo Martinez and HyperDreamer",