pi-mega-compact 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/dashboard-server/api-contracts/embedder-health.js +11 -0
- package/dist/extensions/dashboard-server/api-contracts/endpoints/registry.js +225 -0
- package/dist/extensions/dashboard-server/api-contracts/endpoints/types.js +1 -0
- package/dist/extensions/dashboard-server/api-contracts/endpoints.js +5 -224
- package/dist/extensions/dashboard-server/api-contracts/raptor.js +8 -0
- package/dist/extensions/dashboard-server/api-contracts.test/_helpers.js +32 -0
- package/dist/extensions/dashboard-server/routes-cache.test/_helpers.js +48 -0
- package/dist/extensions/dashboard-server/routes-embedder-health.js +67 -0
- package/dist/extensions/dashboard-server/routes-raptor.js +88 -0
- package/dist/extensions/dashboard-server/routes-setup.js +1 -1
- package/dist/extensions/dashboard-server/routes.js +2 -0
- package/dist/extensions/dashboard-server/server.js +5 -1
- package/dist/extensions/mega-cache-replay.test/_helpers.js +175 -0
- package/dist/extensions/mega-commands/dataCommands.js +151 -0
- package/dist/extensions/mega-commands/helpers.js +61 -0
- package/dist/extensions/mega-commands/historyCommands.js +97 -0
- package/dist/extensions/mega-commands/setupCommand.js +200 -0
- package/dist/extensions/mega-commands.js +14 -499
- package/dist/extensions/mega-compact-s38.test/_helpers.js +194 -0
- package/dist/extensions/mega-compact.js +12 -2
- package/dist/extensions/mega-compact.test/_helpers.js +225 -0
- package/dist/extensions/mega-events/agent-handlers/agentEndHandler.js +211 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/cacheStripe.js +49 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/contextHealth.js +33 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/errorRetry.js +387 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/event.js +7 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/gameScoring.js +55 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/lengthStop.js +12 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/memoryReview.js +22 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/recordTurnRow.js +38 -0
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler.js +36 -0
- package/dist/extensions/mega-events/agent-handlers.js +4 -799
- package/dist/extensions/mega-events/context-handler/afterCompact.js +163 -0
- package/dist/extensions/mega-events/context-handler/messageText.js +12 -0
- package/dist/extensions/mega-events/context-handler/tailResult.js +46 -0
- package/dist/extensions/mega-events/context-handler.js +11 -198
- package/dist/extensions/mega-events/separated-prompt.test/_helpers.js +25 -0
- package/dist/src/config.js +2 -0
- package/dist/src/dedup-engine.test/_helpers.js +55 -0
- package/dist/src/e2e.test/_helpers.js +52 -0
- package/dist/src/embedder.js +1 -0
- package/dist/src/httpEmbedder.js +6 -0
- package/dist/src/hyde.js +146 -0
- package/dist/src/importance.test/_helpers.js +5 -0
- package/dist/src/memoryGraph/sources/checkpoints.js +78 -0
- package/dist/src/memoryGraph/sources/edges.js +17 -0
- package/dist/src/memoryGraph/sources/flags.js +22 -0
- package/dist/src/memoryGraph/sources/helpers.js +14 -0
- package/dist/src/memoryGraph/sources/memories.js +88 -0
- package/dist/src/memoryGraph/sources/raptor.js +26 -0
- package/dist/src/memoryGraph/sources/turns.js +176 -0
- package/dist/src/memoryGraph/sources.js +15 -441
- package/dist/src/memoryGraph-gates.test/_helpers.js +120 -0
- package/dist/src/ratio.bench.test/_helpers.js +198 -0
- package/dist/src/recall/async.js +112 -0
- package/dist/src/recall/format.js +149 -0
- package/dist/src/recall/memory.js +62 -0
- package/dist/src/recall/reformulate.js +82 -0
- package/dist/src/recall/sync.js +169 -0
- package/dist/src/recall/types.js +1 -0
- package/dist/src/recall.js +13 -530
- package/dist/src/store/sqlite/schema/core.js +232 -0
- package/dist/src/store/sqlite/schema/game.js +65 -0
- package/dist/src/store/sqlite/schema/plan-v2.js +107 -0
- package/dist/src/store/sqlite/schema/turns.js +59 -0
- package/dist/src/store/sqlite/schema.js +8 -441
- package/dist/src/store/turns/contract-compliance.test/_helpers.js +21 -0
- package/dist/src/store/turns/sqlite-store/admin.js +171 -0
- package/dist/src/store/turns/sqlite-store/ctx.js +1 -0
- package/dist/src/store/turns/sqlite-store/read.js +111 -0
- package/dist/src/store/turns/sqlite-store/rows.js +42 -0
- package/dist/src/store/turns/sqlite-store/write.js +102 -0
- package/dist/src/store/turns/sqlite-store.js +31 -367
- package/dist/src/vectorStore/class.js +356 -0
- package/dist/src/vectorStore/hash.js +10 -0
- package/dist/src/vectorStore/types.js +2 -0
- package/dist/src/vectorStore.js +8 -359
- package/dist/src/vectorStore.test/_helpers.js +17 -0
- package/extensions/dashboard-client/dist/assets/{CacheTab-BZNnKhh5.js → CacheTab-DPRHjYZ0.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-BZNnKhh5.js.map → CacheTab-DPRHjYZ0.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-CzF5L42U.js → EventsTab-CgwYq-Qf.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-CzF5L42U.js.map → EventsTab-CgwYq-Qf.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-BLpidMrX.js → HealthTab-BgOCjVzR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-BLpidMrX.js.map → HealthTab-BgOCjVzR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MaintenanceTab-Yw1yFpsy.js +2 -0
- package/extensions/dashboard-client/dist/assets/MaintenanceTab-Yw1yFpsy.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-yHUX7Yzi.js +2 -0
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-yHUX7Yzi.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{MetricsTab-B0PCysqs.js → MetricsTab-CcH9fP8P.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-B0PCysqs.js.map → MetricsTab-CcH9fP8P.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-DsOhqFu4.js → OverviewTab-BOs8ZNev.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-DsOhqFu4.js.map → OverviewTab-BOs8ZNev.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-B3YKYuOf.js → ReposTab-B-MfSPvg.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-B3YKYuOf.js.map → ReposTab-B-MfSPvg.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-B96FWcrC.js → SessionsTab-BmeN649Q.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-B96FWcrC.js.map → SessionsTab-BmeN649Q.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/SetupTab-nOknoph5.js +2 -0
- package/extensions/dashboard-client/dist/assets/SetupTab-nOknoph5.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BfkUVTvA.js → TimeSavedCard-DnPg0L0z.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BfkUVTvA.js.map → TimeSavedCard-DnPg0L0z.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TopicsTab-DLRsZmXJ.js → TopicsTab-BODHOg_b.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TopicsTab-DLRsZmXJ.js.map → TopicsTab-BODHOg_b.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-DKGU2Bf6.js → TurnsTab-BK0I7hKr.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-DKGU2Bf6.js.map → TurnsTab-BK0I7hKr.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-D-lPLRWB.js → index-mOlljTFI.js} +10 -10
- package/extensions/dashboard-client/dist/assets/index-mOlljTFI.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{useSSE-ClbbcgIp.js → useSSE-BYOtv1-3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-ClbbcgIp.js.map → useSSE-BYOtv1-3.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/App.tsx +0 -4
- package/extensions/dashboard-client/src/api/client.ts +16 -0
- package/extensions/dashboard-client/src/tabs/MaintenanceTab/ActionsCard.tsx +178 -0
- package/extensions/dashboard-client/src/tabs/MaintenanceTab/DbStatsCard.tsx +140 -0
- package/extensions/dashboard-client/src/tabs/MaintenanceTab/DebugBundleCard.tsx +109 -0
- package/extensions/dashboard-client/src/tabs/MaintenanceTab/HealthMitigationCard.tsx +98 -0
- package/extensions/dashboard-client/src/tabs/MaintenanceTab/SchemaHealthCard.tsx +108 -0
- package/extensions/dashboard-client/src/tabs/MaintenanceTab.tsx +12 -598
- package/extensions/dashboard-client/src/tabs/MemoryMapTab/MemoryMapView.tsx +476 -0
- package/extensions/dashboard-client/src/tabs/MemoryMapTab/RaptorTreeView.tsx +163 -0
- package/extensions/dashboard-client/src/tabs/MemoryMapTab.tsx +56 -466
- package/extensions/dashboard-client/src/tabs/SetupTab/EmbedderHealthCard.tsx +109 -0
- package/extensions/dashboard-client/src/tabs/SetupTab/EmbedderSetup.tsx +468 -0
- package/extensions/dashboard-client/src/tabs/SetupTab.tsx +23 -484
- package/extensions/dashboard-server/api-contracts/embedder-health.ts +32 -0
- package/extensions/dashboard-server/api-contracts/endpoints/registry.ts +360 -0
- package/extensions/dashboard-server/api-contracts/endpoints/types.ts +350 -0
- package/extensions/dashboard-server/api-contracts/endpoints.ts +27 -648
- package/extensions/dashboard-server/api-contracts/index.ts +6 -0
- package/extensions/dashboard-server/api-contracts/raptor.ts +49 -0
- package/extensions/dashboard-server/api-contracts.test/_helpers.ts +47 -0
- package/extensions/dashboard-server/routes-cache.test/_helpers.ts +94 -0
- package/extensions/dashboard-server/routes-embedder-health.ts +77 -0
- package/extensions/dashboard-server/routes-raptor.ts +128 -0
- package/extensions/dashboard-server/routes-setup.ts +1 -1
- package/extensions/dashboard-server/routes.ts +2 -0
- package/extensions/dashboard-server/server.ts +4 -0
- package/extensions/mega-cache-replay.test/_helpers.ts +188 -0
- package/extensions/mega-commands/dataCommands.ts +169 -0
- package/extensions/mega-commands/helpers.ts +62 -0
- package/extensions/mega-commands/historyCommands.ts +117 -0
- package/extensions/mega-commands/setupCommand.ts +235 -0
- package/extensions/mega-commands.ts +25 -538
- package/extensions/mega-compact-s38.test/_helpers.ts +201 -0
- package/extensions/mega-compact.test/_helpers.ts +237 -0
- package/extensions/mega-compact.ts +12 -2
- package/extensions/mega-events/agent-handlers/agentEndHandler.ts +238 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/cacheStripe.ts +74 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/contextHealth.ts +50 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/errorRetry.ts +421 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/event.ts +16 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/gameScoring.ts +73 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/lengthStop.ts +29 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/memoryReview.ts +42 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler/recordTurnRow.ts +61 -0
- package/extensions/mega-events/agent-handlers/turnEndHandler.ts +64 -0
- package/extensions/mega-events/agent-handlers.ts +15 -861
- package/extensions/mega-events/context-handler/afterCompact.ts +213 -0
- package/extensions/mega-events/context-handler/messageText.ts +20 -0
- package/extensions/mega-events/context-handler/tailResult.ts +63 -0
- package/extensions/mega-events/context-handler.ts +17 -235
- package/extensions/mega-events/separated-prompt.test/_helpers.ts +35 -0
- package/package.json +1 -1
- package/src/config.ts +4 -0
- package/src/dedup-engine.test/_helpers.ts +79 -0
- package/src/e2e.test/_helpers.ts +59 -0
- package/src/embedder.ts +4 -0
- package/src/httpEmbedder.ts +7 -0
- package/src/hyde.ts +162 -0
- package/src/importance.test/_helpers.ts +5 -0
- package/src/memoryGraph/sources/checkpoints.ts +99 -0
- package/src/memoryGraph/sources/edges.ts +23 -0
- package/src/memoryGraph/sources/flags.ts +26 -0
- package/src/memoryGraph/sources/helpers.ts +13 -0
- package/src/memoryGraph/sources/memories.ts +108 -0
- package/src/memoryGraph/sources/raptor.ts +37 -0
- package/src/memoryGraph/sources/turns.ts +226 -0
- package/src/memoryGraph/sources.ts +19 -544
- package/src/memoryGraph-gates.test/_helpers.ts +164 -0
- package/src/ratio.bench.test/_helpers.ts +268 -0
- package/src/recall/async.ts +142 -0
- package/src/recall/format.ts +173 -0
- package/src/recall/memory.ts +90 -0
- package/src/recall/reformulate.ts +111 -0
- package/src/recall/sync.ts +196 -0
- package/src/recall/types.ts +63 -0
- package/src/recall.ts +25 -712
- package/src/store/sqlite/schema/core.ts +233 -0
- package/src/store/sqlite/schema/game.ts +66 -0
- package/src/store/sqlite/schema/plan-v2.ts +108 -0
- package/src/store/sqlite/schema/turns.ts +60 -0
- package/src/store/sqlite/schema.ts +13 -441
- package/src/store/turns/contract-compliance.test/_helpers.ts +38 -0
- package/src/store/turns/sqlite-store/admin.ts +249 -0
- package/src/store/turns/sqlite-store/ctx.ts +14 -0
- package/src/store/turns/sqlite-store/read.ts +174 -0
- package/src/store/turns/sqlite-store/rows.ts +55 -0
- package/src/store/turns/sqlite-store/write.ts +193 -0
- package/src/store/turns/sqlite-store.ts +33 -514
- package/src/vectorStore/class.ts +433 -0
- package/src/vectorStore/hash.ts +11 -0
- package/src/vectorStore/types.ts +58 -0
- package/src/vectorStore.test/_helpers.ts +20 -0
- package/src/vectorStore.ts +13 -489
- package/extensions/dashboard-client/dist/assets/ConfigTab-DG0WkuuG.js +0 -2
- package/extensions/dashboard-client/dist/assets/ConfigTab-DG0WkuuG.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/MaintenanceTab-BQF7W7xX.js +0 -2
- package/extensions/dashboard-client/dist/assets/MaintenanceTab-BQF7W7xX.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-CPtHLv0A.js +0 -2
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-CPtHLv0A.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/SetupTab-hbzQ_NZv.js +0 -2
- package/extensions/dashboard-client/dist/assets/SetupTab-hbzQ_NZv.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/index-D-lPLRWB.js.map +0 -1
|
@@ -1,672 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* api-contracts/endpoints.ts — Central registry of all dashboard API endpoints.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Delegate-shell (extensions split): single source of truth for all dashboard
|
|
5
|
+
* API routes. The inline response types + game-types re-exports live in
|
|
6
|
+
* ./endpoints/types.ts and the ENDPOINTS object literal in ./endpoints/registry.ts;
|
|
7
|
+
* this pointer re-exports the full public surface unchanged.
|
|
7
8
|
*
|
|
8
9
|
* Sprint A1 — PREVENT-PI-004: zero network code (type definitions only).
|
|
9
10
|
* PREVENT-011: no `any` type — all types are explicit.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
import type { EndpointDef } from "./core.js";
|
|
13
|
-
import type { SnapshotResponse } from "./snapshot.js";
|
|
14
|
-
import type { IndexesIndexRow, IndexesSummaryResponse } from "./multi-repo.js";
|
|
15
|
-
import type { GameStateResponse } from "./game.js";
|
|
16
|
-
import type { SseEvent } from "./index.js";
|
|
17
|
-
import type { ProviderCacheResponse } from "./provider-cache.js";
|
|
18
|
-
import type { MemoryStatusResponse } from "./memory.js";
|
|
19
|
-
import type { SetupStatusResponse, SetupDetectResponse, SetupConfigureRequest, SetupConfigureResponse } from "./setup.js";
|
|
20
|
-
import type {
|
|
21
|
-
TurnsResponse,
|
|
22
|
-
ConversationTurnsResponse,
|
|
23
|
-
RewindIntentsResponse,
|
|
24
|
-
ForkRequest,
|
|
25
|
-
ForkResponse,
|
|
26
|
-
PostIntentRequest,
|
|
27
|
-
PruneRequest,
|
|
28
|
-
PruneTurnsResponse,
|
|
29
|
-
TopicMemoriesResponse,
|
|
30
|
-
} from "./turns.js";
|
|
31
|
-
|
|
32
|
-
import type {
|
|
33
|
-
DbStatsResponse,
|
|
34
|
-
MaintenanceActionResult,
|
|
35
|
-
MaintenanceAction,
|
|
36
|
-
SchemaHealthResponse,
|
|
37
|
-
} from "./maintenance.js";
|
|
38
|
-
|
|
39
|
-
import type { CacheStripesResponse } from "./cache-stripes.js";
|
|
40
|
-
|
|
41
|
-
import type {
|
|
42
|
-
GameScoreRow,
|
|
43
|
-
GameScoresQuery,
|
|
44
|
-
AchievementRow,
|
|
45
|
-
SessionsResponse,
|
|
46
|
-
SessionTimeseriesQuery,
|
|
47
|
-
SessionTimeseriesResponse,
|
|
48
|
-
GameStatePatch,
|
|
49
|
-
SseEndpointDef,
|
|
50
|
-
TopicsResponse,
|
|
51
|
-
} from "./game-types.js";
|
|
52
|
-
|
|
53
13
|
export type {
|
|
14
|
+
VersionResponse,
|
|
15
|
+
IndexSummary,
|
|
16
|
+
IndexFallbackResponse,
|
|
17
|
+
ReposQuery,
|
|
18
|
+
ReposResponse,
|
|
19
|
+
SummaryResponse,
|
|
20
|
+
DriftSeverity,
|
|
21
|
+
DriftSignal,
|
|
22
|
+
RepoDrift,
|
|
23
|
+
DriftReportResponse,
|
|
24
|
+
ServerEntry,
|
|
25
|
+
ServersResponse,
|
|
26
|
+
PerfPercentile,
|
|
27
|
+
PerfAverage,
|
|
28
|
+
PerfLatest,
|
|
29
|
+
CacheHitSample,
|
|
30
|
+
PerfCacheHit,
|
|
31
|
+
PerfDiag,
|
|
32
|
+
PerfQuery,
|
|
33
|
+
PerfResponse,
|
|
54
34
|
GameScoreRow,
|
|
55
35
|
GameScoresQuery,
|
|
56
36
|
AchievementRow,
|
|
37
|
+
GameStatePatch,
|
|
57
38
|
ActiveSession,
|
|
58
39
|
SessionsResponse,
|
|
59
40
|
SessionDataPoint,
|
|
60
41
|
SessionSeries,
|
|
61
42
|
SessionTimeseriesQuery,
|
|
62
43
|
SessionTimeseriesResponse,
|
|
63
|
-
GameStatePatch,
|
|
64
44
|
SseEndpointDef,
|
|
65
45
|
TopicRow,
|
|
66
46
|
TopicAssignmentRow,
|
|
67
47
|
TopicsResponse,
|
|
68
48
|
TopicDetailResponse,
|
|
69
|
-
} from "./
|
|
70
|
-
|
|
71
|
-
// ─── New Response Types (inline) ───────────────────────────────────────────
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Response for GET /api/version. Returns the dashboard server version string
|
|
75
|
-
* so the launcher can detect stale servers from older builds.
|
|
76
|
-
*/
|
|
77
|
-
export interface VersionResponse {
|
|
78
|
-
/** Semver-style version string of the running dashboard server. */
|
|
79
|
-
readonly version: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Aggregated summary of the multi-repo index (subset of IndexesSummaryResponse).
|
|
84
|
-
* Used by GET /api/summary for lightweight header tiles.
|
|
85
|
-
*/
|
|
86
|
-
export type IndexSummary = Pick<
|
|
87
|
-
IndexesSummaryResponse,
|
|
88
|
-
| "totalRepos"
|
|
89
|
-
| "totalCheckpoints"
|
|
90
|
-
| "totalTokensSaved"
|
|
91
|
-
| "totalCompressedOriginalBytes"
|
|
92
|
-
>;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Fallback response for GET /api/index when the multi-repo index is unavailable
|
|
96
|
-
* (no index.sqlite file or read error). All fields are null/empty.
|
|
97
|
-
*/
|
|
98
|
-
export interface IndexFallbackResponse {
|
|
99
|
-
/** Always null — no index data available. */
|
|
100
|
-
readonly updatedAt: null;
|
|
101
|
-
/** Always null — no summary available. */
|
|
102
|
-
readonly summary: null;
|
|
103
|
-
/** Always an empty array — no repos registered. */
|
|
104
|
-
readonly repos: IndexesIndexRow[];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Query parameters for GET /api/repos. The `active` parameter filters to repos
|
|
109
|
-
* seen within the last N hours (format: "<N>h", e.g. "24h").
|
|
110
|
-
*/
|
|
111
|
-
export interface ReposQuery {
|
|
112
|
-
/** Active-window filter in format "<hours>h" (e.g. "24h"). Optional. */
|
|
113
|
-
readonly active?: string;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Response for GET /api/repos. Returns the registry list with an optional
|
|
118
|
-
* active-window filter applied.
|
|
119
|
-
*/
|
|
120
|
-
export interface ReposResponse {
|
|
121
|
-
/** ISO timestamp of the last index update, or null if unavailable. */
|
|
122
|
-
readonly updatedAt: string | null;
|
|
123
|
-
/** Array of repo index rows. */
|
|
124
|
-
readonly repos: IndexesIndexRow[];
|
|
125
|
-
/** Number of repos in the response (after filtering). */
|
|
126
|
-
readonly count: number;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Response for GET /api/summary. Lightweight header tiles without the full
|
|
131
|
-
* repo list (keeps payload small for embed scenarios).
|
|
132
|
-
*/
|
|
133
|
-
export interface SummaryResponse {
|
|
134
|
-
/** ISO timestamp of the last index update, or null if unavailable. */
|
|
135
|
-
readonly updatedAt: string | null;
|
|
136
|
-
/** Aggregate index summary, or null if no index exists. */
|
|
137
|
-
readonly summary: IndexSummary | null;
|
|
138
|
-
/** Number of repos active within the last 24 hours. */
|
|
139
|
-
readonly activeRepos: number;
|
|
140
|
-
/** Total number of repos in the registry. */
|
|
141
|
-
readonly totalRepos: number;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// ─── Drift Report Types ─────────────────────────────────────────────────────
|
|
145
|
-
|
|
146
|
-
/** Severity level for a drift signal. */
|
|
147
|
-
export type DriftSeverity = "warn" | "info";
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* A single drift signal for a repo.
|
|
151
|
-
*/
|
|
152
|
-
export interface DriftSignal {
|
|
153
|
-
/** The kind of drift detected. */
|
|
154
|
-
readonly kind: "stale" | "compaction_lag" | "model_churn";
|
|
155
|
-
/** Severity level of the signal. */
|
|
156
|
-
readonly severity: DriftSeverity;
|
|
157
|
-
/** Human-readable detail describing the drift. */
|
|
158
|
-
readonly detail: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Drift classification for a single repo.
|
|
163
|
-
*/
|
|
164
|
-
export interface RepoDrift {
|
|
165
|
-
/** Absolute path to the repo root. */
|
|
166
|
-
readonly repoRoot: string;
|
|
167
|
-
/** Display name of the repo. */
|
|
168
|
-
readonly displayName: string;
|
|
169
|
-
/** Unix timestamp (seconds) of the last dashboard activity. */
|
|
170
|
-
readonly lastSeen: number;
|
|
171
|
-
/** Unix timestamp (seconds) of the last compaction, or null if never. */
|
|
172
|
-
readonly lastCompactedAt: number | null;
|
|
173
|
-
/** Unix timestamp (seconds) of the last model capture, or null. */
|
|
174
|
-
readonly modelCapturedAt: number | null;
|
|
175
|
-
/** Array of drift signals detected for this repo. */
|
|
176
|
-
readonly signals: DriftSignal[];
|
|
177
|
-
/** Highest severity across signals; "ok" if none. */
|
|
178
|
-
readonly status: "ok" | "warn";
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Response for GET /api/drift. Cross-repo drift report over the machine-wide
|
|
183
|
-
* repo_registry, flagging stale repos, compaction lag, and model churn.
|
|
184
|
-
*/
|
|
185
|
-
export interface DriftReportResponse {
|
|
186
|
-
/** Unix timestamp (seconds) when the report was generated. */
|
|
187
|
-
readonly generatedAt: number;
|
|
188
|
-
/** Aggregate counts by status/signal. */
|
|
189
|
-
readonly totals: {
|
|
190
|
-
/** Repos with no drift signals. */
|
|
191
|
-
readonly ok: number;
|
|
192
|
-
/** Repos with at least one warning signal. */
|
|
193
|
-
readonly warn: number;
|
|
194
|
-
/** Repos with the "stale" signal. */
|
|
195
|
-
readonly stale: number;
|
|
196
|
-
/** Repos with the "compaction_lag" signal. */
|
|
197
|
-
readonly compactionLag: number;
|
|
198
|
-
/** Repos with the "model_churn" signal. */
|
|
199
|
-
readonly modelChurn: number;
|
|
200
|
-
};
|
|
201
|
-
/** Per-repo drift classifications. */
|
|
202
|
-
readonly repos: RepoDrift[];
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// ─── Servers Types ──────────────────────────────────────────────────────────
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* A single server entry in the GET /api/servers response. Represents a
|
|
209
|
-
* recently-active repo with its live dashboard snapshot data.
|
|
210
|
-
*/
|
|
211
|
-
export interface ServerEntry {
|
|
212
|
-
/** Absolute path to the repo root. */
|
|
213
|
-
readonly repoRoot: string;
|
|
214
|
-
/** Display name of the repo. */
|
|
215
|
-
readonly displayName: string;
|
|
216
|
-
/** Model name, or null if not set. */
|
|
217
|
-
readonly model: string | null;
|
|
218
|
-
/** Provider display name, or null if not set. */
|
|
219
|
-
readonly provider: string | null;
|
|
220
|
-
/** Unix timestamp (seconds) of the last dashboard activity. */
|
|
221
|
-
readonly lastSeen: number;
|
|
222
|
-
/** Unix timestamp (seconds) of the last compaction, or null. */
|
|
223
|
-
readonly lastCompactedAt: number | null;
|
|
224
|
-
/** Current compaction tier, or null if no live snapshot. Present when a live dashboard.json exists. */
|
|
225
|
-
readonly tier?: string | null;
|
|
226
|
-
/** Current context pressure percentage (0–100), or null. Present when a live snapshot has context data. */
|
|
227
|
-
readonly contextPct?: number | null;
|
|
228
|
-
/** Current session state string, or null. Present when a live snapshot has session data. */
|
|
229
|
-
readonly state?: string | null;
|
|
230
|
-
/** Cache hit counters from the live snapshot, or null. Present when a live snapshot has cacheHits. */
|
|
231
|
-
readonly cacheHits?: {
|
|
232
|
-
readonly session: number;
|
|
233
|
-
readonly total: number;
|
|
234
|
-
readonly sessionTokensSaved: number;
|
|
235
|
-
readonly totalTokensSaved: number;
|
|
236
|
-
} | null;
|
|
237
|
-
/** Compaction counters from the live snapshot, or null. Present when a live snapshot has compacts. */
|
|
238
|
-
readonly compacts?: {
|
|
239
|
-
readonly session: number;
|
|
240
|
-
readonly total: number;
|
|
241
|
-
} | null;
|
|
242
|
-
/** Time saved counters from the live snapshot, or null. Present when a live snapshot has timeSaved. */
|
|
243
|
-
readonly timeSaved?: {
|
|
244
|
-
readonly compact: {
|
|
245
|
-
readonly sessionSec: number;
|
|
246
|
-
readonly totalSec: number;
|
|
247
|
-
};
|
|
248
|
-
readonly cacheHit: {
|
|
249
|
-
readonly sessionSec: number;
|
|
250
|
-
readonly totalSec: number;
|
|
251
|
-
};
|
|
252
|
-
} | null;
|
|
253
|
-
/** ISO timestamp of the live snapshot, or null. Present when a live snapshot has updatedAt. */
|
|
254
|
-
readonly updatedAt?: string | null;
|
|
255
|
-
/** Provider prompt-cache lifetime aggregates for this repo, or null when unavailable. */
|
|
256
|
-
readonly providerCache?: {
|
|
257
|
-
readonly avgHitPct: number;
|
|
258
|
-
readonly cacheRead: number;
|
|
259
|
-
readonly cacheWrite: number;
|
|
260
|
-
readonly totalInput: number;
|
|
261
|
-
readonly sampleCount: number;
|
|
262
|
-
readonly estimatedSaved: number | null;
|
|
263
|
-
} | null;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Response for GET /api/servers. Lists recently-active repo servers with
|
|
268
|
-
* live snapshot data.
|
|
269
|
-
*/
|
|
270
|
-
export interface ServersResponse {
|
|
271
|
-
/** ISO timestamp when the response was generated. */
|
|
272
|
-
readonly updatedAt: string;
|
|
273
|
-
/** Array of server entries, sorted by lastSeen descending. */
|
|
274
|
-
readonly servers: ServerEntry[];
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// ─── Perf Types ─────────────────────────────────────────────────────────────
|
|
278
|
-
|
|
279
|
-
/** Percentile statistics for a latency metric (in milliseconds). */
|
|
280
|
-
export interface PerfPercentile {
|
|
281
|
-
/** 50th percentile (median) in milliseconds. */
|
|
282
|
-
readonly p50: number;
|
|
283
|
-
/** 95th percentile in milliseconds. */
|
|
284
|
-
readonly p95: number;
|
|
285
|
-
/** Number of samples in the window. */
|
|
286
|
-
readonly n: number;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/** Average statistics for a rate metric. */
|
|
290
|
-
export interface PerfAverage {
|
|
291
|
-
/** Average value across all samples in the window. */
|
|
292
|
-
readonly avg: number;
|
|
293
|
-
/** Number of samples in the window. */
|
|
294
|
-
readonly n: number;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/** Latest-value statistics for a gauge metric. */
|
|
298
|
-
export interface PerfLatest {
|
|
299
|
-
/** Most recent value in the window. */
|
|
300
|
-
readonly latest: number;
|
|
301
|
-
/** Number of samples in the window. */
|
|
302
|
-
readonly n: number;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/** A single cache hit rate sample with timestamp. */
|
|
306
|
-
export interface CacheHitSample {
|
|
307
|
-
/** Cache hit percentage (0–100). */
|
|
308
|
-
readonly pct: number;
|
|
309
|
-
/** Epoch ms timestamp of the sample. */
|
|
310
|
-
readonly ts: number;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/** Average + latest statistics for cache hit percentage. */
|
|
314
|
-
export interface PerfCacheHit {
|
|
315
|
-
/** Average cache hit percentage (0–100). */
|
|
316
|
-
readonly avg: number;
|
|
317
|
-
/** Most recent cache hit percentage (0–100). */
|
|
318
|
-
readonly latest: number;
|
|
319
|
-
/** Number of samples in the window. */
|
|
320
|
-
readonly n: number;
|
|
321
|
-
/** Raw cache hit samples with timestamps for time-series charting. */
|
|
322
|
-
readonly samples: CacheHitSample[];
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/** Diagnostic counters from the live dashboard snapshot. */
|
|
326
|
-
export interface PerfDiag {
|
|
327
|
-
/** Number of fast-gate context trim fires. */
|
|
328
|
-
readonly ctxFastGate: number;
|
|
329
|
-
/** Number of live trim fires. */
|
|
330
|
-
readonly liveTrimFires: number;
|
|
331
|
-
/** Number of live trim replays. */
|
|
332
|
-
readonly liveTrimReplays: number;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Query parameters for GET /api/perf. The `minutes` parameter controls the
|
|
337
|
-
* rolling window size.
|
|
338
|
-
*/
|
|
339
|
-
export interface PerfQuery {
|
|
340
|
-
/** Rolling window size in minutes (default: 30, max: 1440). Optional. */
|
|
341
|
-
readonly minutes?: number;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Response for GET /api/perf. Rolling-window aggregates over perf_samples
|
|
346
|
-
* with per-kind p50/p95, latest rss/heap, cpu counters, and diagnostic data.
|
|
347
|
-
*/
|
|
348
|
-
export interface PerfResponse {
|
|
349
|
-
/** ISO timestamp when the response was generated. */
|
|
350
|
-
readonly updatedAt: string;
|
|
351
|
-
/** Rolling window size in minutes. */
|
|
352
|
-
readonly windowMinutes: number;
|
|
353
|
-
/** Total number of perf samples in the window. */
|
|
354
|
-
readonly sampleCount: number;
|
|
355
|
-
/** Turn latency statistics in milliseconds. */
|
|
356
|
-
readonly turn_latency_ms: PerfPercentile;
|
|
357
|
-
/** Provider latency statistics in milliseconds. */
|
|
358
|
-
readonly provider_latency_ms: PerfPercentile;
|
|
359
|
-
/** Tokens-per-second statistics. */
|
|
360
|
-
readonly tps: PerfAverage;
|
|
361
|
-
/** Cache hit percentage statistics. */
|
|
362
|
-
readonly cache_hit_pct: PerfCacheHit;
|
|
363
|
-
/** Database recompute duration statistics in milliseconds. */
|
|
364
|
-
readonly db_recompute_ms: PerfPercentile;
|
|
365
|
-
/** Disk write duration statistics in milliseconds. */
|
|
366
|
-
readonly disk_write_ms: PerfPercentile;
|
|
367
|
-
/** RSS memory usage in MB (latest value). */
|
|
368
|
-
readonly rss_mb: PerfLatest;
|
|
369
|
-
/** Heap memory usage in MB (latest value). */
|
|
370
|
-
readonly heap_mb: PerfLatest;
|
|
371
|
-
/** CPU user time in milliseconds (latest value). */
|
|
372
|
-
readonly cpu_user_ms: PerfLatest;
|
|
373
|
-
/** CPU system time in milliseconds (latest value). */
|
|
374
|
-
readonly cpu_sys_ms: PerfLatest;
|
|
375
|
-
/** Diagnostic counters from the live snapshot, or null if unavailable. */
|
|
376
|
-
readonly diag: PerfDiag | null;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// ─── Provider Cache Lifetime (A.2) — see provider-cache.ts ─────────────────
|
|
380
|
-
|
|
381
|
-
// ─── Game Score & Achievement Types ─────────────────────────────────────────
|
|
382
|
-
// (moved to game-types.ts; re-exported for backwards compatibility)
|
|
383
|
-
|
|
384
|
-
// ─── Sessions Memory Graph (S39) ─────────────────────────────────────────
|
|
385
|
-
// (moved to game-types.ts; re-exported for backwards compatibility)
|
|
386
|
-
|
|
387
|
-
// ─── Game State Patch (PUT request body) ────────────────────────────────────
|
|
388
|
-
// (moved to game-types.ts; re-exported for backwards compatibility)
|
|
389
|
-
|
|
390
|
-
// ─── SSE Endpoint Definition ────────────────────────────────────────────────
|
|
391
|
-
// (moved to game-types.ts; re-exported for backwards compatibility)
|
|
392
|
-
|
|
393
|
-
// ─── ENDPOINTS Registry ─────────────────────────────────────────────────────
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Central registry of all 14 dashboard API endpoints. Each entry is an
|
|
397
|
-
* `EndpointDef` or `SseEndpointDef` instance serving as the single source of
|
|
398
|
-
* truth for route paths, methods, descriptions, and typed request/response
|
|
399
|
-
* contracts.
|
|
400
|
-
*
|
|
401
|
-
* Usage:
|
|
402
|
-
* import { ENDPOINTS } from './api-contracts';
|
|
403
|
-
* ENDPOINTS.snapshot.path // '/api/snapshot'
|
|
404
|
-
* ENDPOINTS.snapshot.method // 'GET'
|
|
405
|
-
*/
|
|
406
|
-
export const ENDPOINTS = {
|
|
407
|
-
/** GET /api/snapshot — Full session, store, compression, and context snapshot. */
|
|
408
|
-
snapshot: {
|
|
409
|
-
method: "GET",
|
|
410
|
-
path: "/api/snapshot",
|
|
411
|
-
description: "Full session, store, compression, and context snapshot.",
|
|
412
|
-
} as const satisfies EndpointDef<"GET", undefined, SnapshotResponse>,
|
|
413
|
-
|
|
414
|
-
/** GET /api/version — Dashboard server version string. */
|
|
415
|
-
version: {
|
|
416
|
-
method: "GET",
|
|
417
|
-
path: "/api/version",
|
|
418
|
-
description: "Dashboard server version for stale-server detection.",
|
|
419
|
-
} as const satisfies EndpointDef<"GET", undefined, VersionResponse>,
|
|
420
|
-
|
|
421
|
-
/** GET /api/index — Multi-repo aggregate index (or fallback when unavailable). */
|
|
422
|
-
index: {
|
|
423
|
-
method: "GET",
|
|
424
|
-
path: "/api/index",
|
|
425
|
-
description:
|
|
426
|
-
"Machine-wide multi-repo registry with checkpoints, tokens, and model info.",
|
|
427
|
-
} as const satisfies EndpointDef<
|
|
428
|
-
"GET",
|
|
429
|
-
undefined,
|
|
430
|
-
IndexesSummaryResponse | IndexFallbackResponse
|
|
431
|
-
>,
|
|
432
|
-
|
|
433
|
-
/** GET /api/repos — Registry list with optional active-window filter. */
|
|
434
|
-
repos: {
|
|
435
|
-
method: "GET",
|
|
436
|
-
path: "/api/repos",
|
|
437
|
-
description: "Repo registry list, optionally filtered by recent activity.",
|
|
438
|
-
} as const satisfies EndpointDef<"GET", ReposQuery, ReposResponse>,
|
|
439
|
-
|
|
440
|
-
/** GET /api/summary — Lightweight header tiles without the full repo list. */
|
|
441
|
-
summary: {
|
|
442
|
-
method: "GET",
|
|
443
|
-
path: "/api/summary",
|
|
444
|
-
description:
|
|
445
|
-
"Aggregate summary with active/total repo counts (no repo list).",
|
|
446
|
-
} as const satisfies EndpointDef<"GET", undefined, SummaryResponse>,
|
|
447
|
-
|
|
448
|
-
/** GET /api/drift — Cross-repo drift report. */
|
|
449
|
-
drift: {
|
|
450
|
-
method: "GET",
|
|
451
|
-
path: "/api/drift",
|
|
452
|
-
description:
|
|
453
|
-
"Cross-repo drift report flagging stale repos, compaction lag, and model churn.",
|
|
454
|
-
} as const satisfies EndpointDef<"GET", undefined, DriftReportResponse>,
|
|
455
|
-
|
|
456
|
-
/** GET /api/servers — Recently-active repo servers with live snapshot data. */
|
|
457
|
-
servers: {
|
|
458
|
-
method: "GET",
|
|
459
|
-
path: "/api/servers",
|
|
460
|
-
description: "Recently-active repo servers with live snapshot data.",
|
|
461
|
-
} as const satisfies EndpointDef<"GET", undefined, ServersResponse>,
|
|
462
|
-
|
|
463
|
-
/** GET /api/events — SSE stream of dashboard events. */
|
|
464
|
-
events: {
|
|
465
|
-
type: "sse",
|
|
466
|
-
method: "GET",
|
|
467
|
-
path: "/api/events",
|
|
468
|
-
description: "Server-Sent Events stream of all dashboard events.",
|
|
469
|
-
event: "data",
|
|
470
|
-
} as const satisfies SseEndpointDef<SseEvent>,
|
|
471
|
-
|
|
472
|
-
/** GET /api/game-state — Current game-mode settings. */
|
|
473
|
-
getGameState: {
|
|
474
|
-
method: "GET",
|
|
475
|
-
path: "/api/game-state",
|
|
476
|
-
description: "Current game-mode configuration and active ritual state.",
|
|
477
|
-
} as const satisfies EndpointDef<"GET", undefined, GameStateResponse>,
|
|
478
|
-
|
|
479
|
-
/** PUT /api/game-state — Apply a partial patch to game-mode settings. */
|
|
480
|
-
putGameState: {
|
|
481
|
-
method: "PUT",
|
|
482
|
-
path: "/api/game-state",
|
|
483
|
-
description:
|
|
484
|
-
"Apply a partial patch to game-mode settings and return the updated state.",
|
|
485
|
-
} as const satisfies EndpointDef<"PUT", GameStatePatch, GameStateResponse>,
|
|
486
|
-
|
|
487
|
-
/** GET /api/game-scores — High-score leaderboard for a metric. */
|
|
488
|
-
gameScores: {
|
|
489
|
-
method: "GET",
|
|
490
|
-
path: "/api/game-scores",
|
|
491
|
-
description: "High-score leaderboard for a game metric.",
|
|
492
|
-
} as const satisfies EndpointDef<"GET", GameScoresQuery, GameScoreRow[]>,
|
|
493
|
-
|
|
494
|
-
/** GET /api/perf — Rolling-window performance aggregates. */
|
|
495
|
-
perf: {
|
|
496
|
-
method: "GET",
|
|
497
|
-
path: "/api/perf",
|
|
498
|
-
description: "Rolling-window performance aggregates over perf_samples.",
|
|
499
|
-
} as const satisfies EndpointDef<"GET", PerfQuery, PerfResponse>,
|
|
500
|
-
|
|
501
|
-
/** GET /api/achievements — Achievement tiles with unlock state. */
|
|
502
|
-
achievements: {
|
|
503
|
-
method: "GET",
|
|
504
|
-
path: "/api/achievements",
|
|
505
|
-
description: "All achievement rows with unlock state.",
|
|
506
|
-
} as const satisfies EndpointDef<"GET", undefined, AchievementRow[]>,
|
|
507
|
-
|
|
508
|
-
/** GET /api/sessions — Active sessions with latest token usage (S39). */
|
|
509
|
-
sessions: {
|
|
510
|
-
method: "GET",
|
|
511
|
-
path: "/api/sessions",
|
|
512
|
-
description: "Active pi sessions with latest token usage + heartbeat.",
|
|
513
|
-
} as const satisfies EndpointDef<"GET", undefined, SessionsResponse>,
|
|
514
|
-
|
|
515
|
-
/** GET /api/sessions/timeseries — Stacked per-session token timeseries (S39). */
|
|
516
|
-
sessionTimeseries: {
|
|
517
|
-
method: "GET",
|
|
518
|
-
path: "/api/sessions/timeseries",
|
|
519
|
-
description:
|
|
520
|
-
"Recharts-ready per-session token timeseries for the stacked memory graph.",
|
|
521
|
-
} as const satisfies EndpointDef<
|
|
522
|
-
"GET",
|
|
523
|
-
SessionTimeseriesQuery,
|
|
524
|
-
SessionTimeseriesResponse
|
|
525
|
-
>,
|
|
526
|
-
|
|
527
|
-
/** GET /api/topics — Auto-categorizing wiki topics (S51). */
|
|
528
|
-
topics: {
|
|
529
|
-
method: "GET",
|
|
530
|
-
path: "/api/topics",
|
|
531
|
-
description:
|
|
532
|
-
"Auto-categorized wiki topics from k-means + TF-IDF over real embeddings.",
|
|
533
|
-
} as const satisfies EndpointDef<"GET", undefined, TopicsResponse>,
|
|
534
|
-
|
|
535
|
-
/** GET /api/turns — Turn-by-turn memory tracking + recall (S52). */
|
|
536
|
-
turns: {
|
|
537
|
-
method: "GET",
|
|
538
|
-
path: "/api/turns",
|
|
539
|
-
description:
|
|
540
|
-
"Per-conversation turn list with recall + epoch provenance (turn-by-turn memory tracking).",
|
|
541
|
-
} as const satisfies EndpointDef<"GET", undefined, TurnsResponse>,
|
|
542
|
-
|
|
543
|
-
/** GET /api/turns/conversation/:convId — per-turn detail + recall hits. */
|
|
544
|
-
conversationTurns: {
|
|
545
|
-
method: "GET",
|
|
546
|
-
path: "/api/turns/conversation/:convId",
|
|
547
|
-
description:
|
|
548
|
-
"Per-turn metrics + injected-checkpoint recall provenance for one conversation.",
|
|
549
|
-
} as const satisfies EndpointDef<"GET", undefined, ConversationTurnsResponse>,
|
|
550
|
-
|
|
551
|
-
/** GET /api/turns/intents — pending rewind intents (S52A). */
|
|
552
|
-
turnIntents: {
|
|
553
|
-
method: "GET",
|
|
554
|
-
path: "/api/turns/intents",
|
|
555
|
-
description:
|
|
556
|
-
"Pending rewind intents queued by the dashboard for the host to consume.",
|
|
557
|
-
} as const satisfies EndpointDef<"GET", undefined, RewindIntentsResponse>,
|
|
558
|
-
|
|
559
|
-
/** POST /api/turns/intent — post a rewind intent. */
|
|
560
|
-
postTurnIntent: {
|
|
561
|
-
method: "POST",
|
|
562
|
-
path: "/api/turns/intent",
|
|
563
|
-
description:
|
|
564
|
-
"Queue a rewind-to-turn-N intent for the host to apply at before_agent_start.",
|
|
565
|
-
} as const satisfies EndpointDef<"POST", PostIntentRequest, unknown>,
|
|
566
|
-
|
|
567
|
-
/** POST /api/fork — fork a conversation at a turn. */
|
|
568
|
-
fork: {
|
|
569
|
-
method: "POST",
|
|
570
|
-
path: "/api/fork",
|
|
571
|
-
description:
|
|
572
|
-
"Branch a child conversation off a parent turn + return the recall set to rehydrate.",
|
|
573
|
-
} as const satisfies EndpointDef<"POST", ForkRequest, ForkResponse>,
|
|
574
|
-
|
|
575
|
-
/** POST /api/turns/prune — admin prune (capability-gated). */
|
|
576
|
-
pruneTurns: {
|
|
577
|
-
method: "POST",
|
|
578
|
-
path: "/api/turns/prune",
|
|
579
|
-
description:
|
|
580
|
-
"Prune old turns (admin capability — dashboard uses asAdmin()).",
|
|
581
|
-
} as const satisfies EndpointDef<"POST", PruneRequest, PruneTurnsResponse>,
|
|
582
|
-
|
|
583
|
-
/** GET /api/topics/:topicId/memories — wiki topic drill-down (S52). */
|
|
584
|
-
topicMemories: {
|
|
585
|
-
method: "GET",
|
|
586
|
-
path: "/api/topics/:topicId/memories",
|
|
587
|
-
description: "Member memories assigned to a wiki topic (drill-down).",
|
|
588
|
-
} as const satisfies EndpointDef<"GET", undefined, TopicMemoriesResponse>,
|
|
589
|
-
|
|
590
|
-
// ─── S49B Maintenance Tab ─────────────────────────────────────────
|
|
591
|
-
|
|
592
|
-
/** GET /api/maintenance — DB stats (table row counts + storage). */
|
|
593
|
-
maintenanceStats: {
|
|
594
|
-
method: "GET",
|
|
595
|
-
path: "/api/maintenance",
|
|
596
|
-
description: "SQLite table row counts, storage stats, and DB file sizes.",
|
|
597
|
-
} as const satisfies EndpointDef<"GET", undefined, DbStatsResponse>,
|
|
598
|
-
|
|
599
|
-
/** GET /api/maintenance/schema-health — Schema version + integrity audit. */
|
|
600
|
-
schemaHealth: {
|
|
601
|
-
method: "GET",
|
|
602
|
-
path: "/api/maintenance/schema-health",
|
|
603
|
-
description:
|
|
604
|
-
"SCHEMA_VERSION, PRAGMA integrity_check, FK check, and per-column audit.",
|
|
605
|
-
} as const satisfies EndpointDef<"GET", undefined, SchemaHealthResponse>,
|
|
606
|
-
|
|
607
|
-
/** POST /api/maintenance/action — Trigger a maintenance action. */
|
|
608
|
-
maintenanceAction: {
|
|
609
|
-
method: "POST",
|
|
610
|
-
path: "/api/maintenance/action",
|
|
611
|
-
description:
|
|
612
|
-
"Run vacuum, checkpoint, reindex, fts5-rebuild, reconcile-dedup, prune, or integrity-check.",
|
|
613
|
-
} as const satisfies EndpointDef<
|
|
614
|
-
"POST",
|
|
615
|
-
MaintenanceAction,
|
|
616
|
-
MaintenanceActionResult
|
|
617
|
-
>,
|
|
618
|
-
|
|
619
|
-
// ─── Provider Cache (Sprint A.2) ─────────────────────────────────
|
|
620
|
-
|
|
621
|
-
/** GET /api/provider-cache — Lifetime provider prompt cache aggregates + $ savings. */
|
|
622
|
-
providerCache: {
|
|
623
|
-
method: "GET",
|
|
624
|
-
path: "/api/provider-cache",
|
|
625
|
-
description:
|
|
626
|
-
"Lifetime provider prompt cache hit-rate aggregates + dollar savings estimate.",
|
|
627
|
-
} as const satisfies EndpointDef<"GET", undefined, ProviderCacheResponse>,
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
// ─── A3 Cache Stripes (PLAN_V2 Phase 4) ───────────────────────────
|
|
631
|
-
|
|
632
|
-
/** GET /api/cache-stripes — Per-stripe distribution + health score. */
|
|
633
|
-
cacheStripes: {
|
|
634
|
-
method: "GET",
|
|
635
|
-
path: "/api/cache-stripes",
|
|
636
|
-
description:
|
|
637
|
-
"Per-stripe distribution counts, average stability scores, and composite cache health.",
|
|
638
|
-
} as const satisfies EndpointDef<"GET", undefined, CacheStripesResponse>,
|
|
639
|
-
// ─── Memory Effectiveness (S53B) ───────────────────────────────────────
|
|
640
|
-
|
|
641
|
-
/** GET /api/memory-status — Memory store aggregate statistics. */
|
|
642
|
-
memoryStatus: {
|
|
643
|
-
method: "GET",
|
|
644
|
-
path: "/api/memory-status",
|
|
645
|
-
description:
|
|
646
|
-
"Memory store statistics: total count, 30-day window, top-N stable memories, avg recall score.",
|
|
647
|
-
} as const satisfies EndpointDef<"GET", undefined, MemoryStatusResponse>,
|
|
648
|
-
|
|
649
|
-
/** GET /api/setup-status — Current embedder configuration. */
|
|
650
|
-
setupStatus: {
|
|
651
|
-
method: "GET",
|
|
652
|
-
path: "/api/setup-status",
|
|
653
|
-
description:
|
|
654
|
-
"Current embedder configuration (which embedder is active, embedding URL, cache, MiniLM flag).",
|
|
655
|
-
} as const satisfies EndpointDef<"GET", undefined, SetupStatusResponse>,
|
|
656
|
-
|
|
657
|
-
/** GET /api/setup-detect — Detect available local embedder backends. */
|
|
658
|
-
setupDetect: {
|
|
659
|
-
method: "GET",
|
|
660
|
-
path: "/api/setup-detect",
|
|
661
|
-
description:
|
|
662
|
-
"Best-effort detection of local embedder backends (ollama, llama.cpp, ONNX) available on the machine.",
|
|
663
|
-
} as const satisfies EndpointDef<"GET", undefined, SetupDetectResponse>,
|
|
49
|
+
} from "./endpoints/types.js";
|
|
664
50
|
|
|
665
|
-
|
|
666
|
-
setupConfigure: {
|
|
667
|
-
method: "POST",
|
|
668
|
-
path: "/api/setup-configure",
|
|
669
|
-
description:
|
|
670
|
-
"Write the chosen embedder configuration to .mega-compact.env (loaded at next startup). Returns whether a restart is required.",
|
|
671
|
-
} as const satisfies EndpointDef<"POST", SetupConfigureRequest, SetupConfigureResponse>,
|
|
672
|
-
} as const;
|
|
51
|
+
export { ENDPOINTS } from "./endpoints/registry.js";
|