friend-assistant 0.1.111 → 0.1.112

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/BUILD.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "friend-assistant",
3
- "version": "0.1.111",
4
- "builtAt": "2026-11-27T17:54:50.050Z"
3
+ "version": "0.1.112",
4
+ "builtAt": "2026-11-27T18:06:56.316Z"
5
5
  }
package/dist/friend.mjs CHANGED
@@ -22092,7 +22092,11 @@ Move-Item -Force $part $agent
22092
22092
 
22093
22093
  # 3. start at every logon, and every five minutes if it is not running (after a crash or an update; while it runs the task ignores the trigger)
22094
22094
  $who = $env:USERDOMAIN + '\\' + $env:USERNAME
22095
- $action = New-ScheduledTaskAction -Execute $nodeExe -Argument ($q + $agent + $q) -WorkingDirectory $dir
22095
+ # node.exe is a console program and would open a terminal window at every logon: Windows Script Host starts it with no window at all
22096
+ $vbs = Join-Path $dir 'run.vbs'
22097
+ $vbsLines = @('Set s = CreateObject(' + $q + 'WScript.Shell' + $q + ')', ('s.CurrentDirectory = ' + $q + $dir + $q), ('rc = s.Run(' + $q + $q + $q + $nodeExe + $q + $q + ' ' + $q + $q + $agent + $q + $q + $q + ', 0, True)'), 'WScript.Quit rc')
22098
+ [IO.File]::WriteAllText($vbs, (($vbsLines -join [Environment]::NewLine) + [Environment]::NewLine), [Text.Encoding]::Default)
22099
+ $action = New-ScheduledTaskAction -Execute 'wscript.exe' -Argument ('//B //Nologo ' + $q + $vbs + $q) -WorkingDirectory $dir
22096
22100
  $trigger = @((New-ScheduledTaskTrigger -AtLogOn -User $who), (New-ScheduledTaskTrigger -Once -At ((Get-Date).AddMinutes(2)) -RepetitionInterval (New-TimeSpan -Minutes 5) -RepetitionDuration (New-TimeSpan -Days 3650)))
22097
22101
  $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -RestartCount 999 -RestartInterval (New-TimeSpan -Minutes 1) -ExecutionTimeLimit ([TimeSpan]::Zero) -MultipleInstances IgnoreNew
22098
22102
  $principal = New-ScheduledTaskPrincipal -UserId $who -LogonType Interactive -RunLevel Limited
