@myagentroam/node 0.11.58 → 0.11.60
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.
|
@@ -11,6 +11,7 @@ import { captureMarAgentExecutionInput, marAgentEnvelopeInput } from './mar-agen
|
|
|
11
11
|
export class MarAgentRunner extends AbstractRunner {
|
|
12
12
|
homeDirectory;
|
|
13
13
|
name = 'mar-agent';
|
|
14
|
+
#contextCatalog;
|
|
14
15
|
prepareMessageInput(input, collaborationMode) {
|
|
15
16
|
const prepared = super.prepareMessageInput(input, collaborationMode);
|
|
16
17
|
return parseComposerTags(prepared)
|
|
@@ -582,26 +583,37 @@ export class MarAgentRunner extends AbstractRunner {
|
|
|
582
583
|
const model = this.#models.find((candidate) => candidate.id === session.modelId);
|
|
583
584
|
if (model === undefined)
|
|
584
585
|
return undefined;
|
|
586
|
+
const pending = (this.#contextCatalog ??= openAgentSessionCatalog({
|
|
587
|
+
homeDirectory: this.homeDirectory
|
|
588
|
+
}));
|
|
585
589
|
let catalog;
|
|
586
590
|
try {
|
|
587
|
-
catalog = await
|
|
591
|
+
catalog = await pending;
|
|
588
592
|
const usage = await catalog.contextUsage(session.externalSessionId);
|
|
589
593
|
return usage === undefined
|
|
590
594
|
? undefined
|
|
591
595
|
: {
|
|
592
596
|
model: model.modelId,
|
|
593
597
|
usedTokens: usage.inputTokens,
|
|
594
|
-
maxTokens: model.contextWindowTokens
|
|
598
|
+
maxTokens: model.contextWindowTokens,
|
|
599
|
+
gcCount: usage.gcCount,
|
|
600
|
+
...(usage.gcReclaimedTokens === undefined
|
|
601
|
+
? {}
|
|
602
|
+
: { gcReclaimedTokens: usage.gcReclaimedTokens })
|
|
595
603
|
};
|
|
596
604
|
}
|
|
597
605
|
catch {
|
|
606
|
+
if (catalog === undefined && this.#contextCatalog === pending)
|
|
607
|
+
this.#contextCatalog = undefined;
|
|
598
608
|
return undefined;
|
|
599
609
|
}
|
|
600
|
-
finally {
|
|
601
|
-
await catalog?.close().catch(() => undefined);
|
|
602
|
-
}
|
|
603
610
|
}
|
|
604
|
-
stop() {
|
|
611
|
+
async stop() {
|
|
612
|
+
const pending = this.#contextCatalog;
|
|
613
|
+
this.#contextCatalog = undefined;
|
|
614
|
+
const catalog = await pending?.catch(() => undefined);
|
|
615
|
+
await catalog?.close();
|
|
616
|
+
}
|
|
605
617
|
async #readInputImage(sessionId, sequence, imageIndex, expected) {
|
|
606
618
|
let catalog;
|
|
607
619
|
try {
|
|
@@ -23,7 +23,11 @@ export class SessionContextService {
|
|
|
23
23
|
model: usage.model ?? session.modelId,
|
|
24
24
|
usedTokens: usage.usedTokens,
|
|
25
25
|
maxTokens: usage.maxTokens,
|
|
26
|
-
percentage: Math.round((usage.usedTokens / usage.maxTokens) * 1000) / 10
|
|
26
|
+
percentage: Math.round((usage.usedTokens / usage.maxTokens) * 1000) / 10,
|
|
27
|
+
...(usage.gcCount === undefined ? {} : { gcCount: usage.gcCount }),
|
|
28
|
+
...(usage.gcReclaimedTokens === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: { gcReclaimedTokens: usage.gcReclaimedTokens })
|
|
27
31
|
};
|
|
28
32
|
this.snapshots.set(session.id, context);
|
|
29
33
|
const previousTimer = this.snapshotTimers.get(session.id);
|
|
@@ -124,5 +128,7 @@ function sameUsage(left, right) {
|
|
|
124
128
|
return (left.model === right.model &&
|
|
125
129
|
left.usedTokens === right.usedTokens &&
|
|
126
130
|
left.maxTokens === right.maxTokens &&
|
|
127
|
-
left.percentage === right.percentage
|
|
131
|
+
left.percentage === right.percentage &&
|
|
132
|
+
left.gcCount === right.gcCount &&
|
|
133
|
+
left.gcReclaimedTokens === right.gcReclaimedTokens);
|
|
128
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.60",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0 AND GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"sharp": "0.35.5",
|
|
39
39
|
"ws": "^8.21.3",
|
|
40
40
|
"zod": "4.4.3",
|
|
41
|
-
"@myagentroam/
|
|
41
|
+
"@myagentroam/protocol": "0.11.60",
|
|
42
42
|
"@myagentroam/code-navigation": "0.11.1",
|
|
43
|
-
"@myagentroam/
|
|
44
|
-
"@myagentroam/
|
|
43
|
+
"@myagentroam/agent": "0.11.60",
|
|
44
|
+
"@myagentroam/marctl": "0.11.11"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/ws": "^8.18.1"
|