dsh-context-memory 0.1.2 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ Ecosystem sync: every plugin in this suite shares one version, so a version number
6
+ identifies a set that was tested together rather than one plugin's own history.
7
+
8
+ - Fix the Model Arena panel rendering "Cannot read properties of undefined": the host
9
+ route returned the bare run list while the view reads `payload.recentRuns`.
10
+ - The client `inject` field now names services (`slots`, `connection`) instead of the
11
+ packages that provide them.
12
+ - README badges cover version, downloads, CI, license, Node requirement, stars, and the
13
+ dsh plugin topic.
14
+
3
15
  ## 0.1.2
4
16
 
5
17
  - **Fix the client half never activating.** The browser half declared package names
package/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # dsh-context-memory
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/dsh-context-memory)](https://www.npmjs.com/package/dsh-context-memory) [![CI](https://github.com/hj01857655/dsh-context-memory/actions/workflows/ci.yml/badge.svg)](https://github.com/hj01857655/dsh-context-memory/actions/workflows/ci.yml)
3
+ [![npm version](https://img.shields.io/npm/v/dsh-context-memory?color=cb3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/dsh-context-memory)
4
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-context-memory?color=cb3837)](https://www.npmjs.com/package/dsh-context-memory)
5
+ [![CI](https://github.com/hj01857655/dsh-context-memory/actions/workflows/ci.yml/badge.svg)](https://github.com/hj01857655/dsh-context-memory/actions/workflows/ci.yml)
6
+ [![license](https://img.shields.io/npm/l/dsh-context-memory?color=blue)](LICENSE)
7
+ [![node](https://img.shields.io/node/v/dsh-context-memory?color=339933&logo=node.js&logoColor=white)](package.json)
8
+ [![GitHub stars](https://img.shields.io/github/stars/hj01857655/dsh-context-memory?color=yellow)](https://github.com/hj01857655/dsh-context-memory/stargazers)
9
+ [![dsh plugin](https://img.shields.io/badge/dsh-plugin-4B8BBE)](https://github.com/topics/dsh-plugin)
4
10
 
5
11
  Cross-session memory for your dsh agent — remembered, recalled, and re-verified instead of assumed.
6
12
 
@@ -1,14 +1,15 @@
1
1
  /**
2
- * Browser half of dsh-context-memory: the Context memory page inside Settings.
2
+ * Browser half of dsh-context-memory: its page inside Settings.
3
3
  *
4
- * Services are named by their runtime identity, not by the package that provides them:
5
- * the settings shell is the `slots` service and the host bridge is `connection`. A
6
- * fiber that injects package names never resolves and the plugin stays pending, which
7
- * the loader reports as "did not activate".
4
+ * Two services are injected by their runtime identity, not by the packages that provide
5
+ * them: the settings shell is `slots`, the dictionary registry is `locale`. The label and
6
+ * every string inside the component are translated through this plugin's own namespace,
7
+ * which is why the page follows the UI language instead of the plugin author's.
8
8
  *
9
9
  * @module client
10
10
  */
11
11
  import type { ComponentType } from 'react';
12
+ export declare const inject: string[];
12
13
  interface SlotsService {
13
14
  inject(name: string, register: () => void): void;
14
15
  register(options: {
@@ -16,11 +17,21 @@ interface SlotsService {
16
17
  id: string;
17
18
  order: number;
18
19
  label: () => string;
19
- }, component: ComponentType): unknown;
20
+ locale: string;
21
+ }, component: ComponentType<{
22
+ t: (key: string, params?: Record<string, unknown>) => string;
23
+ }>): unknown;
20
24
  }
21
- /** The slots service is what the settings shell exposes. */
22
- export declare const inject: string[];
23
- export declare function apply(ctx: {
25
+ interface ClientContext {
24
26
  slots: SlotsService;
25
- }): void;
27
+ locale: {
28
+ register(ns: string, dicts: {
29
+ zh: unknown;
30
+ en: unknown;
31
+ }): () => void;
32
+ bind(ns: string): (key: string, params?: Record<string, unknown>) => string;
33
+ };
34
+ effect(callback: () => unknown, label?: string): unknown;
35
+ }
36
+ export declare function apply(ctx: ClientContext): void;
26
37
  export {};
@@ -1,65 +1,24 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
1
  /**
3
- * Browser half of dsh-context-memory: the Context memory page inside Settings.
2
+ * Browser half of dsh-context-memory: its page inside Settings.
4
3
  *
5
- * Services are named by their runtime identity, not by the package that provides them:
6
- * the settings shell is the `slots` service and the host bridge is `connection`. A
7
- * fiber that injects package names never resolves and the plugin stays pending, which
8
- * the loader reports as "did not activate".
4
+ * Two services are injected by their runtime identity, not by the packages that provide
5
+ * them: the settings shell is `slots`, the dictionary registry is `locale`. The label and
6
+ * every string inside the component are translated through this plugin's own namespace,
7
+ * which is why the page follows the UI language instead of the plugin author's.
9
8
  *
10
9
  * @module client
11
10
  */
12
- import { useCallback, useEffect, useState } from 'react';
13
- import { renderPanel } from './view.js';
14
- /** Path the host half registers on the web connection. */
15
- const PANEL_PATH = '/api/context-memory.panel';
16
- /** Fetch the panel payload; `reload` re-runs the request. */
17
- function usePanel() {
18
- const [html, setHtml] = useState(null);
19
- const [error, setError] = useState(null);
20
- const [tick, setTick] = useState(0);
21
- const reload = useCallback(() => setTick((t) => t + 1), []);
22
- useEffect(() => {
23
- const controller = new AbortController();
24
- setError(null);
25
- fetch(PANEL_PATH, { signal: controller.signal })
26
- .then(async (response) => {
27
- if (!response.ok)
28
- throw new Error(`panel request failed with ${response.status}`);
29
- return response.json();
30
- })
31
- .then((payload) => {
32
- if (!controller.signal.aborted)
33
- setHtml(renderPanel(payload));
34
- })
35
- .catch((cause) => {
36
- if (controller.signal.aborted)
37
- return;
38
- // Say what failed rather than rendering an empty panel, which would read as
39
- // "nothing recorded" — a different and wrong answer.
40
- setError(cause instanceof Error ? cause.message : String(cause));
41
- });
42
- return () => controller.abort();
43
- }, [tick]);
44
- return { html, error, reload };
45
- }
46
- function ContextmemoryPage() {
47
- const { html, error, reload } = usePanel();
48
- if (error !== null) {
49
- return (_jsxs("section", { children: [_jsxs("p", { role: "alert", children: ["Context memory panel failed to load: ", error] }), _jsx("button", { type: "button", onClick: reload, children: "Retry" })] }));
50
- }
51
- if (html === null)
52
- return _jsx("p", { "aria-live": "polite", children: "Loading the Context memory panel\u2026" });
53
- // The markup is produced by `renderPanel`, which escapes every interpolated value.
54
- return _jsx("div", { dangerouslySetInnerHTML: { __html: html } });
55
- }
56
- /** The slots service is what the settings shell exposes. */
57
- export const inject = ['slots'];
11
+ import { NS, en, zh } from './locales.js';
12
+ import { ContextMemoryPanel } from './view.js';
13
+ export const inject = ['slots', 'locale'];
58
14
  export function apply(ctx) {
15
+ // `zh` is the key-set source of truth, matching the official client plugins.
16
+ ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-context-memory: dictionaries');
59
17
  ctx.slots.inject('settings.section', () => ctx.slots.register({
60
18
  name: 'settings.section',
61
19
  id: 'context-memory',
62
20
  order: 46,
63
- label: () => 'Context memory',
64
- }, ContextmemoryPage));
21
+ label: () => ctx.locale.bind(NS)('nav'),
22
+ locale: NS,
23
+ }, ContextMemoryPanel));
65
24
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Dictionaries for the Context memory page.
3
+ *
4
+ * `zh` is the key-set source of truth, as in the official client plugins, and `en` is
5
+ * typed against it: a key translated in one language but not the other fails the build
6
+ * instead of silently rendering the raw key.
7
+ *
8
+ * @module client/locales
9
+ */
10
+ /** Dictionary namespace owned by this plugin. */
11
+ export declare const NS = "contextMemory";
12
+ /** Simplified Chinese dictionary (the key-set source of truth). */
13
+ export declare const zh: {
14
+ nav: string;
15
+ title: string;
16
+ active: string;
17
+ superseded: string;
18
+ conflicts: string;
19
+ noConflicts: string;
20
+ memory: string;
21
+ kind: string;
22
+ status: string;
23
+ from: string;
24
+ checkNone: string;
25
+ checkPassed: string;
26
+ checkViolated: string;
27
+ checkBroken: string;
28
+ checkPending: string;
29
+ unverified: string;
30
+ empty: string;
31
+ checkLegend: string;
32
+ refresh: string;
33
+ loading: string;
34
+ failed: string;
35
+ retry: string;
36
+ };
37
+ /** English dictionary, checked complete against the zh key set. */
38
+ export declare const en: typeof zh;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Dictionaries for the Context memory page.
3
+ *
4
+ * `zh` is the key-set source of truth, as in the official client plugins, and `en` is
5
+ * typed against it: a key translated in one language but not the other fails the build
6
+ * instead of silently rendering the raw key.
7
+ *
8
+ * @module client/locales
9
+ */
10
+ /** Dictionary namespace owned by this plugin. */
11
+ export const NS = 'contextMemory';
12
+ /** Simplified Chinese dictionary (the key-set source of truth). */
13
+ export const zh = {
14
+ 'nav': '跨会话记忆',
15
+ 'title': '跨会话记忆',
16
+ 'active': '生效中',
17
+ 'superseded': '已失效',
18
+ 'conflicts': '冲突',
19
+ 'noConflicts': '没有冲突。',
20
+ 'memory': '记忆',
21
+ 'kind': '类型',
22
+ 'status': '校验状态',
23
+ 'from': '来源',
24
+ 'checkNone': '无检查',
25
+ 'checkPassed': '已核对,成立',
26
+ 'checkViolated': '已核对,不成立',
27
+ 'checkBroken': '检查无法运行',
28
+ 'checkPending': '尚未核对',
29
+ 'unverified': '未验证成立',
30
+ 'empty': '还没有记住任何内容。',
31
+ 'checkLegend': '无检查=无法编译检查;检查无法运行=检查本身有问题,不代表记忆错误。',
32
+ 'refresh': '刷新',
33
+ 'loading': '正在加载…',
34
+ 'failed': '加载失败',
35
+ 'retry': '重试',
36
+ };
37
+ /** English dictionary, checked complete against the zh key set. */
38
+ export const en = {
39
+ 'nav': 'Context memory',
40
+ 'title': 'Context memory',
41
+ 'active': 'active',
42
+ 'superseded': 'superseded',
43
+ 'conflicts': 'Conflicts',
44
+ 'noConflicts': 'No conflicts.',
45
+ 'memory': 'Memory',
46
+ 'kind': 'Kind',
47
+ 'status': 'Check',
48
+ 'from': 'From',
49
+ 'checkNone': 'no check',
50
+ 'checkPassed': 'checked, holds',
51
+ 'checkViolated': 'checked, does not hold',
52
+ 'checkBroken': 'check unusable',
53
+ 'checkPending': 'not yet checked',
54
+ 'unverified': 'not verified as holding',
55
+ 'empty': 'Nothing is remembered yet.',
56
+ 'checkLegend': 'no check = no check could be compiled; check unusable = the check is defective, not the memory.',
57
+ 'refresh': 'Refresh',
58
+ 'loading': 'Loading…',
59
+ 'failed': 'Failed to load',
60
+ 'retry': 'Retry',
61
+ };
@@ -1,20 +1,38 @@
1
1
  /**
2
- * Browser half of dsh-context-memory — the view model.
2
+ * Pure rendering half of the contextMemory page.
3
3
  *
4
- * Rendering is kept here, separate from the fetch-and-register shell, so it can be
5
- * statically rendered in Node during tests. The panel is a claim about what the agent
6
- * remembers, so it is worth asserting on without a browser.
4
+ * Separate from `index.tsx` so a static render can assert in Node what the page draws —
5
+ * the shipped bundle is a loader factory only a browser can run. Every user-visible
6
+ * string comes from the `t` seat the renderer binds from this plugin's namespace, so the
7
+ * page follows the UI language; no copy is hardcoded here.
7
8
  *
8
- * @module context-memory/client/view
9
+ * @module client/view
9
10
  */
10
11
  import type { MemoryState, PanelPayload } from '../types.js';
12
+ /** The translate seat the renderer binds from this plugin's locale namespace. */
13
+ export type Translate = (key: string, params?: Record<string, unknown>) => string;
14
+ export interface PanelProps {
15
+ /** Bound translate function for this plugin's namespace. */
16
+ t: Translate;
17
+ }
18
+ interface PanelState {
19
+ payload: PanelPayload | null;
20
+ error: string | null;
21
+ }
22
+ /** Fetch the host panel payload; `reload` re-runs the request. */
23
+ export declare function usePanel(): PanelState & {
24
+ reload: () => void;
25
+ };
11
26
  /**
12
- * A memory's verification badge.
27
+ * A memory's verification label.
13
28
  *
14
29
  * Four states, not two, because "no check exists" and "the check could not run" are
15
30
  * different answers from "the check failed" — collapsing them would report an
16
31
  * unverifiable memory and a false one identically, which is the failure this plugin
17
32
  * exists to avoid.
18
33
  */
19
- export declare function verificationLabel(memory: MemoryState): string;
20
- export declare function renderPanel(payload: PanelPayload): string;
34
+ export declare function checkLabel(memory: MemoryState, t: Translate): string;
35
+ /** Where a memory came from: the answer to "why does the agent think it knows this". */
36
+ export declare function provenance(memory: MemoryState): string;
37
+ export declare function ContextMemoryPanel({ t }: PanelProps): import("react").JSX.Element;
38
+ export {};
@@ -1,64 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
2
  /**
2
- * Browser half of dsh-context-memory — the view model.
3
+ * Pure rendering half of the contextMemory page.
3
4
  *
4
- * Rendering is kept here, separate from the fetch-and-register shell, so it can be
5
- * statically rendered in Node during tests. The panel is a claim about what the agent
6
- * remembers, so it is worth asserting on without a browser.
5
+ * Separate from `index.tsx` so a static render can assert in Node what the page draws —
6
+ * the shipped bundle is a loader factory only a browser can run. Every user-visible
7
+ * string comes from the `t` seat the renderer binds from this plugin's namespace, so the
8
+ * page follows the UI language; no copy is hardcoded here.
7
9
  *
8
- * @module context-memory/client/view
10
+ * @module client/view
9
11
  */
10
- function escapeHtml(value) {
11
- return value
12
- .replace(/&/g, '&amp;')
13
- .replace(/</g, '&lt;')
14
- .replace(/>/g, '&gt;')
15
- .replace(/"/g, '&quot;');
12
+ import { useCallback, useEffect, useState } from 'react';
13
+ /** Panel route registered by the host half on the web connection. */
14
+ const PANEL_PATH = "/api/context-memory.panel";
15
+ const wrap = { display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 760, fontFamily: 'inherit' };
16
+ const head = { display: 'flex', alignItems: 'baseline', gap: 12, flexWrap: 'wrap' };
17
+ const muted = { fontSize: 12, opacity: 0.75 };
18
+ const table = { borderCollapse: 'collapse', width: '100%' };
19
+ const th = { textAlign: 'left', padding: '4px 10px 4px 0', fontWeight: 600, fontSize: 12, opacity: 0.8, borderBottom: '0.5px solid rgba(128,128,128,0.4)' };
20
+ const td = { padding: '6px 10px 6px 0', fontSize: 13, borderBottom: '0.5px solid rgba(128,128,128,0.18)' };
21
+ const list = { margin: 0, paddingLeft: 18, fontSize: 13 };
22
+ /** Fetch the host panel payload; `reload` re-runs the request. */
23
+ export function usePanel() {
24
+ const [state, setState] = useState({ payload: null, error: null });
25
+ const [tick, setTick] = useState(0);
26
+ const reload = useCallback(() => setTick((value) => value + 1), []);
27
+ useEffect(() => {
28
+ const controller = new AbortController();
29
+ setState((previous) => ({ ...previous, error: null }));
30
+ fetch(PANEL_PATH, { signal: controller.signal })
31
+ .then(async (response) => {
32
+ if (!response.ok)
33
+ throw new Error(String(response.status));
34
+ return response.json();
35
+ })
36
+ .then((payload) => {
37
+ if (!controller.signal.aborted)
38
+ setState({ payload, error: null });
39
+ })
40
+ .catch((cause) => {
41
+ if (controller.signal.aborted)
42
+ return;
43
+ setState({ payload: null, error: cause instanceof Error ? cause.message : String(cause) });
44
+ });
45
+ return () => controller.abort();
46
+ }, [tick]);
47
+ return { ...state, reload };
16
48
  }
17
49
  /**
18
- * A memory's verification badge.
50
+ * A memory's verification label.
19
51
  *
20
52
  * Four states, not two, because "no check exists" and "the check could not run" are
21
53
  * different answers from "the check failed" — collapsing them would report an
22
54
  * unverifiable memory and a false one identically, which is the failure this plugin
23
55
  * exists to avoid.
24
56
  */
25
- export function verificationLabel(memory) {
57
+ export function checkLabel(memory, t) {
26
58
  if (!memory.guard)
27
- return 'no check';
59
+ return t('checkNone');
28
60
  switch (memory.verification?.outcome) {
29
- case 'passed': return 'checked, holds';
30
- case 'violated': return 'checked, does not hold';
31
- case 'broken': return 'check unusable';
32
- default: return 'not yet checked';
61
+ case 'passed': return t('checkPassed');
62
+ case 'violated': return t('checkViolated');
63
+ case 'broken': return t('checkBroken');
64
+ default: return t('checkPending');
33
65
  }
34
66
  }
35
- function rows(memories) {
36
- return memories
37
- .map((memory) => {
38
- const provenance = [
39
- memory.source,
40
- memory.sessionId ? `session ${memory.sessionId}` : null,
41
- memory.step !== undefined ? `step ${memory.step}` : null,
42
- ].filter(Boolean).join(' · ');
43
- return `<tr><td><code>${escapeHtml(memory.id)}</code></td><td>${escapeHtml(memory.text)}</td><td>${escapeHtml(memory.kind)}</td><td>${escapeHtml(verificationLabel(memory))}</td><td>${escapeHtml(provenance)}</td></tr>`;
44
- })
45
- .join('');
67
+ /** Where a memory came from: the answer to "why does the agent think it knows this". */
68
+ export function provenance(memory) {
69
+ return [
70
+ memory.source,
71
+ memory.sessionId !== undefined ? `session ${memory.sessionId}` : null,
72
+ memory.step !== undefined ? `step ${String(memory.step)}` : null,
73
+ ].filter((part) => part !== null).join(' · ');
46
74
  }
47
- export function renderPanel(payload) {
75
+ export function ContextMemoryPanel({ t }) {
76
+ const { payload, error, reload } = usePanel();
77
+ const header = (_jsxs("header", { style: head, children: [_jsx("strong", { style: { fontSize: 13 }, children: t('title') }), _jsx("span", { style: { flex: 1 } }), _jsx("button", { type: "button", onClick: reload, style: { fontSize: 12 }, children: t('refresh') })] }));
78
+ if (error !== null) {
79
+ return (_jsxs("div", { style: wrap, children: [header, _jsxs("p", { role: "alert", style: { margin: 0, fontSize: 13 }, children: [t('failed'), ": ", error] }), _jsx("button", { type: "button", onClick: reload, style: { alignSelf: 'flex-start', fontSize: 12 }, children: t('retry') })] }));
80
+ }
81
+ if (payload === null)
82
+ return _jsx("p", { style: muted, "aria-live": "polite", children: t('loading') });
83
+ const rows = (memories) => memories.map((memory) => (_jsxs("tr", { children: [_jsx("td", { style: td, children: _jsx("code", { style: { fontSize: 11 }, children: memory.id }) }), _jsx("td", { style: td, children: memory.text }), _jsx("td", { style: td, children: memory.kind }), _jsx("td", { style: td, children: checkLabel(memory, t) }), _jsx("td", { style: td, children: provenance(memory) })] }, memory.id)));
48
84
  const { totals } = payload;
49
- const summary = `<p class="memory-summary">${totals.active} active (${totals.verified} checked and holding, ${totals.unverified} not), ${totals.superseded} superseded, ${totals.withGuard} with a compiled check.</p>`;
50
- const conflictBlock = payload.conflicts.length === 0
51
- ? '<p>No conflicts.</p>'
52
- : `<div class="memory-conflicts"><h3>Conflicts</h3><ul>${payload.conflicts
53
- .map((conflict) => `<li><strong>${escapeHtml(conflict.subject)}</strong><ul>${conflict.memories
54
- .map((memory) => `<li><code>${escapeHtml(memory.id)}</code> ${escapeHtml(memory.text)}</li>`)
55
- .join('')}</ul></li>`)
56
- .join('')}</ul></div>`;
57
- const activeBlock = payload.active.length === 0
58
- ? '<p>Nothing is remembered yet.</p>'
59
- : `<table><thead><tr><th>Id</th><th>Memory</th><th>Kind</th><th>Status</th><th>From</th></tr></thead><tbody>${rows(payload.active)}</tbody></table>`;
60
- const supersededBlock = payload.superseded.length === 0
61
- ? ''
62
- : `<details><summary>Superseded (${payload.superseded.length})</summary><table><thead><tr><th>Id</th><th>Memory</th><th>Kind</th><th>Status</th><th>From</th></tr></thead><tbody>${rows(payload.superseded)}</tbody></table></details>`;
63
- return `<div class="context-memory-panel"><h2>Context memory</h2>${summary}${conflictBlock}<h3>Active</h3>${activeBlock}${supersededBlock}</div>`;
85
+ return (_jsxs("div", { style: wrap, children: [header, _jsxs("span", { style: muted, children: [t('active'), " ", totals.active, " \u00B7 ", t('checkPassed'), " ", totals.verified, " \u00B7 ", t('unverified'), " ", totals.unverified, " \u00B7 ", t('superseded'), " ", totals.superseded] }), _jsx("span", { style: muted, children: t('checkLegend') }), _jsx("strong", { style: { fontSize: 13 }, children: t('conflicts') }), payload.conflicts.length === 0 ? (_jsx("span", { style: muted, children: t('noConflicts') })) : (_jsx("ul", { style: list, children: payload.conflicts.map((conflict) => (_jsxs("li", { children: [_jsx("strong", { children: conflict.subject }), _jsx("ul", { style: { ...list, fontSize: 12, opacity: 0.85 }, children: conflict.memories.map((memory) => (_jsxs("li", { children: [_jsx("code", { style: { fontSize: 11 }, children: memory.id }), " ", memory.text] }, memory.id))) })] }, conflict.subject))) })), _jsx("strong", { style: { fontSize: 13 }, children: t('active') }), payload.active.length === 0 ? (_jsx("p", { style: { margin: 0, fontSize: 13, opacity: 0.8 }, children: t('empty') })) : (_jsxs("table", { style: table, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: th, children: "Id" }), _jsx("th", { style: th, children: t('memory') }), _jsx("th", { style: th, children: t('kind') }), _jsx("th", { style: th, children: t('status') }), _jsx("th", { style: th, children: t('from') })] }) }), _jsx("tbody", { children: rows(payload.active) })] })), payload.superseded.length > 0 && (_jsxs(_Fragment, { children: [_jsxs("strong", { style: { fontSize: 13 }, children: [t('superseded'), " (", payload.superseded.length, ")"] }), _jsxs("table", { style: table, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: th, children: "Id" }), _jsx("th", { style: th, children: t('memory') }), _jsx("th", { style: th, children: t('kind') }), _jsx("th", { style: th, children: t('status') }), _jsx("th", { style: th, children: t('from') })] }) }), _jsx("tbody", { children: rows(payload.superseded) })] })] }))] }));
64
86
  }
