agent-recall-core 3.4.38 → 3.4.39
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 +1 -1
- package/dist/host-profile.d.ts +69 -0
- package/dist/host-profile.d.ts.map +1 -0
- package/dist/host-profile.js +107 -0
- package/dist/host-profile.js.map +1 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/corrections.d.ts +128 -0
- package/dist/storage/corrections.d.ts.map +1 -1
- package/dist/storage/corrections.js +562 -147
- package/dist/storage/corrections.js.map +1 -1
- package/dist/storage/lifecycle-telemetry.d.ts +56 -0
- package/dist/storage/lifecycle-telemetry.d.ts.map +1 -0
- package/dist/storage/lifecycle-telemetry.js +134 -0
- package/dist/storage/lifecycle-telemetry.js.map +1 -0
- package/dist/storage/sanitize.d.ts +2 -1
- package/dist/storage/sanitize.d.ts.map +1 -1
- package/dist/storage/sanitize.js +19 -2
- package/dist/storage/sanitize.js.map +1 -1
- package/dist/storage/session.d.ts +25 -1
- package/dist/storage/session.d.ts.map +1 -1
- package/dist/storage/session.js +60 -1
- package/dist/storage/session.js.map +1 -1
- package/dist/tools-logic/check-action.d.ts.map +1 -1
- package/dist/tools-logic/check-action.js +97 -3
- package/dist/tools-logic/check-action.js.map +1 -1
- package/dist/tools-logic/check.d.ts +22 -0
- package/dist/tools-logic/check.d.ts.map +1 -1
- package/dist/tools-logic/check.js +31 -1
- package/dist/tools-logic/check.js.map +1 -1
- package/dist/tools-logic/session-end.d.ts.map +1 -1
- package/dist/tools-logic/session-end.js +49 -4
- package/dist/tools-logic/session-end.js.map +1 -1
- package/dist/tools-logic/session-start.d.ts.map +1 -1
- package/dist/tools-logic/session-start.js +29 -6
- package/dist/tools-logic/session-start.js.map +1 -1
- package/dist/tools-logic/smart-recall.d.ts +93 -1
- package/dist/tools-logic/smart-recall.d.ts.map +1 -1
- package/dist/tools-logic/smart-recall.js +199 -11
- package/dist/tools-logic/smart-recall.js.map +1 -1
- package/dist/tools-logic/smart-remember.d.ts.map +1 -1
- package/dist/tools-logic/smart-remember.js +12 -0
- package/dist/tools-logic/smart-remember.js.map +1 -1
- package/dist/tools-logic/store-doctor.d.ts +1 -1
- package/dist/tools-logic/store-doctor.d.ts.map +1 -1
- package/dist/tools-logic/store-doctor.js +64 -0
- package/dist/tools-logic/store-doctor.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +4 -3
- package/dist/tools-logic/brief.d.ts +0 -84
- package/dist/tools-logic/brief.d.ts.map +0 -1
- package/dist/tools-logic/brief.js +0 -193
- package/dist/tools-logic/brief.js.map +0 -1
- package/dist/tools-logic/dashboard-export.d.ts +0 -130
- package/dist/tools-logic/dashboard-export.d.ts.map +0 -1
- package/dist/tools-logic/dashboard-export.js +0 -485
- package/dist/tools-logic/dashboard-export.js.map +0 -1
- package/dist/tools-logic/memory-query.d.ts +0 -43
- package/dist/tools-logic/memory-query.d.ts.map +0 -1
- package/dist/tools-logic/memory-query.js +0 -77
- package/dist/tools-logic/memory-query.js.map +0 -1
- package/dist/tools-logic/project-status.d.ts +0 -24
- package/dist/tools-logic/project-status.d.ts.map +0 -1
- package/dist/tools-logic/project-status.js +0 -155
- package/dist/tools-logic/project-status.js.map +0 -1
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* brief.ts — compact LLM-free re-orientation briefing (≤200 tokens).
|
|
3
|
-
*
|
|
4
|
-
* Designed for:
|
|
5
|
-
* - Hook-less hosts (no session_start auto-fire) that need a lightweight
|
|
6
|
-
* mid-session reminder of lifecycle rules and current project state.
|
|
7
|
-
* - Tier-B fallback when a client does not want the full session_start payload.
|
|
8
|
-
*
|
|
9
|
-
* Contract:
|
|
10
|
-
* - READ-ONLY: no session_start side-effects (no recordPolicyLoad, no
|
|
11
|
-
* recordOutcome, no autoBackfill). Does NOT replace session_start.
|
|
12
|
-
* - DETERMINISTIC: same on-disk state → byte-identical JSON output across
|
|
13
|
-
* runs. No Date.now() in output, no timestamps, no random values.
|
|
14
|
-
* - LLM-FREE: only synchronous fs reads + keyword matching.
|
|
15
|
-
* - ≤200 tokens output budget (enforced by field limits; caller may verify).
|
|
16
|
-
* - NEVER call recordPolicyLoad or any write-side function here.
|
|
17
|
-
*
|
|
18
|
-
* Spec ref: cross-surface-adapter-spec.md §5 "brief tool design"
|
|
19
|
-
* --full only: registered inside the `if (fullMode)` block in index.ts.
|
|
20
|
-
*/
|
|
21
|
-
import { resolveProject } from "../storage/project.js";
|
|
22
|
-
import { readIdentity } from "../palace/identity.js";
|
|
23
|
-
import { readActiveCorrections } from "../storage/corrections.js";
|
|
24
|
-
import { readAlignmentLog, extractWatchPatterns } from "../helpers/alignment-patterns.js";
|
|
25
|
-
import { readBehaviorPolicies } from "../storage/behavior-policies.js";
|
|
26
|
-
import { listMilestones } from "../palace/pipeline.js";
|
|
27
|
-
import { runStoreDoctor, storeDoctorBanner } from "./store-doctor.js";
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
// Constants
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
|
-
/**
|
|
32
|
-
* The 3-rule lifecycle verbatim — must match server.ts instructions.
|
|
33
|
-
* Single source of truth here; server.ts REFERENCES this exported constant.
|
|
34
|
-
*/
|
|
35
|
-
export const LIFECYCLE_TEXT = "AgentRecall lifecycle (this host has NO auto-hooks — you drive it):\n" +
|
|
36
|
-
"(1) ENTRY: call session_start FIRST, before acting.\n" +
|
|
37
|
-
"(2) DURABLE INTENT: when you or the user says save/remember/checkpoint/记住, call session_end (or remember for a single fact). Saying it ≠ saving it.\n" +
|
|
38
|
-
"(3) EXIT: call session_end before the session ends.";
|
|
39
|
-
/** Save-trigger vocabulary rendered as human-readable strings. */
|
|
40
|
-
const TRIGGER_VOCAB_DISPLAY = [
|
|
41
|
-
"save", "save this", "save the session",
|
|
42
|
-
"checkpoint", "retain this",
|
|
43
|
-
"don't forget this", "remember this", "write this down",
|
|
44
|
-
"记住", "保存", "存档",
|
|
45
|
-
];
|
|
46
|
-
const HOST_HINT = "Hook-less host? call brief() once for lifecycle rules. session_start is still required at entry.";
|
|
47
|
-
/**
|
|
48
|
-
* ≤200-token budget enforced as a conservative char-count proxy.
|
|
49
|
-
* JSON overhead ≈ 20%; 1200 chars ≈ 200 tokens at ~6 chars/token.
|
|
50
|
-
* enforceTokenBudget() truncates per-section so the invariant holds on a
|
|
51
|
-
* fully-populated store, not just an empty one.
|
|
52
|
-
*/
|
|
53
|
-
const BUDGET_CHARS = 1200;
|
|
54
|
-
/** Per-section field limits (chars) sized so the total stays under BUDGET_CHARS.
|
|
55
|
-
*
|
|
56
|
-
* Fixed overhead analysis (measured):
|
|
57
|
-
* lifecycle_text ~319, host_hint ~96, trigger_vocab ~135, project ~30 → ~580 fixed.
|
|
58
|
-
* JSON structural overhead (keys, brackets, commas) → ~120.
|
|
59
|
-
* Budget for dynamic fields: 1200 - 580 - 120 = 500 chars.
|
|
60
|
-
* Slots: identity(1) + corrections_top(3) + watch_for_top(2) + rules_top(3).
|
|
61
|
-
* Budget allocation per slot type:
|
|
62
|
-
* identity: 1 × 40 = 40
|
|
63
|
-
* correction: 3 × (id≤12 + rule≤30) ≈ 3×50 = 150 (id truncated to date-part)
|
|
64
|
-
* watch: 2 × (pattern≤30 + suggestion≤30) = 120
|
|
65
|
-
* rule: 3 × (name≤20 + when≤25 + do≤25) = 210
|
|
66
|
-
* Total dynamic: 40 + 150 + 120 + 210 = 520 (tight, within budget with ~80 margin)
|
|
67
|
-
*/
|
|
68
|
-
const LIMITS = {
|
|
69
|
-
identity: 40,
|
|
70
|
-
correction_id: 10, // keep only date "2026-06-14" — strip slug suffix
|
|
71
|
-
correction_rule: 20,
|
|
72
|
-
watch_pattern: 28,
|
|
73
|
-
watch_suggestion: 28,
|
|
74
|
-
rule_name: 15,
|
|
75
|
-
rule_when: 18,
|
|
76
|
-
rule_do: 18,
|
|
77
|
-
};
|
|
78
|
-
function enforceTokenBudget(r) {
|
|
79
|
-
return {
|
|
80
|
-
...r,
|
|
81
|
-
identity: r.identity.slice(0, LIMITS.identity),
|
|
82
|
-
corrections_top: r.corrections_top.map((c) => ({
|
|
83
|
-
...c,
|
|
84
|
-
id: c.id.slice(0, LIMITS.correction_id),
|
|
85
|
-
rule: c.rule.slice(0, LIMITS.correction_rule),
|
|
86
|
-
})),
|
|
87
|
-
watch_for_top: r.watch_for_top.map((w) => ({
|
|
88
|
-
...w,
|
|
89
|
-
pattern: w.pattern.slice(0, LIMITS.watch_pattern),
|
|
90
|
-
suggestion: w.suggestion.slice(0, LIMITS.watch_suggestion),
|
|
91
|
-
})),
|
|
92
|
-
rules_top: r.rules_top.map((rule) => ({
|
|
93
|
-
...rule,
|
|
94
|
-
name: rule.name.slice(0, LIMITS.rule_name),
|
|
95
|
-
when: rule.when.slice(0, LIMITS.rule_when),
|
|
96
|
-
do: rule.do.slice(0, LIMITS.rule_do),
|
|
97
|
-
})),
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
// brief()
|
|
102
|
-
// ---------------------------------------------------------------------------
|
|
103
|
-
export async function brief(input) {
|
|
104
|
-
const slug = await resolveProject(input.project);
|
|
105
|
-
// --- identity (≤140 chars) ---
|
|
106
|
-
const rawIdentity = readIdentity(slug);
|
|
107
|
-
const firstMeaningful = rawIdentity.split("\n").find((l) => {
|
|
108
|
-
const t = l.trim();
|
|
109
|
-
return t && !t.startsWith("---") && !t.startsWith(">") && !/^[a-z_]+:\s/.test(t) && !t.startsWith("_(");
|
|
110
|
-
});
|
|
111
|
-
const identity = (firstMeaningful ?? slug).replace(/^#+\s*/, "").trim().slice(0, 140);
|
|
112
|
-
// --- active pipeline phase (deterministic, null if none) ---
|
|
113
|
-
let active_phase = null;
|
|
114
|
-
try {
|
|
115
|
-
const milestones = listMilestones(slug);
|
|
116
|
-
const active = milestones.find((m) => m.meta.status === "active");
|
|
117
|
-
active_phase = active?.meta.phase ?? null;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
active_phase = null;
|
|
121
|
-
}
|
|
122
|
-
// --- top P0 corrections (≤3, date-descending) ---
|
|
123
|
-
let corrections_top = [];
|
|
124
|
-
try {
|
|
125
|
-
const corrections = readActiveCorrections(slug);
|
|
126
|
-
// Sort deterministically: P0 first, then by id (date-stamped ids are
|
|
127
|
-
// lexicographically ordered newest-first after the date prefix).
|
|
128
|
-
const sorted = corrections
|
|
129
|
-
.filter((c) => c.severity === "p0")
|
|
130
|
-
.sort((a, b) => b.id.localeCompare(a.id))
|
|
131
|
-
.slice(0, 3);
|
|
132
|
-
corrections_top = sorted.map((c) => ({
|
|
133
|
-
id: c.id,
|
|
134
|
-
rule: c.rule.slice(0, 120),
|
|
135
|
-
severity: c.severity,
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
corrections_top = [];
|
|
140
|
-
}
|
|
141
|
-
// --- watch_for (≤2) ---
|
|
142
|
-
let watch_for_top = [];
|
|
143
|
-
try {
|
|
144
|
-
const alignLog = readAlignmentLog(slug);
|
|
145
|
-
const patterns = extractWatchPatterns(alignLog, 2);
|
|
146
|
-
watch_for_top = patterns.map((p) => ({
|
|
147
|
-
pattern: p.pattern.slice(0, 80),
|
|
148
|
-
suggestion: p.suggestion.slice(0, 80),
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
watch_for_top = [];
|
|
153
|
-
}
|
|
154
|
-
// --- top behavior rules (≤3) ---
|
|
155
|
-
let rules_top = [];
|
|
156
|
-
try {
|
|
157
|
-
// NOTE: brief intentionally does NOT call recordPolicyLoad() — read-only.
|
|
158
|
-
const policies = readBehaviorPolicies(slug);
|
|
159
|
-
const topRules = policies.rules
|
|
160
|
-
.sort((a, b) => b.created.localeCompare(a.created))
|
|
161
|
-
.slice(0, 3);
|
|
162
|
-
rules_top = topRules.map((r) => ({
|
|
163
|
-
name: r.name.slice(0, 60),
|
|
164
|
-
when: r.when.slice(0, 80),
|
|
165
|
-
do: r.do.slice(0, 80),
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
rules_top = [];
|
|
170
|
-
}
|
|
171
|
-
// --- store health (best-effort, silent on healthy) ---
|
|
172
|
-
let store_health = null;
|
|
173
|
-
try {
|
|
174
|
-
store_health = storeDoctorBanner(runStoreDoctor());
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
store_health = null;
|
|
178
|
-
}
|
|
179
|
-
const raw = {
|
|
180
|
-
project: slug,
|
|
181
|
-
identity,
|
|
182
|
-
active_phase,
|
|
183
|
-
corrections_top,
|
|
184
|
-
watch_for_top,
|
|
185
|
-
rules_top,
|
|
186
|
-
lifecycle_text: LIFECYCLE_TEXT,
|
|
187
|
-
trigger_vocab: [...TRIGGER_VOCAB_DISPLAY],
|
|
188
|
-
store_health,
|
|
189
|
-
host_hint: HOST_HINT,
|
|
190
|
-
};
|
|
191
|
-
return enforceTokenBudget(raw);
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=brief.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brief.js","sourceRoot":"","sources":["../../src/tools-logic/brief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAyB,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAwB,MAAM,kCAAkC,CAAC;AAChH,OAAO,EAAE,oBAAoB,EAAqB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EA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CAAC,EAAE,EAAE,CAAC;YACzB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YACzB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;SACtB,CAAC,CAAC,CAAC;IACN,CAAC;IAAC,MAAM,CAAC;QACP,SAAS,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,wDAAwD;IACxD,IAAI,YAAY,GAAkB,IAAI,CAAC;IACvC,IAAI,CAAC;QACH,YAAY,GAAG,iBAAiB,CAAC,cAAc,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,MAAM,GAAG,GAAgB;QACvB,OAAO,EAAE,IAAI;QACb,QAAQ;QACR,YAAY;QACZ,eAAe;QACf,aAAa;QACb,SAAS;QACT,cAAc,EAAE,cAAc;QAC9B,aAAa,EAAE,CAAC,GAAG,qBAAqB,CAAC;QACzC,YAAY;QACZ,SAAS,EAAE,SAAS;KACrB,CAAC;IACF,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dashboard_export — V8 finding: AgentRecall's dashboard is human-only HTML.
|
|
3
|
-
* No structured view the agent can fetch to inspect its own memory in one call.
|
|
4
|
-
*
|
|
5
|
-
* This tool emits ~/.agent-recall/dashboard.json — stable schema, all-projects
|
|
6
|
-
* snapshot, suitable for both the HTML dashboard (consumed via fetch) and any
|
|
7
|
-
* agent wanting a one-call self-inspection of memory state.
|
|
8
|
-
*/
|
|
9
|
-
import { type ActivityEvent } from "../helpers/activity-feed.js";
|
|
10
|
-
import { type CorrectionKPI } from "../storage/corrections.js";
|
|
11
|
-
import { type MilestoneSummary } from "../palace/pipeline.js";
|
|
12
|
-
import { type NamingIndexEntry } from "../naming.js";
|
|
13
|
-
export interface DashboardProjectSnapshot {
|
|
14
|
-
slug: string;
|
|
15
|
-
total_sessions: number;
|
|
16
|
-
first_session: string | null;
|
|
17
|
-
last_session: string | null;
|
|
18
|
-
rooms: Array<{
|
|
19
|
-
slug: string;
|
|
20
|
-
name: string;
|
|
21
|
-
salience: number;
|
|
22
|
-
updated: string;
|
|
23
|
-
topic_count: number;
|
|
24
|
-
}>;
|
|
25
|
-
skills_count: number;
|
|
26
|
-
pipeline: {
|
|
27
|
-
total: number;
|
|
28
|
-
closed: number;
|
|
29
|
-
active: number;
|
|
30
|
-
abandoned: number;
|
|
31
|
-
active_phase: string | null;
|
|
32
|
-
last_synthesis: string | null;
|
|
33
|
-
spine: MilestoneSummary[];
|
|
34
|
-
};
|
|
35
|
-
corrections: {
|
|
36
|
-
total: number;
|
|
37
|
-
p0_active: number;
|
|
38
|
-
kpis: CorrectionKPI;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Cross-project awareness insights — note: these come from the GLOBAL
|
|
42
|
-
* awareness state, not from per-project awareness. Same list appears under
|
|
43
|
-
* every project snapshot until per-project awareness is supported upstream.
|
|
44
|
-
*/
|
|
45
|
-
global_insights_top: Array<{
|
|
46
|
-
title: string;
|
|
47
|
-
confirmations: number;
|
|
48
|
-
severity: string;
|
|
49
|
-
}>;
|
|
50
|
-
/**
|
|
51
|
-
* North-star alignment metric — correction precision (heeded/retrieved).
|
|
52
|
-
* Convenience top-level field mirroring corrections.kpis.precision.
|
|
53
|
-
* Null when retrieved === 0 (no outcome data yet — no fake claims).
|
|
54
|
-
*/
|
|
55
|
-
alignment_precision: number | null;
|
|
56
|
-
/**
|
|
57
|
-
* FEED 4 — alignment detail object (additive; alignment_precision kept for back-compat).
|
|
58
|
-
* Promotes the bare precision number into a full KPI object.
|
|
59
|
-
*/
|
|
60
|
-
alignment: {
|
|
61
|
-
precision: number | null;
|
|
62
|
-
retrieved: number;
|
|
63
|
-
heeded: number;
|
|
64
|
-
recurred: number;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* FEED 2 — recent activity timeline, newest-first, up to 20 events.
|
|
68
|
-
* Merges sessions, corrections, outcomes, pipeline phases, and skills.
|
|
69
|
-
*/
|
|
70
|
-
recent_activity: ActivityEvent[];
|
|
71
|
-
/**
|
|
72
|
-
* FEED 3 — palace graph edges for this project (deduped, no self-loops).
|
|
73
|
-
* source/target are room-level slugs (first path segment before "/").
|
|
74
|
-
*/
|
|
75
|
-
palace_edges: Array<{
|
|
76
|
-
source: string;
|
|
77
|
-
target: string;
|
|
78
|
-
type: string;
|
|
79
|
-
weight: number;
|
|
80
|
-
}>;
|
|
81
|
-
}
|
|
82
|
-
/** One cell in the 14-day dream health heatmap. */
|
|
83
|
-
export interface DreamHealthCell {
|
|
84
|
-
date: string;
|
|
85
|
-
status: "ok" | "fail" | "none";
|
|
86
|
-
}
|
|
87
|
-
/** FEED 1 — machine-global dream health (14-day heatmap + summary). */
|
|
88
|
-
export interface DashboardDreamHealth {
|
|
89
|
-
/** 14 cells, ordered oldest→newest (index 0 = 13 days ago, index 13 = yesterday). */
|
|
90
|
-
cells: DreamHealthCell[];
|
|
91
|
-
success_count: number;
|
|
92
|
-
fail_count: number;
|
|
93
|
-
/** Date string of most recent failure, or null. */
|
|
94
|
-
last_fail_date: string | null;
|
|
95
|
-
/** Date string of most recent success, or null. */
|
|
96
|
-
last_success_date: string | null;
|
|
97
|
-
/** Banner string when consecutive_failures >= 2, else null. */
|
|
98
|
-
banner: string | null;
|
|
99
|
-
}
|
|
100
|
-
export interface DashboardSnapshot {
|
|
101
|
-
generated_at: string;
|
|
102
|
-
schema_version: 1;
|
|
103
|
-
projects: DashboardProjectSnapshot[];
|
|
104
|
-
global: {
|
|
105
|
-
project_count: number;
|
|
106
|
-
awareness_insight_count: number;
|
|
107
|
-
naming_index_count: number;
|
|
108
|
-
};
|
|
109
|
-
/** Canonical naming index — every well-named file across all projects. */
|
|
110
|
-
naming_index: NamingIndexEntry[];
|
|
111
|
-
/**
|
|
112
|
-
* FEED 1 — machine-global dream health heatmap (14 days).
|
|
113
|
-
* This is NOT per-project — AAM dreams run against the whole memory system.
|
|
114
|
-
*/
|
|
115
|
-
dream_health: DashboardDreamHealth;
|
|
116
|
-
}
|
|
117
|
-
export interface DashboardExportInput {
|
|
118
|
-
format?: "json" | "both";
|
|
119
|
-
/** Optional: limit naming index size in returned payload (still written full to disk). */
|
|
120
|
-
inline_index_limit?: number;
|
|
121
|
-
}
|
|
122
|
-
export interface DashboardExportResult {
|
|
123
|
-
success: boolean;
|
|
124
|
-
json_path: string;
|
|
125
|
-
generated_at: string;
|
|
126
|
-
project_count: number;
|
|
127
|
-
snapshot: DashboardSnapshot;
|
|
128
|
-
}
|
|
129
|
-
export declare function dashboardExport(input: DashboardExportInput): Promise<DashboardExportResult>;
|
|
130
|
-
//# sourceMappingURL=dashboard-export.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-export.d.ts","sourceRoot":"","sources":["../../src/tools-logic/dashboard-export.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAmD,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO/G,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAmFtE,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE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