ai_co_discuss 0.2.58 → 0.2.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.2.58",
3
+ "version": "0.2.60",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -71,11 +71,27 @@ conversation 还须 current_session_id,当前会话接手首个主持任务。
71
71
  // Windows PowerShell 5.1 ships WinForms. A background process cannot take the foreground, so the owner must be
72
72
  // shown (off-screen) as a topmost window; the dialog it owns then stays above the browser that asked for it.
73
73
  // windowsHide turns the process's first Show into a hide, so the owner is shown a second time to really appear.
74
+ // Foreground rights are not guaranteed to a background process either, so a timer in the dialog's message loop pins the dialog owned by the hidden form topmost.
75
+ // The C# source must not contain single quotes: it is embedded in a single-quoted PowerShell string.
76
+ const PICKER_RAISE_SOURCE = [
77
+ 'using System; using System.Runtime.InteropServices;',
78
+ 'public static class PickerRaise {',
79
+ ' delegate bool EnumProc(IntPtr handle, IntPtr arg);',
80
+ ' [DllImport("user32.dll")] static extern bool EnumWindows(EnumProc proc, IntPtr arg);',
81
+ ' [DllImport("user32.dll")] static extern IntPtr GetWindow(IntPtr handle, uint command);',
82
+ ' [DllImport("user32.dll")] static extern bool SetWindowPos(IntPtr handle, IntPtr after, int x, int y, int width, int height, uint flags);',
83
+ ' public static void OwnedBy(IntPtr owner) {',
84
+ ' EnumWindows((handle, arg) => { if (GetWindow(handle, 4) == owner) SetWindowPos(handle, (IntPtr)(-1), 0, 0, 0, 0, 0x13); return true; }, IntPtr.Zero);',
85
+ ' }',
86
+ '}',
87
+ ].join(' ');
74
88
  const WINDOWS_PICKER = [
75
89
  'Add-Type -AssemblyName System.Windows.Forms',
76
90
  '[Console]::OutputEncoding = [Text.Encoding]::UTF8',
77
91
  '$owner = New-Object System.Windows.Forms.Form -Property @{ TopMost = $true; ShowInTaskbar = $false; FormBorderStyle = "None"; StartPosition = "Manual"; Location = New-Object System.Drawing.Point(-32000, -32000); Size = New-Object System.Drawing.Size(1, 1) }',
92
+ `Add-Type -TypeDefinition '${PICKER_RAISE_SOURCE}'`,
78
93
  '$owner.Show(); $owner.Hide(); $owner.Show(); $owner.Activate()',
94
+ '$timer = New-Object System.Windows.Forms.Timer -Property @{ Interval = 150 }; $timer.Add_Tick({ [PickerRaise]::OwnedBy($owner.Handle) }); $timer.Start()',
79
95
  '$dialog = New-Object System.Windows.Forms.FolderBrowserDialog -Property @{ Description = "选择项目目录"; ShowNewFolderButton = $true }',
80
96
  'if ($dialog.ShowDialog($owner) -eq "OK") { $dialog.SelectedPath }',
81
97
  '$owner.Close()',