package/lib/memory.web.js CHANGED
@@ -26,92 +26,210 @@ __export(index_exports, {
26
26
  inject: () => inject
27
27
  });
28
28
  module.exports = __toCommonJS(index_exports);
29
- var import_react = require("react");
30
29
 
31
- // src/client/view.tsx
32
- function escapeHtml(value) {
33
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
34
- }
35
- function verificationLabel(memory) {
36
- if (!memory.guard) return "no check";
37
- switch (memory.verification?.outcome) {
38
- case "passed":
39
- return "checked, holds";
40
- case "violated":
41
- return "checked, does not hold";
42
- case "broken":
43
- return "check unusable";
44
- default:
45
- return "not yet checked";
46
- }
47
- }
48
- function rows(memories) {
49
- return memories.map((memory) => {
50
- const provenance = [
51
- memory.source,
52
- memory.sessionId ? `session ${memory.sessionId}` : null,
53
- memory.step !== void 0 ? `step ${memory.step}` : null
54
- ].filter(Boolean).join(" \xB7 ");
55
- return `<tr><td><code>${escapeHtml(memory.id)}</code></td><td>${escapeHtml(memory.text)}</td><td>${escapeHtml(memory.kind)}</td><td>${escapeHtml(verificationLabel(memory))}</td><td>${escapeHtml(provenance)}</td></tr>`;
56
- }).join("");
57
- }
58
- function renderPanel(payload) {
59
- const { totals } = payload;
60
- const summary = `<p class="memory-summary">${totals.active} active (${totals.verified} checked and holding, ${totals.unverified} not), ${totals.superseded} superseded, ${totals.withGuard} with a compiled check.</p>`;
61
- const conflictBlock = payload.conflicts.length === 0 ? "<p>No conflicts.</p>" : `<div class="memory-conflicts"><h3>Conflicts</h3><ul>${payload.conflicts.map((conflict) => `<li><strong>${escapeHtml(conflict.subject)}</strong><ul>${conflict.memories.map((memory) => `<li><code>${escapeHtml(memory.id)}</code> ${escapeHtml(memory.text)}</li>`).join("")}</ul></li>`).join("")}</ul></div>`;
62
- const activeBlock = payload.active.length === 0 ? "<p>Nothing is remembered yet.</p>" : `<table><thead><tr><th>Id</th><th>Memory</th><th>Kind</th><th>Status</th><th>From</th></tr></thead><tbody>${rows(payload.active)}</tbody></table>`;
63
- const supersededBlock = payload.superseded.length === 0 ? "" : `<details><summary>Superseded (${payload.superseded.length})</summary><table><thead><tr><th>Id</th><th>Memory</th><th>Kind</th><th>Status</th><th>From</th></tr></thead><tbody>${rows(payload.superseded)}</tbody></table></details>`;
64
- return `<div class="context-memory-panel"><h2>Context memory</h2>${summary}${conflictBlock}<h3>Active</h3>${activeBlock}${supersededBlock}</div>`;
65
- }
30
+ // src/client/locales.ts
31
+ var NS = "contextMemory";
32
+ var zh = {
33
+ "nav": "\u8DE8\u4F1A\u8BDD\u8BB0\u5FC6",
34
+ "title": "\u8DE8\u4F1A\u8BDD\u8BB0\u5FC6",
35
+ "active": "\u751F\u6548\u4E2D",
36
+ "superseded": "\u5DF2\u5931\u6548",
37
+ "conflicts": "\u51B2\u7A81",
38
+ "noConflicts": "\u6CA1\u6709\u51B2\u7A81\u3002",
39
+ "memory": "\u8BB0\u5FC6",
40
+ "kind": "\u7C7B\u578B",
41
+ "status": "\u6821\u9A8C\u72B6\u6001",
42
+ "from": "\u6765\u6E90",
43
+ "checkNone": "\u65E0\u68C0\u67E5",
44
+ "checkPassed": "\u5DF2\u6838\u5BF9\uFF0C\u6210\u7ACB",
45
+ "checkViolated": "\u5DF2\u6838\u5BF9\uFF0C\u4E0D\u6210\u7ACB",
46
+ "checkBroken": "\u68C0\u67E5\u65E0\u6CD5\u8FD0\u884C",
47
+ "checkPending": "\u5C1A\u672A\u6838\u5BF9",
48
+ "unverified": "\u672A\u9A8C\u8BC1\u6210\u7ACB",
49
+ "empty": "\u8FD8\u6CA1\u6709\u8BB0\u4F4F\u4EFB\u4F55\u5185\u5BB9\u3002",
50
+ "checkLegend": "\u65E0\u68C0\u67E5\uFF1D\u65E0\u6CD5\u7F16\u8BD1\u68C0\u67E5\uFF1B\u68C0\u67E5\u65E0\u6CD5\u8FD0\u884C\uFF1D\u68C0\u67E5\u672C\u8EAB\u6709\u95EE\u9898\uFF0C\u4E0D\u4EE3\u8868\u8BB0\u5FC6\u9519\u8BEF\u3002",
51
+ "refresh": "\u5237\u65B0",
52
+ "loading": "\u6B63\u5728\u52A0\u8F7D\u2026",
53
+ "failed": "\u52A0\u8F7D\u5931\u8D25",
54
+ "retry": "\u91CD\u8BD5"
55
+ };
56
+ var en = {
57
+ "nav": "Context memory",
58
+ "title": "Context memory",
59
+ "active": "active",
60
+ "superseded": "superseded",
61
+ "conflicts": "Conflicts",
62
+ "noConflicts": "No conflicts.",
63
+ "memory": "Memory",
64
+ "kind": "Kind",
65
+ "status": "Check",
66
+ "from": "From",
67
+ "checkNone": "no check",
68
+ "checkPassed": "checked, holds",
69
+ "checkViolated": "checked, does not hold",
70
+ "checkBroken": "check unusable",
71
+ "checkPending": "not yet checked",
72
+ "unverified": "not verified as holding",
73
+ "empty": "Nothing is remembered yet.",
74
+ "checkLegend": "no check = no check could be compiled; check unusable = the check is defective, not the memory.",
75
+ "refresh": "Refresh",
76
+ "loading": "Loading\u2026",
77
+ "failed": "Failed to load",
78
+ "retry": "Retry"
79
+ };
66
80
 
