@noesis-brain/mcp-server 2.1.5 → 2.5.0
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 +10 -1
- package/dist/agent/identity.d.ts +33 -0
- package/dist/agent/identity.d.ts.map +1 -0
- package/dist/agent/identity.js +61 -0
- package/dist/agent/identity.js.map +1 -0
- package/dist/agent/runner.d.ts +103 -6
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +375 -64
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/tokenState.d.ts +81 -0
- package/dist/agent/tokenState.d.ts.map +1 -0
- package/dist/agent/tokenState.js +173 -0
- package/dist/agent/tokenState.js.map +1 -0
- package/dist/agent/webGuard.d.ts +48 -0
- package/dist/agent/webGuard.d.ts.map +1 -0
- package/dist/agent/webGuard.js +173 -0
- package/dist/agent/webGuard.js.map +1 -0
- package/dist/api/NoesisClient.d.ts +19 -1
- package/dist/api/NoesisClient.d.ts.map +1 -1
- package/dist/api/NoesisClient.js +55 -3
- package/dist/api/NoesisClient.js.map +1 -1
- package/dist/cli/setup.js +1 -1
- package/dist/cli/setup.js.map +1 -1
- package/dist/machineLabel.d.ts +16 -0
- package/dist/machineLabel.d.ts.map +1 -0
- package/dist/machineLabel.js +43 -0
- package/dist/machineLabel.js.map +1 -0
- package/dist/tools/backlog.d.ts +21 -0
- package/dist/tools/backlog.d.ts.map +1 -1
- package/dist/tools/backlog.js +123 -1
- package/dist/tools/backlog.js.map +1 -1
- package/dist/tools/claudeSessions.d.ts +83 -0
- package/dist/tools/claudeSessions.d.ts.map +1 -0
- package/dist/tools/claudeSessions.js +330 -0
- package/dist/tools/claudeSessions.js.map +1 -0
- package/dist/tools/index.d.ts +1 -6
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +166 -37
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/sessionIndex.d.ts +66 -0
- package/dist/tools/sessionIndex.d.ts.map +1 -0
- package/dist/tools/sessionIndex.js +241 -0
- package/dist/tools/sessionIndex.js.map +1 -0
- package/package.json +1 -1
- package/scripts/noesis-capture-watcher.mjs +722 -107
- package/scripts/start-agent.sh +51 -12
- package/skill-templates/noesis-refine-relations.md +163 -0
- package/skill-templates/noesis-ticket.md +79 -0
- package/templates/claude-md-block.md +7 -0
package/dist/tools/backlog.js
CHANGED
|
@@ -6,13 +6,69 @@
|
|
|
6
6
|
* anything UN-parked) have NO tool here by design — they exist only on the
|
|
7
7
|
* owner's page. The one disposal this surface carries is the owner-instructed
|
|
8
8
|
* reject of a PARKED item: ambiguous|superseded -> rejected, reason required.
|
|
9
|
+
*
|
|
10
|
+
* 2.5.0 adds the Jot ticket tools (backlog_bind / set_status / unbind / refine): the
|
|
11
|
+
* page's work status and its binding to ONE Claude Code session on one computer. They
|
|
12
|
+
* send this session's id (CLAUDE_CODE_SESSION_ID), the computer name (machineLabel.ts)
|
|
13
|
+
* and the working folder; the server decides who may change what.
|
|
9
14
|
*/
|
|
10
15
|
import { z } from 'zod';
|
|
16
|
+
import { currentSessionRef } from './claudeSessions.js';
|
|
17
|
+
import { machineLabel } from '../machineLabel.js';
|
|
11
18
|
// 'rejected' rides along for set_stage's parked disposal and as a backlog_get
|
|
12
19
|
// list filter; it is NOT a stage the loop may reach from un-parked items.
|
|
13
20
|
const STAGE_ENUM = z.enum(['jot', 'ambiguous', 'superseded', 'refined', 'materialized', 'approved', 'running', 'implemented', 'shipped', 'rejected']);
|
|
14
21
|
const KIND_ENUM = z.enum(['feature', 'bug', 'design', 'process', 'research']);
|
|
15
22
|
const SIZE_ENUM = z.enum(['S', 'M', 'L']);
|
|
23
|
+
// Jot work status (2.5.0) — how far a Claude Code session has got with a ticket.
|
|
24
|
+
// Separate from the old `stage` above, which belongs to the retired groom/run workflow.
|
|
25
|
+
const WORK_STATUS_ENUM = z.enum([
|
|
26
|
+
'created', 'planning', 'ready_to_implement', 'implementing', 'iterating',
|
|
27
|
+
'ready_to_merge', 'deploying', 'shipped', 'dropped',
|
|
28
|
+
]);
|
|
29
|
+
// created and dropped are the user's decisions (a new jot, an abandoned idea): OWNER_GATE.
|
|
30
|
+
const CLAUDE_STATUS_ENUM = z.enum([
|
|
31
|
+
'planning', 'ready_to_implement', 'implementing', 'iterating', 'ready_to_merge', 'deploying', 'shipped',
|
|
32
|
+
]);
|
|
33
|
+
/** The status ladder, said the same way in every tool description and in the skill. */
|
|
34
|
+
export const STATUS_LADDER = 'planning = reading the ticket and the code, writing a plan (plan mode) · ' +
|
|
35
|
+
'ready_to_implement = the plan is presented, waiting for the user to approve it · ' +
|
|
36
|
+
'implementing = building the approved plan · ' +
|
|
37
|
+
'iterating = the first version is delivered; the user is testing it and asking for changes · ' +
|
|
38
|
+
'ready_to_merge = YOU judge the work complete (all feedback done, or a /cc-loop reached LOOP COMPLETE); waiting for the user to say ship it · ' +
|
|
39
|
+
'deploying = merging, pushing and verifying the deployment · ' +
|
|
40
|
+
'shipped = the change is live in production. ' +
|
|
41
|
+
'created and dropped are the user\'s to set.';
|
|
42
|
+
/** Who is calling: this Claude Code session, this computer, this folder. */
|
|
43
|
+
export function ticketCaller() {
|
|
44
|
+
const ref = currentSessionRef();
|
|
45
|
+
if (!ref)
|
|
46
|
+
return null;
|
|
47
|
+
return { session_id: ref.ref.id, machine: machineLabel(), cwd: ref.ref.cwd };
|
|
48
|
+
}
|
|
49
|
+
/** Returned with every successful bind. The tool result is the freshest thing the
|
|
50
|
+
* model reads, and a round trip showed the conventions block alone was not enough
|
|
51
|
+
* for the refine-before-ExitPlanMode step. */
|
|
52
|
+
export const BIND_NEXT = 'Bound. When your plan is ready — before ExitPlanMode — refine this ticket once with backlog_refine ' +
|
|
53
|
+
"(70%–120% of the draft's words, in the draft's language, plain sentences, no sections or increments). " +
|
|
54
|
+
'Then keep the status current with backlog_set_status as you work.';
|
|
55
|
+
/** For a bind at a later status on a ticket not refined yet — a `link` from a session
|
|
56
|
+
* that may already have a plan, which then refines once (AC9). */
|
|
57
|
+
export const BIND_NEXT_LINK = 'Bound. If this session already has a plan, refine this ticket once now with backlog_refine ' +
|
|
58
|
+
"(70%–120% of the draft's words, in the draft's language, plain sentences, no sections or increments). " +
|
|
59
|
+
'Keep the status current with backlog_set_status as you work.';
|
|
60
|
+
/** For a ticket already refined (a re-link after /clear, a second bind) — repeating the
|
|
61
|
+
* refine step there invites a second refine. */
|
|
62
|
+
export const BIND_NEXT_LATER = 'Bound. Keep the status current with backlog_set_status as you work; refine the ticket again only if the plan changes or the user asks.';
|
|
63
|
+
/** Pick the hint for a bind response: refine before ExitPlanMode on an unrefined planning
|
|
64
|
+
* bind, refine now on an unrefined later bind, no refine step once the ticket is refined. */
|
|
65
|
+
export function bindNextHint(data) {
|
|
66
|
+
const issue = data?.issue;
|
|
67
|
+
if (!issue || (issue.refined_text && issue.refined_text.trim()))
|
|
68
|
+
return BIND_NEXT_LATER;
|
|
69
|
+
return issue.work_status === 'planning' ? BIND_NEXT : BIND_NEXT_LINK;
|
|
70
|
+
}
|
|
71
|
+
const NO_SESSION = 'No Claude Code session id (CLAUDE_CODE_SESSION_ID is not set). Ticket binding works only inside a Claude Code session.';
|
|
16
72
|
function jsonText(data) {
|
|
17
73
|
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
18
74
|
}
|
|
@@ -24,12 +80,13 @@ export function registerBacklogTools(server, client) {
|
|
|
24
80
|
server.tool('backlog_get', 'Read the Backlog: without a key, list issues (+ per-stage counts and open_question_count, optionally filtered by stage or a text query); with a key (TCK-<n>), the full issue including increments, open owner questions, and the bounded message thread (questions + answers linked via answered_by_message_id — what RESOLVE reads).', {
|
|
25
81
|
key: z.string().optional().describe('Issue key like TCK-7 (omit to list)'),
|
|
26
82
|
stage: STAGE_ENUM.optional().describe('List filter: only this stage'),
|
|
83
|
+
status: WORK_STATUS_ENUM.optional().describe('List filter: only this work status (the Jot page status)'),
|
|
27
84
|
query: z.string().optional().describe('List filter: title/body text search'),
|
|
28
85
|
}, async (args) => {
|
|
29
86
|
try {
|
|
30
87
|
const data = args.key
|
|
31
88
|
? await client.backlogGet(args.key)
|
|
32
|
-
: await client.backlogList({ stage: args.stage, q: args.query });
|
|
89
|
+
: await client.backlogList({ stage: args.stage, status: args.status, q: args.query });
|
|
33
90
|
return jsonText(data);
|
|
34
91
|
}
|
|
35
92
|
catch (e) {
|
|
@@ -157,5 +214,70 @@ export function registerBacklogTools(server, client) {
|
|
|
157
214
|
return errText(e);
|
|
158
215
|
}
|
|
159
216
|
});
|
|
217
|
+
// ── Jot work status + Claude Code binding + refinement (2.5.0) ─────────────────
|
|
218
|
+
// The ticket tools are bookkeeping on the user's Noesis ticket, which the user asked
|
|
219
|
+
// for: calling them in plan mode is expected. Rules are enforced server-side.
|
|
220
|
+
server.tool('backlog_bind', "Bind a Jot ticket to THIS Claude Code session: records the session id, this computer's name and the working folder, and sets the ticket's work status. Call it when the user hands you a ticket (pastes 'TCK-<n>: …', or asks you to read, plan or work on TCK-<n>), or links the running session to one (/noesis-ticket link). With no status the ticket is set to planning; when you link a session that is already further along, pass the status it has really reached. Errors: BOUND_ELSEWHERE — another session or computer holds it; take it over (force) only if the user asks. SESSION_BUSY — this session already holds another ticket; switch only if the user hands over this one. RESET_BY_OWNER — the user reset this session's binding on the page; bind again (force) only if the user asks. Status ladder: " + STATUS_LADDER, {
|
|
221
|
+
key: z.string().describe('Ticket key like TCK-7'),
|
|
222
|
+
status: CLAUDE_STATUS_ENUM.optional().describe('Status to set; omit to start at planning'),
|
|
223
|
+
force: z.boolean().optional().describe('Take over a ticket bound elsewhere, or re-bind after an owner reset — only when the user asks'),
|
|
224
|
+
switch: z.boolean().optional().describe('Release the ticket this session holds and bind this one — only when the user hands this one over'),
|
|
225
|
+
}, async (args) => {
|
|
226
|
+
try {
|
|
227
|
+
const who = ticketCaller();
|
|
228
|
+
if (!who)
|
|
229
|
+
return errText(new Error(NO_SESSION));
|
|
230
|
+
const { key, ...rest } = args;
|
|
231
|
+
const body = Object.fromEntries(Object.entries({ ...who, ...rest }).filter(([, v]) => v !== undefined));
|
|
232
|
+
const data = await client.backlogBind(key, body);
|
|
233
|
+
return jsonText({ ...data, next: bindNextHint(data) });
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
return errText(e);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
server.tool('backlog_set_status', 'Set the work status of the Jot ticket bound to THIS session (bind it first with backlog_bind). Keep it current as you work. Status ladder: ' + STATUS_LADDER + ' Errors: NOT_BOUND (bind first; if the user reset the binding, ask before binding again), BOUND_ELSEWHERE (another session holds it), OWNER_GATE (created/dropped are the user\'s).', {
|
|
240
|
+
key: z.string().describe('Ticket key like TCK-7'),
|
|
241
|
+
status: CLAUDE_STATUS_ENUM,
|
|
242
|
+
}, async (args) => {
|
|
243
|
+
try {
|
|
244
|
+
const who = ticketCaller();
|
|
245
|
+
if (!who)
|
|
246
|
+
return errText(new Error(NO_SESSION));
|
|
247
|
+
return jsonText(await client.backlogSetStatus(args.key, { ...who, status: args.status }));
|
|
248
|
+
}
|
|
249
|
+
catch (e) {
|
|
250
|
+
return errText(e);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
server.tool('backlog_unbind', "Release this session's binding on a Jot ticket (the status stays). Use it when the user says to stop working the ticket here, or to reset the binding. force releases a binding held by another session — only when the user asks.", {
|
|
254
|
+
key: z.string().describe('Ticket key like TCK-7'),
|
|
255
|
+
force: z.boolean().optional(),
|
|
256
|
+
}, async (args) => {
|
|
257
|
+
try {
|
|
258
|
+
const who = ticketCaller();
|
|
259
|
+
if (!who)
|
|
260
|
+
return errText(new Error(NO_SESSION));
|
|
261
|
+
const body = Object.fromEntries(Object.entries({ ...who, force: args.force }).filter(([, v]) => v !== undefined));
|
|
262
|
+
return jsonText(await client.backlogUnbind(args.key, body));
|
|
263
|
+
}
|
|
264
|
+
catch (e) {
|
|
265
|
+
return errText(e);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
server.tool('backlog_refine', "Store your refinement of a Jot ticket's text (the ticket must be bound to this session). It must stay a jot: 70%–120% of the draft's word count (5 words of slack for short drafts; each Chinese, Japanese or Korean character counts as one word), in the draft's language, plain sentences or a short list — no headings, no code fences, no increments, acceptance criteria or plan sections. Refine once when your plan is ready (just before ExitPlanMode), and again only if the plan changes or the user asks. The user's draft is never changed; the page shows your text with the draft kept under it. Errors: REFINE_LENGTH (the details give draft_words, min, max and got — rewrite to fit), REFINE_FORMAT.", {
|
|
269
|
+
key: z.string().describe('Ticket key like TCK-7'),
|
|
270
|
+
text: z.string().describe('The refined ticket text, about as long as the draft'),
|
|
271
|
+
}, async (args) => {
|
|
272
|
+
try {
|
|
273
|
+
const who = ticketCaller();
|
|
274
|
+
if (!who)
|
|
275
|
+
return errText(new Error(NO_SESSION));
|
|
276
|
+
return jsonText(await client.backlogRefine(args.key, { ...who, text: args.text }));
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
return errText(e);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
160
282
|
}
|
|
161
283
|
//# sourceMappingURL=backlog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backlog.js","sourceRoot":"","sources":["../../src/tools/backlog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,8EAA8E;AAC9E,0EAA0E;AAC1E,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACtJ,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAC9E,MAAM,SAAS,GAAG,CAAC,CAAC,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O,QAAQ,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,yrBAAyrB,EACzrB;QACE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACjF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,YAAY,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG;gBAAE,OAAO,OAAO,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;YAChD,OAAO,QAAQ,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface ClaudeSessionRef {
|
|
2
|
+
id: string;
|
|
3
|
+
cwd: string;
|
|
4
|
+
last_active: string;
|
|
5
|
+
/**
|
|
6
|
+
* Hostname of the machine the session ran on. A Claude Code session lives in
|
|
7
|
+
* ~/.claude/projects on exactly ONE machine, so without this a note synced from another
|
|
8
|
+
* laptop hands you a `--resume` command that cannot work there. Reuses the `machineName`
|
|
9
|
+
* convention already used for sync_logs.machine_name.
|
|
10
|
+
*/
|
|
11
|
+
machine_name?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
branch?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The session reached bypass-permissions mode. Claude Code enters that mode for a session
|
|
16
|
+
* launched with --dangerously-skip-permissions (or --allow-dangerously-skip-permissions), or
|
|
17
|
+
* set to it by a `defaultMode` setting. It records no launch flags, so this is the closest
|
|
18
|
+
* fact the transcript holds. The web panel adds --dangerously-skip-permissions to the copied
|
|
19
|
+
* resume command when it is set.
|
|
20
|
+
* Written only when true, and sticky: a later stamp without it never clears it.
|
|
21
|
+
*/
|
|
22
|
+
skip_permissions?: true;
|
|
23
|
+
}
|
|
24
|
+
/** Mirrors MAX_CLAUDE_SESSIONS in the backend. Keeps frontmatter readable, bounds diff noise. */
|
|
25
|
+
export declare const MAX_CLAUDE_SESSIONS = 10;
|
|
26
|
+
export declare function claudeConfigDir(): string;
|
|
27
|
+
export declare function projectsDir(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Claude Code's cwd -> project-dir encoding: every character outside [A-Za-z0-9-] becomes '-'.
|
|
30
|
+
*
|
|
31
|
+
* The encoding is LOSSY and NOT invertible ('md-manager', 'md_manager' and 'md.manager' all
|
|
32
|
+
* collapse to the same name), and the drive-letter case follows whatever the user typed at
|
|
33
|
+
* launch. So this is only ever used to FIND a directory — never to reconstruct a path from one.
|
|
34
|
+
*/
|
|
35
|
+
export declare function encodeProjectDir(cwd: string): string;
|
|
36
|
+
export declare function normalizeCwd(p: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Locate a session transcript. Depth 1 only, and the basename must be the session id.
|
|
39
|
+
*
|
|
40
|
+
* Both filters matter: `agent-<hex>.jsonl` subagent transcripts sit as SIBLINGS of real session
|
|
41
|
+
* files in the legacy layout (1,490 of them on this machine), and the newer layout nests them
|
|
42
|
+
* under `<session-id>/subagents/`. Neither is a session.
|
|
43
|
+
*/
|
|
44
|
+
export declare function findTranscript(sessionId: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Pull {cwd, branch, last_active, title, skip_permissions} out of a transcript with two bounded
|
|
47
|
+
* reads.
|
|
48
|
+
*
|
|
49
|
+
* ~300 KB regardless of file size, which matters: the transcript corpus here is ~471 MB with a
|
|
50
|
+
* 30 MB single-file maximum, and this runs on every push.
|
|
51
|
+
*/
|
|
52
|
+
export declare function readTranscriptMeta(file: string): {
|
|
53
|
+
cwd: string | null;
|
|
54
|
+
branch: string | null;
|
|
55
|
+
last_active: string | null;
|
|
56
|
+
title: string | null;
|
|
57
|
+
skip_permissions: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The session calling us, or null when we cannot tell.
|
|
61
|
+
*
|
|
62
|
+
* CLAUDE_CODE_SESSION_ID is authoritative: Claude Code injects it (with CLAUDE_PROJECT_DIR) into
|
|
63
|
+
* every stdio MCP server it spawns. Do NOT fall back to "newest transcript in the project dir" —
|
|
64
|
+
* that heuristic picks a concurrent session in another repo, which is measurably wrong.
|
|
65
|
+
*
|
|
66
|
+
* Known limitation: MCP servers spawn once per session, so after `/clear` this id is the
|
|
67
|
+
* pre-clear session. It still resumes a real conversation, and the value is reported to the
|
|
68
|
+
* caller so the drift is visible rather than silently "corrected".
|
|
69
|
+
*/
|
|
70
|
+
export declare function currentSessionRef(explicitId?: string): {
|
|
71
|
+
ref: ClaudeSessionRef;
|
|
72
|
+
note?: string;
|
|
73
|
+
} | null;
|
|
74
|
+
/**
|
|
75
|
+
* Merge `ref` into a note's `claude_sessions:` frontmatter, returning the new content — or the
|
|
76
|
+
* ORIGINAL STRING, byte-identical, when nothing meaningful changed.
|
|
77
|
+
*
|
|
78
|
+
* Only the `claude_sessions:` span is re-emitted; every other frontmatter byte is spliced back
|
|
79
|
+
* verbatim, blank lines included. That is deliberately better-behaved than updateFrontmatter,
|
|
80
|
+
* whose line-walker ends with a blank-line-dropping filter — do not route this through it.
|
|
81
|
+
*/
|
|
82
|
+
export declare function upsertSessionFrontmatter(content: string, ref: ClaudeSessionRef): string;
|
|
83
|
+
//# sourceMappingURL=claudeSessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeSessions.d.ts","sourceRoot":"","sources":["../../src/tools/claudeSessions.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,IAAI,CAAC;CACzB;AAED,iGAAiG;AACjG,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAiBtC,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9C;AAeD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgB/D;AA4BD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAChD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5F,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAoCA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,gBAAgB,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgDtG;AAqBD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,MAAM,CA2EvF"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stamping the calling Claude Code session onto a note when sync_notes pushes it.
|
|
3
|
+
*
|
|
4
|
+
* The point is one command: from a note, the owner should be able to run
|
|
5
|
+
* cd "<cwd>" && claude --resume <id>
|
|
6
|
+
* and land back in the conversation that produced it.
|
|
7
|
+
*
|
|
8
|
+
* The note's `claude_sessions:` frontmatter is the portable source of truth; the backend parses
|
|
9
|
+
* it into notes.claude_sessions on upsert. See src/backend/utils/claudeSessions.ts.
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as os from 'os';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import * as yaml from 'js-yaml';
|
|
15
|
+
/** Mirrors MAX_CLAUDE_SESSIONS in the backend. Keeps frontmatter readable, bounds diff noise. */
|
|
16
|
+
export const MAX_CLAUDE_SESSIONS = 10;
|
|
17
|
+
/**
|
|
18
|
+
* Don't rewrite the file for a few seconds of drift. Without this, every repeat sync inside one
|
|
19
|
+
* session would produce new bytes, turning a "skipped (unchanged)" into a full content push AND
|
|
20
|
+
* a version-history snapshot on the backend. This guard is what makes stamping cheap.
|
|
21
|
+
*/
|
|
22
|
+
const LAST_ACTIVE_REFRESH_MS = 5 * 60 * 1000;
|
|
23
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
24
|
+
/** Head bytes scanned for the first `cwd`. The first entry is a header line with no cwd. */
|
|
25
|
+
const HEAD_BYTES = 256 * 1024;
|
|
26
|
+
/** Tail bytes scanned for max(timestamp) and the last ai-title. Grown once if it comes up empty. */
|
|
27
|
+
const TAIL_BYTES = 64 * 1024;
|
|
28
|
+
const TAIL_BYTES_MAX = 1024 * 1024;
|
|
29
|
+
export function claudeConfigDir() {
|
|
30
|
+
return process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude');
|
|
31
|
+
}
|
|
32
|
+
export function projectsDir() {
|
|
33
|
+
return path.join(claudeConfigDir(), 'projects');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Claude Code's cwd -> project-dir encoding: every character outside [A-Za-z0-9-] becomes '-'.
|
|
37
|
+
*
|
|
38
|
+
* The encoding is LOSSY and NOT invertible ('md-manager', 'md_manager' and 'md.manager' all
|
|
39
|
+
* collapse to the same name), and the drive-letter case follows whatever the user typed at
|
|
40
|
+
* launch. So this is only ever used to FIND a directory — never to reconstruct a path from one.
|
|
41
|
+
*/
|
|
42
|
+
export function encodeProjectDir(cwd) {
|
|
43
|
+
return cwd.replace(/[^A-Za-z0-9-]/g, '-');
|
|
44
|
+
}
|
|
45
|
+
export function normalizeCwd(p) {
|
|
46
|
+
return p.replace(/\\/g, '/').replace(/\/+$/, '');
|
|
47
|
+
}
|
|
48
|
+
function readChunk(file, from, length) {
|
|
49
|
+
const fd = fs.openSync(file, 'r');
|
|
50
|
+
try {
|
|
51
|
+
const size = Math.max(0, Math.min(length, fs.fstatSync(fd).size - from));
|
|
52
|
+
if (size === 0)
|
|
53
|
+
return '';
|
|
54
|
+
const buf = Buffer.alloc(size);
|
|
55
|
+
fs.readSync(fd, buf, 0, size, from);
|
|
56
|
+
return buf.toString('utf-8');
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
fs.closeSync(fd);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Locate a session transcript. Depth 1 only, and the basename must be the session id.
|
|
64
|
+
*
|
|
65
|
+
* Both filters matter: `agent-<hex>.jsonl` subagent transcripts sit as SIBLINGS of real session
|
|
66
|
+
* files in the legacy layout (1,490 of them on this machine), and the newer layout nests them
|
|
67
|
+
* under `<session-id>/subagents/`. Neither is a session.
|
|
68
|
+
*/
|
|
69
|
+
export function findTranscript(sessionId) {
|
|
70
|
+
if (!UUID_RE.test(sessionId))
|
|
71
|
+
return null;
|
|
72
|
+
const root = projectsDir();
|
|
73
|
+
let dirs;
|
|
74
|
+
try {
|
|
75
|
+
dirs = fs.readdirSync(root, { withFileTypes: true })
|
|
76
|
+
.filter((e) => e.isDirectory())
|
|
77
|
+
.map((e) => path.join(root, e.name));
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
for (const dir of dirs) {
|
|
83
|
+
const candidate = path.join(dir, `${sessionId}.jsonl`);
|
|
84
|
+
if (fs.existsSync(candidate))
|
|
85
|
+
return candidate;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
function parseLines(chunk, dropFirstPartial) {
|
|
90
|
+
const lines = chunk.split('\n');
|
|
91
|
+
if (dropFirstPartial)
|
|
92
|
+
lines.shift();
|
|
93
|
+
else
|
|
94
|
+
lines.pop(); // last line of a head chunk is almost certainly truncated
|
|
95
|
+
const out = [];
|
|
96
|
+
for (const line of lines) {
|
|
97
|
+
const s = line.trim();
|
|
98
|
+
if (!s.startsWith('{'))
|
|
99
|
+
continue;
|
|
100
|
+
try {
|
|
101
|
+
const v = JSON.parse(s);
|
|
102
|
+
if (v && typeof v === 'object')
|
|
103
|
+
out.push(v);
|
|
104
|
+
}
|
|
105
|
+
catch { /* truncated or non-JSON line */ }
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Both `type: "permission-mode"` records and typed-prompt `user` records carry the mode. Claude
|
|
111
|
+
* Code re-emits it on every turn, so the head and tail windows below find it in practice: all
|
|
112
|
+
* but one of ~47 bypass sessions in a ~300-transcript scan (the miss had bypass only in its
|
|
113
|
+
* middle).
|
|
114
|
+
*/
|
|
115
|
+
function isBypassRecord(e) {
|
|
116
|
+
return e.permissionMode === 'bypassPermissions';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Pull {cwd, branch, last_active, title, skip_permissions} out of a transcript with two bounded
|
|
120
|
+
* reads.
|
|
121
|
+
*
|
|
122
|
+
* ~300 KB regardless of file size, which matters: the transcript corpus here is ~471 MB with a
|
|
123
|
+
* 30 MB single-file maximum, and this runs on every push.
|
|
124
|
+
*/
|
|
125
|
+
export function readTranscriptMeta(file) {
|
|
126
|
+
let cwd = null;
|
|
127
|
+
let branch = null;
|
|
128
|
+
let skip_permissions = false;
|
|
129
|
+
// FIRST cwd, not the last: a `cd` inside a Bash tool call changes the recorded cwd partway
|
|
130
|
+
// through ~3% of transcripts, and the launch directory is the one `claude --resume` needs.
|
|
131
|
+
// The loop runs on past the first cwd and branch: a bypass record can come later in the head.
|
|
132
|
+
for (const e of parseLines(readChunk(file, 0, HEAD_BYTES), false)) {
|
|
133
|
+
if (cwd === null && typeof e.cwd === 'string' && e.cwd)
|
|
134
|
+
cwd = e.cwd;
|
|
135
|
+
if (branch === null && typeof e.gitBranch === 'string')
|
|
136
|
+
branch = e.gitBranch;
|
|
137
|
+
if (!skip_permissions && isBypassRecord(e))
|
|
138
|
+
skip_permissions = true;
|
|
139
|
+
if (cwd !== null && branch !== null && skip_permissions)
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
let last_active = null;
|
|
143
|
+
let title = null;
|
|
144
|
+
const size = fs.statSync(file).size;
|
|
145
|
+
for (const span of [TAIL_BYTES, TAIL_BYTES_MAX]) {
|
|
146
|
+
const from = Math.max(0, size - span);
|
|
147
|
+
for (const e of parseLines(readChunk(file, from, span), from > 0)) {
|
|
148
|
+
if (!skip_permissions && isBypassRecord(e))
|
|
149
|
+
skip_permissions = true;
|
|
150
|
+
// max(timestamp), never the file mtime: reopening a session appends untimestamped lines,
|
|
151
|
+
// so mtime can overshoot real activity by days.
|
|
152
|
+
if (typeof e.timestamp === 'string' && (last_active === null || e.timestamp > last_active)) {
|
|
153
|
+
last_active = e.timestamp;
|
|
154
|
+
}
|
|
155
|
+
// ai-title is re-emitted as the title is refined, so last one wins.
|
|
156
|
+
if (e.type === 'ai-title' && typeof e.aiTitle === 'string' && e.aiTitle)
|
|
157
|
+
title = e.aiTitle;
|
|
158
|
+
else if (title === null && e.type === 'agent-name' && typeof e.agentName === 'string')
|
|
159
|
+
title = e.agentName;
|
|
160
|
+
else if (title === null && typeof e.slug === 'string' && e.slug)
|
|
161
|
+
title = e.slug;
|
|
162
|
+
}
|
|
163
|
+
if (last_active !== null || from === 0)
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
return { cwd, branch, last_active, title, skip_permissions };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The session calling us, or null when we cannot tell.
|
|
170
|
+
*
|
|
171
|
+
* CLAUDE_CODE_SESSION_ID is authoritative: Claude Code injects it (with CLAUDE_PROJECT_DIR) into
|
|
172
|
+
* every stdio MCP server it spawns. Do NOT fall back to "newest transcript in the project dir" —
|
|
173
|
+
* that heuristic picks a concurrent session in another repo, which is measurably wrong.
|
|
174
|
+
*
|
|
175
|
+
* Known limitation: MCP servers spawn once per session, so after `/clear` this id is the
|
|
176
|
+
* pre-clear session. It still resumes a real conversation, and the value is reported to the
|
|
177
|
+
* caller so the drift is visible rather than silently "corrected".
|
|
178
|
+
*/
|
|
179
|
+
export function currentSessionRef(explicitId) {
|
|
180
|
+
const id = (explicitId || process.env.CLAUDE_CODE_SESSION_ID || '').trim().toLowerCase();
|
|
181
|
+
if (!UUID_RE.test(id))
|
|
182
|
+
return null;
|
|
183
|
+
const file = findTranscript(id);
|
|
184
|
+
if (!file) {
|
|
185
|
+
// No transcript (another machine's config dir, a pruned history). The id and the folder are
|
|
186
|
+
// the only two things `--resume` actually needs, so still stamp — and say what happened.
|
|
187
|
+
const fallbackCwd = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
188
|
+
return {
|
|
189
|
+
ref: { id, cwd: normalizeCwd(fallbackCwd), last_active: new Date().toISOString(), machine_name: os.hostname() },
|
|
190
|
+
note: 'transcript not found — recorded cwd from CLAUDE_PROJECT_DIR/process.cwd() and last_active from the clock',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
let meta;
|
|
194
|
+
try {
|
|
195
|
+
meta = readTranscriptMeta(file);
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
return {
|
|
199
|
+
ref: {
|
|
200
|
+
id,
|
|
201
|
+
cwd: normalizeCwd(process.env.CLAUDE_PROJECT_DIR || process.cwd()),
|
|
202
|
+
last_active: new Date().toISOString(),
|
|
203
|
+
machine_name: os.hostname(),
|
|
204
|
+
},
|
|
205
|
+
note: `transcript unreadable (${e.message})`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const ref = {
|
|
209
|
+
id,
|
|
210
|
+
cwd: normalizeCwd(meta.cwd || process.env.CLAUDE_PROJECT_DIR || process.cwd()),
|
|
211
|
+
last_active: meta.last_active || new Date().toISOString(),
|
|
212
|
+
machine_name: os.hostname(),
|
|
213
|
+
};
|
|
214
|
+
if (meta.title)
|
|
215
|
+
ref.title = meta.title;
|
|
216
|
+
if (meta.branch)
|
|
217
|
+
ref.branch = meta.branch;
|
|
218
|
+
if (meta.skip_permissions)
|
|
219
|
+
ref.skip_permissions = true;
|
|
220
|
+
// Surface the /clear-style drift instead of guessing around it. The threshold is generous on
|
|
221
|
+
// purpose: a live session's transcript is routinely minutes stale mid-turn.
|
|
222
|
+
let note;
|
|
223
|
+
const age = Date.now() - new Date(ref.last_active).getTime();
|
|
224
|
+
if (Number.isFinite(age) && age > 30 * 60 * 1000) {
|
|
225
|
+
note = `session ${id.slice(0, 8)} last shows activity ${Math.round(age / 60000)} min ago — if you ran /clear, this is the pre-clear session`;
|
|
226
|
+
}
|
|
227
|
+
return { ref, note };
|
|
228
|
+
}
|
|
229
|
+
function sortAndCap(refs) {
|
|
230
|
+
return refs
|
|
231
|
+
.sort((a, b) => (a.last_active === b.last_active
|
|
232
|
+
? a.id.localeCompare(b.id)
|
|
233
|
+
: (a.last_active < b.last_active ? 1 : -1)))
|
|
234
|
+
.slice(0, MAX_CLAUDE_SESSIONS);
|
|
235
|
+
}
|
|
236
|
+
function sameRefs(a, b) {
|
|
237
|
+
if (a.length !== b.length)
|
|
238
|
+
return false;
|
|
239
|
+
return a.every((x, i) => {
|
|
240
|
+
const y = b[i];
|
|
241
|
+
return x.id === y.id && x.cwd === y.cwd && x.last_active === y.last_active
|
|
242
|
+
&& (x.machine_name || '') === (y.machine_name || '')
|
|
243
|
+
&& (x.title || '') === (y.title || '') && (x.branch || '') === (y.branch || '')
|
|
244
|
+
&& (x.skip_permissions === true) === (y.skip_permissions === true);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Merge `ref` into a note's `claude_sessions:` frontmatter, returning the new content — or the
|
|
249
|
+
* ORIGINAL STRING, byte-identical, when nothing meaningful changed.
|
|
250
|
+
*
|
|
251
|
+
* Only the `claude_sessions:` span is re-emitted; every other frontmatter byte is spliced back
|
|
252
|
+
* verbatim, blank lines included. That is deliberately better-behaved than updateFrontmatter,
|
|
253
|
+
* whose line-walker ends with a blank-line-dropping filter — do not route this through it.
|
|
254
|
+
*/
|
|
255
|
+
export function upsertSessionFrontmatter(content, ref) {
|
|
256
|
+
const m = content.match(/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/);
|
|
257
|
+
const eol = content.includes('\r\n') ? '\r\n' : '\n';
|
|
258
|
+
if (!m) {
|
|
259
|
+
// An unterminated `---` opener is a malformed file, not an empty-frontmatter one. Refuse to
|
|
260
|
+
// guess where the block ends — same defensive stance as updateFrontmatter.
|
|
261
|
+
if (content.startsWith('---'))
|
|
262
|
+
return content;
|
|
263
|
+
const block = yaml.dump({ claude_sessions: [ref] }, { lineWidth: -1 }).trimEnd();
|
|
264
|
+
return `---${eol}${block.split('\n').join(eol)}${eol}---${eol}${eol}${content}`;
|
|
265
|
+
}
|
|
266
|
+
let existing = [];
|
|
267
|
+
try {
|
|
268
|
+
const parsed = yaml.load(m[1], { json: true });
|
|
269
|
+
if (parsed && Array.isArray(parsed.claude_sessions)) {
|
|
270
|
+
existing = parsed.claude_sessions
|
|
271
|
+
.filter((r) => !!r && typeof r === 'object'
|
|
272
|
+
&& typeof r.id === 'string'
|
|
273
|
+
&& typeof r.cwd === 'string'
|
|
274
|
+
&& typeof r.last_active === 'string');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// Unparseable frontmatter: leave the file alone rather than rewrite around a guess.
|
|
279
|
+
return content;
|
|
280
|
+
}
|
|
281
|
+
const prior = existing.find((r) => r.id === ref.id);
|
|
282
|
+
// Sticky, and applied BEFORE the guard and the merge: a stamp that lacks the flag (a tail
|
|
283
|
+
// window that no longer reaches a bypass record, or find_claude_sessions_for_note) must not
|
|
284
|
+
// drop it from the entry it replaces.
|
|
285
|
+
if (prior?.skip_permissions === true && ref.skip_permissions !== true) {
|
|
286
|
+
ref = { ...ref, skip_permissions: true };
|
|
287
|
+
}
|
|
288
|
+
if (prior) {
|
|
289
|
+
const drift = new Date(ref.last_active).getTime() - new Date(prior.last_active).getTime();
|
|
290
|
+
// Same session, same folder, and the clock barely moved — nothing worth rewriting the file for.
|
|
291
|
+
// A machine change must never be swallowed by the time guard: the same session id carrying a
|
|
292
|
+
// different hostname means the note moved between machines, and that is exactly the fact the
|
|
293
|
+
// reader needs to know the entry is not resumable here. Nor may a newly seen bypass mode.
|
|
294
|
+
if (Number.isFinite(drift) && drift < LAST_ACTIVE_REFRESH_MS && prior.cwd === ref.cwd
|
|
295
|
+
&& (prior.machine_name || '') === (ref.machine_name || '')
|
|
296
|
+
&& (prior.title || '') === (ref.title || '')
|
|
297
|
+
&& (prior.skip_permissions === true) === (ref.skip_permissions === true)) {
|
|
298
|
+
return content;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const merged = sortAndCap([ref, ...existing.filter((r) => r.id !== ref.id)]);
|
|
302
|
+
if (sameRefs(sortAndCap([...existing]), merged))
|
|
303
|
+
return content;
|
|
304
|
+
const rendered = yaml.dump({ claude_sessions: merged }, { lineWidth: -1 }).trimEnd().split('\n');
|
|
305
|
+
// Splice by line so unrelated keys — and blank lines between them — survive untouched.
|
|
306
|
+
const inner = m[1].split(/\r?\n/);
|
|
307
|
+
const out = [];
|
|
308
|
+
let i = 0;
|
|
309
|
+
let replaced = false;
|
|
310
|
+
while (i < inner.length) {
|
|
311
|
+
if (/^\s*claude_sessions\s*:/.test(inner[i])) {
|
|
312
|
+
if (!replaced) {
|
|
313
|
+
out.push(...rendered);
|
|
314
|
+
replaced = true;
|
|
315
|
+
}
|
|
316
|
+
i++;
|
|
317
|
+
// Swallow the old block's indented continuation lines.
|
|
318
|
+
while (i < inner.length && /^\s+\S/.test(inner[i]))
|
|
319
|
+
i++;
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
out.push(inner[i]);
|
|
323
|
+
i++;
|
|
324
|
+
}
|
|
325
|
+
if (!replaced)
|
|
326
|
+
out.push(...rendered);
|
|
327
|
+
const newRaw = `---${eol}${out.join(eol)}${eol}---${eol}`;
|
|
328
|
+
return newRaw + content.slice(m[0].length);
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=claudeSessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeSessions.js","sourceRoot":"","sources":["../../src/tools/claudeSessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AA0BhC,iGAAiG;AACjG,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC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