@xkwdstore/agent 2.1.2 → 2.1.3
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/README.md +4 -4
- package/package.json +1 -1
- package/scripts/install-machine-agent.ps1 +41 -7
- package/src/cli.js +1 -1
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ Terminal-only, cryptographically authenticated CLI for XKWDStore browser automat
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
> **@xkwdstore/agent 2.1.
|
|
7
|
+
> **@xkwdstore/agent 2.1.3 is the last version published on npm.**
|
|
8
8
|
>
|
|
9
|
-
> The current source version is **2.1.
|
|
9
|
+
> The current source version is **2.1.3** (machine-wide hardening). It is
|
|
10
10
|
> NOT claimed to be published unless the release workflow has published it — see
|
|
11
11
|
> `reports/` for the authoritative publication state.
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ curl -L -o "%TEMP%\xkwdstore-install.ps1" https://raw.githubusercontent.com/Essa
|
|
|
29
29
|
The generated launcher runs the pinned command:
|
|
30
30
|
|
|
31
31
|
```powershell
|
|
32
|
-
npx --yes @xkwdstore/agent@2.1.
|
|
32
|
+
npx --yes @xkwdstore/agent@2.1.3 start
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Automated installer tests use `-NoLaunch` or a mocked `npx` command so the
|
|
@@ -203,7 +203,7 @@ The agent does NOT update itself. To use a newer version, change the version
|
|
|
203
203
|
number in the command. The pinned command for this release is:
|
|
204
204
|
|
|
205
205
|
```powershell
|
|
206
|
-
npx --yes @xkwdstore/agent@2.1.
|
|
206
|
+
npx --yes @xkwdstore/agent@2.1.3 start
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
> 2.1.0 is the current local agent version (machine-wide hardening).
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# XKWDStore Agent
|
|
1
|
+
# XKWDStore Agent - Machine-Wide Silent Startup (version from -AgentVersion)
|
|
2
2
|
#
|
|
3
3
|
# Installs / removes the machine-wide BROKER + per-session interactive WORKER
|
|
4
4
|
# startup. This script MUST run elevated (it creates a Windows service and writes
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
# -NoLaunch (test) validate + write files, never start a process
|
|
36
36
|
|
|
37
37
|
param(
|
|
38
|
-
[string]$AgentVersion = '2.1.
|
|
38
|
+
[string]$AgentVersion = '2.1.3',
|
|
39
39
|
[string]$Server = 'https://x.kwdstore.com',
|
|
40
40
|
[string]$ServiceAccount = 'LocalSystem',
|
|
41
41
|
[string]$AgentRoot,
|
|
@@ -69,10 +69,10 @@ function Get-NodePath {
|
|
|
69
69
|
return $cmd.Source
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
#
|
|
72
|
+
# -- install -----------------------------------------------------------------
|
|
73
73
|
if (-not $Uninstall) {
|
|
74
74
|
Write-Host ''
|
|
75
|
-
Write-Host
|
|
75
|
+
Write-Host " XKWDStore Agent $AgentVersion - machine-wide silent startup" -ForegroundColor Cyan
|
|
76
76
|
Write-Host ' ==================================================' -ForegroundColor Cyan
|
|
77
77
|
Assert-Elevated
|
|
78
78
|
$node = Get-NodePath
|
|
@@ -106,6 +106,40 @@ if (-not $Uninstall) {
|
|
|
106
106
|
Write-Warn2 "agent src not found next to the installer; using the repo path in the service wrapper"
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
# 1a-bis. Provision the RUNTIME DEPENDENCIES into the install dir.
|
|
110
|
+
# The block above copies a `node_modules` only if one sits next to the
|
|
111
|
+
# installer. A normal `npm install @xkwdstore/agent` hoists the agent's
|
|
112
|
+
# dependencies to the CALLER's node_modules, so the package directory ships
|
|
113
|
+
# none. Copying only what happens to be there therefore produced an install
|
|
114
|
+
# with no dependencies at all, and the broker died on its first bare
|
|
115
|
+
# `require('playwright-core')` - a MODULE_NOT_FOUND crash-loop masked by the
|
|
116
|
+
# service restarting it. The installer must guarantee the dependency tree
|
|
117
|
+
# exists, not hope it was shipped alongside.
|
|
118
|
+
$agentPkgJson = Join-Path $AgentInstallDir 'package.json'
|
|
119
|
+
if (Test-Path -LiteralPath $agentPkgJson) {
|
|
120
|
+
$depProbe = Join-Path $AgentInstallDir 'node_modules\playwright-core'
|
|
121
|
+
if (-not (Test-Path -LiteralPath $depProbe)) {
|
|
122
|
+
$agentLockJson = Join-Path $AgentInstallDir 'package-lock.json'
|
|
123
|
+
Write-Step 'provisioning agent runtime dependencies (npm)'
|
|
124
|
+
Push-Location $AgentInstallDir
|
|
125
|
+
try {
|
|
126
|
+
if (Test-Path -LiteralPath $agentLockJson) {
|
|
127
|
+
& npm ci --omit=dev --no-audit --no-fund *> $null
|
|
128
|
+
} else {
|
|
129
|
+
& npm install --omit=dev --no-audit --no-fund *> $null
|
|
130
|
+
}
|
|
131
|
+
} finally { Pop-Location }
|
|
132
|
+
if (-not (Test-Path -LiteralPath $depProbe)) {
|
|
133
|
+
Write-Host ' X agent runtime dependencies could not be provisioned.' -ForegroundColor Red
|
|
134
|
+
Write-Host ' The agent needs npm + network access on this machine.' -ForegroundColor Red
|
|
135
|
+
exit 1
|
|
136
|
+
}
|
|
137
|
+
Write-Ok 'agent runtime dependencies provisioned'
|
|
138
|
+
} else {
|
|
139
|
+
Write-Ok 'agent runtime dependencies already present'
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
109
143
|
# 1b. place the worker-entry launcher where the logon task expects it AND the
|
|
110
144
|
# installer-managed scripts next to the installed program files.
|
|
111
145
|
$workerEntrySrc = Join-Path $PSScriptRoot 'worker-entry.js'
|
|
@@ -266,7 +300,7 @@ try {
|
|
|
266
300
|
$staleCmd = Join-Path $MachineRoot 'launcher\broker-service.cmd'
|
|
267
301
|
if (Test-Path -LiteralPath $staleCmd) { Remove-Item $staleCmd -Force -ErrorAction SilentlyContinue }
|
|
268
302
|
|
|
269
|
-
# 4. per-session worker fallback (logon task)
|
|
303
|
+
# 4. per-session worker fallback (logon task) - only used if session spawning is unavailable
|
|
270
304
|
$taskName = 'XKWDStoreAgentWorker'
|
|
271
305
|
try {
|
|
272
306
|
$action = New-ScheduledTaskAction -Execute $node -Argument "`"$workerEntryDst`""
|
|
@@ -325,9 +359,9 @@ try {
|
|
|
325
359
|
exit 0
|
|
326
360
|
}
|
|
327
361
|
|
|
328
|
-
#
|
|
362
|
+
# -- uninstall ---------------------------------------------------------------
|
|
329
363
|
Write-Host ''
|
|
330
|
-
Write-Host
|
|
364
|
+
Write-Host " XKWDStore Agent $AgentVersion - uninstall" -ForegroundColor Cyan
|
|
331
365
|
Assert-Elevated
|
|
332
366
|
$svc = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
|
333
367
|
if ($svc) {
|
package/src/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ const crypto = require('crypto');
|
|
|
24
24
|
const os = require('os');
|
|
25
25
|
const path = require('path');
|
|
26
26
|
|
|
27
|
-
const CLI_VERSION = '2.1.
|
|
27
|
+
const CLI_VERSION = '2.1.3';
|
|
28
28
|
const PROTOCOL_VERSION = 2;
|
|
29
29
|
|
|
30
30
|
// ── Command parsing ──────────────────────────────────────────────────────────
|