@cydm/magic-shell-agent-node 0.1.15 → 0.1.17

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.
@@ -1,4 +1,20 @@
1
- export function normalizeWorkerTitleCandidate(raw) {
1
+ function isShellNoiseTitle(value) {
2
+ const normalized = value.trim().toLowerCase();
3
+ if (!normalized)
4
+ return true;
5
+ if (normalized.startsWith("/"))
6
+ return true;
7
+ if (/^[a-z]:\\windows\\system32\\cmd(?:\.exe)?$/i.test(normalized))
8
+ return true;
9
+ if (/^[a-z]:\\windows\\system32\\windowspowershell\\v1\.0\\powershell(?:\.exe)?$/i.test(normalized))
10
+ return true;
11
+ if (/^[a-z]:\\windows\\system32\\wt(?:\.exe)?$/i.test(normalized))
12
+ return true;
13
+ if (/^(cmd|cmd\.exe|powershell|powershell\.exe|pwsh|pwsh\.exe|wt|wt\.exe)$/i.test(normalized))
14
+ return true;
15
+ return false;
16
+ }
17
+ function normalizeVisibleTitle(raw, maxLength) {
2
18
  const cleaned = raw
3
19
  .split(/\n{2,}/)[0]
4
20
  .split("\n")[0]
@@ -6,13 +22,16 @@ export function normalizeWorkerTitleCandidate(raw) {
6
22
  .replace(/Reply to the primary agent now.*$/i, "")
7
23
  .replace(/\s+/g, " ")
8
24
  .trim();
9
- const title = cleaned.slice(0, 48);
25
+ const title = cleaned.slice(0, maxLength).trim();
10
26
  if (!title)
11
27
  return null;
12
- if (title.startsWith("/"))
28
+ if (isShellNoiseTitle(title))
13
29
  return null;
14
30
  return title;
15
31
  }
32
+ export function normalizeWorkerTitleCandidate(raw) {
33
+ return normalizeVisibleTitle(raw, 48);
34
+ }
16
35
  export function extractTerminalMetadata(output, agentType) {
17
36
  const matches = Array.from(output.matchAll(/\x1b\](?:0|2);([^\x07\x1b]*)(?:\x07|\x1b\\)/g));
18
37
  if (!matches.length) {
@@ -44,7 +63,7 @@ export function extractTerminalMetadata(output, agentType) {
44
63
  const normalized = agentType === "pie"
45
64
  ? visibleTitle.replace(/^Pie\s*[·-]\s*/i, "")
46
65
  : visibleTitle;
47
- const title = normalized.trim().replace(/\s+/g, " ").slice(0, 60);
66
+ const title = normalizeVisibleTitle(normalized, 60);
48
67
  if (title) {
49
68
  metadata.title = title;
50
69
  }
@@ -3082,6 +3082,8 @@
3082
3082
  if (!summary) return true;
3083
3083
  const normalized = String(summary).toLowerCase();
3084
3084
  return normalized.includes('detail requested')
3085
+ || normalized.includes(' launched in ')
3086
+ || normalized.includes(' relaunched in ')
3085
3087
  || normalized.includes('attached from browser')
3086
3088
  || normalized.includes('control snapshot')
3087
3089
  || normalized.includes('attached ')
@@ -3093,7 +3095,7 @@
3093
3095
  if (worker.interventionReason) return worker.interventionReason;
3094
3096
  if (worker.attentionReason) return worker.attentionReason;
3095
3097
  if (worker.lastEventSummary && !isControlNoise(worker.lastEventSummary)) return worker.lastEventSummary;
3096
- return worker.cwd || '.';
3098
+ return pathBaseName(worker.cwd || '.');
3097
3099
  }
3098
3100
 
3099
3101
  function renderWorkers() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/magic-shell-agent-node",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Magic Shell Agent Node - Local agent connector",
5
5
  "homepage": "https://magicshell.ai",
6
6
  "keywords": [