agy-delegate-mcp 1.3.0 → 1.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/CHANGELOG.md +46 -0
- package/package.json +1 -1
- package/src/acp-client.js +132 -54
- package/src/agent-reported-files.js +4 -6
- package/src/delegate.js +231 -131
- package/src/doctor.js +53 -32
- package/src/errors.js +2 -4
- package/src/jsonrpc.js +10 -26
- package/src/model-options.js +10 -18
- package/src/proc.js +9 -19
- package/src/request-router.js +4 -10
- package/src/server.js +162 -111
- package/src/session-supervisor.js +14 -7
- package/src/spawn.js +17 -14
- package/src/turn-state.js +17 -27
- package/src/version.js +3 -5
package/src/turn-state.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
// Everything describing the turn in progress,
|
|
2
|
-
//
|
|
3
|
-
// leaks into the next result. Fields are declared in exactly one place, freshFields(), which is
|
|
4
|
-
// also what reset() applies — a field added there is reset for free, and one that is missed is a
|
|
5
|
-
// silent stale-data bug on resume.
|
|
1
|
+
// Everything describing the turn in progress, reset as one before the prompt. freshFields() is the
|
|
2
|
+
// single declaration reset() applies, so a field added there is reset too.
|
|
6
3
|
|
|
7
4
|
const isTerminalToolStatus = (status) =>
|
|
8
5
|
status === "completed" || status === "failed" || status === "cancelled";
|
|
@@ -46,33 +43,27 @@ function progressStream(prefix, onProgress, throttleMs) {
|
|
|
46
43
|
function freshFields() {
|
|
47
44
|
return {
|
|
48
45
|
resultChunks: [],
|
|
49
|
-
// Text
|
|
50
|
-
//
|
|
51
|
-
// that replies and then runs one more command has its entire reply discarded, leaving the
|
|
52
|
-
// caller "" with stopReason end_turn and no error. Kept so it can be handed back when
|
|
53
|
-
// nothing survived — labelled, never blended with a real final message.
|
|
46
|
+
// Text a later tool call superseded: usually a preamble, but it can be the whole answer when
|
|
47
|
+
// agy replies and then runs one more command. Handed back, labelled, only when nothing else is.
|
|
54
48
|
discardedResult: "",
|
|
55
|
-
// Message text sent
|
|
56
|
-
//
|
|
57
|
-
// is how agy reports moving a long shell command to the background.
|
|
49
|
+
// Message text sent since a still-running tool call started; handed back only when the turn
|
|
50
|
+
// ends with the call unfinished (a backgrounded command or ask_question).
|
|
58
51
|
unfinishedToolText: "",
|
|
59
52
|
sawToolCall: false,
|
|
60
53
|
collectingPostToolResult: false,
|
|
61
54
|
activeToolCalls: new Set(),
|
|
62
|
-
// Tool name per call id
|
|
63
|
-
//
|
|
55
|
+
// Tool name per call id, to tell an ask_question (waits on the caller) from a backgrounded
|
|
56
|
+
// command (finishes by itself).
|
|
64
57
|
toolNames: new Map(),
|
|
65
|
-
// Set by a usage_update
|
|
66
|
-
// with a usage_update after its last message.
|
|
58
|
+
// Set by a usage_update, cleared by any other frame: agy closes every turn with one.
|
|
67
59
|
usageAfterActivity: false,
|
|
60
|
+
// The newest usage_update's { used, size }; unlike the reply's usage it covers a continuation.
|
|
61
|
+
contextUsage: undefined,
|
|
68
62
|
lastFrameAt: 0,
|
|
69
|
-
// Ids
|
|
70
|
-
// instead of restarting collection — which would demote an already-collected final message
|
|
71
|
-
// to discardedResult and mislabel it pre-tool-fallback.
|
|
63
|
+
// Ids seen terminal, so a stale non-terminal re-send cannot discard a collected final message.
|
|
72
64
|
finishedToolCalls: new Set(),
|
|
73
|
-
// agy
|
|
74
|
-
//
|
|
75
|
-
// same artifact replaces the earlier entry.
|
|
65
|
+
// agy's artifacts (the plan): write_file calls carrying ArtifactMetadata, under
|
|
66
|
+
// ~/.gemini/antigravity-cli/brain/<sessionId>/. Keyed by path, so a rewrite replaces.
|
|
76
67
|
artifacts: new Map(),
|
|
77
68
|
touched: new Set(),
|
|
78
69
|
lastToolLabel: null,
|
|
@@ -104,8 +95,7 @@ export function makeTurnState({ onProgress, progressThrottleMs = 2000 } = {}) {
|
|
|
104
95
|
state.resultChunks.length = 0;
|
|
105
96
|
},
|
|
106
97
|
|
|
107
|
-
//
|
|
108
|
-
// here would hand back a partial answer as if it were the whole one.
|
|
98
|
+
// Uncapped: a cap would return a partial answer as the whole one.
|
|
109
99
|
appendResult(text) {
|
|
110
100
|
state.resultChunks.push(text);
|
|
111
101
|
},
|
|
@@ -138,8 +128,8 @@ export function makeTurnState({ onProgress, progressThrottleMs = 2000 } = {}) {
|
|
|
138
128
|
state.finishedToolCalls.add(toolCallId);
|
|
139
129
|
}
|
|
140
130
|
if (state.activeToolCalls.size === 0 && !state.collectingPostToolResult) {
|
|
141
|
-
//
|
|
142
|
-
//
|
|
131
|
+
// Drop text sent while tools ran; the guard above keeps a late duplicate from wiping a
|
|
132
|
+
// collected final message.
|
|
143
133
|
state.resetResult();
|
|
144
134
|
state.collectingPostToolResult = true;
|
|
145
135
|
}
|
package/src/version.js
CHANGED
|
@@ -8,13 +8,11 @@ function readVersion() {
|
|
|
8
8
|
return JSON.parse(readFileSync(PKG_PATH, "utf8")).version;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
// Captured once, for the ACP
|
|
11
|
+
// Captured once, for the ACP and MCP identity sent at connect.
|
|
12
12
|
export const VERSION = readVersion();
|
|
13
13
|
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// an in-place upgrade — exactly when doctor is run to confirm the new version shipped. An
|
|
17
|
-
// un-restarted child running old code stays a gap, but no in-process value can close that.
|
|
14
|
+
// Read fresh for doctor: /reload-plugins does not restart the server, so the constant goes stale
|
|
15
|
+
// after an in-place upgrade.
|
|
18
16
|
export function readPackageVersion() {
|
|
19
17
|
try {
|
|
20
18
|
return readVersion();
|