@myagentroam/node 0.9.80 → 0.9.82

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.
@@ -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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.9.80",
3
+ "version": "0.9.82",
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.80",
32
- "@myagentroam/protocol": "0.9.80"
31
+ "@myagentroam/agent": "0.9.82",
32
+ "@myagentroam/protocol": "0.9.82"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/ws": "^8.18.1"