@abstractframework/monitor-active-memory 0.1.0
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.md +76 -0
- package/dist/KgActiveMemoryExplorer.d.ts +33 -0
- package/dist/KgActiveMemoryExplorer.d.ts.map +1 -0
- package/dist/KgActiveMemoryExplorer.js +1398 -0
- package/dist/graph.d.ts +74 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +523 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +58 -0
- package/src/styles.css +378 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @abstractuic/monitor-active-memory
|
|
2
|
+
|
|
3
|
+
ReactFlow-based explorer for **Knowledge Graph assertions** (`KgAssertion`) and the derived **Active Memory** text.
|
|
4
|
+
|
|
5
|
+
## What you get
|
|
6
|
+
|
|
7
|
+
- `KgActiveMemoryExplorer` component (see `monitor-active-memory/src/KgActiveMemoryExplorer.tsx`)
|
|
8
|
+
- Graph/layout utilities (see `monitor-active-memory/src/graph.ts`):
|
|
9
|
+
- `buildKgGraph`, `shortestPath`
|
|
10
|
+
- `buildKgLayout` + force-layout helpers (`initForceSimulation`, `stepForceSimulation`, …)
|
|
11
|
+
- Types / contracts (see `monitor-active-memory/src/types.ts`):
|
|
12
|
+
- `KgAssertion`, `KgQueryParams`, `KgQueryResult`
|
|
13
|
+
|
|
14
|
+
## Peer dependencies
|
|
15
|
+
|
|
16
|
+
Declared in `monitor-active-memory/package.json`:
|
|
17
|
+
|
|
18
|
+
- `react@^18`, `react-dom@^18`
|
|
19
|
+
- `reactflow@^11`
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
- Workspace: add a dependency on `@abstractuic/monitor-active-memory`
|
|
24
|
+
- npm (once published): `npm i @abstractuic/monitor-active-memory`
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { KgActiveMemoryExplorer, type KgAssertion } from "@abstractuic/monitor-active-memory";
|
|
30
|
+
|
|
31
|
+
const items: KgAssertion[] = [];
|
|
32
|
+
|
|
33
|
+
export function MemoryView() {
|
|
34
|
+
return (
|
|
35
|
+
<KgActiveMemoryExplorer
|
|
36
|
+
title="Active Memory"
|
|
37
|
+
items={items}
|
|
38
|
+
activeMemoryText=""
|
|
39
|
+
onQuery={async (params) => {
|
|
40
|
+
// Your host decides how to fetch/search KG assertions.
|
|
41
|
+
return { ok: true, items: [], active_memory_text: "" };
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Key props (host integration points)
|
|
49
|
+
|
|
50
|
+
Authoritative prop types live in `monitor-active-memory/src/KgActiveMemoryExplorer.tsx` (`KgActiveMemoryExplorerProps`).
|
|
51
|
+
|
|
52
|
+
- `items: KgAssertion[]` (required)
|
|
53
|
+
- `activeMemoryText?: string`
|
|
54
|
+
- `onQuery?: (params: KgQueryParams) => Promise<KgQueryResult>` (enables the query UI)
|
|
55
|
+
- `queryMode?: "override" | "replace"` (how query results interact with `items`)
|
|
56
|
+
- `onItemsReplace?: (items, meta) => void` (used when `queryMode === "replace"`)
|
|
57
|
+
- `onOpenSpan?` / `onOpenTranscript?` (optional host navigation hooks)
|
|
58
|
+
|
|
59
|
+
## Layout persistence
|
|
60
|
+
|
|
61
|
+
The component can persist per-view layouts in `localStorage` under key `abstractuic_amx_saved_layouts_v1` (see `monitor-active-memory/src/KgActiveMemoryExplorer.tsx`).
|
|
62
|
+
|
|
63
|
+
## CSS
|
|
64
|
+
|
|
65
|
+
- ReactFlow base styles are **not** imported by this package. In your app:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import "reactflow/dist/style.css";
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- This package imports `monitor-active-memory/src/styles.css` internally.
|
|
72
|
+
|
|
73
|
+
## Related docs
|
|
74
|
+
|
|
75
|
+
- Getting started: [`docs/getting-started.md`](../docs/getting-started.md)
|
|
76
|
+
- Architecture: [`docs/architecture.md`](../docs/architecture.md)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { JsonValue, KgAssertion, KgQueryParams, KgQueryResult } from './types';
|
|
2
|
+
import './styles.css';
|
|
3
|
+
export interface KgActiveMemoryExplorerProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
resetKey?: string;
|
|
6
|
+
queryMode?: 'override' | 'replace';
|
|
7
|
+
items: KgAssertion[];
|
|
8
|
+
activeMemoryText?: string;
|
|
9
|
+
packets?: JsonValue[];
|
|
10
|
+
packetsVersion?: number;
|
|
11
|
+
packedCount?: number;
|
|
12
|
+
dropped?: number;
|
|
13
|
+
estimatedTokens?: number;
|
|
14
|
+
effort?: JsonValue;
|
|
15
|
+
warnings?: JsonValue;
|
|
16
|
+
onQuery?: (params: KgQueryParams) => Promise<KgQueryResult>;
|
|
17
|
+
onItemsReplace?: (items: KgAssertion[], meta: {
|
|
18
|
+
kind: 'live query' | 'expanded neighborhood';
|
|
19
|
+
result: KgQueryResult;
|
|
20
|
+
}) => void;
|
|
21
|
+
onOpenSpan?: (args: {
|
|
22
|
+
span_id: string;
|
|
23
|
+
run_id: string;
|
|
24
|
+
assertion: KgAssertion;
|
|
25
|
+
}) => void;
|
|
26
|
+
onOpenTranscript?: (args: {
|
|
27
|
+
run_id: string;
|
|
28
|
+
span_id?: string;
|
|
29
|
+
assertion: KgAssertion;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function KgActiveMemoryExplorer({ title, resetKey, queryMode, items, activeMemoryText, packets, packetsVersion, packedCount, dropped, estimatedTokens, effort, warnings, onQuery, onItemsReplace, onOpenSpan, onOpenTranscript, }: KgActiveMemoryExplorerProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=KgActiveMemoryExplorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KgActiveMemoryExplorer.d.ts","sourceRoot":"","sources":["../src/KgActiveMemoryExplorer.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAA4B,MAAM,SAAS,CAAC;AAC9G,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5D,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE;QAAE,IAAI,EAAE,YAAY,GAAG,uBAAuB,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/H,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IACzF,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CACjG;AAgSD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,WAAW,EACX,OAAO,EACP,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,cAAc,EACd,UAAU,EACV,gBAAgB,GACjB,EAAE,2BAA2B,2CAypD7B"}
|