@warlock.js/ai-cli 5.51.0 → 5.53.0
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/CHANGELOG.md +15 -0
- package/cjs/index.cjs +39 -11
- package/cjs/index.cjs.map +1 -1
- package/esm/adapters/aider.mjs.map +1 -1
- package/esm/adapters/amp.mjs.map +1 -1
- package/esm/adapters/antigravity.mjs.map +1 -1
- package/esm/adapters/claude-code.mjs.map +1 -1
- package/esm/adapters/claude-stream.mjs.map +1 -1
- package/esm/adapters/codex.mjs.map +1 -1
- package/esm/adapters/copilot.mjs.map +1 -1
- package/esm/adapters/cursor.mjs.map +1 -1
- package/esm/adapters/droid.mjs.map +1 -1
- package/esm/adapters/grok.mjs.map +1 -1
- package/esm/adapters/kimi.mjs.map +1 -1
- package/esm/adapters/mistral-vibe.mjs.map +1 -1
- package/esm/adapters/opencode.mjs.map +1 -1
- package/esm/adapters/qwen-code.mjs.map +1 -1
- package/esm/adapters/reasonix.mjs.map +1 -1
- package/esm/adapters/shared.mjs.map +1 -1
- package/esm/cli-agent.mjs +4 -1
- package/esm/cli-agent.mjs.map +1 -1
- package/esm/cli.mjs.map +1 -1
- package/esm/contracts/options.type.d.mts +10 -4
- package/esm/contracts/options.type.d.mts.map +1 -1
- package/esm/errors.mjs.map +1 -1
- package/esm/model/cli-model.mjs.map +1 -1
- package/esm/probe/probe.mjs.map +1 -1
- package/esm/session/aggregate.mjs.map +1 -1
- package/esm/session/environment.mjs +15 -2
- package/esm/session/environment.mjs.map +1 -1
- package/esm/session/run-directory.mjs.map +1 -1
- package/esm/session/session.mjs.map +1 -1
- package/esm/spawn/invocation.mjs.map +1 -1
- package/esm/spawn/process-tree.mjs.map +1 -1
- package/esm/spawn/resolve-command.mjs.map +1 -1
- package/esm/stream/event-log.mjs.map +1 -1
- package/esm/stream/json-lines.mjs.map +1 -1
- package/esm/stream/line-splitter.mjs +22 -10
- package/esm/stream/line-splitter.mjs.map +1 -1
- package/esm/utils/toml.mjs.map +1 -1
- package/llms-full.txt +2 -0
- package/package.json +2 -2
- package/skills/run-cli-agents/SKILL.md +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to `@warlock.js/ai-cli` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.53.0 - 2026-11-11
|
|
8
|
+
|
|
9
|
+
### Upgrading
|
|
10
|
+
|
|
11
|
+
- Production apps that leave `inheritEnv` unset see a one-time warning on the first CLI run. Set `inheritEnv: "curated"` (recommended) or `inheritEnv: true` to silence it. The default stays `true` in this release.
|
|
12
|
+
|
|
13
|
+
### Security
|
|
14
|
+
|
|
15
|
+
- A CLI agent inherits the whole server environment by default (`inheritEnv: true`), so a model-driven coding CLI can read database URLs, signing keys and other providers' keys. New `inheritEnv: "curated"` passes only the minimal system set (PATH, home, temp, locale, proxy and TLS settings, Windows system variables) plus the adapter's own API key variables (`apiKeyEnv`); add anything else through `env`.
|
|
16
|
+
- When `NODE_ENV` is `production` and `inheritEnv` is not set, the first run logs a one-time console warning that names the option. Set `inheritEnv: true` explicitly to keep the full environment and silence it.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- The stdout line splitter no longer rescans and re-joins the whole pending buffer on every chunk. A very long stream-JSON line (a tool result with a whole file) costs linear time instead of quadratic; line, CRLF and overflow behaviour are unchanged.
|
|
21
|
+
|
|
7
22
|
## 5.45.0 - 2026-11-05
|
|
8
23
|
|
|
9
24
|
### Added
|
package/cjs/index.cjs
CHANGED
|
@@ -512,7 +512,8 @@ const MINIMAL_ENV = [
|
|
|
512
512
|
function buildEnvironment(input) {
|
|
513
513
|
const normalize = (name) => input.platform === "win32" ? name.toUpperCase() : name;
|
|
514
514
|
const managed = new Set(input.managed.map(normalize));
|
|
515
|
-
const
|
|
515
|
+
const extra = input.inherit === false ? [] : input.inherit === "curated" ? input.credentials ?? [] : input.inherit === true ? [] : input.inherit;
|
|
516
|
+
const allowed = input.inherit === true ? void 0 : new Set([...MINIMAL_ENV, ...extra].map(normalize));
|
|
516
517
|
const environment = {};
|
|
517
518
|
for (const [name, value] of Object.entries(input.source)) {
|
|
518
519
|
if (value === void 0 || managed.has(normalize(name))) continue;
|
|
@@ -530,6 +531,18 @@ function buildEnvironment(input) {
|
|
|
530
531
|
for (const [name, value] of Object.entries(input.user ?? {})) assign(name, value);
|
|
531
532
|
return environment;
|
|
532
533
|
}
|
|
534
|
+
let warnedInheritedEnvironment = false;
|
|
535
|
+
/**
|
|
536
|
+
* One console warning per process when a CLI agent runs in production with
|
|
537
|
+
* `inheritEnv` left at its default (`true`), which hands every server
|
|
538
|
+
* variable — database URLs, signing keys, other providers' keys — to a
|
|
539
|
+
* model-driven CLI.
|
|
540
|
+
*/
|
|
541
|
+
function warnInheritedEnvironment(title, inheritEnv, env) {
|
|
542
|
+
if (warnedInheritedEnvironment || inheritEnv !== void 0 || env.NODE_ENV !== "production") return;
|
|
543
|
+
warnedInheritedEnvironment = true;
|
|
544
|
+
console.warn(`[warlock-ai-cli] ${title} receives the whole server environment because \`inheritEnv\` is not set (default \`true\`). Set \`inheritEnv: "curated"\` to pass only the system variables and the CLI's own API key variable, or \`inheritEnv: true\` to keep the current behaviour and silence this warning.`);
|
|
545
|
+
}
|
|
533
546
|
|
|
534
547
|
//#endregion
|
|
535
548
|
//#region ../../packages/ai-cli/src/session/run-directory.ts
|
|
@@ -666,20 +679,32 @@ const MAX_LINE_BYTES = 33554432;
|
|
|
666
679
|
*/
|
|
667
680
|
function createLineSplitter(onLine, onOverflow = () => void 0) {
|
|
668
681
|
const decoder = new node_string_decoder.StringDecoder("utf8");
|
|
669
|
-
let
|
|
682
|
+
let parts = [];
|
|
683
|
+
let pendingLength = 0;
|
|
670
684
|
let overflowed = false;
|
|
685
|
+
const takePending = (tail) => {
|
|
686
|
+
const line = parts.length === 0 ? tail : parts.join("") + tail;
|
|
687
|
+
parts = [];
|
|
688
|
+
pendingLength = 0;
|
|
689
|
+
return line;
|
|
690
|
+
};
|
|
671
691
|
const consume = (text) => {
|
|
672
|
-
|
|
673
|
-
let newline =
|
|
692
|
+
let start = 0;
|
|
693
|
+
let newline = text.indexOf("\n");
|
|
674
694
|
while (newline !== -1) {
|
|
675
|
-
const line =
|
|
676
|
-
|
|
695
|
+
const line = takePending(text.slice(start, newline)).replace(/\r$/, "");
|
|
696
|
+
start = newline + 1;
|
|
677
697
|
if (overflowed) overflowed = false;
|
|
678
698
|
else onLine(line);
|
|
679
|
-
newline =
|
|
699
|
+
newline = text.indexOf("\n", start);
|
|
700
|
+
}
|
|
701
|
+
if (start < text.length) {
|
|
702
|
+
parts.push(start === 0 ? text : text.slice(start));
|
|
703
|
+
pendingLength += text.length - start;
|
|
680
704
|
}
|
|
681
|
-
if (
|
|
682
|
-
|
|
705
|
+
if (pendingLength > 33554432) {
|
|
706
|
+
parts = [];
|
|
707
|
+
pendingLength = 0;
|
|
683
708
|
if (!overflowed) {
|
|
684
709
|
overflowed = true;
|
|
685
710
|
onOverflow();
|
|
@@ -692,8 +717,8 @@ function createLineSplitter(onLine, onOverflow = () => void 0) {
|
|
|
692
717
|
},
|
|
693
718
|
end() {
|
|
694
719
|
consume(decoder.end());
|
|
695
|
-
|
|
696
|
-
|
|
720
|
+
const rest = takePending("");
|
|
721
|
+
if (rest.length > 0 && !overflowed) onLine(rest.replace(/\r$/, ""));
|
|
697
722
|
}
|
|
698
723
|
};
|
|
699
724
|
}
|
|
@@ -1124,6 +1149,7 @@ function createCliAgent(adapter, options = {}, host = currentHost()) {
|
|
|
1124
1149
|
const probeEnvironment = () => buildEnvironment({
|
|
1125
1150
|
source: host.env,
|
|
1126
1151
|
inherit: options.inheritEnv ?? true,
|
|
1152
|
+
credentials: adapter.apiKeyEnv,
|
|
1127
1153
|
managed: [],
|
|
1128
1154
|
user: options.env,
|
|
1129
1155
|
platform: host.platform
|
|
@@ -1215,9 +1241,11 @@ function createCliAgent(adapter, options = {}, host = currentHost()) {
|
|
|
1215
1241
|
});
|
|
1216
1242
|
await writeLaunchFiles(chosen.plan.files ?? [], directories);
|
|
1217
1243
|
const apiKeyEnv = adapter.apiKeyEnv[0];
|
|
1244
|
+
warnInheritedEnvironment(adapter.title, options.inheritEnv, host.env);
|
|
1218
1245
|
const env = buildEnvironment({
|
|
1219
1246
|
source: host.env,
|
|
1220
1247
|
inherit: options.inheritEnv ?? true,
|
|
1248
|
+
credentials: adapter.apiKeyEnv,
|
|
1221
1249
|
managed: home === "inherit" ? [] : adapter.homeEnv,
|
|
1222
1250
|
plan: host.platform === "win32" ? chosen.plan.env : {
|
|
1223
1251
|
PWD: cwd,
|