Add ultra keyword configuration
This commit is contained in:
1 parent
8e392ee140
commit
8f8fe92089
2 files changed
+29
No files matched your search
@@ -63,6 +63,21 @@ export function readUltraNotify(value: string | undefined): { value: boolean; wa
|
||||
return { value: true, warning: `Invalid PI_SUBAGENT_ULTRA_NOTIFY="${value}"; using on.` };
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a human-typed prompt containing the `ultracode` keyword forces one
|
||||
* plan-first run.
|
||||
*
|
||||
* `PI_SUBAGENT_ULTRA_KEYWORD=off` disables the trigger; the default is on, and
|
||||
* an unrecognized value keeps the default with a warning. The `PI_SUBAGENT_ULTRA`
|
||||
* kill switch disables this surface along with the rest of the layer.
|
||||
*/
|
||||
export function readUltraKeyword(value: string | undefined): { value: boolean; warning?: string } {
|
||||
if (value === undefined || value === "") return { value: true };
|
||||
if (value === "on") return { value: true };
|
||||
if (value === "off") return { value: false };
|
||||
return { value: true, warning: `Invalid PI_SUBAGENT_ULTRA_KEYWORD="${value}"; using on.` };
|
||||
}
|
||||
|
||||
/**
|
||||
* The session's starting ultra-mode state.
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
readMaxWorkers,
|
||||
readUltraEnabled,
|
||||
readUltraGuideline,
|
||||
readUltraKeyword,
|
||||
readUltraMode,
|
||||
readUltraNotify,
|
||||
} from "../src/config.ts";
|
||||
@@ -70,6 +71,19 @@ test("ultra mode defaults off, accepts on/off, and warns on invalid values", ()
|
||||
}
|
||||
});
|
||||
|
||||
test("the ultra keyword defaults on, disables only on an explicit off, and warns on invalid values", () => {
|
||||
assert.deepEqual(readUltraKeyword(undefined), { value: true });
|
||||
assert.deepEqual(readUltraKeyword(""), { value: true });
|
||||
assert.deepEqual(readUltraKeyword("on"), { value: true });
|
||||
assert.deepEqual(readUltraKeyword("off"), { value: false });
|
||||
for (const invalid of ["0", "false", "OFF", " maybe", "disabled"]) {
|
||||
const result = readUltraKeyword(invalid);
|
||||
assert.equal(result.value, true);
|
||||
assert.match(result.warning ?? "", /PI_SUBAGENT_ULTRA_KEYWORD/);
|
||||
assert.match(result.warning ?? "", /using on/);
|
||||
}
|
||||
});
|
||||
|
||||
test("ultra size guideline defaults to medium, accepts the four values, and warns on invalid values", () => {
|
||||
assert.deepEqual(readUltraGuideline(undefined), { value: "medium" });
|
||||
assert.deepEqual(readUltraGuideline(""), { value: "medium" });
|
||||
|
||||
Reference in new issue
Block a user