67
- // src/client/index.tsx
81
+ // src/client/view.tsx
82
+ var import_react = require("react");
68
83
  var import_jsx_runtime = require("react/jsx-runtime");
69
84
  var PANEL_PATH = "/api/context-memory.panel";
85
+ var wrap = { display: "flex", flexDirection: "column", gap: 12, maxWidth: 760, fontFamily: "inherit" };
86
+ var head = { display: "flex", alignItems: "baseline", gap: 12, flexWrap: "wrap" };
87
+ var muted = { fontSize: 12, opacity: 0.75 };
88
+ var table = { borderCollapse: "collapse", width: "100%" };
89
+ var th = { textAlign: "left", padding: "4px 10px 4px 0", fontWeight: 600, fontSize: 12, opacity: 0.8, borderBottom: "0.5px solid rgba(128,128,128,0.4)" };
90
+ var td = { padding: "6px 10px 6px 0", fontSize: 13, borderBottom: "0.5px solid rgba(128,128,128,0.18)" };
91
+ var list = { margin: 0, paddingLeft: 18, fontSize: 13 };
70
92
  function usePanel() {
71
- const [html, setHtml] = (0, import_react.useState)(null);
72
- const [error, setError] = (0, import_react.useState)(null);
93
+ const [state, setState] = (0, import_react.useState)({ payload: null, error: null });
73
94
  const [tick, setTick] = (0, import_react.useState)(0);
74
- const reload = (0, import_react.useCallback)(() => setTick((t) => t + 1), []);
95
+ const reload = (0, import_react.useCallback)(() => setTick((value) => value + 1), []);
75
96
  (0, import_react.useEffect)(() => {
76
97
  const controller = new AbortController();
77
- setError(null);
98
+ setState((previous) => ({ ...previous, error: null }));
78
99
  fetch(PANEL_PATH, { signal: controller.signal }).then(async (response) => {
79
- if (!response.ok) throw new Error(`panel request failed with ${response.status}`);
100
+ if (!response.ok) throw new Error(String(response.status));
80
101
  return response.json();
81
102
  }).then((payload) => {
82
- if (!controller.signal.aborted) setHtml(renderPanel(payload));
103
+ if (!controller.signal.aborted) setState({ payload, error: null });
83
104
  }).catch((cause) => {
84
105
  if (controller.signal.aborted) return;
85
- setError(cause instanceof Error ? cause.message : String(cause));
106
+ setState({ payload: null, error: cause instanceof Error ? cause.message : String(cause) });
86
107
  });
87
108
  return () => controller.abort();
88
109
  }, [tick]);
89
- return { html, error, reload };
110
+ return { ...state, reload };
90
111
  }