@@ -29518,7 +29522,7 @@ function currentSelf() {
29518
29522
  // ../server/src/system/npm.ts
29519
29523
  import { spawn as spawn11 } from "node:child_process";
29520
29524
  var PACKAGE = "friend-assistant";
29521
- var runningVersion = () => true ? "0.1.111" : "development";
29525
+ var runningVersion = () => true ? "0.1.112" : "development";
29522
29526
  async function npmLatest(fetchFn = fetch, timeoutMs = 1e4) {
29523
29527
  try {
29524
29528
  const res = await fetchFn(`https://registry.npmjs.org/${PACKAGE}/latest`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(timeoutMs) });
@@ -35510,7 +35514,7 @@ import { appendFileSync } from "node:fs";
35510
35514
  import { join as join44 } from "node:path";
35511
35515
  var PACKAGE2 = "friend-assistant";
35512
35516
  var real2 = {
35513
- current: () => true ? "0.1.111" : "development",
35517
+ current: () => true ? "0.1.112" : "development",
35514
35518
  latest: () => new Promise((resolve13) => {
35515
35519
  const child = crossSpawn5("npm", ["view", PACKAGE2, "version", "--prefer-online"], { stdio: ["ignore", "pipe", "ignore"] });
35516
35520
  let out = "";
@@ -35828,7 +35832,7 @@ async function run2(argv, io2) {
35828
35832
  case "version":
35829
35833
  case "--version":
35830
35834
  case "-v":
35831
- io2.out(true ? "0.1.111" : "development");
35835
+ io2.out(true ? "0.1.112" : "development");
35832
35836
  return 0;
35833
35837
  case "lan":
35834
35838
  return await lanCommand(rest, io2);
@@ -30977,6 +30977,16 @@ async function takeLock(dir, log, waitMs = 8e3) {
30977
30977
  });
30978
30978
  return true;
30979
30979
  }
30980
+ function launcherVbs(dir, nodeExe, agentFile) {
30981
+ const q = (s) => s.replace(/"/g, '""');
30982
+ return [
30983
+ 'Set s = CreateObject("WScript.Shell")',
30984
+ `s.CurrentDirectory = "${q(dir)}"`,
30985
+ `rc = s.Run("""${q(nodeExe)}"" ""${q(agentFile)}""", 0, True)`,
30986
+ "WScript.Quit rc",
30987
+ ""
30988
+ ].join("\r\n");
30989
+ }
30980
30990
  var POWERSHELL = ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command"];
30981
30991
  function restartSoon(dir, log) {
30982
30992
  if (process.platform !== "win32" || process.env.FRIEND_PC_NO_TASK) return;
@@ -30986,28 +30996,50 @@ function restartSoon(dir, log) {
30986
30996
  log(`could not ask for a restart: ${e.message}`);
30987
30997
  }
30988
30998
  }
30989
- async function ensureWatchdog(log) {
30999
+ async function ensureWatchdog(dir, nodeExe, agentFile, log) {
30990
31000
  if (process.platform !== "win32" || process.env.FRIEND_PC_NO_TASK) return;
31001
+ const vbs = (0, import_node_path4.join)(dir, "run.vbs");
31002
+ try {
31003
+ (0, import_node_fs4.writeFileSync)(vbs, launcherVbs(dir, nodeExe, agentFile));
31004
+ } catch (e) {
31005
+ log(`could not write the launcher: ${e.message}`);
31006
+ return;
31007
+ }
31008
+ const q = (s) => `'${s.replace(/'/g, "''")}'`;
30991
31009
  const script = `$ErrorActionPreference = 'Stop'
30992
31010
  $task = '${TASK}'
31011
+ $vbs = ${q(vbs)}
31012
+ $dir = ${q(dir)}
30993
31013
  $t = Get-ScheduledTask -TaskName $task -ErrorAction SilentlyContinue
30994
31014
  if (-not $t) { Write-Output 'no task'; exit 0 }
30995
- foreach ($x in $t.Triggers) { if ($x.Repetition -and $x.Repetition.Interval) { Write-Output 'already'; exit 0 } }
30996
- $who = $env:USERDOMAIN + '\\' + $env:USERNAME
30997
- $triggers = @((New-ScheduledTaskTrigger -AtLogOn -User $who), (New-ScheduledTaskTrigger -Once -At ((Get-Date).AddMinutes(2)) -RepetitionInterval (New-TimeSpan -Minutes 5) -RepetitionDuration (New-TimeSpan -Days 3650)))
30998
- Set-ScheduledTask -TaskName $task -Trigger $triggers | Out-Null
30999
- Write-Output 'added'`;
31015
+ $did = @()
31016
+ $exe = ''
31017
+ if ($t.Actions.Count -gt 0) { $exe = [string]$t.Actions[0].Execute }
31018
+ if ($exe -notmatch 'wscript') {
31019
+ $action = New-ScheduledTaskAction -Execute 'wscript.exe' -Argument ('//B //Nologo ' + [char]34 + $vbs + [char]34) -WorkingDirectory $dir
31020
+ Set-ScheduledTask -TaskName $task -Action $action | Out-Null
31021
+ $did += 'hidden'
31022
+ }
31023
+ $has = $false
31024
+ foreach ($x in $t.Triggers) { if ($x.Repetition -and $x.Repetition.Interval) { $has = $true } }
31025
+ if (-not $has) {
31026
+ $who = $env:USERDOMAIN + '\\' + $env:USERNAME
31027
+ $triggers = @((New-ScheduledTaskTrigger -AtLogOn -User $who), (New-ScheduledTaskTrigger -Once -At ((Get-Date).AddMinutes(2)) -RepetitionInterval (New-TimeSpan -Minutes 5) -RepetitionDuration (New-TimeSpan -Days 3650)))
31028
+ Set-ScheduledTask -TaskName $task -Trigger $triggers | Out-Null
31029
+ $did += 'watchdog'
31030
+ }
31031
+ Write-Output ('changed: ' + ($did -join ','))`;
31000
31032
  await new Promise((resolve) => {
31001
31033
  (0, import_node_child_process3.execFile)("powershell.exe", [...POWERSHELL, script], { windowsHide: true, timeout: 3e4 }, (e, out) => {
31002
31034
  if (e) log(`could not check the restart task: ${e.message.split("\n")[0]}`);
31003
- else if (/added/.test(out)) log("the logon task now also starts the agent again every five minutes if it is not running");
31035
+ else if (/changed: \S/.test(out)) log(`the logon task was updated (${out.replace(/^[\s\S]*changed:\s*/, "").trim()}): it starts the agent without a window, and again every five minutes if it is not running`);
31004
31036
  resolve();
31005
31037
  });
31006
31038
  });
31007
31039
  }
31008
31040
 
31009
31041
  // ../pc-agent/src/main.ts
31010
- var VERSION = "0.1.111";
31042
+ var VERSION = "0.1.112";
31011
31043
  var TASK2 = "Friend PC Agent";
31012
31044
  function parse3(argv) {
31013
31045
  const out = {};
@@ -31105,7 +31137,7 @@ Friend PC Agent
31105
31137
  }
31106
31138
  });
31107
31139
  holder.agent = agent;
31108
- void ensureWatchdog(log);
31140
+ void ensureWatchdog(dir, process.execPath, self, log);
31109
31141
  const stop = () => void agent.stop().finally(() => process.exit(0));
31110
31142
  process.on("SIGINT", stop);
31111
31143
  process.on("SIGTERM", stop);
@@ -1 +1 @@
1
- 2d1596e6e39f65504e60bc1199c0b2562b7e6077ae06f6fc31e7219683fbc699
1
+ 5896d75c965a48307ff135ba9d476e23848f2a02aaafef6d741d74b00bde7477
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "friend-assistant",
3
- "version": "0.1.111",
3
+ "version": "0.1.112",
4
4
  "description": "A self-hosted personal AI assistant for your own PC: a full-screen stage, voice, tools with your approval, and your Claude subscription or a local model.",
5
5
  "keywords": ["ai", "assistant", "jarvis", "voice", "claude", "ollama", "mcp", "self-hosted"],
6
6
  "license": "UNLICENSED",