@myagentroam/node 0.9.136 → 0.9.137

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.
@@ -337,7 +337,7 @@ export class ClaudeManagedRunController {
337
337
  value >= 0 &&
338
338
  Number.isSafeInteger(Math.round(value)));
339
339
  if (nativeTtft !== undefined)
340
- this.host.emit(runId, 'run.performance', { ttftMs: Math.round(nativeTtft) });
340
+ this.host.emit(runId, 'run.performance', { latencyMs: Math.round(nativeTtft) });
341
341
  const subtype = typeof record.subtype === 'string' ? record.subtype : 'unknown';
342
342
  const completedNativeSessionId = this.runner.execution.runs.get(runId)?.nativeSessionId ?? nativeSessionId;
343
343
  this.host.emit(runId, 'turn.completed', {
@@ -1,15 +1,9 @@
1
1
  import { compactRunnerText } from '../../util/node-operation-parsers.js';
2
2
  export function normalizeCodexTool(input) {
3
- const wrapped = unwrapCodexExec(input.name, input.rawInput);
4
- const name = compactRunnerText(wrapped?.name ?? input.name, 128) || 'tool';
5
- const rawInput = wrapped?.rawInput ?? input.rawInput;
3
+ const name = compactRunnerText(input.name, 128) || 'tool';
4
+ const rawInput = input.rawInput;
6
5
  const attachments = input.attachments ?? [];
7
6
  const subagent = codexSubagentProjection(input.namespace, name, rawInput, input.outputSummary);
8
- if (name === 'apply_patch') {
9
- const changes = patchFileChanges(wrapped?.patch);
10
- if (changes.length > 0)
11
- return { kind: 'file_change', payload: { changes } };
12
- }
13
7
  if (isCommandTool(name)) {
14
8
  const outputPreview = compactRunnerText(input.outputSummary ?? '', 10_000);
15
9
  if (input.outputOnly === true)
@@ -70,72 +64,8 @@ export function normalizeCodexTool(input) {
70
64
  }
71
65
  };
72
66
  }
73
- function unwrapCodexExec(name, rawInput) {
74
- if (name !== 'exec' || typeof rawInput !== 'string')
75
- return undefined;
76
- const match = /\btools\.([A-Za-z_][A-Za-z0-9_]*)\s*\(/u.exec(rawInput);
77
- if (match?.[1] === undefined)
78
- return undefined;
79
- const wrappedName = match[1];
80
- if (wrappedName === 'exec_command') {
81
- const command = quotedProperty(rawInput, 'cmd');
82
- const cwd = quotedProperty(rawInput, 'workdir');
83
- return {
84
- name: wrappedName,
85
- rawInput: {
86
- ...(command === undefined ? {} : { cmd: command }),
87
- ...(cwd === undefined ? {} : { cwd })
88
- }
89
- };
90
- }
91
- if (wrappedName === 'apply_patch') {
92
- const patch = quotedVariable(rawInput, 'patch');
93
- return { name: wrappedName, rawInput: patch ?? rawInput, ...(patch ? { patch } : {}) };
94
- }
95
- return { name: wrappedName, rawInput };
96
- }
97
- function quotedProperty(source, key) {
98
- const match = new RegExp(`\\b${key}\\s*:\\s*("(?:\\\\.|[^"\\\\])*")`, 'u').exec(source);
99
- return decodeJsonString(match?.[1]);
100
- }
101
- function quotedVariable(source, name) {
102
- const match = new RegExp(`\\b(?:const|let)\\s+${name}\\s*=\\s*("(?:\\\\.|[^"\\\\])*")`, 'u').exec(source);
103
- return decodeJsonString(match?.[1]);
104
- }
105
- function decodeJsonString(value) {
106
- if (value === undefined)
107
- return undefined;
108
- try {
109
- const parsed = JSON.parse(value);
110
- return typeof parsed === 'string' ? parsed : undefined;
111
- }
112
- catch {
113
- return undefined;
114
- }
115
- }
116
- function patchFileChanges(patch) {
117
- if (patch === undefined)
118
- return [];
119
- const changes = [];
120
- for (const line of patch.split(/\r?\n/u)) {
121
- const match = /^\*\*\* (Add|Delete|Update) File: (.+)$/u.exec(line);
122
- if (match?.[1] === undefined || match[2] === undefined)
123
- continue;
124
- const path = compactRunnerText(match[2], 4_096);
125
- if (path.length === 0)
126
- continue;
127
- changes.push({
128
- path,
129
- change: match[1] === 'Add' ? 'ADDED' : match[1] === 'Delete' ? 'DELETED' : 'MODIFIED',
130
- additions: null,
131
- deletions: null,
132
- diffAvailable: false
133
- });
134
- }
135
- return changes;
136
- }
137
67
  function isCommandTool(name) {
138
- return name === 'exec' || name === 'exec_command';
68
+ return name === 'exec_command';
139
69
  }
140
70
  function record(value) {
141
71
  return value !== null && typeof value === 'object' && !Array.isArray(value)
@@ -63,12 +63,17 @@ export class MarAgentConversationNormalizer {
63
63
  payload: { sections: [{ index: 0, text: compactRunnerText(event.text, 10_000) }] }
64
64
  }
65
65
  ];
66
- if (event.type === 'tool.started')
67
- return this.#toolStarted(event);
68
- if (event.type === 'tool.completed')
69
- return this.#toolCompleted(event);
70
- if (event.type === 'tool.failed')
66
+ if (event.type === 'tool.started' ||
67
+ event.type === 'tool.completed' ||
68
+ event.type === 'tool.failed') {
69
+ if (event.parentCallId !== undefined)
70
+ return [];
71
+ if (event.type === 'tool.started')
72
+ return this.#toolStarted(event);
73
+ if (event.type === 'tool.completed')
74
+ return this.#toolCompleted(event);
71
75
  return this.#toolFailed(event);
76
+ }
72
77
  if (event.type === 'hosted_tool.updated') {
73
78
  const sourceSummary = event.summary.sources
74
79
  ?.slice(0, 20)
@@ -670,7 +670,7 @@ export class MarAgentManagedRunController {
670
670
  this.host.refreshContext?.(runId);
671
671
  if (event.type === 'model.performance')
672
672
  this.host.emit(runId, 'run.performance', {
673
- ttftMs: event.ttftMs,
673
+ latencyMs: event.latencyMs,
674
674
  ...(event.tokensPerSecond === undefined ? {} : { tokensPerSecond: event.tokensPerSecond })
675
675
  });
676
676
  else if (event.type === 'message.delta')
@@ -15,11 +15,13 @@ export class RunEventService {
15
15
  if (run === undefined || !isPlainRecord(payload))
16
16
  return;
17
17
  const parsed = runPerformanceSchema.safeParse({ ...payload, runId: run.id });
18
- if (parsed.success)
18
+ if (parsed.success) {
19
+ this.flushText(runId);
19
20
  this.options.emitWorkbench('conversation', {
20
21
  sessionId: run.sessionId,
21
22
  performance: parsed.data
22
23
  });
24
+ }
23
25
  return;
24
26
  }
25
27
  if (eventType === 'text.delta' &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.9.136",
3
+ "version": "0.9.137",
4
4
  "description": "MyAgentRoam Node runtime CLI.",
5
5
  "license": "Apache-2.0 AND GPL-2.0-or-later",
6
6
  "type": "module",
@@ -35,9 +35,9 @@
35
35
  "ws": "^8.21.3",
36
36
  "zod": "4.4.3",
37
37
  "@myagentroam/marmgr": "0.9.119",
38
- "@myagentroam/protocol": "0.9.136",
39
38
  "@myagentroam/code-navigation": "0.9.129",
40
- "@myagentroam/agent": "0.9.136"
39
+ "@myagentroam/protocol": "0.9.137",
40
+ "@myagentroam/agent": "0.9.137"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/ws": "^8.18.1"