newmark-agent 0.4.4 → 0.4.6

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.
@@ -1,4 +1,4 @@
1
- export declare const CLI_COMMANDS: readonly ["state", "tool", "send", "validate-models", "fuzzy-inject", "skills-market", "memory-lab", "install-update", "compat", "compat-tool"];
1
+ export declare const CLI_COMMANDS: readonly ["state", "tool", "send", "validate-models", "fuzzy-inject", "skills-market", "memory-lab", "install-update", "compat", "compat-tool", "pair", "remote"];
2
2
  export declare function cliHelpRequested(args: string[]): boolean;
3
3
  /**
4
4
  * Compatibility discovery reads third-party metadata outside the selected
@@ -49,7 +49,8 @@ const compat_1 = require("./core/compat");
49
49
  const dshCompatibility_1 = require("./core/dshCompatibility");
50
50
  const memoryLab_1 = require("./core/memoryLab");
51
51
  const installUpdate_1 = require("./core/installUpdate");
52
- exports.CLI_COMMANDS = ['state', 'tool', 'send', 'validate-models', 'fuzzy-inject', 'skills-market', 'memory-lab', 'install-update', 'compat', 'compat-tool'];
52
+ const mobilePairing_1 = require("./core/mobilePairing");
53
+ exports.CLI_COMMANDS = ['state', 'tool', 'send', 'validate-models', 'fuzzy-inject', 'skills-market', 'memory-lab', 'install-update', 'compat', 'compat-tool', 'pair', 'remote'];
53
54
  const CLI_COMMAND_HELP = {
54
55
  state: [
55
56
  'Usage: Newmark.exe state [--root <dir>]',
@@ -80,9 +81,17 @@ const CLI_COMMAND_HELP = {
80
81
  'Usage: Newmark.exe memory-lab [--read|--component <name>|--update ...|--reindex] [--root <dir>]',
81
82
  'Read or update the local Memory Lab index and components.',
82
83
  ],
84
+ pair: [
85
+ 'Usage: Newmark.exe pair [--root <dir>]',
86
+ 'Print a Tailscale pairing QR code and URL for the Newmark mobile app.',
87
+ ],
88
+ remote: [
89
+ 'Usage: Newmark.exe remote --on|--off [--root <dir>]',
90
+ 'Enable or disable mobile remote-touch over Tailscale.',
91
+ ],
83
92
  'install-update': [
84
- 'Usage: Newmark.exe install-update (--source <path>|--check-github|--from-github) [options] [--root <dir>]',
85
- 'Inspect or apply a local/GitHub update using the selected install target.',
93
+ 'Usage: Newmark.exe install-update (--source <path>|--check-github|--from-github|--msi <path>) [options] [--root <dir>]',
94
+ 'Inspect or apply a local/GitHub update, or run a managed MSI install with process confirmation, previous-version uninstall, and legacy cleanup.',
86
95
  ],
87
96
  compat: [
88
97
  'Usage: Newmark.exe compat [--target all|tools|plugins|dsh|marketplaces|skills|agents|subagents] [--root <dir>]',
@@ -104,12 +113,12 @@ const CLI_VALUE_FLAGS = new Set([
104
113
  '--candidate-models', '--protocol', '--query', '--type', '--path', '--component', '--source-id',
105
114
  '--remove-source', '--enable-source', '--disable-source', '--source', '--target', '--target-file',
106
115
  '--expected-version', '--preserve', '--repo', '--tag', '--asset', '--version', '--content-file',
107
- '--content', '--description', '--tags',
116
+ '--content', '--description', '--tags', '--msi', '--log-dir',
108
117
  ]);
109
118
  const CLI_BOOLEAN_FLAGS = new Set([
110
119
  '--persist', '--agent-only', '--list', '--preview-only', '--sources', '--add-source', '--check-github',
111
120
  '--from-github', '--dry-run', '--read', '--index', '--reindex', '--update', '--version', '--folder', '--help', '-h',
112
- '--branch-communication',
121
+ '--branch-communication', '--yes', '--confirm-stop', '--confirm-remove-legacy', '--no-uninstall-previous', '--no-elevate',
113
122
  ]);
114
123
  function invalidCliCommandArgument(args) {
115
124
  let skipNext = false;
@@ -712,6 +721,41 @@ async function runCliCommand(root, args) {
712
721
  }
713
722
  agent.setMode(requestedMode);
714
723
  }
724
+ if (command === 'pair') {
725
+ const qr = await (0, mobilePairing_1.pairingQrAscii)(root);
726
+ safeStdout(qr.ascii + '\n');
727
+ safeStdout(`\nPairing URL: ${qr.session.url}\n`);
728
+ safeStdout(`Token file: ${(0, mobilePairing_1.pairingTokenPath)(root)}\n`);
729
+ const expiresIn = Math.max(0, Math.round((qr.session.expiresAt - Date.now()) / 1000));
730
+ safeStdout(`Window: ${expiresIn}s — scan with the Newmark mobile app. Waiting for confirmation...\n`);
731
+ const deadline = qr.session.expiresAt + 1000;
732
+ while (Date.now() < deadline) {
733
+ await new Promise(resolve => setTimeout(resolve, 1000));
734
+ const status = (0, mobilePairing_1.pairingStatus)(root);
735
+ if (status.confirmed) {
736
+ safeStdout('\n✓ Paired successfully. QR window closed.\n');
737
+ return true;
738
+ }
739
+ if (status.expired || !status.active) {
740
+ safeStdout("\n✗ Pairing window expired. Run 'pair' again for a new QR.\n");
741
+ return false;
742
+ }
743
+ }
744
+ return false;
745
+ }
746
+ if (command === 'remote') {
747
+ const on = args.includes('--on');
748
+ const off = args.includes('--off');
749
+ if (on === off) {
750
+ safeStderr('Usage: Newmark.exe remote --on|--off\n');
751
+ process.exitCode = 2;
752
+ return true;
753
+ }
754
+ agent.config.set('remote', 'touch_enabled', on);
755
+ agent.config.save();
756
+ safeStdout(`Remote touch ${on ? 'enabled' : 'disabled'}\n`);
757
+ return true;
758
+ }
715
759
  if (command === 'state') {
716
760
  printJson(safeState(agent, root));
717
761
  return true;
@@ -963,10 +1007,47 @@ async function runCliCommand(root, args) {
963
1007
  process.exitCode = 1;
964
1008
  return true;
965
1009
  }
1010
+ if (args.includes('--msi')) {
1011
+ const msiPath = argValue(args, '--msi') || positionalAfter(args, 'install-update')[0] || '';
1012
+ const confirmAll = args.includes('--yes');
1013
+ const stopConfirmed = confirmAll || args.includes('--confirm-stop');
1014
+ const removeLegacyConfirmed = confirmAll || args.includes('--confirm-remove-legacy');
1015
+ const options = {
1016
+ stopConfirmed,
1017
+ removeLegacyConfirmed,
1018
+ uninstallPrevious: !args.includes('--no-uninstall-previous'),
1019
+ allowElevate: !args.includes('--no-elevate'),
1020
+ logDir: argValue(args, '--log-dir') || root,
1021
+ };
1022
+ const plan = (0, installUpdate_1.planManagedMsiInstall)(msiPath, options);
1023
+ if (!plan.ok) {
1024
+ printJson(plan);
1025
+ safeStderr(`Managed MSI install cannot start: ${plan.error || 'unknown error'}\n`);
1026
+ process.exitCode = 1;
1027
+ return true;
1028
+ }
1029
+ if (plan.needsStopConfirmation) {
1030
+ printJson(plan);
1031
+ safeStderr('Running Newmark processes were found. Re-run with --confirm-stop (or --yes) to stop them before installing.\n');
1032
+ process.exitCode = 2;
1033
+ return true;
1034
+ }
1035
+ if (plan.needsLegacyRemovalConfirmation) {
1036
+ printJson(plan);
1037
+ safeStderr('Legacy Newmark executables were found outside the install target. Re-run with --confirm-remove-legacy (or --yes) to remove them.\n');
1038
+ process.exitCode = 2;
1039
+ return true;
1040
+ }
1041
+ const result = (0, installUpdate_1.executeManagedMsiInstall)(msiPath, options);
1042
+ printJson(result);
1043
+ if (!result.ok)
1044
+ process.exitCode = 1;
1045
+ return true;
1046
+ }
966
1047
  const source = pathArgValue(args, '--source') || positionalAfter(args, 'install-update')[0] || '';
967
1048
  const target = pathArgValue(args, '--target') || root;
968
1049
  if (!source) {
969
- safeStderr('Usage: Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]\n');
1050
+ safeStderr('Usage: Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github|--msi <path>) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]\n');
970
1051
  process.exitCode = 1;
971
1052
  return true;
972
1053
  }
@@ -1082,7 +1163,8 @@ function cliCommandUsage() {
1082
1163
  ' Newmark.exe fuzzy-inject [--name <provider>] [--env-file <PowerShell-or-dotenv-file>|--env-file-env <ENV_WITH_FILE_PATH>] [--endpoint-env <ENV_WITH_BASE_URL>] [--key-env <ENV_WITH_API_KEY>] [--protocol openai|anthropic] [--preview-only] [--root <dir>]',
1083
1164
  ' Newmark.exe skills-market [--query <text>|--sources|--add-source --name <name> (--url <url>|--path <path>) [--type json|skill-url|local-dir]|--remove-source <id>|--enable-source <id>|--disable-source <id>] [--root <dir>]',
1084
1165
  ' Newmark.exe memory-lab [--read|--component <name>|--update --name <name> --description <text> --tags <csv> --content-file <path> [--folder]|--reindex] [--root <dir>]',
1085
- ' Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]',
1166
+ ' Newmark.exe pair [--root <dir>]',
1167
+ ' Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github|--msi <path>) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--confirm-stop|--confirm-remove-legacy|--yes] [--no-uninstall-previous] [--no-elevate] [--log-dir <dir>] [--root <dir>]',
1086
1168
  ' Newmark.exe compat [--target all|tools|plugins|marketplaces|skills|agents|subagents] [--root <dir>]',
1087
1169
  ' Newmark.exe compat-tool --list | --name <opencode-tool> [json-args | --args-file path] [--root <dir>]',
1088
1170
  `Working directory fallback: ${path.resolve('.')}`,
@@ -64,6 +64,8 @@ const VALUE_FLAGS = new Set([
64
64
  '--inspect-port',
65
65
  '--js-flags',
66
66
  '--viewer-request',
67
+ '--msi',
68
+ '--log-dir',
67
69
  ]);
68
70
  const BOOLEAN_FLAGS = new Set([
69
71
  '--tui',
@@ -76,6 +78,7 @@ const BOOLEAN_FLAGS = new Set([
76
78
  '-v',
77
79
  '-version',
78
80
  '--automation-wake',
81
+ '--no-browser',
79
82
  '--newmark-viewer',
80
83
  '--allow-multiple-instances',
81
84
  '--disable-gpu',
@@ -101,6 +104,11 @@ const BOOLEAN_FLAGS = new Set([
101
104
  '--limit',
102
105
  '--scopes',
103
106
  '--web',
107
+ '--yes',
108
+ '--confirm-stop',
109
+ '--confirm-remove-legacy',
110
+ '--no-uninstall-previous',
111
+ '--no-elevate',
104
112
  ]);
105
113
  /** Public version spellings accepted by every Newmark entrypoint. */
106
114
  function isVersionArgument(args) {