mirror of
https://github.com/SikongJueluo/pi-extensions.git
synced 2026-10-05 11:52:55 +08:00
refactor(ai-judge): shorten session notices to essentials
The enforce notice spelled out the risk contract, ADR reference, and
high-risk categories every session; users only need to know enforce is
on, which model judges, and that high-risk commands still ask.
- condense the enforce notice to one line and drop the "(configured)"
provenance marker from the model description
- shorten catalog status notes ("Model untested in advisory catalog.")
- trim the catalog diagnostic notice to "treated as empty"
This commit is contained in:
@@ -581,10 +581,10 @@ async function judgeAuthorize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One non-blocking session notice in Enforce mode: the risk contract and
|
* One non-blocking session notice in Enforce mode: the effective judge
|
||||||
* the effective judge model (ADR 0008). Not repeated per ask. The advisory
|
* model and the risk contract in one line (ADR 0008). Not repeated per
|
||||||
* model catalog (PIEXTENSIO-24) only annotates this notice — it never gates
|
* ask. The advisory model catalog (PIEXTENSIO-24) only annotates this
|
||||||
* authority.
|
* notice — it never gates authority.
|
||||||
*/
|
*/
|
||||||
function notifyEnforceActive(
|
function notifyEnforceActive(
|
||||||
notify: (message: string, kind: "info" | "warning") => void,
|
notify: (message: string, kind: "info" | "warning") => void,
|
||||||
@@ -596,7 +596,7 @@ function notifyEnforceActive(
|
|||||||
let judgeModelDescription: string;
|
let judgeModelDescription: string;
|
||||||
let classification: ModelCatalogClassification | null;
|
let classification: ModelCatalogClassification | null;
|
||||||
if (configured !== undefined) {
|
if (configured !== undefined) {
|
||||||
judgeModelDescription = `${configured.provider}/${configured.id} (configured)`;
|
judgeModelDescription = `${configured.provider}/${configured.id}`;
|
||||||
classification = classifyModel(
|
classification = classifyModel(
|
||||||
catalog,
|
catalog,
|
||||||
configured.provider,
|
configured.provider,
|
||||||
@@ -604,11 +604,10 @@ function notifyEnforceActive(
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (sessionModel === undefined) {
|
if (sessionModel === undefined) {
|
||||||
judgeModelDescription =
|
judgeModelDescription = "session model (none yet)";
|
||||||
"the current session model (none resolved yet)";
|
|
||||||
classification = null;
|
classification = null;
|
||||||
} else {
|
} else {
|
||||||
judgeModelDescription = `${sessionModel.provider}/${sessionModel.id} (current session model)`;
|
judgeModelDescription = `${sessionModel.provider}/${sessionModel.id} (session model)`;
|
||||||
classification = classifyModel(
|
classification = classifyModel(
|
||||||
catalog,
|
catalog,
|
||||||
sessionModel.provider,
|
sessionModel.provider,
|
||||||
@@ -618,12 +617,12 @@ function notifyEnforceActive(
|
|||||||
}
|
}
|
||||||
const catalogNote =
|
const catalogNote =
|
||||||
classification === "unlisted"
|
classification === "unlisted"
|
||||||
? " This model is untested in the advisory catalog — used at your own risk."
|
? " Model untested in advisory catalog."
|
||||||
: classification === "deprecated" || classification === "revoked"
|
: classification === "deprecated" || classification === "revoked"
|
||||||
? ` Advisory catalog status: ${classification}.`
|
? ` Catalog status: ${classification}.`
|
||||||
: "";
|
: "";
|
||||||
notify(
|
notify(
|
||||||
`ai-bash-judge Enforce active: ${judgeModelDescription} judges Bash asks; allow skips the dialog — you accept the risk of model misjudgment (ADR 0008). High-risk shapes (irreversible, publish, system, credentials) always ask.${catalogNote}`,
|
`ai-bash-judge Enforce active — ${judgeModelDescription} may auto-allow Bash; high-risk commands still ask.${catalogNote}`,
|
||||||
"info",
|
"info",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -698,7 +697,7 @@ export default function permissionAiJudge(pi: ExtensionAPI): void {
|
|||||||
});
|
});
|
||||||
for (const diagnostic of catalogResult.diagnostics) {
|
for (const diagnostic of catalogResult.diagnostics) {
|
||||||
ctx.ui.notify(
|
ctx.ui.notify(
|
||||||
`ai-bash-judge advisory catalog: ${diagnostic.key} — ${diagnostic.problem}; treating as empty`,
|
`ai-bash-judge catalog: ${diagnostic.key} — ${diagnostic.problem}; treated as empty`,
|
||||||
"warning",
|
"warning",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user