@myagentroam/node 0.9.92 → 0.9.94

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/connector.js CHANGED
@@ -505,8 +505,6 @@ export class NodeConnector {
505
505
  if (sessionId !== undefined)
506
506
  this.sessionContextService.schedule(sessionId);
507
507
  },
508
- createApproval: (input) => this.runtime.createApproval(input),
509
- publishApproval: (input) => this.runEventBridge.publishApproval(input),
510
508
  run: (runId) => this.runtime.getRun(runId),
511
509
  commandState: (sessionId, commandId) => this.commandStates.get(sessionId, commandId),
512
510
  setCommandState: (sessionId, state) => this.commandStates.set(sessionId, state),
@@ -1036,7 +1034,6 @@ export class NodeConnector {
1036
1034
  this.marAgentClient.bindControl({
1037
1035
  start: (envelope) => this.marAgentRunController.start(envelope),
1038
1036
  cancel: (runId, intent) => this.marAgentRunController.cancel(runId, intent),
1039
- decideApproval: (input) => this.marAgentRunController.decideApproval(input),
1040
1037
  respondUserInput: (runId, requestId, answers) => this.marAgentRunController.respondUserInput(runId, requestId, answers)
1041
1038
  });
1042
1039
  this.codexClient.bindCommandControl({
@@ -1665,8 +1662,11 @@ export class NodeConnector {
1665
1662
  }
1666
1663
  prepareMissionSession(session) {
1667
1664
  const access = missionUnrestrictedAccess(session.runner);
1668
- const changed = session.access !== access;
1669
- const prepared = changed ? this.runtime.updateAgentSessionAccess(session.id, access) : session;
1665
+ const requiresUpdate = session.access !== access;
1666
+ const changed = session.runner !== 'mar-agent' && requiresUpdate;
1667
+ const prepared = requiresUpdate
1668
+ ? this.runtime.updateAgentSessionAccess(session.id, access)
1669
+ : session;
1670
1670
  if (changed &&
1671
1671
  prepared.externalSessionId !== null &&
1672
1672
  prepared.model !== null &&
@@ -119,7 +119,6 @@ export class MarAgentHostedConversationRuntime {
119
119
  prompt: input.prompt,
120
120
  clientMessageId: input.clientMessageId,
121
121
  modelId: input.modelId,
122
- access: 'full-access',
123
122
  images: []
124
123
  });
125
124
  }
@@ -19,7 +19,6 @@ export class MarAgentManagedRunController {
19
19
  #runtimeAcquisitions = new Map();
20
20
  #runtimeCreations = new Map();
21
21
  #sessionReleases = new Map();
22
- #approvals = new Map();
23
22
  #questions = new Map();
24
23
  #normalizers = new Map();
25
24
  #resourceIdleTtlMs;
@@ -117,7 +116,6 @@ export class MarAgentManagedRunController {
117
116
  ? { runtimeScopeId: context.marAgentRuntimeScopeId }
118
117
  : {}),
119
118
  effort: session.effort ?? '',
120
- access: session.access === 'full-access' ? 'full-access' : 'on-request',
121
119
  mode: command.id,
122
120
  secretEnvironment: context.secretEnvironment,
123
121
  externalSessionId: session.externalSessionId,
@@ -177,7 +175,6 @@ export class MarAgentManagedRunController {
177
175
  ? { runtimeScopeId: payload.marAgentRuntimeScopeId }
178
176
  : {}),
179
177
  effort: typeof payload.effort === 'string' ? payload.effort : '',
180
- access: payload.access === 'full-access' ? 'full-access' : 'on-request',
181
178
  mode: payload.collaborationMode === 'plan' ? 'plan' : 'run',
182
179
  mcpServers,
183
180
  images: images.map((image) => ({
@@ -204,16 +201,6 @@ export class MarAgentManagedRunController {
204
201
  this.host.emit(runId, 'run.cancelling', { intent }, 'RUNNING');
205
202
  return true;
206
203
  }
207
- decideApproval(input) {
208
- const pending = this.#approvals.get(input.approvalId);
209
- if (!pending || pending.runId !== input.runId)
210
- return false;
211
- clearTimeout(pending.timer);
212
- pending.cleanup();
213
- this.#approvals.delete(input.approvalId);
214
- pending.resolve(input.decision === 'APPROVED' ? 'approved' : 'denied');
215
- return true;
216
- }
217
204
  respondUserInput(runId, requestId, answers) {
218
205
  const pending = this.#questions.get(requestId);
219
206
  if (!pending || pending.runId !== runId)
@@ -269,7 +256,6 @@ export class MarAgentManagedRunController {
269
256
  if (runtime.activeRunId !== undefined)
270
257
  throw new Error('MAR_AGENT_SESSION_RUNTIME_ACTIVE');
271
258
  runtime.activeRunId = input.runId;
272
- runtime.activeAccess = input.access;
273
259
  const executionMcpServers = input.mcpServers.filter((server) => server.lifecycle === 'EXECUTION');
274
260
  if (executionMcpServers.length > 0) {
275
261
  executionMcpLease = await this.#mcpClients.acquire(executionMcpServers, input.cwd, {
@@ -290,7 +276,6 @@ export class MarAgentManagedRunController {
290
276
  ...(input.clientMessageId ? { clientMessageId: input.clientMessageId } : {}),
291
277
  modelId: input.model.id,
292
278
  ...(reasoningEffort === undefined ? {} : { reasoningEffort }),
293
- access: input.access,
294
279
  images: input.images
295
280
  };
296
281
  const handle = input.mode === 'plan'
@@ -354,14 +339,12 @@ export class MarAgentManagedRunController {
354
339
  #prepareRuntimeForTerminal(runId, runtime) {
355
340
  if (runtime.activeRunId === runId) {
356
341
  delete runtime.activeRunId;
357
- delete runtime.activeAccess;
358
342
  }
359
343
  this.#scheduleRuntimeRelease(runtime);
360
344
  }
361
345
  async #finishRuntimeExecution(runId, runtime) {
362
346
  if (runtime.activeRunId === runId) {
363
347
  delete runtime.activeRunId;
364
- delete runtime.activeAccess;
365
348
  }
366
349
  this.#scheduleRuntimeRelease(runtime);
367
350
  }
@@ -445,13 +428,6 @@ export class MarAgentManagedRunController {
445
428
  workspace: input.cwd,
446
429
  environment: hostConfiguration.environment,
447
430
  guaranteedCommands: hostConfiguration.guaranteedCommands,
448
- approve: async (call, signal) => {
449
- const runId = runtime?.activeRunId;
450
- const access = runtime?.activeAccess;
451
- if (runId === undefined || access === undefined)
452
- return 'denied';
453
- return access === 'full-access' ? 'approved' : this.requestApproval(runId, call, signal);
454
- },
455
431
  question: async (request, signal) => {
456
432
  const runId = runtime?.activeRunId;
457
433
  return runId === undefined ? {} : this.requestQuestion(runId, request, signal);
@@ -546,42 +522,6 @@ export class MarAgentManagedRunController {
546
522
  })();
547
523
  return runtime.release;
548
524
  }
549
- requestApproval(runId, call, signal = new AbortController().signal) {
550
- const approvalId = randomUUID();
551
- const expiresAt = Date.now() + 10 * 60_000;
552
- const payload = {
553
- category: call.name === 'apply_patch' ? 'FILE_CHANGE' : call.name === 'exec' ? 'COMMAND' : 'TOOL',
554
- toolName: call.name,
555
- reason: 'MAR Agent requested permission for this tool call.'
556
- };
557
- this.host.createApproval({ runId, approvalId, payload, expiresAt });
558
- this.host.publishApproval({ runId, approvalId, payload, expiresAt });
559
- return new Promise((resolve) => {
560
- const cancel = () => settle('denied');
561
- const settle = (decision) => {
562
- const pending = this.#approvals.get(approvalId);
563
- if (!pending)
564
- return;
565
- clearTimeout(pending.timer);
566
- pending.cleanup();
567
- this.#approvals.delete(approvalId);
568
- resolve(decision);
569
- };
570
- const timer = setTimeout(() => {
571
- settle('denied');
572
- }, 10 * 60_000);
573
- timer.unref();
574
- signal.addEventListener('abort', cancel, { once: true });
575
- this.#approvals.set(approvalId, {
576
- runId,
577
- resolve,
578
- timer,
579
- cleanup: () => signal.removeEventListener('abort', cancel)
580
- });
581
- if (signal.aborted)
582
- cancel();
583
- });
584
- }
585
525
  requestQuestion(runId, request, signal = new AbortController().signal) {
586
526
  const questions = normalizeQuestions(request.questions);
587
527
  if (questions.length === 0)
@@ -619,14 +559,6 @@ export class MarAgentManagedRunController {
619
559
  });
620
560
  }
621
561
  clearInteractions(runId) {
622
- for (const [approvalId, pending] of this.#approvals) {
623
- if (pending.runId !== runId)
624
- continue;
625
- clearTimeout(pending.timer);
626
- pending.cleanup();
627
- this.#approvals.delete(approvalId);
628
- pending.resolve('denied');
629
- }
630
562
  for (const [requestId, pending] of this.#questions) {
631
563
  if (pending.runId !== runId)
632
564
  continue;
@@ -87,12 +87,7 @@ export class MarAgentRunner extends AbstractRunner {
87
87
  {
88
88
  id: 'full-access',
89
89
  label: 'Full access',
90
- description: 'Skip Agent approvals. Host validation remains active and no Agent sandbox is provided.'
91
- },
92
- {
93
- id: 'on-request',
94
- label: 'On-request',
95
- description: 'Ask before tools with side effects. This is not an operating-system sandbox.'
90
+ description: 'Tools run without per-call Agent approval. Host validation remains active and no Agent sandbox is provided.'
96
91
  }
97
92
  ],
98
93
  commands: [
@@ -145,7 +140,6 @@ export class MarAgentRunner extends AbstractRunner {
145
140
  capabilities: [
146
141
  'turn.start',
147
142
  'conversation',
148
- 'approval',
149
143
  'user-input',
150
144
  'plan',
151
145
  'compact',
@@ -192,7 +186,6 @@ export class MarAgentRunner extends AbstractRunner {
192
186
  'turn.queue',
193
187
  'turn.interrupt',
194
188
  'run.cancel',
195
- 'approval.respond',
196
189
  'user-input.respond',
197
190
  'session.rename',
198
191
  'session.remove',
@@ -113,12 +113,16 @@ export class NativeSessionProjectionService {
113
113
  if (typeof current.model === 'string' &&
114
114
  typeof current.effort === 'string' &&
115
115
  typeof current.access === 'string')
116
- return current;
116
+ return session.runner === 'mar-agent'
117
+ ? { ...current, access: 'full-access' }
118
+ : current;
117
119
  const saved = this.options
118
120
  .database()
119
121
  ?.getRunnerDefaults()
120
122
  .find((value) => value.runner === session.runner);
121
- return saved ?? this.options.runners.require(session.runner).defaultConfiguration(workspace);
123
+ if (saved !== undefined)
124
+ return session.runner === 'mar-agent' ? { ...saved, access: 'full-access' } : saved;
125
+ return this.options.runners.require(session.runner).defaultConfiguration(workspace);
122
126
  }
123
127
  ensureResumedConfiguration(session) {
124
128
  const configuration = this.resumedConfiguration(session);
@@ -55,15 +55,29 @@ export class RunnerService {
55
55
  ? input.workspaceId
56
56
  : undefined;
57
57
  const environment = parseSecretEnvironment(input.secretEnvironment);
58
+ const defaults = this.database()
59
+ .getRunnerDefaults()
60
+ .map((configuration) => {
61
+ if (configuration.runner !== 'mar-agent' || configuration.access === 'full-access')
62
+ return configuration;
63
+ const normalized = {
64
+ ...configuration,
65
+ access: 'full-access'
66
+ };
67
+ this.database().saveRunnerDefaults(normalized);
68
+ return normalized;
69
+ });
58
70
  return {
59
71
  profiles: await this.refreshProfiles(workspaceId, environment),
60
- defaults: this.database().getRunnerDefaults()
72
+ defaults
61
73
  };
62
74
  }
63
75
  saveDefaults(data) {
64
76
  const parsed = runnerDefaultConfigurationSchema.safeParse(data);
65
77
  if (!parsed.success)
66
78
  throw new Error('RUNNER_DEFAULT_INVALID');
79
+ if (parsed.data.runner === 'mar-agent' && parsed.data.access !== 'full-access')
80
+ throw new Error('RUNNER_DEFAULT_INVALID');
67
81
  return { defaults: this.database().saveRunnerDefaults(parsed.data) };
68
82
  }
69
83
  }
@@ -83,8 +83,14 @@ export class SessionLifecycleService {
83
83
  runner: runner.name,
84
84
  model: typeof input.model === 'string' ? input.model : (saved?.model ?? fallback.model),
85
85
  effort: typeof input.effort === 'string' ? input.effort : (saved?.effort ?? fallback.effort),
86
- access: typeof input.access === 'string' ? input.access : (saved?.access ?? fallback.access)
86
+ access: typeof input.access === 'string'
87
+ ? input.access
88
+ : runner.name === 'mar-agent'
89
+ ? fallback.access
90
+ : (saved?.access ?? fallback.access)
87
91
  };
92
+ if (runner.name === 'mar-agent' && configuration.access !== 'full-access')
93
+ throw new Error('SESSION_INVALID');
88
94
  const session = this.options.runtime.createAgentSession({
89
95
  workspaceId: input.workspaceId,
90
96
  runner: runner.name,
@@ -117,6 +123,8 @@ export class SessionLifecycleService {
117
123
  (await this.options.projection.createMetadataProjection(input.sessionId));
118
124
  if (current === undefined)
119
125
  throw new Error('SESSION_NOT_FOUND');
126
+ if (current.runner === 'mar-agent' && input.access !== 'full-access')
127
+ throw new Error('SESSION_INVALID');
120
128
  const session = this.options.runtime.updateAgentSessionConfiguration({
121
129
  sessionId: current.id,
122
130
  model: input.model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.9.92",
3
+ "version": "0.9.94",
4
4
  "description": "MyAgentRoam Node runtime CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -28,8 +28,8 @@
28
28
  "node-pty": "1.1.0",
29
29
  "ws": "^8.21.3",
30
30
  "zod": "4.4.3",
31
- "@myagentroam/agent": "0.9.92",
32
- "@myagentroam/protocol": "0.9.92"
31
+ "@myagentroam/agent": "0.9.94",
32
+ "@myagentroam/protocol": "0.9.94"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/ws": "^8.18.1"