dsh-mnemon 0.1.0 → 0.1.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/README.en.md +33 -3
- package/README.md +33 -3
- package/SECURITY.md +89 -0
- package/cordis.patch.yml +1 -0
- package/docs/en/README.md +1 -0
- package/docs/en/configuration.md +17 -7
- package/docs/en/getting-started.md +23 -5
- package/docs/en/interfaces.md +17 -3
- package/docs/en/operations.md +9 -4
- package/docs/en/project-overview.md +3 -1
- package/docs/en/roadmap.md +1 -1
- package/docs/en/storage-model.md +1 -1
- package/docs/zh-CN/README.md +1 -0
- package/docs/zh-CN/configuration.md +17 -7
- package/docs/zh-CN/getting-started.md +23 -5
- package/docs/zh-CN/interfaces.md +17 -3
- package/docs/zh-CN/operations.md +9 -4
- package/docs/zh-CN/project-overview.md +3 -1
- package/docs/zh-CN/roadmap.md +1 -1
- package/docs/zh-CN/storage-model.md +1 -1
- package/lib/client.js +2545 -620
- package/lib/client.js.map +1 -1
- package/lib/index.js +3816 -2481
- package/lib/types/activity.d.ts +32 -0
- package/lib/types/activity.d.ts.map +1 -0
- package/lib/types/activity.js +93 -0
- package/lib/types/activity.js.map +1 -0
- package/lib/types/client/MnemonPackSection.d.ts +11 -0
- package/lib/types/client/MnemonPackSection.d.ts.map +1 -0
- package/lib/types/client/MnemonPackSection.js +136 -0
- package/lib/types/client/MnemonPackSection.js.map +1 -0
- package/lib/types/client/MnemonSaveAction.d.ts +13 -0
- package/lib/types/client/MnemonSaveAction.d.ts.map +1 -0
- package/lib/types/client/MnemonSaveAction.js +141 -0
- package/lib/types/client/MnemonSaveAction.js.map +1 -0
- package/lib/types/client/MnemonSettingsCard.d.ts +9 -3
- package/lib/types/client/MnemonSettingsCard.d.ts.map +1 -1
- package/lib/types/client/MnemonSettingsCard.js +98 -51
- package/lib/types/client/MnemonSettingsCard.js.map +1 -1
- package/lib/types/client/MnemonToolviews.d.ts +19 -0
- package/lib/types/client/MnemonToolviews.d.ts.map +1 -0
- package/lib/types/client/MnemonToolviews.js +172 -0
- package/lib/types/client/MnemonToolviews.js.map +1 -0
- package/lib/types/client/MnemonTurnTail.d.ts +18 -0
- package/lib/types/client/MnemonTurnTail.d.ts.map +1 -0
- package/lib/types/client/MnemonTurnTail.js +44 -0
- package/lib/types/client/MnemonTurnTail.js.map +1 -0
- package/lib/types/client/MnemonView.d.ts +13 -0
- package/lib/types/client/MnemonView.d.ts.map +1 -1
- package/lib/types/client/MnemonView.js +33 -14
- package/lib/types/client/MnemonView.js.map +1 -1
- package/lib/types/client/anchor.d.ts +28 -0
- package/lib/types/client/anchor.d.ts.map +1 -0
- package/lib/types/client/anchor.js +46 -0
- package/lib/types/client/anchor.js.map +1 -0
- package/lib/types/client/api.d.ts +17 -2
- package/lib/types/client/api.d.ts.map +1 -1
- package/lib/types/client/api.js +86 -25
- package/lib/types/client/api.js.map +1 -1
- package/lib/types/client/dsh-compat.d.ts +21 -0
- package/lib/types/client/dsh-compat.d.ts.map +1 -0
- package/lib/types/client/dsh-compat.js +2 -0
- package/lib/types/client/dsh-compat.js.map +1 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +140 -12
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/locales.d.ts +272 -4
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js +292 -24
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/settings.d.ts +10 -5
- package/lib/types/client/settings.d.ts.map +1 -1
- package/lib/types/client/settings.js +32 -11
- package/lib/types/client/settings.js.map +1 -1
- package/lib/types/client/sidebar-entry.d.ts +6 -0
- package/lib/types/client/sidebar-entry.d.ts.map +1 -0
- package/lib/types/client/sidebar-entry.js +132 -0
- package/lib/types/client/sidebar-entry.js.map +1 -0
- package/lib/types/client/workspace-controller.d.ts +15 -0
- package/lib/types/client/workspace-controller.d.ts.map +1 -0
- package/lib/types/client/workspace-controller.js +21 -0
- package/lib/types/client/workspace-controller.js.map +1 -0
- package/lib/types/client/workspace-mount.d.ts +8 -0
- package/lib/types/client/workspace-mount.d.ts.map +1 -0
- package/lib/types/client/workspace-mount.js +135 -0
- package/lib/types/client/workspace-mount.js.map +1 -0
- package/lib/types/commands.d.ts +10 -2
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +5 -1
- package/lib/types/commands.js.map +1 -1
- package/lib/types/config.d.ts +42 -3
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/config.js +80 -6
- package/lib/types/config.js.map +1 -1
- package/lib/types/contracts.d.ts +27 -37
- package/lib/types/contracts.d.ts.map +1 -1
- package/lib/types/documents.d.ts.map +1 -1
- package/lib/types/documents.js +6 -14
- package/lib/types/documents.js.map +1 -1
- package/lib/types/guidance.d.ts +5 -2
- package/lib/types/guidance.d.ts.map +1 -1
- package/lib/types/guidance.js +18 -2
- package/lib/types/guidance.js.map +1 -1
- package/lib/types/index.d.ts +4 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +29 -20
- package/lib/types/index.js.map +1 -1
- package/lib/types/lifecycle.d.ts +23 -3
- package/lib/types/lifecycle.d.ts.map +1 -1
- package/lib/types/lifecycle.js +89 -13
- package/lib/types/lifecycle.js.map +1 -1
- package/lib/types/live-runtime.d.ts +66 -0
- package/lib/types/live-runtime.d.ts.map +1 -0
- package/lib/types/live-runtime.js +146 -0
- package/lib/types/live-runtime.js.map +1 -0
- package/lib/types/memory-bodies.d.ts +2 -0
- package/lib/types/memory-bodies.d.ts.map +1 -1
- package/lib/types/memory-bodies.js +29 -10
- package/lib/types/memory-bodies.js.map +1 -1
- package/lib/types/pack.d.ts +74 -0
- package/lib/types/pack.d.ts.map +1 -0
- package/lib/types/pack.js +709 -0
- package/lib/types/pack.js.map +1 -0
- package/lib/types/rpc.d.ts +10 -3
- package/lib/types/rpc.d.ts.map +1 -1
- package/lib/types/rpc.js +158 -19
- package/lib/types/rpc.js.map +1 -1
- package/lib/types/runner.d.ts +3 -1
- package/lib/types/runner.d.ts.map +1 -1
- package/lib/types/runner.js +7 -2
- package/lib/types/runner.js.map +1 -1
- package/lib/types/service.d.ts +16 -0
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/service.js.map +1 -1
- package/lib/types/settings.d.ts +1 -0
- package/lib/types/settings.d.ts.map +1 -1
- package/lib/types/settings.js +45 -16
- package/lib/types/settings.js.map +1 -1
- package/lib/types/subagent.d.ts +11 -2
- package/lib/types/subagent.d.ts.map +1 -1
- package/lib/types/subagent.js +34 -29
- package/lib/types/subagent.js.map +1 -1
- package/lib/types/tools.d.ts +11 -1
- package/lib/types/tools.d.ts.map +1 -1
- package/lib/types/tools.js +29 -16
- package/lib/types/tools.js.map +1 -1
- package/package.json +23 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { consumeMnemonAnchor, subscribeMnemonAnchor } from "./anchor.js";
|
|
3
4
|
import Markdown from 'markdown-to-jsx';
|
|
4
5
|
import { QODERWORK_REVIEW_POLICY } from "../review-activity.js";
|
|
5
6
|
import { CATEGORIES, } from "../service.js";
|
|
@@ -1181,46 +1182,62 @@ function MemorySystemFlow(props) {
|
|
|
1181
1182
|
export function MnemonView(props) {
|
|
1182
1183
|
return _jsx(I18nContext.Provider, { value: props.t ?? translateZh, children: _jsx(MnemonWorkspace, { ...props }) });
|
|
1183
1184
|
}
|
|
1184
|
-
function MnemonWorkspace({ connection, sessionId }) {
|
|
1185
|
+
function MnemonWorkspace({ connection, sessionId, workspaceId, workspaceSelection }) {
|
|
1185
1186
|
const t = useT();
|
|
1186
|
-
const client = useMemo(() => new MnemonClient(connection, sessionId), [connection, sessionId]);
|
|
1187
|
+
const client = useMemo(() => new MnemonClient(connection, sessionId, workspaceId), [connection, sessionId, workspaceId]);
|
|
1187
1188
|
const [page, setPage] = useState('status');
|
|
1188
1189
|
const canvasRef = useRef(null);
|
|
1189
|
-
/** Pages share one scroll container;
|
|
1190
|
+
/** Pages share one plugin-owned scroll container; never mutate DSH ancestor scrollports. */
|
|
1190
1191
|
const resetViewportScroll = useCallback(() => {
|
|
1191
1192
|
const canvas = canvasRef.current;
|
|
1192
1193
|
if (canvas !== null)
|
|
1193
1194
|
canvas.scrollTop = 0;
|
|
1194
|
-
let node = canvas?.parentElement ?? null;
|
|
1195
|
-
while (node !== null && node !== document.body && node !== document.documentElement) {
|
|
1196
|
-
if (node.scrollTop > 0)
|
|
1197
|
-
node.scrollTop = 0;
|
|
1198
|
-
node = node.parentElement;
|
|
1199
|
-
}
|
|
1200
1195
|
}, []);
|
|
1201
1196
|
useEffect(() => { resetViewportScroll(); }, [page, resetViewportScroll]);
|
|
1202
1197
|
useEffect(() => {
|
|
1203
|
-
//
|
|
1198
|
+
// Clear only this view's offset after layout; the host owns every ancestor.
|
|
1204
1199
|
const frame = window.requestAnimationFrame(() => resetViewportScroll());
|
|
1205
1200
|
return () => window.cancelAnimationFrame(frame);
|
|
1206
1201
|
}, [resetViewportScroll]);
|
|
1207
1202
|
const [status, setStatus] = useState(null);
|
|
1208
1203
|
const [statusLoading, setStatusLoading] = useState(true);
|
|
1209
1204
|
const [statusError, setStatusError] = useState(null);
|
|
1205
|
+
const statusRequest = useRef(0);
|
|
1210
1206
|
const [revision, setRevision] = useState(0);
|
|
1211
1207
|
const [searchSeed, setSearchSeed] = useState('');
|
|
1212
1208
|
const [rememberSeed, setRememberSeed] = useState('');
|
|
1209
|
+
/** Conversation surfaces ask this view to open a page (optionally with a seed). */
|
|
1210
|
+
const applyAnchor = useCallback((anchor) => {
|
|
1211
|
+
if (anchor.seed !== undefined && anchor.seed !== '') {
|
|
1212
|
+
if (anchor.page === 'explore')
|
|
1213
|
+
setSearchSeed(anchor.seed);
|
|
1214
|
+
if (anchor.page === 'remember')
|
|
1215
|
+
setRememberSeed(anchor.seed);
|
|
1216
|
+
}
|
|
1217
|
+
setPage(anchor.page);
|
|
1218
|
+
}, []);
|
|
1219
|
+
useEffect(() => {
|
|
1220
|
+
const held = consumeMnemonAnchor(sessionId);
|
|
1221
|
+
if (held !== null)
|
|
1222
|
+
applyAnchor(held);
|
|
1223
|
+
return subscribeMnemonAnchor(sessionId, applyAnchor);
|
|
1224
|
+
}, [sessionId, applyAnchor]);
|
|
1213
1225
|
const loadStatus = useCallback(async () => {
|
|
1226
|
+
const request = ++statusRequest.current;
|
|
1214
1227
|
setStatusLoading(true);
|
|
1215
1228
|
setStatusError(null);
|
|
1216
1229
|
try {
|
|
1217
|
-
|
|
1230
|
+
const next = await client.status();
|
|
1231
|
+
if (request === statusRequest.current)
|
|
1232
|
+
setStatus(next);
|
|
1218
1233
|
}
|
|
1219
1234
|
catch (reason) {
|
|
1220
|
-
|
|
1235
|
+
if (request === statusRequest.current)
|
|
1236
|
+
setStatusError(message(reason));
|
|
1221
1237
|
}
|
|
1222
1238
|
finally {
|
|
1223
|
-
|
|
1239
|
+
if (request === statusRequest.current)
|
|
1240
|
+
setStatusLoading(false);
|
|
1224
1241
|
}
|
|
1225
1242
|
}, [client]);
|
|
1226
1243
|
useEffect(() => { void loadStatus(); }, [loadStatus]);
|
|
@@ -1234,6 +1251,8 @@ function MnemonWorkspace({ connection, sessionId }) {
|
|
|
1234
1251
|
const catalogKnown = status?.memoryBodies !== undefined;
|
|
1235
1252
|
const memoryBodies = useMemo(() => status?.memoryBodies ?? [], [status]);
|
|
1236
1253
|
const activeBodies = memoryBodies.filter(body => body.active).length;
|
|
1237
|
-
|
|
1254
|
+
const workspaceContext = status?.workspaceContext;
|
|
1255
|
+
const showWorkspacePicker = workspaceContext?.mode === 'workspace' && workspaceSelection !== undefined && workspaceSelection.options.length > 0;
|
|
1256
|
+
return (_jsxs("main", { className: css.shell, children: [_jsxs("header", { className: css.masthead, children: [_jsxs("div", { className: css.brand, children: [_jsx(MnemonLogo, { className: css.brandLogo }), _jsx("h1", { children: "Mnemon" })] }), _jsxs("section", { className: css.telemetry, "aria-label": t('telemetry.aria'), children: [_jsxs("div", { className: css.telemetryMetric, children: [_jsx("span", { children: t('telemetry.memories') }), _jsx("strong", { children: stats?.totalInsights ?? '—' })] }), _jsxs("div", { className: css.telemetryMetric, children: [_jsx("span", { children: t('telemetry.graph') }), _jsx("strong", { children: stats?.edgeCount ?? '—' })] }), _jsxs("div", { className: css.telemetryMetric, children: [_jsx("span", { children: t('telemetry.entities') }), _jsx("strong", { children: stats?.topEntities.length ?? '—' })] }), _jsxs("div", { className: css.telemetryMetric, children: [_jsx("span", { children: t('telemetry.spaces') }), _jsx("strong", { children: status === null || !catalogKnown ? '—' : activeBodies })] })] }), _jsxs("div", { className: css.headerActions, children: [showWorkspacePicker && _jsxs("label", { className: css.workspacePicker, children: [_jsx("span", { children: t('workspace.viewing') }), _jsx("select", { "aria-label": t('workspace.selectorAria'), value: workspaceSelection.selectedWorkspaceId ?? '', onChange: event => workspaceSelection.onSelect(event.target.value), children: workspaceSelection.options.map(workspace => _jsx("option", { value: workspace.id, children: workspace.title }, workspace.id)) })] }), _jsxs("div", { className: css.statusCluster, children: [_jsx("span", { className: `${css.statusDot} ${statusLoading && status === null ? css.checking : status?.healthy === true ? css.online : css.offline}` }), _jsx("span", { children: statusLoading ? t('header.checking') : status?.healthy === true ? catalogKnown ? t('header.connected', { count: activeBodies }) : t('header.directoryPending') : t('header.unavailable') }), _jsx("button", { type: "button", className: css.iconButton, disabled: statusLoading, onClick: refreshAll, "aria-label": t('common.refresh'), children: "\u21BB" })] })] })] }), (statusError !== null || status?.healthy === false) && _jsxs("div", { className: css.alert, role: "alert", children: [_jsx("strong", { children: t('header.notReady') }), _jsx("span", { children: statusError ?? status?.error })] }), workspaceContext?.mode === 'workspace' && !workspaceContext.aligned && _jsxs("div", { className: css.workspaceMismatch, role: "status", children: [_jsxs("div", { children: [_jsx("strong", { children: t('workspace.mismatchTitle') }), _jsx("span", { children: t('workspace.mismatchDescription') }), _jsxs("div", { children: [_jsx("code", { children: t('workspace.selectedRoot', { root: workspaceContext.selectedRoot }) }), _jsx("code", { children: t('workspace.effectiveRoot', { root: workspaceContext.effectiveRoot }) })] })] }), workspaceSelection?.effectiveWorkspaceId !== undefined && _jsx("button", { type: "button", className: css.secondaryButton, onClick: workspaceSelection.onAlign, children: t('workspace.align') })] }), _jsxs("div", { className: css.workspace, children: [_jsxs("div", { className: css.topNavigation, children: [_jsx("nav", { className: css.nav, "aria-label": t('nav.aria'), children: PAGE_NAV.map((group, groupIndex) => _jsxs(Fragment, { children: [_jsx("div", { className: css.navGroup, role: "group", "aria-label": t(group.aria), children: group.entries.map(item => _jsxs("button", { type: "button", "aria-current": page === item.id ? 'page' : undefined, onClick: () => setPage(item.id), children: [_jsx("span", { className: css.navGlyph, "aria-hidden": "true", children: item.glyph }), _jsxs("span", { children: [_jsx("strong", { children: t(item.label) }), _jsx("small", { children: t(item.detail) })] })] }, item.id)) }), groupIndex < PAGE_NAV.length - 1 && _jsx("span", { className: css.navGroupDivider, "aria-hidden": "true" })] }, group.aria)) }), _jsxs("div", { className: css.spaceSummary, children: [_jsx("span", { children: t('sidebar.activeSpaces') }), _jsx("code", { children: catalogKnown ? `${activeBodies} / ${memoryBodies.length}` : '— / —' }), _jsx("small", { children: writeEnabled ? t('common.agentSupervised') : t('common.readOnly') })] })] }), _jsxs("section", { className: css.canvas, ref: canvasRef, "data-testid": "mnemon-canvas", children: [page === 'overview' && _jsx(OverviewPage, { client: client, revision: revision, writeEnabled: writeEnabled, fallbackBodies: memoryBodies, fallbackDirectory: status?.memoryBodyDirectory, catalogKnown: catalogKnown, onMutate: mutate, onExplore: explore }), page === 'runtime' && _jsx(RuntimePage, { client: client, revision: revision, writeEnabled: writeEnabled, onMutate: mutate }), page === 'documents' && _jsx(DocumentsPage, { client: client, revision: revision, writeEnabled: writeEnabled, ...(sessionId === undefined ? {} : { sessionId }), onMutate: mutate }), page === 'explore' && _jsx(ExplorePage, { client: client, status: status, seed: searchSeed, writeEnabled: writeEnabled, onForget: forget }), page === 'entities' && _jsx(EntitiesPage, { client: client, revision: revision, writeEnabled: writeEnabled, onForget: forget, onExplore: explore }), page === 'remember' && _jsx(RememberPage, { client: client, sessionId: sessionId, memoryBodies: status?.memoryBodies ?? [], writeEnabled: writeEnabled, seed: rememberSeed, onMutate: mutate }), page === 'list' && _jsx(ListPage, { client: client, revision: revision, writeEnabled: writeEnabled, onForget: forget, onClone: clone, onExplore: explore }), page === 'status' && _jsx(StatusPage, { status: status, loading: statusLoading, onRefresh: () => void loadStatus() })] })] })] }));
|
|
1238
1257
|
}
|
|
1239
1258
|
//# sourceMappingURL=MnemonView.js.map
|