91
- function ContextmemoryPage() {
92
- const { html, error, reload } = usePanel();
112
+ function checkLabel(memory, t) {
113
+ if (!memory.guard) return t("checkNone");
114
+ switch (memory.verification?.outcome) {
115
+ case "passed":
116
+ return t("checkPassed");
117
+ case "violated":
118
+ return t("checkViolated");
119
+ case "broken":
120
+ return t("checkBroken");
121
+ default:
122
+ return t("checkPending");
123
+ }
124
+ }
125
+ function provenance(memory) {
126
+ return [
127
+ memory.source,
128
+ memory.sessionId !== void 0 ? `session ${memory.sessionId}` : null,
129
+ memory.step !== void 0 ? `step ${String(memory.step)}` : null
130
+ ].filter((part) => part !== null).join(" \xB7 ");
131
+ }
132
+ function ContextMemoryPanel({ t }) {
133
+ const { payload, error, reload } = usePanel();
134
+ const header = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { style: head, children: [
135
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { style: { fontSize: 13 }, children: t("title") }),
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
137
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: reload, style: { fontSize: 12 }, children: t("refresh") })
138
+ ] });
93
139
  if (error !== null) {
94
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { children: [
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { role: "alert", children: [
96
- "Context memory panel failed to load: ",
140
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: wrap, children: [
141
+ header,
142
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { role: "alert", style: { margin: 0, fontSize: 13 }, children: [
143
+ t("failed"),
144
+ ": ",
97
145
  error
98
146
  ] }),
99
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: reload, children: "Retry" })
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: reload, style: { alignSelf: "flex-start", fontSize: 12 }, children: t("retry") })
100
148
  ] });
