@myagentroam/node 0.9.81 → 0.9.83

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
@@ -854,7 +854,7 @@ export class NodeConnector {
854
854
  missionAccessChanged: prepared.changed
855
855
  };
856
856
  },
857
- mission: async ({ session, objective, secretEnvironment, personalInstructions, marAgentModel, marAgentModels, marAgentRuntimeScopeId }) => {
857
+ mission: async ({ session, objective, initiatedByUserId, secretEnvironment, personalInstructions, marAgentModel, marAgentModels, marAgentRuntimeScopeId }) => {
858
858
  this.clearMissionRetry(session.id);
859
859
  const prepared = this.prepareMissionSession(session);
860
860
  const missionSession = prepared.session;
@@ -869,6 +869,7 @@ export class NodeConnector {
869
869
  content: this.missionRuntime.prompt(session.id, 'start'),
870
870
  deliveryIntent: replacing ? 'REPLACE_CURRENT' : 'SEND',
871
871
  mission: { id: mission.id, revision: mission.revision },
872
+ ...(initiatedByUserId === undefined ? {} : { initiatedByUserId }),
872
873
  secretEnvironment,
873
874
  ...(personalInstructions === undefined ? {} : { personalInstructions }),
874
875
  ...(marAgentModel === undefined ? {} : { marAgentModel }),
@@ -300,6 +300,7 @@ export class MarAgentManagedRunController {
300
300
  : result.status === 'cancelled'
301
301
  ? 'CANCELLED'
302
302
  : 'FAILED';
303
+ this.#prepareRuntimeForTerminal(input.runId, runtime);
303
304
  this.host.emit(input.runId, status === 'SUCCEEDED'
304
305
  ? 'run.completed'
305
306
  : status === 'CANCELLED'
@@ -311,6 +312,8 @@ export class MarAgentManagedRunController {
311
312
  }, status);
312
313
  }
313
314
  catch (error) {
315
+ if (runtime !== undefined)
316
+ this.#prepareRuntimeForTerminal(input.runId, runtime);
314
317
  const projected = runnerErrorProjection(error, 'MAR_AGENT_RUN_FAILED');
315
318
  this.host.emitItem(input.runId, {
316
319
  itemId: boundedConversationItemId('mar-agent-error', input.runId),
@@ -329,17 +332,29 @@ export class MarAgentManagedRunController {
329
332
  this.#normalizers.delete(input.runId);
330
333
  this.host.active.delete(input.runId);
331
334
  this.#executions.delete(input.runId);
332
- if (runtime?.activeRunId === input.runId) {
333
- delete runtime.activeRunId;
334
- delete runtime.activeAccess;
335
- }
336
- if (runtime !== undefined) {
337
- if (runtime.retainable)
338
- this.#scheduleRuntimeRelease(runtime);
339
- else
340
- await this.#releaseRuntime(runtime);
341
- }
335
+ if (runtime !== undefined)
336
+ await this.#finishRuntimeExecution(input.runId, runtime).catch(() => undefined);
337
+ }
338
+ }
339
+ #prepareRuntimeForTerminal(runId, runtime) {
340
+ if (runtime.activeRunId === runId) {
341
+ delete runtime.activeRunId;
342
+ delete runtime.activeAccess;
342
343
  }
344
+ if (runtime.retainable)
345
+ this.#scheduleRuntimeRelease(runtime);
346
+ else
347
+ void this.#releaseRuntime(runtime).catch(() => undefined);
348
+ }
349
+ async #finishRuntimeExecution(runId, runtime) {
350
+ if (runtime.activeRunId === runId) {
351
+ delete runtime.activeRunId;
352
+ delete runtime.activeAccess;
353
+ }
354
+ if (runtime.retainable)
355
+ this.#scheduleRuntimeRelease(runtime);
356
+ else
357
+ await this.#releaseRuntime(runtime);
343
358
  }
344
359
  async #acquireRuntime(input) {
345
360
  if (this.#disposed)
@@ -62,6 +62,9 @@ export class SessionCommandService {
62
62
  return this.options.mission({
63
63
  session,
64
64
  objective: invocation.argument,
65
+ ...(Number.isSafeInteger(input.__requestUserId)
66
+ ? { initiatedByUserId: input.__requestUserId }
67
+ : {}),
65
68
  secretEnvironment,
66
69
  ...(typeof input.personalInstructions === 'string'
67
70
  ? { personalInstructions: input.personalInstructions }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.9.81",
3
+ "version": "0.9.83",
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.81",
32
- "@myagentroam/protocol": "0.9.81"
31
+ "@myagentroam/agent": "0.9.83",
32
+ "@myagentroam/protocol": "0.9.83"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/ws": "^8.18.1"