chat-recall 0.5.11 → 0.5.14

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.
@@ -1,98 +0,0 @@
1
- /**
2
- * What the MCP tells an agent when something is refused or stale.
3
- *
4
- * Pure functions, in their own module so they are testable without importing
5
- * mcp.ts — which registers handlers and starts a server on import.
6
- *
7
- * Both exist because of the same class of bug: an answer that looks fine and
8
- * isn't. A 402 that read "request rejected" told an agent nothing, and a search
9
- * over a history that stopped growing three weeks ago looked exactly like a
10
- * search over a current one.
11
- */
12
- /**
13
- * Turn a failed response into something an agent can act on.
14
- *
15
- * The status alone is not enough, and 402 proved it: every payment and
16
- * entitlement refusal fell through to "request rejected", so an agent whose sync
17
- * had stopped learned nothing, retried, and reported a vague failure. The server
18
- * already answers precisely — `error`, `detail`, `checkoutHint`, `resendHint`,
19
- * and for a feature gate `feature` / `requires` / `upgradeUrl` — and all of it
20
- * was being discarded in favour of the number.
21
- */
22
- export async function buildHttpError(path, res) {
23
- const status = res.status;
24
- let body = null;
25
- try {
26
- body = await res.clone().json();
27
- }
28
- catch { /* not JSON */ }
29
- const str = (k) => (typeof body?.[k] === 'string' ? body[k] : '');
30
- if (status === 402) {
31
- // Three distinct reasons with three distinct fixes. Telling someone to
32
- // subscribe when they need to click a link in their inbox is a wrong
33
- // message, not a terse one.
34
- const parts = [str('error') || 'payment required'];
35
- if (str('detail'))
36
- parts.push(str('detail'));
37
- if (str('feature')) {
38
- parts.push(`This is the "${str('feature')}" capability${str('requires') ? `, on the ${str('requires')} plan` : ''}.`);
39
- }
40
- if (str('upgradeUrl'))
41
- parts.push(`Upgrade: ${str('upgradeUrl')}`);
42
- if (str('checkoutHint'))
43
- parts.push(str('checkoutHint'));
44
- if (str('resendHint'))
45
- parts.push(str('resendHint'));
46
- // "Reads still work" was the OLD lapse contract (blanket read-only). The
47
- // free tier replaced it: feature-level 402s refuse READS of paid tools too,
48
- // so promising reads on the error a failed read raised gaslights the agent.
49
- parts.push('Nothing has been deleted. The free plan keeps sync and recent-history search working.');
50
- return new Error(`server ${path}: ${parts.join(' ')}`);
51
- }
52
- const hint = status === 401 || status === 403 ? 'auth failed — re-run `chat-recall login <server-url>`' :
53
- status === 404 ? 'not found — the id may be wrong, or the server is older than this CLI' :
54
- status === 429 ? 'rate limited — retry in a moment' :
55
- status >= 500 ? 'server error — check the chat-recall server logs' :
56
- str('error') || str('detail') || 'request rejected';
57
- return new Error(`server ${path}: HTTP ${status} (${hint})`);
58
- }
59
- /**
60
- * The line prepended to every successful read while sync is paused.
61
- *
62
- * A lapsed tenant keeps read access, so searches keep answering — from data that
63
- * stopped growing when the subscription ended. The agent cannot see that, so it
64
- * will state that work does not exist when it simply was not indexed. The banner
65
- * therefore does three things: says sync stopped, says when, and tells the agent
66
- * what conclusion NOT to draw.
67
- *
68
- * Returns null when entitled, and when the state is unknown — an unreachable
69
- * billing endpoint must not decorate every answer with a warning it cannot
70
- * substantiate.
71
- */
72
- export function stalenessBanner(state) {
73
- if (!state || state.entitled)
74
- return null;
75
- const since = state.periodEnd ? new Date(state.periodEnd).toISOString().slice(0, 10) : null;
76
- const days = state.periodEnd
77
- ? Math.max(0, Math.floor((Date.now() - state.periodEnd) / 86_400_000))
78
- : null;
79
- const reason = state.status === 'trialing'
80
- ? 'the trial has ended'
81
- : state.status === 'past_due'
82
- ? 'a payment has not gone through'
83
- : 'the subscription has lapsed';
84
- // What the agent must get right about a dormant account: READS are complete.
85
- // Two earlier versions of this text were wrong in opposite directions —
86
- // "sync is paused, search is read-only", then "sync continues under a monthly
87
- // quota, search covers the recent window". Since 2026-08-22 exactly one thing
88
- // stops, and it is ingest.
89
- return [
90
- `⚠ SYNCING IS OFF — ${reason}.`,
91
- 'Search and lists cover the WHOLE synced history; nothing is windowed or locked.',
92
- since ? `The plan lapsed ${since}${days !== null ? ` (${days} days ago)` : ''}.` : '',
93
- 'What is missing is only work done SINCE the lapse, because new sessions stopped uploading.',
94
- 'Do not tell the user their history is gone or locked. Say new sessions are not syncing, and that '
95
- + 'subscribing plus one `chat-recall sync --full` brings everything current. Export always works.',
96
- ].filter(Boolean).join(' ');
97
- }
98
- //# sourceMappingURL=mcp-diagnostics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-diagnostics.js","sourceRoot":"","sources":["../src/mcp-diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,GAAa;IAC9D,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC1B,IAAI,IAAI,GAAmC,IAAI,CAAC;IAChD,IAAI,CAAC;QAAC,IAAI,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,EAA6B,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAC5F,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEpF,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,uEAAuE;QACvE,qEAAqE;QACrE,4BAA4B;QAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,CAAC;QACnD,IAAI,GAAG,CAAC,QAAQ,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7C,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,SAAS,CAAC,eAAe,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,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,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5F,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS;QAC1B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,CAAC;QACtE,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,UAAU;QACxC,CAAC,CAAC,qBAAqB;QACvB,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,UAAU;YAC3B,CAAC,CAAC,gCAAgC;YAClC,CAAC,CAAC,6BAA6B,CAAC;IACpC,6EAA6E;IAC7E,wEAAwE;IACxE,8EAA8E;IAC9E,8EAA8E;IAC9E,2BAA2B;IAC3B,OAAO;QACL,sBAAsB,MAAM,GAAG;QAC/B,iFAAiF;QACjF,KAAK,CAAC,CAAC,CAAC,mBAAmB,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;QACrF,4FAA4F;QAC5F,mGAAmG;cAC/F,gGAAgG;KACrG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,106 +0,0 @@
1
- /**
2
- * Merge layer for `recall_claude_suggestions` and `recall_improvements`.
3
- *
4
- * These two MCP tools do NOT compute recommendations. The engines that do are
5
- * `buildAccountRecommendations` and `buildRecommendations` in
6
- * `engine/src/core/code/recommendations.ts`, plus the code-action collector.
7
- * This module only does what a caller of several of those endpoints has to do
8
- * anyway: partition the output by what the item asks you to change, and put two
9
- * different priority scales into one honest order.
10
- *
11
- * It lives apart from `mcp.ts` because importing that file starts a server and
12
- * reads credentials, so nothing in it can be unit tested. Everything here is
13
- * pure: same input, same output, no I/O.
14
- */
15
- /** A Recommendation as `engine/core/code/recommendations.ts` emits it. */
16
- export interface EngineRec {
17
- id: string;
18
- kind: string;
19
- severity: Severity;
20
- title: string;
21
- rationale: string;
22
- evidence: string[];
23
- action: {
24
- type: string;
25
- payload: Record<string, unknown>;
26
- };
27
- }
28
- /** A CodeActionRow as `GET /api/code/actions` returns it. */
29
- export interface EngineAction {
30
- id: string;
31
- projectId: string;
32
- pri: number;
33
- category: string;
34
- title: string;
35
- fix: string;
36
- loc: Array<{
37
- file: string;
38
- line?: number | null;
39
- }>;
40
- agentPrompt: string;
41
- status: string;
42
- }
43
- export type Severity = 'high' | 'medium' | 'low';
44
- /** One row of the merged, ranked improvements list. */
45
- export interface Improvement {
46
- /** Lower sorts first, matching CodeAction.pri where 0 is the most urgent. */
47
- rank: number;
48
- severity: Severity;
49
- title: string;
50
- detail: string;
51
- source: string;
52
- project?: string;
53
- where: string[];
54
- agentPrompt?: string;
55
- }
56
- /**
57
- * Recommendation kinds that change agent instructions rather than code.
58
- *
59
- * This constant is what partitions the two tools. `recall_claude_suggestions`
60
- * takes these; `recall_improvements` takes the rest. They never both return the
61
- * same recommendation, so acting on one list cannot silently duplicate work
62
- * from the other.
63
- */
64
- export declare const INSTRUCTION_KINDS: readonly ["rule", "skill"];
65
- export declare const SEVERITIES: readonly ["high", "medium", "low"];
66
- /** `high` → 0. Lower sorts first, so this shares CodeAction.pri's direction. */
67
- export declare function sevRank(sev: string): number;
68
- /**
69
- * Map a code action's numeric `pri` onto the three severity bands the
70
- * recommendations use.
71
- *
72
- * The bands are deliberately coarse. `pri` is an ordering, not a measurement,
73
- * so inventing more than three levels would claim a precision the collector
74
- * never had. A negative or non-finite `pri` is treated as most urgent rather
75
- * than dropped: a malformed row must not silently vanish from the plan.
76
- */
77
- export declare function priToSeverity(pri: number): Severity;
78
- /** Split one scope's recommendations into the two tools' halves. */
79
- export declare function partitionRecs(recs: EngineRec[]): {
80
- instruction: EngineRec[];
81
- improvement: EngineRec[];
82
- };
83
- /** Turn an unfinished code action into an improvement row. */
84
- export declare function actionToImprovement(a: EngineAction): Improvement;
85
- /** Turn a non-instruction recommendation into an improvement row. */
86
- export declare function recToImprovement(rec: EngineRec, scope: string): Improvement;
87
- /** A code action that is already finished or waved off is not an improvement. */
88
- export declare function isOpenAction(a: EngineAction): boolean;
89
- /**
90
- * Filter to `minSeverity` and above, order most urgent first, then cap.
91
- *
92
- * Ties break on title so the same inputs always produce the same order — a
93
- * caller that opens tasks from this list must not get a different set of cards
94
- * on a re-run just because two items scored the same.
95
- */
96
- export declare function rankImprovements(items: Improvement[], opts: {
97
- minSeverity: Severity;
98
- limit: number;
99
- }): Improvement[];
100
- /** Order agent-instruction suggestions: most severe first, then by title. */
101
- export declare function rankInstructions<T extends {
102
- rec: EngineRec;
103
- }>(rows: T[]): T[];
104
- /** The task description written when `create_tasks` opens a card. */
105
- export declare function taskBody(i: Improvement): string;
106
- //# sourceMappingURL=recommendation-merge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recommendation-merge.d.ts","sourceRoot":"","sources":["../src/recommendation-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC5D;AAED,6DAA6D;AAC7D,MAAM,WAAW,YAAY;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AY,GAAG,WAAW,CAWhE;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAU3E;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAErD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAAE,EACpB,IAAI,EAAE;IAAE,WAAW,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC7C,WAAW,EAAE,CAMf;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAI7E;AAED,qEAAqE;AACrE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAM/C"}
@@ -1,109 +0,0 @@
1
- /**
2
- * Merge layer for `recall_claude_suggestions` and `recall_improvements`.
3
- *
4
- * These two MCP tools do NOT compute recommendations. The engines that do are
5
- * `buildAccountRecommendations` and `buildRecommendations` in
6
- * `engine/src/core/code/recommendations.ts`, plus the code-action collector.
7
- * This module only does what a caller of several of those endpoints has to do
8
- * anyway: partition the output by what the item asks you to change, and put two
9
- * different priority scales into one honest order.
10
- *
11
- * It lives apart from `mcp.ts` because importing that file starts a server and
12
- * reads credentials, so nothing in it can be unit tested. Everything here is
13
- * pure: same input, same output, no I/O.
14
- */
15
- /**
16
- * Recommendation kinds that change agent instructions rather than code.
17
- *
18
- * This constant is what partitions the two tools. `recall_claude_suggestions`
19
- * takes these; `recall_improvements` takes the rest. They never both return the
20
- * same recommendation, so acting on one list cannot silently duplicate work
21
- * from the other.
22
- */
23
- export const INSTRUCTION_KINDS = ['rule', 'skill'];
24
- export const SEVERITIES = ['high', 'medium', 'low'];
25
- /** `high` → 0. Lower sorts first, so this shares CodeAction.pri's direction. */
26
- export function sevRank(sev) {
27
- return sev === 'high' ? 0 : sev === 'medium' ? 1 : 2;
28
- }
29
- /**
30
- * Map a code action's numeric `pri` onto the three severity bands the
31
- * recommendations use.
32
- *
33
- * The bands are deliberately coarse. `pri` is an ordering, not a measurement,
34
- * so inventing more than three levels would claim a precision the collector
35
- * never had. A negative or non-finite `pri` is treated as most urgent rather
36
- * than dropped: a malformed row must not silently vanish from the plan.
37
- */
38
- export function priToSeverity(pri) {
39
- if (!Number.isFinite(pri) || pri <= 0)
40
- return 'high';
41
- return pri === 1 ? 'medium' : 'low';
42
- }
43
- /** Split one scope's recommendations into the two tools' halves. */
44
- export function partitionRecs(recs) {
45
- const kinds = INSTRUCTION_KINDS;
46
- const instruction = [];
47
- const improvement = [];
48
- for (const rec of recs)
49
- (kinds.includes(rec.kind) ? instruction : improvement).push(rec);
50
- return { instruction, improvement };
51
- }
52
- /** Turn an unfinished code action into an improvement row. */
53
- export function actionToImprovement(a) {
54
- return {
55
- rank: typeof a.pri === 'number' && Number.isFinite(a.pri) ? a.pri : 2,
56
- severity: priToSeverity(a.pri),
57
- title: a.title,
58
- detail: a.fix,
59
- source: `code action · ${a.category}`,
60
- project: a.projectId,
61
- where: (a.loc ?? []).map((l) => (l.line ? `${l.file}:${l.line}` : l.file)),
62
- agentPrompt: a.agentPrompt,
63
- };
64
- }
65
- /** Turn a non-instruction recommendation into an improvement row. */
66
- export function recToImprovement(rec, scope) {
67
- return {
68
- rank: sevRank(rec.severity),
69
- severity: rec.severity,
70
- title: rec.title,
71
- detail: rec.rationale,
72
- source: `recommendation · ${rec.kind}`,
73
- project: scope === 'account' ? undefined : scope,
74
- where: rec.evidence ?? [],
75
- };
76
- }
77
- /** A code action that is already finished or waved off is not an improvement. */
78
- export function isOpenAction(a) {
79
- return a.status !== 'done' && a.status !== 'dismissed';
80
- }
81
- /**
82
- * Filter to `minSeverity` and above, order most urgent first, then cap.
83
- *
84
- * Ties break on title so the same inputs always produce the same order — a
85
- * caller that opens tasks from this list must not get a different set of cards
86
- * on a re-run just because two items scored the same.
87
- */
88
- export function rankImprovements(items, opts) {
89
- const floor = sevRank(opts.minSeverity);
90
- return items
91
- .filter((i) => sevRank(i.severity) <= floor)
92
- .sort((a, b) => a.rank - b.rank || a.title.localeCompare(b.title))
93
- .slice(0, Math.max(0, opts.limit));
94
- }
95
- /** Order agent-instruction suggestions: most severe first, then by title. */
96
- export function rankInstructions(rows) {
97
- return [...rows].sort((a, b) => sevRank(a.rec.severity) - sevRank(b.rec.severity) || a.rec.title.localeCompare(b.rec.title));
98
- }
99
- /** The task description written when `create_tasks` opens a card. */
100
- export function taskBody(i) {
101
- const parts = [i.detail, '', `Source: ${i.source}`];
102
- if (i.where.length)
103
- parts.push(`Where: ${i.where.slice(0, 10).join('; ')}`);
104
- if (i.agentPrompt)
105
- parts.push('', 'Agent prompt:', i.agentPrompt);
106
- parts.push('', 'Opened by recall_improvements.');
107
- return parts.join('\n').slice(0, 20000);
108
- }
109
- //# sourceMappingURL=recommendation-merge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recommendation-merge.js","sourceRoot":"","sources":["../src/recommendation-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAyCH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAE5D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAE7D,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,CAA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