@atlas-coder/atlas-agent 0.15.2 → 0.15.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 +19 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +2 -0
- package/scripts/speech-setup.js +30 -0
- package/scripts/speech-setup.test.js +29 -0
package/README.md
CHANGED
|
@@ -13,6 +13,25 @@ On install, the matching native binary for your OS/arch is downloaded from the
|
|
|
13
13
|
[GitHub release](https://github.com/Omerfaruk-aydn/Atlas-Agent/releases) that
|
|
14
14
|
matches this package version.
|
|
15
15
|
|
|
16
|
+
On Windows x64, installation and updates also run `atlas-agent voice install`.
|
|
17
|
+
This downloads the offline **Vosk** runtime and Turkish, English, Italian and
|
|
18
|
+
French models from their official sources, verifies pinned SHA256 hashes and
|
|
19
|
+
installs them beside the executable. Downloads total approximately 185 MB;
|
|
20
|
+
installed assets occupy approximately 344 MB. Existing complete assets are
|
|
21
|
+
reused. Administrator permission, a transcription API and Whisper are not
|
|
22
|
+
required. Failed speech setup leaves the coding CLI installed and usable.
|
|
23
|
+
|
|
24
|
+
Use `atlas-agent voice install` to retry downloads and `atlas-agent voice status`
|
|
25
|
+
to check recognition. `ATLAS_AGENT_SKIP_SPEECH_SETUP=1` skips automatic downloads.
|
|
26
|
+
Menu language selects the dictation model unless `option voice language` is set.
|
|
27
|
+
`option voice model-dir` and `option voice runtime-dir` support custom paths.
|
|
28
|
+
|
|
29
|
+
The legacy Windows engine remains optional: set `option voice backend windows`.
|
|
30
|
+
`atlas-agent voice setup` installs its Windows components and may request UAC.
|
|
31
|
+
Set `ATLAS_AGENT_VOICE_BACKEND=windows` before npm installation to choose this
|
|
32
|
+
optional setup instead of Vosk downloads. That legacy engine does not support
|
|
33
|
+
Turkish or Italian. Arabic models are not installed. Audio remains local.
|
|
34
|
+
|
|
16
35
|
## Usage
|
|
17
36
|
|
|
18
37
|
```bash
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -14,6 +14,7 @@ const fs = require('fs');
|
|
|
14
14
|
const path = require('path');
|
|
15
15
|
const https = require('https');
|
|
16
16
|
const { URL } = require('url');
|
|
17
|
+
const { setupWindowsSpeech } = require('./speech-setup');
|
|
17
18
|
|
|
18
19
|
const PLATFORM_MAP = { win32: 'windows', darwin: 'darwin', linux: 'linux' };
|
|
19
20
|
const platform = PLATFORM_MAP[process.platform] || process.platform;
|
|
@@ -135,4 +136,5 @@ function download(url, redirectsLeft, attempt) {
|
|
|
135
136
|
}
|
|
136
137
|
const size = (fs.statSync(dest).size / 1024 / 1024).toFixed(1);
|
|
137
138
|
console.log(`Atlas Agent postinstall: installed ${assetName} (${size} MB)`);
|
|
139
|
+
setupWindowsSpeech(dest);
|
|
138
140
|
})();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
// Use the installed binary's embedded setup, never a second downloaded script.
|
|
6
|
+
// Failure only affects dictation; the coding CLI remains usable.
|
|
7
|
+
function setupWindowsSpeech(binary, options = {}) {
|
|
8
|
+
const platform = options.platform || process.platform;
|
|
9
|
+
const env = options.env || process.env;
|
|
10
|
+
const spawn = options.spawn || spawnSync;
|
|
11
|
+
const log = options.log || console;
|
|
12
|
+
if (platform !== 'win32' || env.ATLAS_AGENT_SKIP_SPEECH_SETUP === '1') return;
|
|
13
|
+
const backend = env.ATLAS_AGENT_VOICE_BACKEND === 'windows' ? 'setup' : 'install';
|
|
14
|
+
const args = ['voice', backend, '--automatic'];
|
|
15
|
+
if (env.ATLAS_AGENT_VOICE_LANGUAGE) {
|
|
16
|
+
args.push('--language', env.ATLAS_AGENT_VOICE_LANGUAGE);
|
|
17
|
+
}
|
|
18
|
+
log.log(backend === 'setup'
|
|
19
|
+
? 'Atlas Agent: checking optional Windows speech components. Windows may request administrator approval.'
|
|
20
|
+
: 'Atlas Agent: installing verified offline Turkish, English, Italian and French Vosk models.');
|
|
21
|
+
const result = spawn(binary, args, {
|
|
22
|
+
stdio: 'inherit', windowsHide: true, shell: false, env,
|
|
23
|
+
timeout: 17 * 60 * 1000,
|
|
24
|
+
});
|
|
25
|
+
if (result.error || result.status !== 0) {
|
|
26
|
+
log.warn(`Atlas Agent is installed. Offline dictation setup did not finish; retry atlas-agent voice ${backend} later.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { setupWindowsSpeech };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert').strict;
|
|
4
|
+
const { setupWindowsSpeech } = require('./speech-setup');
|
|
5
|
+
|
|
6
|
+
let calls = [];
|
|
7
|
+
let warnings = [];
|
|
8
|
+
const fixture = {
|
|
9
|
+
platform: 'win32', env: {},
|
|
10
|
+
spawn: (...args) => { calls.push(args); return { status: 0 }; },
|
|
11
|
+
log: { log: () => {}, warn: (message) => warnings.push(message) },
|
|
12
|
+
};
|
|
13
|
+
setupWindowsSpeech('C:\\Users\\Ömer&Ceylin\\atlas.exe', fixture);
|
|
14
|
+
assert.equal(calls.length, 1);
|
|
15
|
+
assert.equal(calls[0][0], 'C:\\Users\\Ömer&Ceylin\\atlas.exe');
|
|
16
|
+
assert.deepEqual(calls[0][1], ['voice', 'install', '--automatic']);
|
|
17
|
+
assert.equal(calls[0][2].shell, false);
|
|
18
|
+
assert.equal(calls[0][2].windowsHide, true);
|
|
19
|
+
setupWindowsSpeech('atlas.exe', { ...fixture, platform: 'linux' });
|
|
20
|
+
setupWindowsSpeech('atlas.exe', { ...fixture, env: { ATLAS_AGENT_SKIP_SPEECH_SETUP: '1' } });
|
|
21
|
+
assert.equal(calls.length, 1);
|
|
22
|
+
setupWindowsSpeech('atlas.exe', { ...fixture, env: { ATLAS_AGENT_VOICE_LANGUAGE: 'tr-TR' } });
|
|
23
|
+
assert.deepEqual(calls[1][1], ['voice', 'install', '--automatic', '--language', 'tr-TR']);
|
|
24
|
+
setupWindowsSpeech('atlas.exe', { ...fixture, env: { ATLAS_AGENT_VOICE_BACKEND: 'windows' } });
|
|
25
|
+
assert.deepEqual(calls[2][1], ['voice', 'setup', '--automatic']);
|
|
26
|
+
setupWindowsSpeech('atlas.exe', { ...fixture, spawn: () => ({ status: 1 }) });
|
|
27
|
+
setupWindowsSpeech('atlas.exe', { ...fixture, spawn: () => ({ error: new Error('timed out') }) });
|
|
28
|
+
assert.equal(warnings.length, 2);
|
|
29
|
+
console.log('Windows speech installer checks passed.');
|