@dinoxx/dinox-cli 2.18.3 → 2.18.5

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.
@@ -68,12 +68,6 @@ export declare function quoteWindowsArg(value: string): string;
68
68
  export declare function splitWindowsCommandLine(commandLine: string): string[];
69
69
  /** The command line of a launcher written by renderWindowsLauncher. */
70
70
  export declare function parseWindowsLauncherCommand(launcher: string): string[] | null;
71
- /**
72
- * Task Scheduler runs console programs in a visible window, so the task runs
73
- * this script with wscript, which sets the daemon environment and starts the
74
- * supervisor with a hidden window (the launcher pattern pm2-windows-startup
75
- * uses). The supervisor then outlives the script.
76
- */
77
71
  export declare function renderWindowsLauncher(spec: DaemonServiceSpec): string;
78
72
  export declare function renderWindowsTaskXml(userId: string, wscriptPath: string, launcherPath: string): string;
79
73
  export type DaemonServiceOptions = {
@@ -87,5 +81,11 @@ export type DaemonServiceOptions = {
87
81
  /** Windows: `DOMAIN\\user` the logon task runs as. */
88
82
  windowsUserId?: string;
89
83
  };
84
+ /**
85
+ * `DOMAIN\\user` for the logon task. Outside an interactive logon (OpenSSH,
86
+ * some service hosts) USERDOMAIN is the workgroup name, which maps to no
87
+ * account; a local account is `COMPUTERNAME\\user`.
88
+ */
89
+ export declare function windowsTaskUser(env: NodeJS.ProcessEnv, user: string): string;
90
90
  /** The service manager for this platform, or null where none is supported. */
91
91
  export declare function getDaemonService(options?: DaemonServiceOptions): DaemonService | null;
@@ -372,6 +372,12 @@ function vbsString(value) {
372
372
  * supervisor with a hidden window (the launcher pattern pm2-windows-startup
373
373
  * uses). The supervisor then outlives the script.
374
374
  */
375
+ /**
376
+ * `//E:vbscript` names the engine, so the launcher runs even when the `.vbs`
377
+ * file association is broken (wscript then fails silently under //B with
378
+ * "There is no script engine for file extension .vbs").
379
+ */
380
+ const WSCRIPT_ARGS = ['//B', '//Nologo', '//E:vbscript'];
375
381
  export function renderWindowsLauncher(spec) {
376
382
  const commandLine = [spec.program, ...spec.args].map(quoteWindowsArg).join(' ');
377
383
  const env = Object.keys(spec.env)
@@ -380,6 +386,8 @@ export function renderWindowsLauncher(spec) {
380
386
  .join('\r\n');
381
387
  return [
382
388
  "' Generated by `dino daemon install`; rewritten when the CLI changes.",
389
+ // Run with //E:vbscript; the line changes the file so older registrations are rewritten.
390
+ "' Started as: wscript //B //Nologo //E:vbscript <this file>",
383
391
  'Set shell = CreateObject("WScript.Shell")',
384
392
  'Set env = shell.Environment("Process")',
385
393
  env,
@@ -427,7 +435,7 @@ export function renderWindowsTaskXml(userId, wscriptPath, launcherPath) {
427
435
  <Actions Context="Author">
428
436
  <Exec>
429
437
  <Command>${xmlEscape(wscriptPath)}</Command>
430
- <Arguments>${xmlEscape(`//B //Nologo ${quoteWindowsArg(launcherPath)}`)}</Arguments>
438
+ <Arguments>${xmlEscape(`${WSCRIPT_ARGS.join(' ')} ${quoteWindowsArg(launcherPath)}`)}</Arguments>
431
439
  </Exec>
432
440
  </Actions>
433
441
  </Task>
@@ -481,7 +489,7 @@ class WindowsTaskService {
481
489
  return launcher === null ? null : parseWindowsLauncherCommand(launcher);
482
490
  }
483
491
  launcherArgs() {
484
- return ['//B', '//Nologo', this.definitionPath];
492
+ return [...WSCRIPT_ARGS, this.definitionPath];
485
493
  }
486
494
  async isTaskRegistered() {
487
495
  return (await this.run('schtasks', ['/Query', '/TN', this.taskName])).code === 0;
@@ -573,6 +581,15 @@ class WindowsTaskService {
573
581
  return installed;
574
582
  }
575
583
  }
584
+ /**
585
+ * `DOMAIN\\user` for the logon task. Outside an interactive logon (OpenSSH,
586
+ * some service hosts) USERDOMAIN is the workgroup name, which maps to no
587
+ * account; a local account is `COMPUTERNAME\\user`.
588
+ */
589
+ export function windowsTaskUser(env, user) {
590
+ const domain = env.USERDOMAIN && env.USERDOMAIN.toUpperCase() !== 'WORKGROUP' ? env.USERDOMAIN : env.COMPUTERNAME;
591
+ return domain ? `${domain}\\${user}` : user;
592
+ }
576
593
  /** The service manager for this platform, or null where none is supported. */
577
594
  export function getDaemonService(options = {}) {
578
595
  const platform = options.platform ?? process.platform;
@@ -589,7 +606,7 @@ export function getDaemonService(options = {}) {
589
606
  if (platform === 'win32') {
590
607
  const systemRoot = env.SystemRoot || env.SYSTEMROOT || 'C:\\Windows';
591
608
  const user = env.USERNAME || os.userInfo().username;
592
- return new WindowsTaskService(label, run, options.launcherDir ?? path.join(getDataDir(), 'daemon'), path.join(systemRoot, 'System32', 'wscript.exe'), options.windowsUserId ?? (env.USERDOMAIN ? `${env.USERDOMAIN}\\${user}` : user));
609
+ return new WindowsTaskService(label, run, options.launcherDir ?? path.join(getDataDir(), 'daemon'), path.join(systemRoot, 'System32', 'wscript.exe'), options.windowsUserId ?? windowsTaskUser(env, user));
593
610
  }
594
611
  return null;
595
612
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinox-editor-dsh",
3
- "version": "2.18.3",
3
+ "version": "2.18.5",
4
4
  "private": true,
5
5
  "description": "Dinox note editor for DeepSeek Harness Desktop (built by @dinoxx/dinox-cli)",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": "/opt/hostedtoolcache/node/22.13.0/x64/bin/node",
3
3
  "cli": "/home/runner/work/dinox-cli/dinox-cli/dist/dinox.js",
4
- "version": "2.18.3"
4
+ "version": "2.18.5"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dinoxx/dinox-cli",
3
- "version": "2.18.3",
3
+ "version": "2.18.5",
4
4
  "description": "Dinox CLI",
5
5
  "main": "dist/dinox.js",
6
6
  "scripts": {