pi-mega-compact 0.7.7 → 0.7.9
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 +11 -12
- package/dist/extensions/dashboard-server/helpers.js +37 -0
- package/dist/extensions/dashboard-server/html/all-repos-tab.js +26 -0
- package/dist/extensions/dashboard-server/html/body-open.js +23 -0
- package/dist/extensions/dashboard-server/html/current-repo-tab.js +130 -0
- package/dist/extensions/dashboard-server/html/head-open.js +16 -0
- package/dist/extensions/dashboard-server/html/high-score-tab.js +25 -0
- package/dist/extensions/dashboard-server/html/repo-detail-modal.js +26 -0
- package/dist/extensions/dashboard-server/html/script.js +259 -0
- package/dist/extensions/dashboard-server/html/styles.js +103 -0
- package/dist/extensions/dashboard-server/html/summary-tab.js +19 -0
- package/dist/extensions/dashboard-server/html-template.js +41 -0
- package/dist/extensions/dashboard-server/html.js +756 -0
- package/dist/extensions/dashboard-server/index-reader.js +133 -0
- package/dist/extensions/dashboard-server/server.js +370 -0
- package/dist/extensions/dashboard-server/snapshot.js +43 -0
- package/dist/extensions/dashboard-server/state.js +30 -0
- package/dist/extensions/dashboard-server/types.js +5 -0
- package/dist/extensions/dashboard-server.js +7 -1315
- package/dist/extensions/mega-commands.js +162 -134
- package/dist/extensions/mega-compact.test.js +292 -24
- package/dist/extensions/mega-config.js +10 -0
- package/dist/extensions/mega-conflict-cmds.js +5 -1
- package/dist/extensions/mega-dashboard-cmds.js +29 -22
- package/dist/extensions/mega-db-cmds.js +11 -2
- package/dist/extensions/mega-events/agent-handlers.js +173 -0
- package/dist/extensions/mega-events/compact-handlers.js +133 -0
- package/dist/extensions/mega-events/context-handler.js +249 -0
- package/dist/extensions/mega-events/register.js +21 -0
- package/dist/extensions/mega-events/session-handlers.js +142 -0
- package/dist/extensions/mega-events.js +15 -652
- package/dist/extensions/mega-pipeline/compact.js +324 -0
- package/dist/extensions/mega-pipeline/memory-review.js +38 -0
- package/dist/extensions/mega-pipeline/recall.js +147 -0
- package/dist/extensions/mega-pipeline.js +9 -480
- package/dist/extensions/mega-runtime/helpers.js +40 -0
- package/dist/extensions/mega-runtime/query.js +29 -0
- package/dist/extensions/mega-runtime/state.js +711 -0
- package/dist/extensions/mega-runtime/widget.js +197 -0
- package/dist/extensions/mega-runtime.js +15 -932
- package/dist/src/store/sqlite/checkpoints.js +145 -0
- package/dist/src/store/sqlite/connection.js +35 -0
- package/dist/src/store/sqlite/dedup-mirror.js +64 -0
- package/dist/src/store/sqlite/foundation.js +38 -0
- package/dist/src/store/sqlite/global-index.js +224 -0
- package/dist/src/store/sqlite/index-store.js +167 -0
- package/dist/src/store/sqlite/maintenance.js +235 -0
- package/dist/src/store/sqlite/memories.js +164 -0
- package/dist/src/store/sqlite/memory.js +54 -0
- package/dist/src/store/sqlite/meta.js +82 -0
- package/dist/src/store/sqlite/minhash-lsh.js +47 -0
- package/dist/src/store/sqlite/model-snapshots.js +47 -0
- package/dist/src/store/sqlite/raptor.js +57 -0
- package/dist/src/store/sqlite/raw-transcript.js +134 -0
- package/dist/src/store/sqlite/schema.js +250 -0
- package/dist/src/store/sqlite/session-state.js +28 -0
- package/dist/src/store/sqlite/sessions.js +39 -0
- package/dist/src/store/sqlite/stats.js +66 -0
- package/dist/src/store/sqlite/transaction.js +19 -0
- package/dist/src/store/sqlite/utils.js +120 -0
- package/dist/src/store/sqlite.js +20 -1607
- package/dist/src/vectorStore/add.js +260 -0
- package/dist/src/vectorStore/dedup.js +52 -0
- package/dist/src/vectorStore/index.js +10 -0
- package/dist/src/vectorStore/queries.js +83 -0
- package/dist/src/vectorStore/search.js +95 -0
- package/dist/src/vectorStore/session.js +19 -0
- package/dist/src/vectorStore/store.js +105 -0
- package/dist/src/vectorStore/types.js +6 -0
- package/dist/src/vectorStore/utils.js +23 -0
- package/extensions/dashboard-server/html.ts +758 -0
- package/extensions/dashboard-server/index-reader.ts +130 -0
- package/extensions/dashboard-server/server.ts +358 -0
- package/extensions/dashboard-server/snapshot.ts +44 -0
- package/extensions/dashboard-server/state.ts +33 -0
- package/extensions/dashboard-server/types.ts +134 -0
- package/extensions/dashboard-server.ts +7 -1431
- package/extensions/mega-commands.ts +33 -10
- package/extensions/mega-compact.test.ts +453 -37
- package/extensions/mega-config.ts +22 -0
- package/extensions/mega-conflict-cmds.ts +6 -2
- package/extensions/mega-dashboard-cmds.ts +30 -23
- package/extensions/mega-db-cmds.ts +11 -3
- package/extensions/mega-events/agent-handlers.ts +214 -0
- package/extensions/mega-events/compact-handlers.ts +164 -0
- package/extensions/mega-events/context-handler.ts +290 -0
- package/extensions/mega-events/register.ts +37 -0
- package/extensions/mega-events/session-handlers.ts +165 -0
- package/extensions/mega-events.ts +15 -732
- package/extensions/mega-pipeline/compact.ts +366 -0
- package/extensions/mega-pipeline/memory-review.ts +46 -0
- package/extensions/mega-pipeline/recall.ts +165 -0
- package/extensions/mega-pipeline.ts +9 -537
- package/extensions/mega-runtime/helpers.ts +68 -0
- package/extensions/mega-runtime/query.ts +29 -0
- package/extensions/mega-runtime/state.ts +797 -0
- package/extensions/mega-runtime/widget.ts +258 -0
- package/extensions/mega-runtime.ts +15 -1076
- package/package.json +4 -3
- package/src/store/sqlite/checkpoints.ts +204 -0
- package/src/store/sqlite/dedup-mirror.ts +114 -0
- package/src/store/sqlite/foundation.ts +63 -0
- package/src/store/sqlite/global-index.ts +305 -0
- package/src/store/sqlite/maintenance.ts +294 -0
- package/src/store/sqlite/memories.ts +217 -0
- package/src/store/sqlite/meta.ts +108 -0
- package/src/store/sqlite/model-snapshots.ts +83 -0
- package/src/store/sqlite/raptor.ts +107 -0
- package/src/store/sqlite/raw-transcript.ts +221 -0
- package/src/store/sqlite/schema.ts +258 -0
- package/src/store/sqlite/session-state.ts +38 -0
- package/src/store/sqlite/stats.ts +127 -0
- package/src/store/sqlite/utils.ts +125 -0
- package/src/store/sqlite.ts +20 -2204
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ sessions into a **local SQLite store** and offers **deduped inline recall** —
|
|
|
6
6
|
running **locally inside the extension**, with **no remote MCP server** and
|
|
7
7
|
**zero network calls at runtime** (PREVENT-PI-004).
|
|
8
8
|
|
|
9
|
-
> **Status - v0.7.
|
|
9
|
+
> **Status - v0.7.9.** Storage uses the built-in `node:sqlite` backend
|
|
10
10
|
> (`DatabaseSync`, Node >=22.13): zero native build step, fully local, and zero
|
|
11
11
|
> network at runtime. See [RELEASE_NOTES.md](RELEASE_NOTES.md) for the full
|
|
12
12
|
> changelog.
|
|
@@ -96,7 +96,7 @@ Marker insert compact-marker; dedupe so repeated triggers cost ~0 tokens
|
|
|
96
96
|
**One store, three ways to read it back — one dedup engine:**
|
|
97
97
|
|
|
98
98
|
| Entry point | Trigger | Behavior |
|
|
99
|
-
|
|
99
|
+
| --- | --- | --- |
|
|
100
100
|
| **Auto-inline** (Layer 5) | `session_start` / `session_tree` | Resume → `recallAndInline(source:"resume")` prepends the most relevant checkpoints, deduped against current context. |
|
|
101
101
|
| **On-demand recall** | `/mega-recall [query]` | Semantic search the store, dedupe, and inline the top-K. |
|
|
102
102
|
| **Dedup sentinel** | every compact | A lightweight `mega-compact-marker` entry lets auto-inline and recall skip re-injecting / re-vectorizing already-present regions. |
|
|
@@ -243,7 +243,7 @@ The commands (slash commands inside pi):
|
|
|
243
243
|
### Commands
|
|
244
244
|
|
|
245
245
|
| Command | Description |
|
|
246
|
-
|
|
246
|
+
| --- | --- |
|
|
247
247
|
| `/mega-compact [summary...]` | Manually compact the current session. A summary arg is used verbatim; otherwise the COLLAPSE heuristics build one. Persists a `chkpt_xxx`. |
|
|
248
248
|
| `/mega-compact off` | Disable auto-compaction for this session. |
|
|
249
249
|
| `/mega-status` | Show config + current context usage + store stats (checkpoint count, dedup rate, tokens saved) + the **installed version**. |
|
|
@@ -267,13 +267,12 @@ The commands (slash commands inside pi):
|
|
|
267
267
|
|
|
268
268
|
The **tier** you see in the toolbar and dashboard is a *live pressure band* (`low` → `medium` → `high` → `ultra` → `mega`) that climbs automatically as your context window fills and falls back as it's relieved — it is driven by `currentTokens / effectiveThreshold`, not a manual setting. The base compaction *threshold* is set by `MEGACOMPACT_TIER` at startup as a **% of the model context window** (`low` 50% · `medium` 60% · `high` 70% · `ultra` 70% · `mega` 75%; default `low`) — the fire point is `tierPct × contextWindow`, so it always lands below pi's native ~80% auto-compaction (any model size). The old static token amounts (50k/100k/200k/1M/10M) are now only the boot fallback used before the first context event reports a window. `/mega-tier` was removed in v0.7.6. Higher pressure also deepens the live trim and reviews durable memory more often — the whole system reacts as one.
|
|
269
269
|
|
|
270
|
-
|
|
271
270
|
### Live stats widget
|
|
272
271
|
|
|
273
272
|
Above the pi editor the extension shows a compact widget:
|
|
274
273
|
|
|
275
274
|
```
|
|
276
|
-
⚡ high·low v0.7.
|
|
275
|
+
⚡ high·low v0.7.9 │ 142k/200k tokens (71%) │ 3 chkpts │ 🤖 2 agents │ turn 5
|
|
277
276
|
◐ armed │ dedup: 92% │ saved: 45k tok
|
|
278
277
|
```
|
|
279
278
|
|
|
@@ -304,17 +303,17 @@ before starting pi.
|
|
|
304
303
|
### Core settings
|
|
305
304
|
|
|
306
305
|
| Variable | Default | Meaning |
|
|
307
|
-
|
|
306
|
+
| --- | --- | --- |
|
|
308
307
|
| `MEGACOMPACT_FAST_GATE_PCT` | `70` | Context-usage % that arms the auto-trigger. Defaults to the tier's % of window (`tierPct*100`): low 50 · med 60 · high 70 · ultra 70 · mega 75. Override raises the arming floor. |
|
|
309
308
|
| `MEGACOMPACT_TIER` | `low` | Named trigger preset — sets the compaction threshold as a **% of the model context window**: `low`(50%) `medium`(60%) `high`(70%) `ultra`(70%) `mega`(75%). Fire point = `tierPct × contextWindow`, so it always fires below pi's native ~80% auto-compaction (any model size). The old static token amounts (50k/100k/200k/1M/10M) are now only the **boot fallback** used before the first context event reports a window. Default `low`. |
|
|
310
|
-
| `MEGACOMPACT_THRESHOLD_TOKENS` |
|
|
309
|
+
| `MEGACOMPACT_THRESHOLD_TOKENS` | *(tier default)* | Explicit **absolute** token budget (the `custom` tier). Overrides `MEGACOMPACT_TIER` when set and is **never percent-scaled** — use this to pin an exact token fire point regardless of model window. |
|
|
311
310
|
| `MEGACOMPACT_ANCHOR_USER_MESSAGES` | `3` | Never drop the most recent N user messages (anchor floor). |
|
|
312
311
|
| `MEGACOMPACT_PRESERVE_RECENT` | `4` | Preserve the most recent N messages verbatim. |
|
|
313
312
|
| `MEGACOMPACT_AUTO` | `true` | Enable the auto-trigger. |
|
|
314
313
|
| `MEGACOMPACT_AUTO_INLINE` | `true` | Auto-inline on resume / branch. |
|
|
315
314
|
| `MEGACOMPACT_AUTO_INLINE_K` | `3` | Top-K checkpoints to auto-inline. |
|
|
316
315
|
| `MEGACOMPACT_DEDUP_SIM` | `0.90` | Cosine threshold to collapse near-dupes. |
|
|
317
|
-
| `MEGACOMPACT_STATE_DIR` |
|
|
316
|
+
| `MEGACOMPACT_STATE_DIR` | *(none — per-repo default)* | Override the store location. By default state is per-repo at `<repo>/.pi/mega-compact/`; this env var forces a single explicit dir (used as the fallback for non-git cwds). |
|
|
318
317
|
|
|
319
318
|
### Dedup pipeline flags
|
|
320
319
|
|
|
@@ -323,7 +322,7 @@ behavior. `MARK_ONLY_*` tiers run + record their decision but never
|
|
|
323
322
|
collapse (safe partial-rollout / auto-degrade state).
|
|
324
323
|
|
|
325
324
|
| Variable | Default | Meaning |
|
|
326
|
-
|
|
325
|
+
| --- | --- | --- |
|
|
327
326
|
| `MEGACOMPACT_L0_ENABLED` | `true` | L0 exact content-hash dedup. |
|
|
328
327
|
| `MEGACOMPACT_L1_ENABLED` | `true` | L1 MinHash/LSH near-dup verification. |
|
|
329
328
|
| `MEGACOMPACT_L2_ENABLED` | `true` | L2 semantic cosine dedup + MMR retrieval diversity. |
|
|
@@ -332,7 +331,7 @@ collapse (safe partial-rollout / auto-degrade state).
|
|
|
332
331
|
| `MEGACOMPACT_MARK_ONLY_L1` | `false` | L1: record, don't collapse. |
|
|
333
332
|
| `MEGACOMPACT_MARK_ONLY_L2` | `false` | L2: record, don't collapse. |
|
|
334
333
|
| `MEGACOMPACT_MINILM` | `false` | MiniLM embedder flag — **off; not shipped** (see Embedding). BYO via `MEGACOMPACT_EMBEDDING_URL`. |
|
|
335
|
-
| `MEGACOMPACT_EMBEDDING_URL` |
|
|
334
|
+
| `MEGACOMPACT_EMBEDDING_URL` | *(unset)* | BYO localhost embedder endpoint (loopback-only; enables `HttpEmbedder`). |
|
|
336
335
|
| `MEGACOMPACT_L2_THRESHOLD` | `0.85` | L2 cosine firing point (trigram-honest; set higher for semantic backends). |
|
|
337
336
|
| `MEGACOMPACT_L1_JACCARD` | `0.8` | L1 MinHash/LSH near-dup Jaccard threshold. |
|
|
338
337
|
| `MEGACOMPACT_MMR_LAMBDA` | `0.5` | MMR retrieval-diversity weight (λ·relevance − (1−λ)·maxSim). |
|
|
@@ -349,13 +348,13 @@ checklist, MARK_ONLY degrade) and `docs/RETENTION_POLICY.md` for TTL / soft-dele
|
|
|
349
348
|
### Continuity & memory
|
|
350
349
|
|
|
351
350
|
| Variable | Default | Meaning |
|
|
352
|
-
|
|
351
|
+
| --- | --- | --- |
|
|
353
352
|
| `MEGACOMPACT_LEGACY_DURABLE_TRIM` | `false` | Restore the legacy auto-trigger (`ctx.compact()` stops the agent). One-release rollback; default uses live context-event trim + pi native auto-compaction (compact-and-continue). |
|
|
354
353
|
| `MEGACOMPACT_CROSSREPO_ENABLED` | `true` | Cross-repo recall on resume + `/mega-recall --cross-repo` (HNSW index over every repo). |
|
|
355
354
|
| `MEGACOMPACT_CROSSREPO_COSINE` | `0.90` | Stricter cosine floor for cross-repo hits (vs `0.85` same-repo). |
|
|
356
355
|
| `MEGACOMPACT_MEMORY_AUTO_REVIEW` | `true` | Auto-review the conversation every `MEGACOMPACT_MEMORY_REVIEW_INTERVAL` turns → durable memories. |
|
|
357
356
|
| `MEGACOMPACT_MEMORY_REVIEW_INTERVAL` | `10` | Turns between auto-review cycles. |
|
|
358
|
-
| `MEGACOMPACT_PGLITE_DISABLED` |
|
|
357
|
+
| `MEGACOMPACT_PGLITE_DISABLED` | *(unset — index on)* | Kill-switch for the PGlite/HNSW cross-repo index; set `1`/`true` to disable (falls back to sync per-session scan). |
|
|
359
358
|
|
|
360
359
|
## Dashboard
|
|
361
360
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-reading helper functions for the dashboard server.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
export function readSnapshot(snapshotPath) {
|
|
6
|
+
try {
|
|
7
|
+
const raw = readFileSync(snapshotPath, "utf-8");
|
|
8
|
+
return JSON.parse(raw);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return {
|
|
12
|
+
version: 1,
|
|
13
|
+
updatedAt: null,
|
|
14
|
+
tier: "unknown",
|
|
15
|
+
config: { fastGatePct: 80, thresholdTokens: 100_000, anchorUserMessages: 1, preserveRecent: 2, auto: true, autoInlineK: 3 },
|
|
16
|
+
session: { id: null, state: null, persistedThisSession: false, lastCheckpointId: null, lastCompactedFrom: 0 },
|
|
17
|
+
context: { tokens: null, percent: null, contextWindow: 0 },
|
|
18
|
+
trigger: { armed: false, ready: false, currentTokens: null, thresholdTokens: 100_000, fastGatePct: 80 },
|
|
19
|
+
store: { checkpointCount: 0, totalTokenEstimate: 0, originalTokens: 0, tokensSaved: 0, injectedCount: 0, dedupHitRate: 0, storageDedupRate: 0, dedupCollapsed: 0 },
|
|
20
|
+
crew: { activeAgents: 0, currentTurn: 0 },
|
|
21
|
+
repo: { checkpointCount: 0, totalTokenEstimate: 0, originalTokens: 0, tokensSaved: 0, sessionCount: 0, dedupAttempts: 0, dedupCollapsed: 0, storageDedupRate: 0 },
|
|
22
|
+
integrity: { regionsRetained: 0, compressedOriginalBytes: 0, duplicatesCollapsed: 0, bytesPermanentlyDeleted: 0 },
|
|
23
|
+
model: undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function readFrom(path, charOffset) {
|
|
28
|
+
try {
|
|
29
|
+
const content = readFileSync(path, "utf-8");
|
|
30
|
+
if (content.length <= charOffset)
|
|
31
|
+
return { data: "", offset: charOffset };
|
|
32
|
+
return { data: content.slice(charOffset), offset: content.length };
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return { data: "", offset: charOffset };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "All repos" tab panel — machine-wide registry table (index.sqlite).
|
|
3
|
+
*
|
|
4
|
+
* Rows are populated by the index poller in `script.ts` (shared with the
|
|
5
|
+
* in-panel table on the Current-repo tab via the same render call).
|
|
6
|
+
*/
|
|
7
|
+
export function allReposTab() {
|
|
8
|
+
return `<!-- All repos (machine-wide registry from index.sqlite) -->
|
|
9
|
+
<div class="tab-panel" id="panel-all">
|
|
10
|
+
<table class="repos">
|
|
11
|
+
<thead>
|
|
12
|
+
<tr>
|
|
13
|
+
<th>Repo</th><th>Model</th>
|
|
14
|
+
<th style="text-align:right">Checkpoints</th>
|
|
15
|
+
<th style="text-align:right">Tokens Saved</th>
|
|
16
|
+
<th style="text-align:right">Retained</th>
|
|
17
|
+
<th style="text-align:right">Last Compacted</th>
|
|
18
|
+
</tr>
|
|
19
|
+
</thead>
|
|
20
|
+
<tbody id="all-rows"><tr><td colspan="6" class="repo-none">loading…</td></tr></tbody>
|
|
21
|
+
</table>
|
|
22
|
+
<div class="updated" id="all-updated"></div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body opening: </head><body>, offline banner, page heading, and the tab nav.
|
|
3
|
+
*
|
|
4
|
+
* `tierName` is interpolated into the heading tier badge.
|
|
5
|
+
* Includes the new "High Score" future-tab button (next project).
|
|
6
|
+
*/
|
|
7
|
+
export function bodyOpen(tierName) {
|
|
8
|
+
return `</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<div class="offline-banner" id="offline-banner">Dashboard data unavailable — waiting for a pi session to write snapshot...</div>
|
|
12
|
+
|
|
13
|
+
<h1><span>mega-compact</span><span class="tier">${tierName}</span><span class="model-pill" id="hdr-model">—</span></h1>
|
|
14
|
+
|
|
15
|
+
<nav class="tabs">
|
|
16
|
+
<button class="tab active" data-tab="current">Current repo</button>
|
|
17
|
+
<button class="tab" data-tab="all">All repos</button>
|
|
18
|
+
<button class="tab" data-tab="summary">Summary</button>
|
|
19
|
+
<button class="tab future" data-tab="highscore">High Score<span class="soon">soon</span></button>
|
|
20
|
+
</nav>
|
|
21
|
+
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Current repo" tab panel — the per-repo dashboard view.
|
|
3
|
+
*
|
|
4
|
+
* Contains: context-window meter, trigger status, vector-store stats,
|
|
5
|
+
* repo-wide stats, data-safety card, configuration, model & cost savings,
|
|
6
|
+
* crew/agents, a legend, the live event stream, and the in-panel all-repos
|
|
7
|
+
* table (shared rows with the All-repos tab via the index poller).
|
|
8
|
+
*
|
|
9
|
+
* `tierName` is interpolated into the Configuration card.
|
|
10
|
+
*/
|
|
11
|
+
export function currentRepoTab(tierName) {
|
|
12
|
+
return `<!-- Current repo (existing single-repo view) -->
|
|
13
|
+
<div class="tab-panel" id="panel-current">
|
|
14
|
+
<div class="grid">
|
|
15
|
+
<div class="card">
|
|
16
|
+
<h2>Context Window</h2>
|
|
17
|
+
<div class="meter-label" id="ctx-pct">—</div>
|
|
18
|
+
<div class="meter-track"><div class="meter-fill" id="ctx-bar" style="width:0%"></div></div>
|
|
19
|
+
<div class="meter-sub" id="ctx-sub">waiting for data</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="card">
|
|
22
|
+
<h2>Trigger Status</h2>
|
|
23
|
+
<div class="status-row"><div class="bullet" id="tr-armed"></div><span>Armed (context ≥ fast gate)</span></div>
|
|
24
|
+
<div class="status-row"><div class="bullet" id="tr-ready"></div><span>Ready (tokens ≥ threshold)</span></div>
|
|
25
|
+
<div class="state-text" id="tr-state">waiting</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="card">
|
|
28
|
+
<h2>Vector Store</h2>
|
|
29
|
+
<div class="stat-grid">
|
|
30
|
+
<span class="label" title="A saved summary of a chunk of your conversation that was compacted to free up space.">Checkpoints</span><span class="value" id="st-count">0</span>
|
|
31
|
+
<span class="label" title="How much conversation we are currently holding as compact summaries (the 'memory' this extension keeps). Smaller is better.">Tokens Stored</span><span class="value" id="st-tokens">0</span>
|
|
32
|
+
<span class="label" title="Total size of the original conversation text before it was compacted.">Original Tokens</span><span class="value" id="st-orig">0</span>
|
|
33
|
+
<span class="label" title="How much conversation space we have freed up for you (original size minus the compact summary we kept).">Tokens Saved</span><span class="value" id="st-saved">0</span>
|
|
34
|
+
<span class="label" title="How many times old context was automatically brought back into the conversation because it was relevant to what you were doing.">Injected</span><span class="value" id="st-injected">0</span>
|
|
35
|
+
<span class="label" title="Of the times we recalled old context, how often it was actually on-topic.">Recall Relevance</span><span class="value" id="st-dedup">0%</span>
|
|
36
|
+
<span class="label" title="How often new content matched something we already had, so we skipped storing a duplicate copy. Higher = less wasted space.">Storage Dedup</span><span class="value" id="st-sdedup">0%</span>
|
|
37
|
+
<span class="label" title="How many duplicate chunks we collapsed into one instead of storing separately.">Collapsed</span><span class="value" id="st-collapsed">0</span>
|
|
38
|
+
<span class="label" title="The ID of the most recent saved checkpoint.">Last ID</span><span class="value" id="st-lastid">—</span>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="card">
|
|
42
|
+
<h2>Repo (all sessions)</h2>
|
|
43
|
+
<div class="stat-grid">
|
|
44
|
+
<span class="label">Checkpoints</span><span class="value" id="rp-count">0</span>
|
|
45
|
+
<span class="label">Tokens Stored</span><span class="value" id="rp-tokens">0</span>
|
|
46
|
+
<span class="label">Original Tokens</span><span class="value" id="rp-orig">0</span>
|
|
47
|
+
<span class="label">Tokens Saved</span><span class="value" id="rp-saved">0</span>
|
|
48
|
+
<span class="label">Sessions</span><span class="value" id="rp-sessions">0</span>
|
|
49
|
+
<span class="label">Collapsed</span><span class="value" id="rp-collapsed">0</span>
|
|
50
|
+
<span class="label">Storage Dedup</span><span class="value" id="rp-sdedup">0%</span>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="card safe">
|
|
54
|
+
<h2>🛡 Data Safety</h2>
|
|
55
|
+
<div class="stat-grid">
|
|
56
|
+
<span class="label">Regions Retained</span><span class="value" id="ig-retained">0</span>
|
|
57
|
+
<span class="label">Compressed-Original</span><span class="value" id="ig-bytes">0 B</span>
|
|
58
|
+
<span class="label">Dedup Duplicates</span><span class="value" id="ig-dupes">0</span>
|
|
59
|
+
<span class="label">Permanently Deleted</span><span class="value ok" id="ig-deleted">0 B</span>
|
|
60
|
+
</div>
|
|
61
|
+
<p class="safe-note">Every compacted region is kept verbatim (compressed). "Drop" = removed from the live window only. We never delete your data.</p>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="card">
|
|
64
|
+
<h2>Configuration</h2>
|
|
65
|
+
<div class="conf-grid">
|
|
66
|
+
<span class="label">Tier</span><span class="value" id="cf-tier">${tierName}</span>
|
|
67
|
+
<span class="label">Threshold</span><span class="value" id="cf-threshold">—</span>
|
|
68
|
+
<span class="label">Fast Gate</span><span class="value" id="cf-gate">—</span>
|
|
69
|
+
<span class="label">Auto</span><span class="value" id="cf-auto">—</span>
|
|
70
|
+
<span class="label">Anchor</span><span class="value" id="cf-anchor">—</span>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="card cost">
|
|
74
|
+
<h2>💰 Model & Cost Savings</h2>
|
|
75
|
+
<div class="cost-usd" id="cost-usd">≈ $0.00 saved</div>
|
|
76
|
+
<div class="cost-sub" id="cost-windows">0 context-windows extended</div>
|
|
77
|
+
<div class="stat-grid" style="margin-top:12px">
|
|
78
|
+
<span class="label" title="The model pi is currently using — its pricing drives the cost figure.">Model</span><span class="value" id="md-name">—</span>
|
|
79
|
+
<span class="label" title="The provider serving the model.">Provider</span><span class="value" id="md-provider">—</span>
|
|
80
|
+
<span class="label" title="USD per input token, from the model's pricing.">Input Rate</span><span class="value" id="md-input">—</span>
|
|
81
|
+
<span class="label" title="USD per output token, from the model's pricing.">Output Rate</span><span class="value" id="md-output">—</span>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<div class="card">
|
|
85
|
+
<h2>Crew / Agents</h2>
|
|
86
|
+
<div class="stat-grid">
|
|
87
|
+
<span class="label">Active Agents</span><span class="value" id="cr-agents">0</span>
|
|
88
|
+
<span class="label">Current Turn</span><span class="value" id="cr-turn">0</span>
|
|
89
|
+
<span class="label">Status</span><span class="value" id="cr-status">idle</span>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="card legend">
|
|
93
|
+
<h2>What these numbers mean</h2>
|
|
94
|
+
<ul class="legend-list">
|
|
95
|
+
<li><b>Tokens saved</b> — conversation space this extension has freed up for you (it compacted old text into short summaries).</li>
|
|
96
|
+
<li><b>Tokens stored</b> — how much "memory" (compact summaries) the extension is currently holding for this repo.</li>
|
|
97
|
+
<li><b>Injected</b> — times old context was automatically pasted back in because it was relevant to your current task.</li>
|
|
98
|
+
<li><b>Recall relevance</b> — of those, how often the recalled context was actually on-topic.</li>
|
|
99
|
+
<li><b>Storage dedup</b> — how often new content matched something already saved, so a duplicate copy was skipped (saves space).</li>
|
|
100
|
+
<li><b>Data safety</b> — every compacted region is kept verbatim (compressed). Nothing is permanently deleted; you can restore any of it.</li>
|
|
101
|
+
</ul>
|
|
102
|
+
<p class="legend-note">Hover any label above for a quick explanation.</p>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div class="events">
|
|
107
|
+
<h2>Event Stream</h2>
|
|
108
|
+
<div class="events-wrap" id="events"><div class="empty">connecting…</div></div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<h2 style="margin-top:24px;font-size:13px;color:#8b949e;text-transform:uppercase;letter-spacing:.5px">All Repositories</h2>
|
|
112
|
+
<table class="repos">
|
|
113
|
+
<thead>
|
|
114
|
+
<tr>
|
|
115
|
+
<th>Repo</th><th>Model</th>
|
|
116
|
+
<th style="text-align:right">Checkpoints</th>
|
|
117
|
+
<th style="text-align:right">Tokens Saved</th>
|
|
118
|
+
<th style="text-align:right">Retained</th>
|
|
119
|
+
<th style="text-align:right">Last Compacted</th>
|
|
120
|
+
</tr>
|
|
121
|
+
</thead>
|
|
122
|
+
<tbody id="cur-rows"><tr><td colspan="6" class="repo-none">loading…</td></tr></tbody>
|
|
123
|
+
</table>
|
|
124
|
+
<div class="updated" id="cur-updated"></div>
|
|
125
|
+
|
|
126
|
+
<div class="updated" id="updated"></div>
|
|
127
|
+
</div><!-- /panel-current -->
|
|
128
|
+
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document opening: DOCTYPE, <html>, <head> opening + meta/title.
|
|
3
|
+
*
|
|
4
|
+
* Styles are injected between this fragment and `bodyOpen()` by the
|
|
5
|
+
* `dashboardHtml` composer in `../html-template.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export function headOpen() {
|
|
8
|
+
return `<!DOCTYPE html>
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="utf-8">
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
13
|
+
<title>mega-compact dashboard</title>
|
|
14
|
+
`;
|
|
15
|
+
// trailing \n preserves the original blank-line separation to <style> in the composer
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "High Score" tab — FUTURE / PLACEHOLDER.
|
|
3
|
+
*
|
|
4
|
+
* Reserved for the next project milestone: a per-repo + global
|
|
5
|
+
* compaction-savings leaderboard ("high score" — most tokens saved, best
|
|
6
|
+
* recall relevance, longest context-window extension streak, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Ships as a visible-but-inert stub so the tab nav, routing, and styles are
|
|
9
|
+
* in place; the data model + scoring logic land in a follow-up. The composer
|
|
10
|
+
* in `../html-template.ts` includes this panel; `script.ts` wires
|
|
11
|
+
* `highscore` into the tab-switch `panels` map so clicking the tab reveals
|
|
12
|
+
* this placeholder.
|
|
13
|
+
*/
|
|
14
|
+
export function highScoreTab() {
|
|
15
|
+
return `<!-- High Score (FUTURE / placeholder for the next project milestone) -->
|
|
16
|
+
<div class="tab-panel" id="panel-highscore">
|
|
17
|
+
<div class="placeholder">
|
|
18
|
+
<div class="em">🏆</div>
|
|
19
|
+
<h2>High Score</h2>
|
|
20
|
+
<p>A compaction-savings leaderboard is coming in the next project milestone — per-repo and global rankings for tokens saved, recall relevance, and context-window extension streaks. Stay tuned.</p>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-repo detail modal — fixed overlay opened when a repo row is clicked.
|
|
3
|
+
*
|
|
4
|
+
* Position-independent in the DOM; the modal is toggled via the `.open`
|
|
5
|
+
* class by `script.ts`. Sits between the tab panels and the script so it
|
|
6
|
+
* overlays whichever panel is active.
|
|
7
|
+
*/
|
|
8
|
+
export function repoDetailModal() {
|
|
9
|
+
return `<!-- Per-repo detail modal -->
|
|
10
|
+
<div class="repo-detail" id="repo-detail">
|
|
11
|
+
<div class="repo-detail-box">
|
|
12
|
+
<h2><span id="rd-name">Repo</span><button class="repo-close" id="rd-close" title="Close">×</button></h2>
|
|
13
|
+
<div class="repo-path" id="rd-path"></div>
|
|
14
|
+
<div class="stat-grid">
|
|
15
|
+
<span class="label">Model</span><span class="value" id="rd-model">—</span>
|
|
16
|
+
<span class="label">Checkpoints</span><span class="value" id="rd-cp">0</span>
|
|
17
|
+
<span class="label">Tokens Saved</span><span class="value" id="rd-saved">0</span>
|
|
18
|
+
<span class="label">Compressed-Original</span><span class="value" id="rd-bytes">0 B</span>
|
|
19
|
+
<span class="label">Last Compacted</span><span class="value" id="rd-when">—</span>
|
|
20
|
+
<span class="label">Provider</span><span class="value" id="rd-provider">—</span>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
`;
|
|
26
|
+
}
|