@ramarivera/coding-agent-langfuse 0.1.55 → 0.1.56
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/service.js +18 -3
- package/package.json +1 -1
package/dist/service.js
CHANGED
|
@@ -368,15 +368,30 @@ function renderWindowsScript(command) {
|
|
|
368
368
|
const commandArray = command.map(powershellString).join(", ");
|
|
369
369
|
return `param(
|
|
370
370
|
[switch]$Install,
|
|
371
|
+
[switch]$Run,
|
|
371
372
|
[string]$TaskName = "CodingAgentLangfuse"
|
|
372
373
|
)
|
|
373
374
|
|
|
374
375
|
$Command = @(${commandArray})
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
|
|
377
|
+
function Quote-PowerShellLiteral([string]$Value) {
|
|
378
|
+
return "'" + $Value.Replace("'", "''") + "'"
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if ($Run) {
|
|
382
|
+
& $Command[0] @($Command | Select-Object -Skip 1)
|
|
383
|
+
exit $LASTEXITCODE
|
|
384
|
+
}
|
|
378
385
|
|
|
379
386
|
if ($Install) {
|
|
387
|
+
$ScriptPath = if ($PSCommandPath) { $PSCommandPath } else { $MyInvocation.MyCommand.Path }
|
|
388
|
+
$RunCommand = "& " + (Quote-PowerShellLiteral $ScriptPath) + " -Run"
|
|
389
|
+
$EncodedRunCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($RunCommand))
|
|
390
|
+
$Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -EncodedCommand $EncodedRunCommand"
|
|
391
|
+
$Trigger = New-ScheduledTaskTrigger -AtLogOn
|
|
392
|
+
$Settings = New-ScheduledTaskSettingsSet -RestartCount 999 -RestartInterval (New-TimeSpan -Minutes 1) -Hidden
|
|
393
|
+
|
|
394
|
+
Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
380
395
|
Register-ScheduledTask -TaskName $TaskName -Action $Action -Trigger $Trigger -Settings $Settings -Force | Out-Null
|
|
381
396
|
Start-ScheduledTask -TaskName $TaskName
|
|
382
397
|
}
|