101
149
  }
102
- if (html === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { "aria-live": "polite", children: "Loading the Context memory panel\u2026" });
103
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { dangerouslySetInnerHTML: { __html: html } });
150
+ if (payload === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: muted, "aria-live": "polite", children: t("loading") });
151
+ const rows = (memories) => memories.map((memory) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
152
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: td, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { style: { fontSize: 11 }, children: memory.id }) }),
153
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: td, children: memory.text }),
154
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: td, children: memory.kind }),
155
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: td, children: checkLabel(memory, t) }),
156
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: td, children: provenance(memory) })
157
+ ] }, memory.id));
158
+ const { totals } = payload;
159
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: wrap, children: [
160
+ header,
161
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: muted, children: [
162
+ t("active"),
163
+ " ",
164
+ totals.active,
165
+ " \xB7 ",
166
+ t("checkPassed"),
167
+ " ",
168
+ totals.verified,
169
+ " \xB7 ",
170
+ t("unverified"),
171
+ " ",
172
+ totals.unverified,
173
+ " \xB7 ",
174
+ t("superseded"),
175
+ " ",
176
+ totals.superseded
177
+ ] }),
178
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: muted, children: t("checkLegend") }),
179
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { style: { fontSize: 13 }, children: t("conflicts") }),
180
+ payload.conflicts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: muted, children: t("noConflicts") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: list, children: payload.conflicts.map((conflict) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
181
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: conflict.subject }),
182
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: { ...list, fontSize: 12, opacity: 0.85 }, children: conflict.memories.map((memory) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
183
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { style: { fontSize: 11 }, children: memory.id }),
184
+ " ",
185
+ memory.text
186
+ ] }, memory.id)) })
187
+ ] }, conflict.subject)) }),
188
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { style: { fontSize: 13 }, children: t("active") }),
189
+ payload.active.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { margin: 0, fontSize: 13, opacity: 0.8 }, children: t("empty") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { style: table, children: [
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: "Id" }),
192
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("memory") }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("kind") }),
194
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("status") }),
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("from") })
196
+ ] }) }),
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: rows(payload.active) })
198
+ ] }),
199
+ payload.superseded.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { style: { fontSize: 13 }, children: [
201
+ t("superseded"),
202
+ " (",
203
+ payload.superseded.length,
204
+ ")"
205
+ ] }),
206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { style: table, children: [
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
208
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: "Id" }),
209
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("memory") }),
210
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("kind") }),
211
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("status") }),
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: th, children: t("from") })
213
+ ] }) }),
214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: rows(payload.superseded) })
215
+ ] })
216
+ ] })
217
+ ] });
104
218
  }
105
- var inject = ["slots"];
219
+
220
+ // src/client/index.tsx
221
+ var inject = ["slots", "locale"];
106
222
  function apply(ctx) {
223
+ ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-context-memory: dictionaries");
107
224
  ctx.slots.inject("settings.section", () => ctx.slots.register(
108
225
  {
109
226
  name: "settings.section",
110
227
  id: "context-memory",
111
228
  order: 46,
112
- label: () => "Context memory"
229
+ label: () => ctx.locale.bind(NS)("nav"),
230
+ locale: NS
113
231
  },
114
- ContextmemoryPage
232
+ ContextMemoryPanel
115
233
  ));
116
234
  }
117
235
  return module.exports; } });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/client/index.tsx", "../src/client/view.tsx"],
