@exellix/jobs-ui 2.0.1 → 2.0.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @exellix/jobs-ui
2
2
 
3
- **Jobs dashboard** — React operator SPA for the Exellix job queue. Queue overview, run detail, record-centric views, Source→Records workflow, and work-factory wizards (continuous work, batches, on-demand).
3
+ **Jobs dashboard** — React operator SPA for the Exellix job factory. Monitor queue health, browse Memorix information and graph outputs, inspect the run journal, configure ongoing work and on-demand batches, and analyze pipeline performance.
4
4
 
5
5
  | Package | Role |
6
6
  |---------|------|
@@ -9,7 +9,38 @@
9
9
  | **`@exellix/jobs-ui`** (this) | Jobs **dashboard** — React SPA only |
10
10
  | [`@exellix/jobs-db`](../jobs-db/README.md) | Jobs **data tier** — Mongo persistence |
11
11
 
12
- > A **JobRun** is one graph run on one input. See [`temp/jobs/`](../temp/jobs/README.md) for the design.
12
+ > A **factory run** is one graph execution on one information item. Continuous work and on-demand flows both enqueue runs into the same journal. See [`temp/jobs/`](../temp/jobs/README.md) for the design.
13
+
14
+ > **Migration from 1.x:** `@exellix/jobs-ui@1.x` bundled the HTTP API and dashboard in one package. **2.x is dashboard-only** — use [`@exellix/jobs-api`](../jobs-api/README.md) for the REST server and programmatic queries.
15
+
16
+ ## Core concepts
17
+
18
+ ### Information items (not just “database records”)
19
+
20
+ The UI speaks in operator terms — **Information** and **item** — but the API and Memorix layer still use **record** in paths and types (`core-records`, `recordId`, etc.). Treat those as the same idea: **one processable unit of information** that a pipeline can run on.
21
+
22
+ That unit is **not** limited to a classic entity row. What it *is* depends entirely on how the object type is modeled in Schema UI and stored in Memorix. Examples:
23
+
24
+ | What you might process | Typical Memorix shape |
25
+ |------------------------|------------------------|
26
+ | A business object (asset, ticket, person) | Core record on an **entity** |
27
+ | A document, page, or media asset | **Content** in a scoped content type |
28
+ | One chat turn | A row in a messages / content collection |
29
+ | An entire conversation | The **core** record for a chat entity (with related message content assembled at run time) |
30
+ | A time-stamped occurrence | An **event** record |
31
+ | A knowledge article or embedding source | A **knowledge** record |
32
+ | Graph output from a prior run | A row in a **processing-output** collection (shown under Outputs) |
33
+
34
+ So “record” here means **whatever your schema defines as the input identity for a run** — not necessarily a single Mongo document in `core`, and not necessarily one physical row if you merge related content types when queuing.
35
+
36
+ For the job factory:
37
+
38
+ - **One factory run = one item** — identified by `entity` + `collection` + `id` (plus optional related content pulled in as context).
39
+ - **Narratives** tag items for matching (ongoing work and batch selection) — e.g. “needs summary”, “high priority”.
40
+ - **Processing stamps** track which pipelines have touched an item and whether they succeeded.
41
+ - **Assembly** (on-demand single) lets you choose which content types and fields are merged into graph input without changing which item the run is *for*.
42
+
43
+ Browse and inspect items under **Information** (inputs) and **Outputs** (saved pipeline results). The journal always refers back to the item that was processed, whatever shape it had.
13
44
 
14
45
  ## Install
15
46
 
