@adrive/mcp-server 1.1.0 → 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/README.md +2 -2
- package/dist/session.d.ts +5 -1
- package/dist/session.js +28 -15
- package/dist/tools/drive-resume.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ The server derives the current project from its working directory (git remote, e
|
|
|
25
25
|
|
|
26
26
|
## Client configuration
|
|
27
27
|
|
|
28
|
-
`curl -fsSL https://app.agentdrive.sh/install | sh` runs `adrive init`, which wires every detected harness. For Claude Code, install the plugin instead: `/plugin marketplace add Rakesh1002/agentdrive` then `/plugin install agentdrive@agentdrive`.
|
|
28
|
+
`curl -fsSL https://app.agentdrive.sh/install | sh` runs `adrive init`, which wires every detected harness. For Claude Code, install the plugin instead: `/plugin marketplace add Rakesh1002/agentdrive-mcp` then `/plugin install agentdrive@agentdrive`.
|
|
29
29
|
|
|
30
30
|
Manual entries, for reference:
|
|
31
31
|
|
|
@@ -88,4 +88,4 @@ AGENTDRIVE_AGENT_PLATFORM = "codex"
|
|
|
88
88
|
|
|
89
89
|
## License
|
|
90
90
|
|
|
91
|
-
Apache-2.0. See
|
|
91
|
+
Apache-2.0. See [LICENSE](https://github.com/Rakesh1002/agentdrive-mcp/blob/main/LICENSE).
|
package/dist/session.d.ts
CHANGED
|
@@ -29,4 +29,8 @@ export declare function sessionActivityAt(run: {
|
|
|
29
29
|
metadata?: Record<string, unknown>;
|
|
30
30
|
}): number;
|
|
31
31
|
export declare function renderSession(doc: SessionDoc): string;
|
|
32
|
-
export
|
|
32
|
+
export interface HandoffUploads {
|
|
33
|
+
workspaceId: string;
|
|
34
|
+
fileIds: string[];
|
|
35
|
+
}
|
|
36
|
+
export declare function buildHandoff(markdown: string, maxChars?: number, uploads?: HandoffUploads): string;
|
package/dist/session.js
CHANGED
|
@@ -107,30 +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
|
-
|
|
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
|
+
}
|
|
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
|
-
|
|
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);
|
|
128
141
|
if (session.turns.length === 0) {
|
|
129
|
-
const fixed = `${
|
|
142
|
+
const fixed = `${fixedHead}\n\n## Transcript (tail)\n\n`;
|
|
130
143
|
const body = markdown.trim();
|
|
131
144
|
return (fixed + body.slice(Math.max(0, body.length - (maxChars - fixed.length)))).slice(0, maxChars);
|
|
132
145
|
}
|
|
133
|
-
const fixed = `${
|
|
146
|
+
const fixed = `${fixedHead}\n\n## Recent turns\n\n`;
|
|
134
147
|
const markerReserve = 64;
|
|
135
148
|
let remaining = maxChars - fixed.length - markerReserve;
|
|
136
149
|
const picked = [];
|
|
@@ -33,5 +33,5 @@ export async function driveResume(client, args) {
|
|
|
33
33
|
if (isEncrypted(file.content)) {
|
|
34
34
|
return text(`This session is encrypted client-side; run \`adrive resume ${run.run_id}\` in a shell to view it.`);
|
|
35
35
|
}
|
|
36
|
-
return text(buildHandoff(file.content, args.max_chars));
|
|
36
|
+
return text(buildHandoff(file.content, args.max_chars, { workspaceId: run.workspace_id, fileIds: run.artifacts_produced }));
|
|
37
37
|
}
|
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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "git+https://github.com/Rakesh1002/agentdrive-mcp.git"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/Rakesh1002/agentdrive/issues"
|
|
27
|
+
"url": "https://github.com/Rakesh1002/agentdrive-mcp/issues"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"agentdrive",
|