@adrive/mcp-server 1.1.1 → 1.1.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/session.js +27 -21
- package/package.json +1 -1
package/dist/session.js
CHANGED
|
@@ -107,37 +107,43 @@ function turnBlock(turn) {
|
|
|
107
107
|
function truncate(s, n) {
|
|
108
108
|
return s.length <= n ? s : `${s.slice(0, n - 3)}...`;
|
|
109
109
|
}
|
|
110
|
+
function listSection(heading, lead, items, cap) {
|
|
111
|
+
const shown = items.slice(0, cap).map((item) => `- ${item}`);
|
|
112
|
+
if (items.length > cap)
|
|
113
|
+
shown.push(`- (+${items.length - cap} more)`);
|
|
114
|
+
return `## ${heading}\n\n${lead}${shown.join('\n')}`;
|
|
115
|
+
}
|
|
110
116
|
export function buildHandoff(markdown, maxChars = DEFAULT_HANDOFF_CHARS, uploads) {
|
|
111
117
|
const session = parseSession(markdown);
|
|
112
118
|
const from = session.harness ?? 'prior';
|
|
113
119
|
const intro = `Handoff from a ${from} session${session.sessionId ? ` (${session.sessionId})` : ''}. Continue this work; verify file state on disk before assuming it.`;
|
|
114
|
-
const sections = [intro];
|
|
115
|
-
if (session.meta.length > 0)
|
|
116
|
-
sections.push(session.meta.join('\n'));
|
|
117
120
|
const firstUser = session.turns.find((t) => t.role === 'user');
|
|
118
121
|
const goal = firstUser ? turnBody(firstUser) : '';
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
const goalChars = Math.min(GOAL_CHARS, Math.floor(maxChars / 8));
|
|
123
|
+
const head = (cap) => {
|
|
124
|
+
const sections = [intro];
|
|
125
|
+
if (session.meta.length > 0)
|
|
126
|
+
sections.push(session.meta.join('\n'));
|
|
127
|
+
if (goal)
|
|
128
|
+
sections.push(`## Goal\n\n${truncate(goal, goalChars)}`);
|
|
129
|
+
if (session.files.length > 0)
|
|
130
|
+
sections.push(listSection('Files touched', '', session.files, cap));
|
|
131
|
+
if (uploads && uploads.fileIds.length > 0) {
|
|
132
|
+
sections.push(listSection('Uploaded files', `Copies of files this session wrote, in workspace ${uploads.workspaceId}. If they are not on disk here, read each with drive_read (workspace_id ${uploads.workspaceId}, file_id below):\n\n`, uploads.fileIds, cap));
|
|
133
|
+
}
|
|
134
|
+
return sections.join('\n\n');
|
|
135
|
+
};
|
|
136
|
+
// The lists give way first, so a small budget still carries the recent turns.
|
|
137
|
+
let cap = MAX_HANDOFF_FILES;
|
|
138
|
+
let fixedHead = head(cap);
|
|
139
|
+
while (cap > 0 && fixedHead.length > maxChars / 2)
|
|
140
|
+
fixedHead = head(--cap);
|
|
135
141
|
if (session.turns.length === 0) {
|
|
136
|
-
const fixed = `${
|
|
142
|
+
const fixed = `${fixedHead}\n\n## Transcript (tail)\n\n`;
|
|
137
143
|
const body = markdown.trim();
|
|
138
144
|
return (fixed + body.slice(Math.max(0, body.length - (maxChars - fixed.length)))).slice(0, maxChars);
|
|
139
145
|
}
|
|
140
|
-
const fixed = `${
|
|
146
|
+
const fixed = `${fixedHead}\n\n## Recent turns\n\n`;
|
|
141
147
|
const markerReserve = 64;
|
|
142
148
|
let remaining = maxChars - fixed.length - markerReserve;
|
|
143
149
|
const picked = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adrive/mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "MCP server for AgentDrive — cross-agent artifact workspace with provenance and portable storage across Claude Code, Codex, Cursor, and LangGraph.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|