tmux-agent-monitor 0.0.16 → 0.0.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.
- package/dist/index.js +40 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1881,6 +1881,34 @@ const buildAgent = (hint) => {
|
|
|
1881
1881
|
return "unknown";
|
|
1882
1882
|
};
|
|
1883
1883
|
const mergeHints = (...parts) => parts.filter((part) => Boolean(part && part.trim().length > 0)).join(" ");
|
|
1884
|
+
const editorCommandNames = new Set([
|
|
1885
|
+
"vim",
|
|
1886
|
+
"nvim",
|
|
1887
|
+
"vi",
|
|
1888
|
+
"gvim",
|
|
1889
|
+
"nvim-qt",
|
|
1890
|
+
"neovim"
|
|
1891
|
+
]);
|
|
1892
|
+
const agentHintPattern = /codex|claude/i;
|
|
1893
|
+
const isEditorCommand = (command) => {
|
|
1894
|
+
if (!command) return false;
|
|
1895
|
+
const trimmed = command.trim();
|
|
1896
|
+
if (!trimmed) return false;
|
|
1897
|
+
const binary = trimmed.split(/\s+/)[0] ?? "";
|
|
1898
|
+
if (!binary) return false;
|
|
1899
|
+
return editorCommandNames.has(path.basename(binary));
|
|
1900
|
+
};
|
|
1901
|
+
const editorCommandHasAgentArg = (command) => {
|
|
1902
|
+
if (!command) return false;
|
|
1903
|
+
const trimmed = command.trim();
|
|
1904
|
+
if (!trimmed) return false;
|
|
1905
|
+
const tokens = trimmed.split(/\s+/);
|
|
1906
|
+
const binary = tokens.shift() ?? "";
|
|
1907
|
+
if (!editorCommandNames.has(path.basename(binary))) return false;
|
|
1908
|
+
const rest = tokens.join(" ");
|
|
1909
|
+
return rest.length > 0 && agentHintPattern.test(rest);
|
|
1910
|
+
};
|
|
1911
|
+
const hasAgentHint = (value) => Boolean(value && agentHintPattern.test(value));
|
|
1884
1912
|
const processCacheTtlMs = 5e3;
|
|
1885
1913
|
const processCommandCache = /* @__PURE__ */ new Map();
|
|
1886
1914
|
const ttyAgentCache = /* @__PURE__ */ new Map();
|
|
@@ -2110,9 +2138,19 @@ const createSessionMonitor = (adapter, config) => {
|
|
|
2110
2138
|
const activePaneIds = /* @__PURE__ */ new Set();
|
|
2111
2139
|
for (const pane of panes) {
|
|
2112
2140
|
if (pane.pipeTagValue === null) pane.pipeTagValue = await inspector.readUserOption(pane.paneId, "@tmux-agent-monitor_pipe");
|
|
2113
|
-
|
|
2141
|
+
const baseHint = mergeHints(pane.currentCommand, pane.paneStartCommand, pane.paneTitle);
|
|
2142
|
+
const isEditorPane = isEditorCommand(pane.currentCommand) || isEditorCommand(pane.paneStartCommand);
|
|
2143
|
+
let processCommand = null;
|
|
2144
|
+
let ignoreEditor = false;
|
|
2145
|
+
if (isEditorPane) if (editorCommandHasAgentArg(pane.paneStartCommand) || hasAgentHint(pane.paneTitle)) ignoreEditor = true;
|
|
2146
|
+
else {
|
|
2147
|
+
processCommand = await getProcessCommand(pane.panePid);
|
|
2148
|
+
if (editorCommandHasAgentArg(processCommand)) ignoreEditor = true;
|
|
2149
|
+
}
|
|
2150
|
+
if (ignoreEditor) continue;
|
|
2151
|
+
let agent = buildAgent(baseHint);
|
|
2114
2152
|
if (agent === "unknown") {
|
|
2115
|
-
|
|
2153
|
+
if (!processCommand) processCommand = await getProcessCommand(pane.panePid);
|
|
2116
2154
|
if (processCommand) agent = buildAgent(processCommand);
|
|
2117
2155
|
}
|
|
2118
2156
|
if (agent === "unknown") agent = await findAgentFromPidTree(pane.panePid);
|