feat: scope overview to durable activity data

This commit is contained in:
mirivlad 2026-07-12 21:11:53 +08:00
parent 5a249dcf24
commit c567b229cc
3 changed files with 23 additions and 7 deletions

View File

@ -136,6 +136,7 @@
].flatMap(key => normalizeRows(settings?.[key])).filter(item => { ].flatMap(key => normalizeRows(settings?.[key])).filter(item => {
const tagged = String(item.workspaceRootPath || item.workspaceName || item.workspaceNodeId || '').trim(); const tagged = String(item.workspaceRootPath || item.workspaceName || item.workspaceNodeId || '').trim();
if (tagged !== workspace) return false; if (tagged !== workspace) return false;
if (String(item.globalState || 'inbox') === 'archived') return false;
const captureId = String(item.captureId || ''); const captureId = String(item.captureId || '');
if (!captureId || seen.has(captureId)) return !captureId; if (!captureId || seen.has(captureId)) return !captureId;
seen.add(captureId); seen.add(captureId);
@ -501,9 +502,14 @@
const workspaceAtStart = String(workspaceRootPath || '').trim(); const workspaceAtStart = String(workspaceRootPath || '').trim();
loadedWorkspaceRoot = workspaceAtStart; loadedWorkspaceRoot = workspaceAtStart;
loading = true; loading = true;
const [browserSettings, activitySettings, journalSettings, todoSettings, resources] = await Promise.all([ const [browserSettings, activitySettings, activityRecords, journalSettings, todoSettings, resources] = await Promise.all([
readPluginSettings('verstak.browser-inbox'), readPluginSettings('verstak.browser-inbox'),
readPluginSettings('verstak.activity'), readPluginSettings('verstak.activity'),
App.ReadPluginDataNDJSON
? App.ReadPluginDataNDJSON('verstak.activity', 'activity-events')
.then(value => decodeTuple(value, []))
.catch(() => [])
: Promise.resolve([]),
readPluginSettings('verstak.journal'), readPluginSettings('verstak.journal'),
readPluginSettings('verstak.todo'), readPluginSettings('verstak.todo'),
loadWorkspaceResources(), loadWorkspaceResources(),
@ -511,11 +517,10 @@
if (workspaceAtStart !== String(workspaceRootPath || '').trim()) return; if (workspaceAtStart !== String(workspaceRootPath || '').trim()) return;
captures = browserCaptureRowsForWorkspace(browserSettings); captures = browserCaptureRowsForWorkspace(browserSettings);
activityEvents = rowsFor(activitySettings, [ activityEvents = normalizeRows(activityRecords).filter(item => {
workspaceKey('events:workspace:'), const tagged = String(item.workspaceRootPath || item.workspaceName || item.workspaceNodeId || '').trim();
'events:global', return !tagged || tagged === workspaceAtStart;
'events', });
]);
journalEntries = rowsFor(journalSettings, [ journalEntries = rowsFor(journalSettings, [
workspaceKey('worklog:workspace:'), workspaceKey('worklog:workspace:'),
'worklog', 'worklog',

View File

@ -3,6 +3,7 @@
import PluginBundleHost from '../plugin-host/PluginBundleHost.svelte'; import PluginBundleHost from '../plugin-host/PluginBundleHost.svelte';
import Icon from '../ui/Icon.svelte'; import Icon from '../ui/Icon.svelte';
import { i18n } from '../i18n/index.js'; import { i18n } from '../i18n/index.js';
import { debug } from '../log/debug.js';
export let openedResource = null; export let openedResource = null;
let locale = i18n.getLocale(); let locale = i18n.getLocale();
@ -53,7 +54,9 @@
{:else if openedResource} {:else if openedResource}
<div class="workbench-header vt-page-header"> <div class="workbench-header vt-page-header">
<span class="workbench-title vt-page-title">{resourcePath}</span> <span class="workbench-title vt-page-title">{resourcePath}</span>
<span class="workbench-provider vt-badge accent">{providerId}</span> {#if debug.isEnabled() && providerId}
<span class="workbench-provider vt-badge accent" data-debug-provider>{providerId}</span>
{/if}
<button class="close-btn btn-ghost btn-icon" type="button" title={tr('common.close')} aria-label={tr('common.close')} on:click={closeWorkbench}> <button class="close-btn btn-ghost btn-icon" type="button" title={tr('common.close')} aria-label={tr('common.close')} on:click={closeWorkbench}>
<Icon name="x" size={18} /> <Icon name="x" size={18} />
</button> </button>

View File

@ -3343,6 +3343,14 @@
}, },
ReadPluginDataNDJSON: function (pluginId, name) { ReadPluginDataNDJSON: function (pluginId, name) {
var data = (pluginData[pluginId] && pluginData[pluginId][name]) || []; var data = (pluginData[pluginId] && pluginData[pluginId][name]) || [];
if (!Array.isArray(data) && pluginId === 'verstak.activity' && name === 'activity-events') data = [];
if (!data.length && pluginId === 'verstak.activity' && name === 'activity-events') {
data = Object.keys(pluginSettings[pluginId] || {}).filter(function (key) {
return key === 'events' || key === 'events:global' || key.indexOf('events:workspace:') === 0;
}).flatMap(function (key) {
return Array.isArray(pluginSettings[pluginId][key]) ? pluginSettings[pluginId][key] : [];
});
}
return Promise.resolve([Array.isArray(data) ? data.slice() : [], '']); return Promise.resolve([Array.isArray(data) ? data.slice() : [], '']);
}, },
WritePluginDataJSON: function (pluginId, name, data) { WritePluginDataJSON: function (pluginId, name, data) {