fix: unblock unattended research workflows
This commit is contained in:
@@ -33,6 +33,27 @@ test("patchPiWebAccessSource updates index.ts directory handling", () => {
|
||||
assert.match(patched, /const dir = dirname\(WEB_SEARCH_CONFIG_PATH\);/);
|
||||
});
|
||||
|
||||
test("patchPiWebAccessSource defaults workflow to none for index.ts", () => {
|
||||
const input = [
|
||||
'function resolveWorkflow(input: unknown, hasUI: boolean): WebSearchWorkflow {',
|
||||
'\tif (!hasUI) return "none";',
|
||||
'\tif (typeof input === "string" && input.trim().toLowerCase() === "none") return "none";',
|
||||
'\treturn "summary-review";',
|
||||
'}',
|
||||
'workflow: Type.Optional(',
|
||||
'\tStringEnum(["none", "summary-review"], {',
|
||||
'\t\tdescription: "Search workflow mode: none = no curator, summary-review = open curator with auto summary draft (default)",',
|
||||
'\t}),',
|
||||
'),',
|
||||
"",
|
||||
].join("\n");
|
||||
|
||||
const patched = patchPiWebAccessSource("index.ts", input);
|
||||
|
||||
assert.match(patched, /return "none";/);
|
||||
assert.doesNotMatch(patched, /summary-review = open curator with auto summary draft \(default\)/);
|
||||
});
|
||||
|
||||
test("patchPiWebAccessSource is idempotent", () => {
|
||||
const input = [
|
||||
'import { join } from "node:path";',
|
||||
|
||||
@@ -62,6 +62,7 @@ test("getPiWebAccessStatus reads Pi web-access config directly", () => {
|
||||
const status = getPiWebAccessStatus(loadPiWebAccessConfig(configPath), configPath);
|
||||
assert.equal(status.routeLabel, "Exa");
|
||||
assert.equal(status.requestProvider, "exa");
|
||||
assert.equal(status.workflow, "none");
|
||||
assert.equal(status.exaConfigured, true);
|
||||
assert.equal(status.geminiApiConfigured, true);
|
||||
assert.equal(status.perplexityConfigured, false);
|
||||
@@ -86,6 +87,7 @@ test("getPiWebAccessStatus reads Gemini routes directly", () => {
|
||||
const status = getPiWebAccessStatus(loadPiWebAccessConfig(configPath), configPath);
|
||||
assert.equal(status.routeLabel, "Gemini");
|
||||
assert.equal(status.requestProvider, "gemini");
|
||||
assert.equal(status.workflow, "none");
|
||||
assert.equal(status.exaConfigured, false);
|
||||
assert.equal(status.geminiApiConfigured, true);
|
||||
assert.equal(status.perplexityConfigured, false);
|
||||
@@ -100,6 +102,7 @@ test("getPiWebAccessStatus supports the legacy route key", () => {
|
||||
|
||||
assert.equal(status.routeLabel, "Perplexity");
|
||||
assert.equal(status.requestProvider, "perplexity");
|
||||
assert.equal(status.workflow, "none");
|
||||
assert.equal(status.perplexityConfigured, true);
|
||||
});
|
||||
|
||||
@@ -112,5 +115,6 @@ test("formatPiWebAccessDoctorLines reports Pi-managed web access", () => {
|
||||
);
|
||||
|
||||
assert.equal(lines[0], "web access: pi-web-access");
|
||||
assert.ok(lines.some((line) => line.includes("search workflow: none")));
|
||||
assert.ok(lines.some((line) => line.includes("/tmp/pi-web-search.json")));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user