utilitas 2001.1.93 → 2001.1.94

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/lib/alan.mjs CHANGED
@@ -1109,6 +1109,7 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1109
1109
  };
1110
1110
  }
1111
1111
  } else if (M?.['deep-research']) {
1112
+ // TODO: previous_interaction_id support
1112
1113
  const pkgOptions = { ...options || {}, provider, model: M.name };
1113
1114
  let interactionId, last_event_id, isComplete = false;
1114
1115
  let [thought, text, result] = ['', '', ''];
@@ -1122,7 +1123,7 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1122
1123
  let deltaThought = '', deltaText = '', delta = '';
1123
1124
  if (chunk.event_type === 'content.delta') {
1124
1125
  if (chunk.delta.type === 'text') {
1125
- thought && (deltaThought = `${THINK_END}\n\n`);
1126
+ thought && (deltaThought = `\n${THINK_END}\n\n`);
1126
1127
  text += (deltaText = chunk.delta.text);
1127
1128
  } else if (chunk.delta.type === 'thought_summary') {
1128
1129
  deltaThought = chunk.delta.content.text;
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2001.1.93",
4
+ "version": "2001.1.94",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/shell.mjs CHANGED
@@ -1,20 +1,30 @@
1
1
  import { exec as _exec } from 'child_process';
2
2
  import { log as _log } from './utilitas.mjs';
3
- import { promisify } from 'util';
4
3
 
5
4
  const log = (content) => _log(content, import.meta.url);
6
5
  const vF = (cmd, cbf) => { log(`Can not run in browser: ${cmd}`); cbf(); };
7
- const pmsExec = promisify(_exec || vF);
8
6
  const assertCommand = (command) => assert(command, 'Command is required.', 500);
9
7
  const exist = (bin) => { assertCommand(bin); return which(bin); };
10
8
 
11
9
  const exec = async (command, options = {}) => {
12
10
  assertCommand(command);
13
- const { stdout, stderr } = await pmsExec(command);
14
- assert(options?.acceptError || !stderr, stderr, 500);
15
- return options?.acceptError
16
- ? [stdout, stderr].map(x => x.trim()).filter(x => x).join('\n')
17
- : stdout.trim();
11
+ return new Promise((resolve, reject) => {
12
+ const child = (_exec || vF)(command, (error, stdout, stderr) => {
13
+ if (error && !options?.acceptError) { return reject(error); }
14
+ try {
15
+ assert(options?.acceptError || !stderr, stderr, 500);
16
+ } catch (e) {
17
+ return reject(e);
18
+ }
19
+ resolve(options?.acceptError
20
+ ? [stdout, stderr].map(x => x.trim()).filter(x => x).join('\n')
21
+ : stdout.trim());
22
+ });
23
+ if (options?.stream && child?.stdout) {
24
+ child.stdout.on('data', options.stream);
25
+ child.stderr.on('data', options.stream);
26
+ }
27
+ });
18
28
  };
19
29
 
20
30
  const which = async (bin) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2001.1.93",
4
+ "version": "2001.1.94",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",