@quolu/lattice 0.60.1 → 0.60.2
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/bin/lattice.mjs +5 -9
- package/package.json +1 -1
- package/src/sensor-node-runtime.mjs +20 -39
package/bin/lattice.mjs
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
3
|
import { installPipeCloseGuard } from '../src/cli-stdio.mjs';
|
|
5
4
|
import { renderCliHelp } from '../src/cli-help.mjs';
|
|
6
|
-
import {
|
|
5
|
+
import { installNode22SqliteWarningFilter } from '../src/sensor-node-runtime.mjs';
|
|
7
6
|
import packageJson from '../package.json' with { type: 'json' };
|
|
8
7
|
|
|
9
8
|
installPipeCloseGuard();
|
|
10
9
|
|
|
11
10
|
const args = process.argv.slice(2);
|
|
12
|
-
const
|
|
13
|
-
args,
|
|
14
|
-
scriptPath: fileURLToPath(import.meta.url),
|
|
15
|
-
});
|
|
11
|
+
const restoreWarningHandler = installNode22SqliteWarningFilter();
|
|
16
12
|
const help = renderCliHelp(args);
|
|
17
13
|
|
|
18
|
-
if (
|
|
19
|
-
process.exitCode = node22RelaunchStatus;
|
|
20
|
-
} else if (help !== null) {
|
|
14
|
+
if (help !== null) {
|
|
21
15
|
process.stdout.write(help);
|
|
22
16
|
} else if (args.length === 1 && args[0] === '--version') {
|
|
23
17
|
process.stdout.write(`${packageJson.version}\n`);
|
|
@@ -151,6 +145,8 @@ if (node22RelaunchStatus !== null) {
|
|
|
151
145
|
}
|
|
152
146
|
}
|
|
153
147
|
|
|
148
|
+
restoreWarningHandler();
|
|
149
|
+
|
|
154
150
|
async function runRuntimeErrorsCli(rest) {
|
|
155
151
|
const runtimeErrors = await import('../src/runtime-errors.mjs');
|
|
156
152
|
const usage = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.2",
|
|
4
4
|
"description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Quo / クオ at kitepon.dev",
|
|
@@ -1,51 +1,32 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
|
|
3
1
|
export const SQLITE_EXPERIMENTAL_WARNING_FLAG = '--disable-warning=ExperimentalWarning';
|
|
4
|
-
const
|
|
2
|
+
export const SQLITE_EXPERIMENTAL_WARNING_MESSAGE =
|
|
3
|
+
'SQLite is an experimental feature and might change at any time';
|
|
5
4
|
|
|
6
5
|
export function sensorNodeRuntimeFlags(nodeVersion = process.versions.node) {
|
|
7
6
|
const major = Number(nodeVersion.split('.')[0]);
|
|
8
7
|
return major === 22 ? [SQLITE_EXPERIMENTAL_WARNING_FLAG] : [];
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export function node22RelaunchArgv(
|
|
12
|
-
scriptPath,
|
|
13
|
-
args,
|
|
14
|
-
execArgv = process.execArgv,
|
|
15
|
-
nodeVersion = process.versions.node,
|
|
16
|
-
) {
|
|
17
|
-
const flags = sensorNodeRuntimeFlags(nodeVersion)
|
|
18
|
-
.filter((flag) => !execArgv.includes(flag));
|
|
19
|
-
return [...flags, ...execArgv, scriptPath, ...args];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
/**
|
|
23
11
|
* Node 22 prints node:sqlite's ExperimentalWarning to stderr. The CLI has a
|
|
24
|
-
* JSON-only output contract, so
|
|
12
|
+
* JSON-only output contract, so suppress that exact warning while node:sqlite loads.
|
|
13
|
+
* Every other process warning keeps Node's original behavior.
|
|
25
14
|
*/
|
|
26
|
-
export function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
export function installNode22SqliteWarningFilter({
|
|
16
|
+
nodeVersion = process.versions.node,
|
|
17
|
+
processObject = process,
|
|
18
|
+
} = {}) {
|
|
19
|
+
if (sensorNodeRuntimeFlags(nodeVersion).length === 0) return () => {};
|
|
20
|
+
|
|
21
|
+
const originalEmitWarning = processObject.emitWarning;
|
|
22
|
+
processObject.emitWarning = function filteredEmitWarning(warning, ...args) {
|
|
23
|
+
const type = typeof args[0] === 'string' ? args[0] : args[0]?.type;
|
|
24
|
+
const message = typeof warning === 'string' ? warning : warning?.message;
|
|
25
|
+
if (type === 'ExperimentalWarning' && message === SQLITE_EXPERIMENTAL_WARNING_MESSAGE) return;
|
|
26
|
+
return Reflect.apply(originalEmitWarning, processObject, [warning, ...args]);
|
|
27
|
+
};
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
cwd: process.cwd(),
|
|
37
|
-
env: { ...env, [RELAUNCH_GUARD_ENV]: '1' },
|
|
38
|
-
stdio: 'inherit',
|
|
39
|
-
windowsHide: true,
|
|
40
|
-
},
|
|
41
|
-
);
|
|
42
|
-
if (result.error) {
|
|
43
|
-
process.stderr.write(`${JSON.stringify({
|
|
44
|
-
schema: 'lattice.cli_error.v2',
|
|
45
|
-
code: 'LATTICE_SENSOR_RELAUNCH_FAILED',
|
|
46
|
-
message: result.error.message,
|
|
47
|
-
})}\n`);
|
|
48
|
-
return 1;
|
|
49
|
-
}
|
|
50
|
-
return result.status ?? 1;
|
|
29
|
+
return () => {
|
|
30
|
+
processObject.emitWarning = originalEmitWarning;
|
|
31
|
+
};
|
|
51
32
|
}
|