@@ -21,15 +52,35 @@ The dashboard requires a running `@exellix/jobs-api` instance (or any host servi
21
52
 
22
53
  ## Quick start
23
54
 
55
+ **Recommended** — one command starts API, queue worker, and UI (needs `MONGO_URI` in `graph-engine/.env`):
56
+
24
57
  ```bash
25
- # terminal 1API backend (needs MONGO_URI)
58
+ npm run dev # from jobs-uifull stack via scripts/dev-jobs.mjs
59
+ # or from monorepo root:
60
+ npm run dev:jobs
61
+ ```
62
+
63
+ | URL | Service |
64
+ |-----|---------|
65
+ | http://localhost:5190 | Dashboard (Vite, proxies `/api`) |
66
+ | http://localhost:3099 | jobs-api REST server |
67
+
68
+ **Split terminals** (UI-only with HMR against an API you start separately):
69
+
70
+ ```bash
71
+ # terminal 1 — API backend
26
72
  cd ../jobs-api && npm run serve
27
73
 
28
- # terminal 2 — UI with HMR
29
- npm run dev # Vite on :5190, proxies /api → http://localhost:3099
74
+ # terminal 2 — UI only
75
+ npm run dev:ui # Vite on :5190, proxies /api → http://localhost:3099
30
76
  ```
31
77
 
32
- Set `VITE_API_PROXY` to point at a remote API during dev. Set `VITE_DEV_PORT` to change the dev server port.
78
+ ### Dev configuration
79
+
80
+ | Variable | Default | Effect |
81
+ |----------|---------|--------|
82
+ | `VITE_API_PROXY` | `http://localhost:<PORT>` | API target for the Vite `/api` proxy (`PORT` from `jobs-api/.env`, default 3099) |
83
+ | `VITE_DEV_PORT` | `5190` | Vite dev server port |
33
84
 
34
85
  ### Combined deploy (single port)
35
86
 
@@ -40,32 +91,212 @@ npm run build
40
91
  cd ../jobs-api && JOBS_UI_STATIC_DIR=../jobs-ui/dist npm run serve
41
92
  ```
42
93
 
43
- ## Browser routes
94
+ When the API sets `JOBS_UI_TOKEN`, the SPA must send `Authorization: Bearer <token>` on `/api/*` requests (configure at the reverse proxy or API layer).
95
+
96
+ ## Architecture
97
+
98
+ - **React 19** SPA with **React Router** and **TanStack Query** for data fetching and cache invalidation.
99
+ - All data flows through `web/src/api/real.ts` → `/api/*` on the jobs-api host.
100
+ - **Agent scope** — the top-bar `AgentScopeSelect` (`@x12i/memorix-agents`) filters entities, ongoing work, information lists, and journal views to a single Memorix agent when selected. Persisted in `localStorage` under `exellix-memorix-ui.selected-agent`.
101
+ - **Queue manager** — compact pause/resume control in the top bar; full card on Settings. Polls queue settings every 10s.
102
+ - **Infinite scroll** — Information browse and Journal list load pages on demand via `useCoreRecordsInfinite` / `useFactoryRunsInfinite`.
103
+
104
+ ## Navigation
105
+
106
+ | Nav item | Route(s) | Purpose |
107
+ |----------|----------|---------|
108
+ | Overview | `/` | Factory health, status counts, throughput chart, recent failed/running/pending runs |
109
+ | Work | `/work`, `/work/new`, `/work/:id` | Ongoing (continuous) work definitions |
110
+ | On-Demand | `/on-demand`, `/on-demand/single`, `/on-demand/batch`, `/on-demand/batch/:id` | Ad-hoc single-item and batch runs |
111
+ | Information | `/information`, `/information/:recordId` | Browse Memorix information items (any schema-defined processable unit) |
112
+ | Outputs | `/outputs`, `/outputs/:recordId` | Browse graph output collections and saved results |
113
+ | Journal | `/journal`, `/journal/:id` | Factory run list and per-run inspection |
114
+ | Pipeline analytics | `/pipelines`, `/pipelines/:graphId`, `/pipelines/entity/:entityName` | Aggregated performance by pipeline or entity |
115
+ | Settings | `/settings` | Queue manager, concurrency, admission interval |
116
+ | Item timeline (legacy) | `/items/:itemId` | Multi-run DAG timeline for a single item ID |
117
+
118
+ ### Legacy redirects
119
+
120
+ Older bookmarks still resolve:
121
+
122
+ | Old path | Redirects to |
123
+ |----------|--------------|
124
+ | `/records`, `/records/:id`, `/sources` | `/information` |
125
+ | `/runs`, `/runs/:id` | `/journal` |
126
+ | `/job-defs`, `/job-defs/:id` | `/work` |
127
+ | `/jobs/new` | `/on-demand` |
128
+
129
+ ## Features by area
130
+
131
+ ### Overview (`/`)
132
+
133
+ - Live status cards for all run states: blocked, pending, running, done, failed, cancelled — click a card to open Journal filtered by that status.
134
+ - Filters: source type (continuous / on-demand single / on-demand batch), ongoing work, entity.
135
+ - 24-hour throughput chart.
136
+ - Preview columns: recent failed, currently running, oldest pending (with inline cancel for pending/blocked).
137
+ - Subtitle shows job manager state (running/paused), active slot usage, and selected agent scope.
138
+
139
+ ### Ongoing work (`/work`)
140
+
141
+ Continuous work definitions poll Memorix on a schedule, match items by narratives and processing rules, and enqueue factory runs automatically.
142
+
143
+ **List** — name, status (active/inactive), entity, narratives, reprocessing mode, graph, re-scan interval, last scan, jobs created, last evaluation result. Actions: evaluate now, activate/deactivate.
144
+
145
+ **Create wizard** (`/work/new`) — six steps:
146
+
147
+ 1. Basic info — name, description, entity
148
+ 2. Narratives — select information tags on the entity
149
+ 3. Prerequisites — reprocessing TTL/skip, exclude in-flight, required graphs, cross-entity prerequisites
150
+ 4. Graph — pipeline chooser with optional persistency override
151
+ 5. Execution policy — re-scan interval (5 min – 24 h), priority
152
+ 6. Review — create inactive or create and activate
153
+
154
+ **Detail** (`/work/:id`) — tabs:
155
+
156
+ - **Overview** — configuration, schedule, jobs created, estimated matching
157
+ - **Evaluations** — history of each scan cycle (matched, created, excluded)
158
+ - **Matching Information** — live preview of items that would match current rules
159
+ - **Runs** — infinite-scroll journal filtered to this work definition
160
+ - **Settings** — edit name, narratives, processing, graph, policy, persistency; exclusion panel for last evaluation
161
+
162
+ ### On-Demand (`/on-demand`)
44
163
 
45
- | Route | Page |
46
- |-------|------|
47
- | `/` | Queue Overview |
48
- | `/runs` | Runs list |
49
- | `/runs/:id` | Run detail |
50
- | `/sources` | Source picker |
51
- | `/records` | Records list |
52
- | `/records/:recordId` | Record detail |
53
- | `/items/:itemId` | Item timeline + DAG |
54
- | `/jobs/new` | Create / enqueue job |
55
- | `/job-defs` | Job definition list |
56
- | `/job-defs/:id` | Job definition detail |
57
- | `/settings` | App-wide queue execution settings |
164
+ **Hub** choose single item or batch mode.
58
165
 
59
- Work-factory routes: `/work`, `/work/:id`, `/batches/:id`, on-demand flows see [`jobs-api` HTTP docs](../jobs-api/README.md).
166
+ **Single item** (`/on-demand/single`)seven-step wizard:
167
+
168
+ 1. Choose item — entity, collection, narratives, pick a specific item or a random sample
169
+ 2. Context — optional related records (ContentTypeAssembler)
170
+ 3. Choose graph — entity-compatible pipelines from Catalox
171
+ 4. Result writeback — simulation, graph default, same-entity inferences, or custom persistency
172
+ 5. Properties — assembly selection (which content types/fields feed the graph)
173
+ 6. Review & run — priority, summary
174
+ 7. Done — action result with link to journal entry
175
+
176
+ Supports deep-link `?entity=` from Information detail.
177
+
178
+ **Batch** (`/on-demand/batch`) — seven-step wizard:
179
+
180
+ 1. Entity
181
+ 2. Narratives
182
+ 3. Processing filters (reprocessing, exclude in-flight, prerequisites)
183
+ 4. Graph
184
+ 5. Review — matching count preview
185
+ 6. Queue policy — batch name, priority
186
+ 7. Queued — batch created; link to batch detail
187
+
188
+ **Batch detail** (`/on-demand/batch/:id`) — status counts, selection summary, excluded items panel, infinite-scroll run list.
189
+
190
+ ### Information (`/information`)
191
+
192
+ Browse Memorix items for an entity — see [Information items](#information-items-not-just-database-records) above. The default view is the entity’s **core** collection, but an “item” may represent a full object, a content slice, a message, a chat, or any other shape your schema defines.
193
+
194
+ - Filters: entity, collection (core and related), narratives (chip multi-select), processed-by graph, processing status (succeeded / failed / running / queued / not-processed / unknown).
195
+ - Infinite-scroll table with dynamic scalar columns from the first row.
196
+ - Actions: run on-demand for entity, create batch from current filter.
197
+ - Row click → item detail.
198
+
199
+ **Item detail** (`/information/:recordId?entity=&collection=`) — tabs:
200
+
201
+ - **Core** — id, entity, label, scalar fields, timestamps
202
+ - **Narratives** — assigned tags with provenance
203
+ - **Processing** — per-graph processing stamps and status
204
+ - **Snapshots** — Memorix snapshot history
205
+ - **Journal** — factory runs for this item (infinite scroll)
206
+
207
+ Shortcut: **Run on-demand** pre-fills the single-item wizard.
208
+
209
+ ### Outputs (`/outputs`)
210
+
211
+ Same browse UI as Information, scoped to `processing-output` collections.
212
+
213
+ - Filter by entity and output collection.
214
+ - **Clear collection** — typed confirmation (`{entity}-{collection}`) deletes all items in that output collection and clears linked stamps.
215
+ - **Item detail** — Output tab (full JSON document), Journal tab; delete a single saved result.
216
+
217
+ ### Journal (`/journal`)
218
+
219
+ Factory run list with infinite scroll.
220
+
221
+ - Scope: total / today / this week / this month.
222
+ - Filters: status, source type, ongoing work, batch, graph, entity, record ID.
223
+ - Bulk cancel for pending/blocked runs (multi-select).
224
+ - Status count chips from API.
225
+
226
+ **Run detail** (`/journal/:id`) — tabs:
227
+
228
+ - **Overview** — summary, source link (work or batch), processing result card, queue admission state, stale-running warning
229
+ - **Console** — live event stream while running (auto-refresh 1.5s)
230
+ - **Pipeline** — execution diagram and performance panel (duration, tokens, cost per node)
231
+ - **Input & Output** — assembled input, graph result, Memorix writeback (`RunIoPanel`)
232
+ - **Details** — raw metadata, assembly selection, related records, error trace
233
+
234
+ Actions: **Re-run** (new journal entry), **Execute now** (inline worker), **Run next when slot available**, **Retry same entry**, **Cancel**.
235
+
236
+ ### Pipeline analytics (`/pipelines`)
237
+
238
+ Two modes (tab switcher):
239
+
240
+ - **By pipeline** — pick a graph; see aggregate runs, success rate, duration/token/cost stats per node and sub-step; execution diagram; performance guide.
241
+ - **By entity** — roll up all graphs for an entity.
242
+
243
+ Drill-down routes: `/pipelines/:graphId`, `/pipelines/entity/:entityName`.
244
+
245
+ Links from run detail and journal rows open the matching pipeline view.
246
+
247
+ ### Settings (`/settings`)
248
+
249
+ - **Job manager** card — pause/resume with running/pending/held counts.
250
+ - **Queue execution** — max concurrent jobs, admission check interval (15s – 2 min). Saved via `PUT /api/settings`.
251
+
252
+ ### Global controls (top bar)
253
+
254
+ - **Queue manager toggle** — pause/resume without leaving the current page.
255
+ - **Agent scope** — filter multi-tenant Memorix agents; affects entity lists, work, information, journal, and pipeline entity mode.
256
+ - **Runtime badge** — Mongo database and host from `GET /api/config`.
257
+
258
+ ## Shared UI building blocks
259
+
260
+ | Component | Used for |
261
+ |-----------|----------|
262
+ | `Wizard` / `WizardSteps` | Multi-step create flows (work, on-demand) |
263
+ | `GraphChooser` | Entity-compatible pipeline picker |
264
+ | `NarrativeChecklist` | Narrative multi-select |
265
+ | `CollectionSourcePicker` | Core vs auxiliary collections |
266
+ | `MatchingPreview` | Count/sample of items matching selection rules |
267
+ | `PrerequisitesEditor` | Reprocessing and cross-graph prerequisites |
268
+ | `PersistencyOverrideEditor` / `ResultWritebackEditor` | Where graph results are saved |
269
+ | `ContentTypeAssembler` | Related-record context for single runs |
270
+ | `PipelineExecutionDiagram` / `PipelinePerformancePanel` | Run and aggregate analytics |
271
+ | `ExclusionPanel` | Why items were skipped in evaluations/batches |
272
+ | `InfiniteScrollFooter` | Paginated list footers |
273
+ | `LiveConsole` | Streaming run events |
274
+ | `DagView` | Item-level multi-run dependency graph (`/items/:itemId`) |
60
275
 
61
276
  ## Scripts
62
277
 
63
278
  ```bash
64
279
  npm run build # vite build → dist/
65
- npm run dev # Vite dev server + API proxy
66
- npm test # build smoke test + graph-picker unit tests
280
+ npm run dev # API + queue worker + UI (full local stack)
281
+ npm run dev:ui # Vite only requires jobs-api on :3099
282
+ npm run dev:all # same as npm run dev
283
+ npm test # build smoke test, graph-picker + pipeline-performance unit tests
284
+ npm run test:watch # vitest watch mode
67
285
  ```
68
286
 
287
+ ## API contract
288
+
289
+ The UI expects the full jobs-api surface documented in [`jobs-api`](../jobs-api/README.md). Key groups used by the dashboard:
290
+
291
+ - **Health / config** — `/api/health`, `/api/config`
292
+ - **Queue settings** — `GET|PUT /api/settings`, `POST /api/queue/push`
293
+ - **Factory runs** — list, detail, execute, retry, cancel, queue-next, activities
294
+ - **Work factory** — work CRUD, evaluate, batches, on-demand single/batch
295
+ - **Memorix records** — entities, narratives, core-records, clear/delete, processing stamps
296
+ - **Selection** — matching preview, assembler properties/preview
297
+ - **Stats** — throughput, stuck (overview/journal helpers)
298
+ - **Agents proxy** — `/api/agents/*` for `AgentScopeSelect`
299
+
69
300
  ## License
70
301
 
71
302
  exellix-license