@hyperdreamer/pi-webui 1.10.3 → 1.10.5
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
|
-
|
|
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>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const DEFAULT_PI_WEBUI_RELEASE_LOOKUP_CACHE_TTL_MS =
|
|
1
|
+
const DEFAULT_PI_WEBUI_RELEASE_LOOKUP_CACHE_TTL_MS = 15 * 60 * 1000;
|
|
2
2
|
export function createPiWebUiReleaseLookupCache(load, options = {}) {
|
|
3
3
|
const ttlMs = options.ttlMs ?? DEFAULT_PI_WEBUI_RELEASE_LOOKUP_CACHE_TTL_MS;
|
|
4
4
|
const now = options.now ?? Date.now;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piWebUiReleaseLookupCache.js","sourceRoot":"","sources":["../../src/server/piWebUiReleaseLookupCache.ts"],"names":[],"mappings":"AAAA,MAAM,4CAA4C,GAAG,
|
|
1
|
+
{"version":3,"file":"piWebUiReleaseLookupCache.js","sourceRoot":"","sources":["../../src/server/piWebUiReleaseLookupCache.ts"],"names":[],"mappings":"AAAA,MAAM,4CAA4C,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAqBpE,MAAM,UAAU,+BAA+B,CAC7C,IAAiD,EACjD,UAA4C,EAAE;IAE9C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,4CAA4C,CAAC;IAC5E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACpC,IAAI,MAAwC,CAAC;IAC7C,IAAI,OAAiG,CAAC;IACtG,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,OAAO;QACL,GAAG,CAAC,cAAsB,EAAE,gBAA6C,EAAE;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