@mjasnikovs/pi-task 0.40.48 → 0.40.49

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.
@@ -23,7 +23,7 @@ const USER_BASH_ENV = 'PI_TASK_USER_BASH_ENV';
23
23
  /** Start tracking a child about to be spawned with `base` as its environment. */
24
24
  export function trackLeftovers(platform, base, graceMs) {
25
25
  if (platform === 'win32')
26
- return trackShells(base, graceMs);
26
+ return trackShells(base);
27
27
  if (platform === 'linux' || platform === 'darwin')
28
28
  return trackToken(platform, base, graceMs);
29
29
  return { env: base, reap: () => Promise.resolve() };
@@ -141,7 +141,7 @@ export const BASH_ENV_SCRIPT = [
141
141
  `trap '__pi_task_now 1; printf "exited %s %s\\n" "$__pi_task_winpid" "$__pi_task_t" >> "$${SHELL_REGISTRY_ENV}"' EXIT`,
142
142
  ''
143
143
  ].join('\n');
144
- function trackShells(base, graceMs) {
144
+ function trackShells(base) {
145
145
  let dir;
146
146
  try {
147
147
  dir = fs.mkdtempSync(path.join(os.tmpdir(), 'pi-task-shells-'));
@@ -165,8 +165,7 @@ function trackShells(base, graceMs) {
165
165
  const shells = parseShells(fs.existsSync(registry) ? fs.readFileSync(registry, 'utf8') : '');
166
166
  if (shells.length === 0)
167
167
  return;
168
- const table = await processTable(graceMs);
169
- const started = startedByShells(parseProcessTable(table), shells);
168
+ const started = startedByShells(parseProcessTable(await processTable()), shells);
170
169
  await Promise.all(started.map(taskkillTree));
171
170
  }
172
171
  catch {
@@ -238,22 +237,18 @@ export function parseProcessTable(text) {
238
237
  return rows;
239
238
  }
240
239
  /**
241
- * Every process as `pid ppid creation-FILETIME`, one per line. A CIM query that
242
- * has not answered within the kill grace is given up on: the run is waiting.
240
+ * Every process as `pid ppid creation-FILETIME`, one per line. Not bounded: a cold
241
+ * WMI outlasted the kill grace on the windows runner, and a query cut short reaps nothing.
243
242
  */
244
- function processTable(graceMs) {
243
+ function processTable() {
245
244
  const query = 'Get-CimInstance Win32_Process -Property ProcessId,ParentProcessId,CreationDate'
246
245
  + ' | ForEach-Object { "$($_.ProcessId) $($_.ParentProcessId) $($_.CreationDate.ToFileTimeUtc())" }';
247
246
  return new Promise(resolve => {
248
247
  let out = '';
249
248
  const ps = spawn(system32('WindowsPowerShell', 'v1.0', 'powershell.exe'), ['-NoProfile', '-NonInteractive', '-Command', query], { stdio: ['ignore', 'pipe', 'ignore'] });
250
- const giveUp = setTimeout(() => ps.kill(), graceMs);
251
249
  ps.stdout.on('data', (d) => (out += d.toString()));
252
250
  ps.on('error', () => resolve(''));
253
- ps.on('close', () => {
254
- clearTimeout(giveUp);
255
- resolve(out);
256
- });
251
+ ps.on('close', () => resolve(out));
257
252
  });
258
253
  }
259
254
  function taskkillTree(pid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.40.48",
3
+ "version": "0.40.49",
4
4
  "description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",