4
- "sourcesContent": ["/**\n * Browser half of dsh-context-memory: the Context memory page inside Settings.\n *\n * Services are named by their runtime identity, not by the package that provides them:\n * the settings shell is the `slots` service and the host bridge is `connection`. A\n * fiber that injects package names never resolves and the plugin stays pending, which\n * the loader reports as \"did not activate\".\n *\n * @module client\n */\n\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ComponentType } from 'react'\nimport type { PanelPayload } from '../types.js'\nimport { renderPanel } from './view.js'\n\n/** Path the host half registers on the web connection. */\nconst PANEL_PATH = '/api/context-memory.panel'\n\ninterface SlotsService {\n inject(name: string, register: () => void): void\n register(options: { name: string; id: string; order: number; label: () => string }, component: ComponentType): unknown\n}\n\n/** Fetch the panel payload; `reload` re-runs the request. */\nfunction usePanel() {\n const [html, setHtml] = useState<string | null>(null)\n const [error, setError] = useState<string | null>(null)\n const [tick, setTick] = useState(0)\n const reload = useCallback(() => setTick((t) => t + 1), [])\n\n useEffect(() => {\n const controller = new AbortController()\n setError(null)\n fetch(PANEL_PATH, { signal: controller.signal })\n .then(async (response) => {\n if (!response.ok) throw new Error(`panel request failed with ${response.status}`)\n return response.json() as Promise<PanelPayload>\n })\n .then((payload) => {\n if (!controller.signal.aborted) setHtml(renderPanel(payload))\n })\n .catch((cause: unknown) => {\n if (controller.signal.aborted) return\n // Say what failed rather than rendering an empty panel, which would read as\n // \"nothing recorded\" \u2014 a different and wrong answer.\n setError(cause instanceof Error ? cause.message : String(cause))\n })\n return () => controller.abort()\n }, [tick])\n\n return { html, error, reload }\n}\n\nfunction ContextmemoryPage() {\n const { html, error, reload } = usePanel()\n if (error !== null) {\n return (\n <section>\n <p role=\"alert\">Context memory panel failed to load: {error}</p>\n <button type=\"button\" onClick={reload}>Retry</button>\n </section>\n )\n }\n if (html === null) return <p aria-live=\"polite\">Loading the Context memory panel\u2026</p>\n // The markup is produced by `renderPanel`, which escapes every interpolated value.\n return <div dangerouslySetInnerHTML={{ __html: html }} />\n}\n\n/** The slots service is what the settings shell exposes. */\nexport const inject = ['slots']\n\nexport function apply(ctx: { slots: SlotsService }): void {\n ctx.slots.inject('settings.section', () => ctx.slots.register(\n {\n name: 'settings.section',\n id: 'context-memory',\n order: 46,\n label: () => 'Context memory',\n },\n ContextmemoryPage,\n ))\n}\n", "/**\n * Browser half of dsh-context-memory \u2014 the view model.\n *\n * Rendering is kept here, separate from the fetch-and-register shell, so it can be\n * statically rendered in Node during tests. The panel is a claim about what the agent\n * remembers, so it is worth asserting on without a browser.\n *\n * @module context-memory/client/view\n */\n\nimport type { MemoryState, PanelPayload } from '../types.js'\n\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n}\n\n/**\n * A memory's verification badge.\n *\n * Four states, not two, because \"no check exists\" and \"the check could not run\" are\n * different answers from \"the check failed\" \u2014 collapsing them would report an\n * unverifiable memory and a false one identically, which is the failure this plugin\n * exists to avoid.\n */\nexport function verificationLabel(memory: MemoryState): string {\n if (!memory.guard) return 'no check'\n switch (memory.verification?.outcome) {\n case 'passed': return 'checked, holds'\n case 'violated': return 'checked, does not hold'\n case 'broken': return 'check unusable'\n default: return 'not yet checked'\n }\n}\n\nfunction rows(memories: MemoryState[]): string {\n return memories\n .map((memory) => {\n const provenance = [\n memory.source,\n memory.sessionId ? `session ${memory.sessionId}` : null,\n memory.step !== undefined ? `step ${memory.step}` : null,\n ].filter(Boolean).join(' \u00B7 ')\n return `<tr><td><code>${escapeHtml(memory.id)}</code></td><td>${escapeHtml(memory.text)}</td><td>${escapeHtml(memory.kind)}</td><td>${escapeHtml(verificationLabel(memory))}</td><td>${escapeHtml(provenance)}</td></tr>`\n })\n .join('')\n}\n\nexport function renderPanel(payload: PanelPayload): string {\n const { totals } = payload\n\n const summary = `<p class=\"memory-summary\">${totals.active} active (${totals.verified} checked and holding, ${totals.unverified} not), ${totals.superseded} superseded, ${totals.withGuard} with a compiled check.</p>`\n\n const conflictBlock = payload.conflicts.length === 0\n ? '<p>No conflicts.</p>'\n : `<div class=\"memory-conflicts\"><h3>Conflicts</h3><ul>${payload.conflicts\n .map((conflict) => `<li><strong>${escapeHtml(conflict.subject)}</strong><ul>${conflict.memories\n .map((memory) => `<li><code>${escapeHtml(memory.id)}</code> ${escapeHtml(memory.text)}</li>`)\n .join('')}</ul></li>`)\n .join('')}</ul></div>`\n\n const activeBlock = payload.active.length === 0\n ? '<p>Nothing is remembered yet.</p>'\n : `<table><thead><tr><th>Id</th><th>Memory</th><th>Kind</th><th>Status</th><th>From</th></tr></thead><tbody>${rows(payload.active)}</tbody></table>`\n\n const supersededBlock = payload.superseded.length === 0\n ? ''\n : `<details><summary>Superseded (${payload.superseded.length})</summary><table><thead><tr><th>Id</th><th>Memory</th><th>Kind</th><th>Status</th><th>From</th></tr></thead><tbody>${rows(payload.superseded)}</tbody></table></details>`\n\n return `<div class=\"context-memory-panel\"><h2>Context memory</h2>${summary}${conflictBlock}<h3>Active</h3>${activeBlock}${supersededBlock}</div>`\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,mBAAiD;;;ACCjD,SAAS,WAAW,OAAuB;AACzC,SAAO,MACJ,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ;AAC3B;AAUO,SAAS,kBAAkB,QAA6B;AAC7D,MAAI,CAAC,OAAO,MAAO,QAAO;AAC1B,UAAQ,OAAO,cAAc,SAAS;AAAA,IACpC,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAY,aAAO;AAAA,IACxB,KAAK;AAAU,aAAO;AAAA,IACtB;AAAS,aAAO;AAAA,EAClB;AACF;AAEA,SAAS,KAAK,UAAiC;AAC7C,SAAO,SACJ,IAAI,CAAC,WAAW;AACf,UAAM,aAAa;AAAA,MACjB,OAAO;AAAA,MACP,OAAO,YAAY,WAAW,OAAO,SAAS,KAAK;AAAA,MACnD,OAAO,SAAS,SAAY,QAAQ,OAAO,IAAI,KAAK;AAAA,IACtD,EAAE,OAAO,OAAO,EAAE,KAAK,QAAK;AAC5B,WAAO,iBAAiB,WAAW,OAAO,EAAE,CAAC,mBAAmB,WAAW,OAAO,IAAI,CAAC,YAAY,WAAW,OAAO,IAAI,CAAC,YAAY,WAAW,kBAAkB,MAAM,CAAC,CAAC,YAAY,WAAW,UAAU,CAAC;AAAA,EAC/M,CAAC,EACA,KAAK,EAAE;AACZ;AAEO,SAAS,YAAY,SAA+B;AACzD,QAAM,EAAE,OAAO,IAAI;AAEnB,QAAM,UAAU,6BAA6B,OAAO,MAAM,YAAY,O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,YAAY,OAAO,CAAC;AAAA,IAC9D,CAAC,EACA,MAAM,CAAC,UAAmB;AACzB,UAAI,WAAW,OAAO,QAAS;AAG/B,eAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,IACjE,CAAC;AACH,WAAO,MAAM,WAAW,MAAM;AAAA,EAChC,GAAG,CAAC,IAAI,CAAC;AAET,SAAO,EAAE,MAAM,OAAO,OAAO;AAC/B;AAEA,SAAS,oBAAoB;AAC3B,QAAM,EAAE,MAAM,OAAO,OAAO,IAAI,SAAS;AACzC,MAAI,UAAU,MAAM;AAClB,WACE,6CAAC,aACC;AAAA,mDAAC,OAAE,MAAK,SAAQ;AAAA;AAAA,QAAsC;AAAA,SAAM;AAAA,MAC5D,4CAAC,YAAO,MAAK,UAAS,SAAS,QAAQ,mBAAK;AAAA,OAC9C;AAAA,EAEJ;AACA,MAAI,SAAS,KAAM,QAAO,4CAAC,OAAE,aAAU,UAAS,oDAAiC;AAEjF,SAAO,4CAAC,SAAI,yBAAyB,EAAE,QAAQ,KAAK,GAAG;AACzD;AAGO,IAAM,SAAS,CAAC,OAAO;AAEvB,SAAS,MAAM,KAAoC;AACxD,MAAI,MAAM,OAAO,oBAAoB,MAAM,IAAI,MAAM;AAAA,IACnD;AAAA,MACE,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,OAAO,MAAM;AAAA,IACf;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
3
+ "sources": ["../src/client/index.tsx", "../src/client/locales.ts", "../src/client/view.tsx"],
4
+ "sourcesContent": ["/**\n * Browser half of dsh-context-memory: its page inside Settings.\n *\n * Two services are injected by their runtime identity, not by the packages that provide\n * them: the settings shell is `slots`, the dictionary registry is `locale`. The label and\n * every string inside the component are translated through this plugin's own namespace,\n * which is why the page follows the UI language instead of the plugin author's.\n *\n * @module client\n */\n\nimport type { ComponentType } from 'react'\n\nimport { NS, en, zh } from './locales.js'\nimport { ContextMemoryPanel } from './view.js'\n\nexport const inject = ['slots', 'locale']\n\ninterface SlotsService {\n inject(name: string, register: () => void): void\n register(\n options: { name: string; id: string; order: number; label: () => string; locale: string },\n component: ComponentType<{ t: (key: string, params?: Record<string, unknown>) => string }>,\n ): unknown\n}\n\ninterface ClientContext {\n slots: SlotsService\n locale: {\n register(ns: string, dicts: { zh: unknown; en: unknown }): () => void\n bind(ns: string): (key: string, params?: Record<string, unknown>) => string\n }\n effect(callback: () => unknown, label?: string): unknown\n}\n\nexport function apply(ctx: ClientContext): void {\n // `zh` is the key-set source of truth, matching the official client plugins.\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-context-memory: dictionaries')\n\n ctx.slots.inject('settings.section', () => ctx.slots.register(\n {\n name: 'settings.section',\n id: 'context-memory',\n order: 46,\n label: () => ctx.locale.bind(NS)('nav'),\n locale: NS,\n },\n ContextMemoryPanel,\n ))\n}\n", "/**\n * Dictionaries for the Context memory page.\n *\n * `zh` is the key-set source of truth, as in the official client plugins, and `en` is\n * typed against it: a key translated in one language but not the other fails the build\n * instead of silently rendering the raw key.\n *\n * @module client/locales\n */\n\n/** Dictionary namespace owned by this plugin. */\nexport const NS = 'contextMemory'\n\n/** Simplified Chinese dictionary (the key-set source of truth). */\nexport const zh = {\n 'nav': '\u8DE8\u4F1A\u8BDD\u8BB0\u5FC6',\n 'title': '\u8DE8\u4F1A\u8BDD\u8BB0\u5FC6',\n 'active': '\u751F\u6548\u4E2D',\n 'superseded': '\u5DF2\u5931\u6548',\n 'conflicts': '\u51B2\u7A81',\n 'noConflicts': '\u6CA1\u6709\u51B2\u7A81\u3002',\n 'memory': '\u8BB0\u5FC6',\n 'kind': '\u7C7B\u578B',\n 'status': '\u6821\u9A8C\u72B6\u6001',\n 'from': '\u6765\u6E90',\n 'checkNone': '\u65E0\u68C0\u67E5',\n 'checkPassed': '\u5DF2\u6838\u5BF9\uFF0C\u6210\u7ACB',\n 'checkViolated': '\u5DF2\u6838\u5BF9\uFF0C\u4E0D\u6210\u7ACB',\n 'checkBroken': '\u68C0\u67E5\u65E0\u6CD5\u8FD0\u884C',\n 'checkPending': '\u5C1A\u672A\u6838\u5BF9',\n 'unverified': '\u672A\u9A8C\u8BC1\u6210\u7ACB',\n 'empty': '\u8FD8\u6CA1\u6709\u8BB0\u4F4F\u4EFB\u4F55\u5185\u5BB9\u3002',\n 'checkLegend': '\u65E0\u68C0\u67E5\uFF1D\u65E0\u6CD5\u7F16\u8BD1\u68C0\u67E5\uFF1B\u68C0\u67E5\u65E0\u6CD5\u8FD0\u884C\uFF1D\u68C0\u67E5\u672C\u8EAB\u6709\u95EE\u9898\uFF0C\u4E0D\u4EE3\u8868\u8BB0\u5FC6\u9519\u8BEF\u3002',\n 'refresh': '\u5237\u65B0',\n 'loading': '\u6B63\u5728\u52A0\u8F7D\u2026',\n 'failed': '\u52A0\u8F7D\u5931\u8D25',\n 'retry': '\u91CD\u8BD5',\n}\n\n/** English dictionary, checked complete against the zh key set. */\nexport const en: typeof zh = {\n 'nav': 'Context memory',\n 'title': 'Context memory',\n 'active': 'active',\n 'superseded': 'superseded',\n 'conflicts': 'Conflicts',\n 'noConflicts': 'No conflicts.',\n 'memory': 'Memory',\n 'kind': 'Kind',\n 'status': 'Check',\n 'from': 'From',\n 'checkNone': 'no check',\n 'checkPassed': 'checked, holds',\n 'checkViolated': 'checked, does not hold',\n 'checkBroken': 'check unusable',\n 'checkPending': 'not yet checked',\n 'unverified': 'not verified as holding',\n 'empty': 'Nothing is remembered yet.',\n 'checkLegend': 'no check = no check could be compiled; check unusable = the check is defective, not the memory.',\n 'refresh': 'Refresh',\n 'loading': 'Loading\u2026',\n 'failed': 'Failed to load',\n 'retry': 'Retry',\n}\n", "/**\n * Pure rendering half of the contextMemory page.\n *\n * Separate from `index.tsx` so a static render can assert in Node what the page draws \u2014\n * the shipped bundle is a loader factory only a browser can run. Every user-visible\n * string comes from the `t` seat the renderer binds from this plugin's namespace, so the\n * page follows the UI language; no copy is hardcoded here.\n *\n * @module client/view\n */\n\nimport { useCallback, useEffect, useState } from 'react'\nimport type { CSSProperties } from 'react'\n\nimport type { MemoryState, PanelPayload } from '../types.js'\n\n/** The translate seat the renderer binds from this plugin's locale namespace. */\nexport type Translate = (key: string, params?: Record<string, unknown>) => string\n\nexport interface PanelProps {\n /** Bound translate function for this plugin's namespace. */\n t: Translate\n}\n\n/** Panel route registered by the host half on the web connection. */\nconst PANEL_PATH = \"/api/context-memory.panel\"\n\nconst wrap: CSSProperties = { display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 760, fontFamily: 'inherit' }\nconst head: CSSProperties = { display: 'flex', alignItems: 'baseline', gap: 12, flexWrap: 'wrap' }\nconst muted: CSSProperties = { fontSize: 12, opacity: 0.75 }\nconst table: CSSProperties = { borderCollapse: 'collapse', width: '100%' }\nconst th: CSSProperties = { textAlign: 'left', padding: '4px 10px 4px 0', fontWeight: 600, fontSize: 12, opacity: 0.8, borderBottom: '0.5px solid rgba(128,128,128,0.4)' }\nconst td: CSSProperties = { padding: '6px 10px 6px 0', fontSize: 13, borderBottom: '0.5px solid rgba(128,128,128,0.18)' }\nconst list: CSSProperties = { margin: 0, paddingLeft: 18, fontSize: 13 }\n\ninterface PanelState {\n payload: PanelPayload | null\n error: string | null\n}\n\n/** Fetch the host panel payload; `reload` re-runs the request. */\nexport function usePanel(): PanelState & { reload: () => void } {\n const [state, setState] = useState<PanelState>({ payload: null, error: null })\n const [tick, setTick] = useState(0)\n const reload = useCallback(() => setTick((value) => value + 1), [])\n\n useEffect(() => {\n const controller = new AbortController()\n setState((previous) => ({ ...previous, error: null }))\n fetch(PANEL_PATH, { signal: controller.signal })\n .then(async (response) => {\n if (!response.ok) throw new Error(String(response.status))\n return response.json() as Promise<PanelPayload>\n })\n .then((payload) => {\n if (!controller.signal.aborted) setState({ payload, error: null })\n })\n .catch((cause: unknown) => {\n if (controller.signal.aborted) return\n setState({ payload: null, error: cause instanceof Error ? cause.message : String(cause) })\n })\n return () => controller.abort()\n }, [tick])\n\n return { ...state, reload }\n}\n\n/**\n * A memory's verification label.\n *\n * Four states, not two, because \"no check exists\" and \"the check could not run\" are\n * different answers from \"the check failed\" \u2014 collapsing them would report an\n * unverifiable memory and a false one identically, which is the failure this plugin\n * exists to avoid.\n */\nexport function checkLabel(memory: MemoryState, t: Translate): string {\n if (!memory.guard) return t('checkNone')\n switch (memory.verification?.outcome) {\n case 'passed': return t('checkPassed')\n case 'violated': return t('checkViolated')\n case 'broken': return t('checkBroken')\n default: return t('checkPending')\n }\n}\n\n/** Where a memory came from: the answer to \"why does the agent think it knows this\". */\nexport function provenance(memory: MemoryState): string {\n return [\n memory.source,\n memory.sessionId !== undefined ? `session ${memory.sessionId}` : null,\n memory.step !== undefined ? `step ${String(memory.step)}` : null,\n ].filter((part) => part !== null).join(' \u00B7 ')\n}\n\nexport function ContextMemoryPanel({ t }: PanelProps) {\n const { payload, error, reload } = usePanel()\n const header = (\n <header style={head}>\n <strong style={{ fontSize: 13 }}>{t('title')}</strong>\n <span style={{ flex: 1 }} />\n <button type=\"button\" onClick={reload} style={{ fontSize: 12 }}>{t('refresh')}</button>\n </header>\n )\n if (error !== null) {\n return (\n <div style={wrap}>\n {header}\n <p role=\"alert\" style={{ margin: 0, fontSize: 13 }}>{t('failed')}: {error}</p>\n <button type=\"button\" onClick={reload} style={{ alignSelf: 'flex-start', fontSize: 12 }}>{t('retry')}</button>\n </div>\n )\n }\n if (payload === null) return <p style={muted} aria-live=\"polite\">{t('loading')}</p>\n const rows = (memories: MemoryState[]) => memories.map((memory) => (\n <tr key={memory.id}>\n <td style={td}><code style={{ fontSize: 11 }}>{memory.id}</code></td>\n <td style={td}>{memory.text}</td>\n <td style={td}>{memory.kind}</td>\n <td style={td}>{checkLabel(memory, t)}</td>\n <td style={td}>{provenance(memory)}</td>\n </tr>\n ))\n const { totals } = payload\n return (\n <div style={wrap}>\n {header}\n <span style={muted}>\n {t('active')} {totals.active} \u00B7 {t('checkPassed')} {totals.verified} \u00B7 {t('unverified')} {totals.unverified} \u00B7 {t('superseded')} {totals.superseded}\n </span>\n <span style={muted}>{t('checkLegend')}</span>\n <strong style={{ fontSize: 13 }}>{t('conflicts')}</strong>\n {payload.conflicts.length === 0 ? (\n <span style={muted}>{t('noConflicts')}</span>\n ) : (\n <ul style={list}>\n {payload.conflicts.map((conflict) => (\n <li key={conflict.subject}>\n <strong>{conflict.subject}</strong>\n <ul style={{ ...list, fontSize: 12, opacity: 0.85 }}>\n {conflict.memories.map((memory) => (\n <li key={memory.id}><code style={{ fontSize: 11 }}>{memory.id}</code> {memory.text}</li>\n ))}\n </ul>\n </li>\n ))}\n </ul>\n )}\n <strong style={{ fontSize: 13 }}>{t('active')}</strong>\n {payload.active.length === 0 ? (\n <p style={{ margin: 0, fontSize: 13, opacity: 0.8 }}>{t('empty')}</p>\n ) : (\n <table style={table}>\n <thead>\n <tr>\n <th style={th}>Id</th><th style={th}>{t('memory')}</th><th style={th}>{t('kind')}</th>\n <th style={th}>{t('status')}</th><th style={th}>{t('from')}</th>\n </tr>\n </thead>\n <tbody>{rows(payload.active)}</tbody>\n </table>\n )}\n {payload.superseded.length > 0 && (\n <>\n <strong style={{ fontSize: 13 }}>{t('superseded')} ({payload.superseded.length})</strong>\n <table style={table}>\n <thead>\n <tr>\n <th style={th}>Id</th><th style={th}>{t('memory')}</th><th style={th}>{t('kind')}</th>\n <th style={th}>{t('status')}</th><th style={th}>{t('from')}</th>\n </tr>\n </thead>\n <tbody>{rows(payload.superseded)}</tbody>\n </table>\n </>\n )}\n </div>\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,KAAK;AAGX,IAAM,KAAK;AAAA,EAChB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AAAA,EACf,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EAC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AI,GAAG,CAAC,GAAG,kCAAkC;AAExF,MAAI,MAAM,OAAO,oBAAoB,MAAM,IAAI,MAAM;AAAA,IACnD;AAAA,MACE,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,OAAO,MAAM,IAAI,OAAO,KAAK,EAAE,EAAE,KAAK;AAAA,MACtC,QAAQ;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,32 +1,68 @@
1
1
  {
2
2
  "name": "dsh-context-memory",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "Cross-session memory for your dsh agent: remembered, recalled, and re-verified instead of assumed.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
- "bin": { "dsh-context-memory": "lib/bin.js" },
8
+ "bin": {
9
+ "dsh-context-memory": "lib/bin.js"
10
+ },
9
11
  "exports": {
10
- ".": { "types": "./lib/index.d.ts", "default": "./lib/index.js" },
11
- "./client": { "types": "./lib/client/index.d.ts", "default": "./lib/memory.web.js" },
12
+ ".": {
13
+ "types": "./lib/index.d.ts",
14
+ "default": "./lib/index.js"
15
+ },
16
+ "./client": {
17
+ "types": "./lib/client/index.d.ts",
18
+ "default": "./lib/memory.web.js"
19
+ },
12
20
  "./package.json": "./package.json"
13
21
  },
14
- "files": ["lib", "cordis.patch.yml", "README.md", "CHANGELOG.md"],
15
- "keywords": ["dsh", "dsh-plugin", "deepseek-harness", "memory", "context", "recall", "persistence"],
22
+ "files": [
23
+ "lib",
24
+ "cordis.patch.yml",
25
+ "README.md",
26
+ "CHANGELOG.md"
27
+ ],
28
+ "keywords": [
29
+ "dsh",
30
+ "dsh-plugin",
31
+ "deepseek-harness",
32
+ "memory",
33
+ "context",
34
+ "recall",
35
+ "persistence"
36
+ ],
16
37
  "dsh": {
17
- "bundle": { "patch": "./cordis.patch.yml" },
38
+ "bundle": {
39
+ "patch": "./cordis.patch.yml"
40
+ },
18
41
  "client": {
19
42
  "platform": "web",
20
- "inject": ["slots", "connection"]
43
+ "inject": [
44
+ "@deepseek-ai/dsh-client-ui-renderer",
45
+ "@deepseek-ai/dsh-client-locale",
46
+ "@deepseek-ai/dsh-client-ui-settings"
47
+ ]
21
48
  }
22
49
  },
23
50
  "license": "MIT",
24
51
  "author": "hj01857655",
25
- "repository": { "type": "git", "url": "git+https://github.com/hj01857655/dsh-context-memory.git" },
26
- "bugs": { "url": "https://github.com/hj01857655/dsh-context-memory/issues" },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/hj01857655/dsh-context-memory.git"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/hj01857655/dsh-context-memory/issues"
58
+ },
27
59
  "homepage": "https://github.com/hj01857655/dsh-context-memory#readme",
28
- "engines": { "node": ">=20" },
29
- "peerDependencies": { "@deepseek-ai/cordis": "^4.0.1" },
60
+ "engines": {
61
+ "node": ">=20"
62
+ },
63
+ "peerDependencies": {
64
+ "@deepseek-ai/cordis": "^4.0.1"
65
+ },
30
66
  "devDependencies": {
31
67
  "@deepseek-ai/cordis": "^4.0.2",
32
68
  "@types/node": "^22.20.3",