ceulen 0.26.2 → 0.28.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 +112 -0
- package/extensions/lib/registry.ts +1 -1
- package/extensions/modules/subagent/index.ts +528 -75
- package/extensions/modules/subagent/lib/herdr-app.ts +917 -0
- package/extensions/modules/subagent/lib/herdr.ts +50 -29
- package/extensions/modules/subagent/lib/render.ts +33 -2
- package/extensions/modules/subagent/lib/rex.ts +902 -0
- package/extensions/modules/subagent/lib/runner.ts +5 -0
- package/extensions/modules/subagent/lib/widget.ts +8 -6
- package/extensions/modules/subagent/test/herdr-app.test.ts +572 -0
- package/extensions/modules/subagent/test/render-hint.test.ts +31 -0
- package/extensions/modules/subagent/test/rex.test.ts +724 -0
- package/extensions/modules/web/test/configPanel.test.ts +20 -3
- package/extensions/modules/web/test/settings.test.ts +6 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import os from "node:os";
|
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
|
|
10
10
|
import { buildWebGroups, diffWebPatch, readWebRowValues, webConfig } from "../configPanel";
|
|
11
|
-
import { writeWebSection } from "../lib/settings";
|
|
11
|
+
import { writeWebSection, ENV_TO_SETTINGS_KEY } from "../lib/settings";
|
|
12
12
|
|
|
13
13
|
function tmpAgentDir(): string {
|
|
14
14
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "web-panel-"));
|
|
@@ -16,6 +16,23 @@ function tmpAgentDir(): string {
|
|
|
16
16
|
return dir;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** Scrub every mapped web var for one test: the real agent dir's .env.local is
|
|
20
|
+
* ingested at import, so "settings supply this value" assertions are only
|
|
21
|
+
* meaningful when no env override shadows them (env wins by design). */
|
|
22
|
+
const SCRUBBED_ENV = Object.keys(ENV_TO_SETTINGS_KEY);
|
|
23
|
+
function withoutMappedEnv<T>(fn: () => T): T {
|
|
24
|
+
const saved = SCRUBBED_ENV.map((k) => [k, process.env[k]] as const);
|
|
25
|
+
for (const k of SCRUBBED_ENV) delete process.env[k];
|
|
26
|
+
try {
|
|
27
|
+
return fn();
|
|
28
|
+
} finally {
|
|
29
|
+
for (const [k, v] of saved) {
|
|
30
|
+
if (v === undefined) delete process.env[k];
|
|
31
|
+
else process.env[k] = v;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
19
36
|
function withEnv(key: string, value: string | undefined, fn: () => void): void {
|
|
20
37
|
const old = process.env[key];
|
|
21
38
|
if (value === undefined) delete process.env[key];
|
|
@@ -46,13 +63,13 @@ describe("web configPanel", () => {
|
|
|
46
63
|
it("readWebRowValues: env wins, settings fallback, empty default", () => {
|
|
47
64
|
const dir = tmpAgentDir();
|
|
48
65
|
try {
|
|
49
|
-
withEnv("BRAVE_API_KEY", "env-key", () => {
|
|
66
|
+
withoutMappedEnv(() => withEnv("BRAVE_API_KEY", "env-key", () => {
|
|
50
67
|
writeWebSection({ "brave.apiKey": "settings-key", "chat.apiKey": "chat-key" }, path.join(dir, "settings.json"));
|
|
51
68
|
const values = readWebRowValues("/nonexistent-project", false);
|
|
52
69
|
assert.deepEqual(values["brave.apiKey"], { value: "env-key", source: "env" });
|
|
53
70
|
assert.deepEqual(values["chat.apiKey"], { value: "chat-key", source: "global settings" });
|
|
54
71
|
assert.deepEqual(values["gemini.proxy"], { value: "", source: "default" });
|
|
55
|
-
});
|
|
72
|
+
}));
|
|
56
73
|
} finally {
|
|
57
74
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
58
75
|
delete process.env.PI_CODING_AGENT_DIR;
|
|
@@ -27,7 +27,12 @@ function setup(): void {
|
|
|
27
27
|
// test process env and "unset everywhere" is a lie. Scrub the mapped
|
|
28
28
|
// vars for the suite's lifetime (the web module re-reads settings layers,
|
|
29
29
|
// not env, for these assertions).
|
|
30
|
-
|
|
30
|
+
// Scrub EVERY mapped var (not a hand-listed subset): the map grows, and a
|
|
31
|
+
// missed one makes "unset everywhere" a lie on any machine whose .env.local
|
|
32
|
+
// carries it — the exact failure that made these suites red locally while
|
|
33
|
+
// CI stayed green (WEB_CHAT_API_BASE_URL was missing here).
|
|
34
|
+
for (const v of Object.keys(ENV_TO_SETTINGS_KEY)) delete process.env[v];
|
|
35
|
+
for (const v of ["SEARXNG_BASE_URL", "WEB_IMAGE_API_LABEL", "WEB_IMAGE_MIN_INTERVAL_MS"]) delete process.env[v];
|
|
31
36
|
// Trust: the real trust.json walk won't see our temp project → untrusted by
|
|
32
37
|
// default. isProjectTrusted(cwd, dirs) is injected nowhere here, so trust
|
|
33
38
|
// tests go through writeWebSection/readWebSettings with explicit trusted
|
package/package.json
CHANGED