@myagentroam/node 0.11.22 → 0.11.23

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.
@@ -5,9 +5,10 @@ import { isPlainRecord } from '../util/node-operation-parsers.js';
5
5
  import { conversationClientMessageId } from '../util/conversation-identity.js';
6
6
  import { nodeLog } from '../operational.js';
7
7
  export function hasManagedActiveRun(runtime, session) {
8
- return (session.nativeControl === 'MAR_MANAGED' &&
8
+ const current = runtime.getAgentSession(session.id) ?? session;
9
+ return (current.nativeControl === 'MAR_MANAGED' &&
9
10
  runtime
10
- .listRunsForSession(session.id)
11
+ .listRunsForSession(current.id)
11
12
  .some((run) => run.status === 'STARTING' || run.status === 'RUNNING' || run.status === 'CANCELLING'));
12
13
  }
13
14
  export function convergeConversationWatchPage(previous, previousObserved, next, previousAuthority) {
@@ -106,7 +106,7 @@ export class SessionCatalogService {
106
106
  const inWorkspace = (session) => workspaceId === undefined || session.workspaceId === workspaceId;
107
107
  const native = nativeSessions
108
108
  .filter(inWorkspace)
109
- .map((session) => this.options.present({ ...session, externalDiscovered: true }));
109
+ .map((session) => ({ ...session, externalDiscovered: true }));
110
110
  const projections = this.options.projection.projectionsForNative(native);
111
111
  const sources = new Map();
112
112
  for (const candidate of native) {
@@ -140,7 +140,9 @@ export class SessionCatalogService {
140
140
  });
141
141
  const merged = new Map([
142
142
  ...projected,
143
- ...native.filter((candidate) => candidate.externalSessionId === null || projections.get(candidate) === undefined)
143
+ ...native
144
+ .filter((candidate) => candidate.externalSessionId === null || projections.get(candidate) === undefined)
145
+ .map((session) => this.options.present(session))
144
146
  ].map((session) => [session.id, session]));
145
147
  if (workspaceId !== undefined)
146
148
  this.mergePersisted(merged, workspaceId, !registeredOnly && query === undefined && this.options.discoveryPending(workspaceId));
@@ -5,6 +5,14 @@ export class SessionPresentationService {
5
5
  this.options = options;
6
6
  }
7
7
  present(session) {
8
+ // Observers can retain pre-activation objects; Runtime owns current Session state.
9
+ const current = this.options.runtime.getAgentSession(session.id);
10
+ if (current !== undefined)
11
+ session = {
12
+ ...session,
13
+ ...current,
14
+ lastActivityAt: latestSessionActivityAt(current.lastActivityAt, session.lastActivityAt)
15
+ };
8
16
  const database = this.options.database();
9
17
  if (session.externalSessionId !== null && database !== undefined) {
10
18
  const metadata = database.getNativeSessionMetadata(session.runner, session.externalSessionId, session.workspaceId);
package/dist/terminal.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { spawn as spawnProcess } from 'node:child_process';
3
- import { existsSync } from 'node:fs';
3
+ import { chmodSync, existsSync, statSync } from 'node:fs';
4
+ import { createRequire } from 'node:module';
4
5
  import { homedir } from 'node:os';
5
- import { join } from 'node:path';
6
+ import { dirname, join } from 'node:path';
6
7
  import { spawn } from 'node-pty';
7
8
  import { terminalDataFrameSchema } from '@myagentroam/protocol';
8
9
  import { nodeExecutionEnvironment } from './node-execution-environment.js';
@@ -528,7 +529,8 @@ export class TerminalManager {
528
529
  listener(frame);
529
530
  }
530
531
  }
531
- function nodePtyFactory(shell, args, options) {
532
+ export function nodePtyFactory(shell, args, options) {
533
+ repairPtySpawnHelper();
532
534
  const pty = spawn(shell, [...args], {
533
535
  name: options.name,
534
536
  cols: options.cols,
@@ -538,6 +540,15 @@ function nodePtyFactory(shell, args, options) {
538
540
  });
539
541
  return pty;
540
542
  }
543
+ export function repairPtySpawnHelper(platform = process.platform, architecture = process.arch, packageRoot) {
544
+ if (platform !== 'darwin')
545
+ return;
546
+ const root = packageRoot ?? dirname(createRequire(import.meta.url).resolve('node-pty/package.json'));
547
+ const helper = join(root, `prebuilds/darwin-${architecture}/spawn-helper`);
548
+ // node-pty 1.1.0 publishes these prebuild helpers without their execute bit.
549
+ if (existsSync(helper) && (statSync(helper).mode & 0o111) !== 0o111)
550
+ chmodSync(helper, 0o755);
551
+ }
541
552
  function nodePipeFactory(shell, args, options) {
542
553
  const child = spawnProcess(shell, [...args], {
543
554
  cwd: options.cwd,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.11.22",
3
+ "version": "0.11.23",
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.11.22",
41
- "@myagentroam/marctl": "0.11.0",
42
- "@myagentroam/protocol": "0.11.22",
43
- "@myagentroam/code-navigation": "0.11.0"
40
+ "@myagentroam/agent": "0.11.23",
41
+ "@myagentroam/code-navigation": "0.11.0",
42
+ "@myagentroam/protocol": "0.11.23",
43
+ "@myagentroam/marctl": "0.11.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/ws": "^8.18.1"