@myagentroam/node 0.10.25 → 0.10.27
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/NOTICE
CHANGED
|
@@ -9,3 +9,29 @@ Author and licensing contact: aCHAOS (achaosxyz@gmail.com)
|
|
|
9
9
|
Licensed under MyAgentRoam Enterprise Source-Available License 1.0; see
|
|
10
10
|
ee/LICENSE and LICENSING.md. Independent core and third-party notices remain
|
|
11
11
|
applicable; this attribution does not transfer any contributor's copyright.
|
|
12
|
+
|
|
13
|
+
Third-party supplement: http_ece@1.2.0 (Web Push encryption dependency)
|
|
14
|
+
The npm archive omits its license file; the upstream v1.2.0 text follows.
|
|
15
|
+
Source: https://github.com/martinthomson/encrypted-content-encoding/blob/0562510a30819f52424724a6fd5504becacd98a1/LICENSE
|
|
16
|
+
|
|
17
|
+
The MIT License (MIT)
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2015 Martin Thomson
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
+
in the Software without restriction, including without limitation the rights
|
|
24
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
+
furnished to do so, subject to the following conditions:
|
|
27
|
+
|
|
28
|
+
The above copyright notice and this permission notice shall be included in all
|
|
29
|
+
copies or substantial portions of the Software.
|
|
30
|
+
|
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
+
SOFTWARE.
|
package/dist/connector.js
CHANGED
|
@@ -605,6 +605,8 @@ export class NodeConnector {
|
|
|
605
605
|
});
|
|
606
606
|
this.capabilities = this.projectComputerUseCapability(this.capabilities);
|
|
607
607
|
this.marAgentRunController = new MarAgentManagedRunController(this.marAgentClient, {
|
|
608
|
+
createApproval: (input) => this.runtime.createApproval(input),
|
|
609
|
+
publishApproval: (input) => this.publishApprovalForRun(input),
|
|
608
610
|
active: this.runState.active,
|
|
609
611
|
adopt: (input) => this.runtime.adoptRun(input),
|
|
610
612
|
promote: (sessionId, nativeSessionId) => this.sessionIdentityService.promote(sessionId, nativeSessionId),
|
|
@@ -1246,6 +1248,7 @@ export class NodeConnector {
|
|
|
1246
1248
|
respondUserInput: (runId, requestId, answers) => this.openCodeRunController.respondUserInput(runId, requestId, answers)
|
|
1247
1249
|
});
|
|
1248
1250
|
this.marAgentClient.bindControl({
|
|
1251
|
+
decideApproval: (input) => this.marAgentRunController.decideApproval(input),
|
|
1249
1252
|
start: (envelope) => this.marAgentRunController.start(envelope),
|
|
1250
1253
|
cancel: (runId, intent) => this.marAgentRunController.cancel(runId, intent),
|
|
1251
1254
|
respondUserInput: (runId, requestId, answers) => this.marAgentRunController.respondUserInput(runId, requestId, answers)
|
|
@@ -29,6 +29,7 @@ export class MarAgentManagedRunController {
|
|
|
29
29
|
#runtimeCreations = new Map();
|
|
30
30
|
#sessionReleases = new Map();
|
|
31
31
|
#questions = new Map();
|
|
32
|
+
#approvals = new Map();
|
|
32
33
|
#normalizers = new Map();
|
|
33
34
|
#resourceIdleTtlMs;
|
|
34
35
|
#retainEnvironment;
|
|
@@ -674,6 +675,14 @@ export class MarAgentManagedRunController {
|
|
|
674
675
|
const runId = runtime?.activeRunId;
|
|
675
676
|
return runId === undefined ? {} : this.requestQuestion(runId, request, signal);
|
|
676
677
|
},
|
|
678
|
+
approval: this.host.createApproval && this.host.publishApproval
|
|
679
|
+
? (request, signal) => {
|
|
680
|
+
const runId = runtime?.activeRunId;
|
|
681
|
+
if (runId === undefined)
|
|
682
|
+
return Promise.resolve('REJECTED');
|
|
683
|
+
return this.requestApproval(runId, request, signal);
|
|
684
|
+
}
|
|
685
|
+
: undefined,
|
|
677
686
|
mcpCatalog: () => mcp.catalog(),
|
|
678
687
|
callMcp: async (call, signal, context) => mcp.call(call.name, call.arguments, signal, context?.expectedTool),
|
|
679
688
|
resourceIdleTtlMs: this.#resourceIdleTtlMs
|
|
@@ -847,7 +856,62 @@ export class MarAgentManagedRunController {
|
|
|
847
856
|
cancel();
|
|
848
857
|
});
|
|
849
858
|
}
|
|
859
|
+
decideApproval(input) {
|
|
860
|
+
const pending = this.#approvals.get(input.approvalId);
|
|
861
|
+
if (!pending || pending.runId !== input.runId)
|
|
862
|
+
return false;
|
|
863
|
+
pending.cleanup();
|
|
864
|
+
pending.resolve(input.decision);
|
|
865
|
+
return true;
|
|
866
|
+
}
|
|
867
|
+
requestApproval(runId, request, signal) {
|
|
868
|
+
signal.throwIfAborted();
|
|
869
|
+
return new Promise((resolve, reject) => {
|
|
870
|
+
const cleanup = () => {
|
|
871
|
+
signal.removeEventListener('abort', cancel);
|
|
872
|
+
this.#approvals.delete(request.approvalId);
|
|
873
|
+
};
|
|
874
|
+
const cancel = () => {
|
|
875
|
+
cleanup();
|
|
876
|
+
if (signal.reason instanceof Error &&
|
|
877
|
+
'code' in signal.reason &&
|
|
878
|
+
signal.reason.code === 'MAR_AGENT_APPROVAL_EXPIRED')
|
|
879
|
+
this.host.emit(runId, 'approval.expired', { approvalId: request.approvalId });
|
|
880
|
+
reject(signal.reason);
|
|
881
|
+
};
|
|
882
|
+
const input = {
|
|
883
|
+
runId,
|
|
884
|
+
approvalId: request.approvalId,
|
|
885
|
+
expiresAt: request.expiresAt,
|
|
886
|
+
payload: {
|
|
887
|
+
toolName: request.source.toolName,
|
|
888
|
+
input: request.input,
|
|
889
|
+
reason: request.reason,
|
|
890
|
+
source: request.source
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
try {
|
|
894
|
+
this.host.createApproval(input);
|
|
895
|
+
this.#approvals.set(request.approvalId, { runId, resolve, cleanup });
|
|
896
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
897
|
+
if (signal.aborted)
|
|
898
|
+
cancel();
|
|
899
|
+
else
|
|
900
|
+
this.host.publishApproval(input);
|
|
901
|
+
}
|
|
902
|
+
catch (error) {
|
|
903
|
+
cleanup();
|
|
904
|
+
reject(error);
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
850
908
|
clearInteractions(runId) {
|
|
909
|
+
for (const pending of this.#approvals.values()) {
|
|
910
|
+
if (pending.runId !== runId)
|
|
911
|
+
continue;
|
|
912
|
+
pending.cleanup();
|
|
913
|
+
pending.resolve('REJECTED');
|
|
914
|
+
}
|
|
851
915
|
for (const [requestId, pending] of this.#questions) {
|
|
852
916
|
if (pending.runId !== runId)
|
|
853
917
|
continue;
|
|
@@ -52,7 +52,9 @@ export class RunnerService {
|
|
|
52
52
|
const defaults = this.database()
|
|
53
53
|
.getRunnerDefaults()
|
|
54
54
|
.map((configuration) => {
|
|
55
|
-
if (configuration.runner !== 'mar-agent' ||
|
|
55
|
+
if (configuration.runner !== 'mar-agent' ||
|
|
56
|
+
configuration.access === 'auto' ||
|
|
57
|
+
configuration.access === 'full-access')
|
|
56
58
|
return configuration;
|
|
57
59
|
const normalized = {
|
|
58
60
|
...configuration,
|
|
@@ -80,7 +82,9 @@ export class RunnerService {
|
|
|
80
82
|
const parsed = runnerDefaultConfigurationSchema.safeParse(data);
|
|
81
83
|
if (!parsed.success)
|
|
82
84
|
throw new Error('RUNNER_DEFAULT_INVALID');
|
|
83
|
-
if (parsed.data.runner === 'mar-agent' &&
|
|
85
|
+
if (parsed.data.runner === 'mar-agent' &&
|
|
86
|
+
parsed.data.access !== 'auto' &&
|
|
87
|
+
parsed.data.access !== 'full-access')
|
|
84
88
|
throw new Error('RUNNER_DEFAULT_INVALID');
|
|
85
89
|
return { defaults: this.database().saveRunnerDefaults(parsed.data) };
|
|
86
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.27",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0 AND GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"playwright": "1.62.1",
|
|
38
38
|
"ws": "^8.21.3",
|
|
39
39
|
"zod": "4.4.3",
|
|
40
|
-
"@myagentroam/agent": "0.10.25",
|
|
41
|
-
"@myagentroam/marctl": "0.10.3",
|
|
42
40
|
"@myagentroam/code-navigation": "0.10.1",
|
|
43
|
-
"@myagentroam/protocol": "0.10.
|
|
41
|
+
"@myagentroam/protocol": "0.10.27",
|
|
42
|
+
"@myagentroam/marctl": "0.10.3",
|
|
43
|
+
"@myagentroam/agent": "0.10.27"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/ws": "^8.18.1"
|