chainlesschain 0.47.7 → 0.47.8
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/package.json +1 -1
- package/src/repl/agent-repl.js +23 -0
package/package.json
CHANGED
package/src/repl/agent-repl.js
CHANGED
|
@@ -101,6 +101,29 @@ async function agentLoop(messages, options) {
|
|
|
101
101
|
process.stdout.write(
|
|
102
102
|
chalk.red(` Error: ${event.error || event.result?.error}\n`),
|
|
103
103
|
);
|
|
104
|
+
// Parity with Desktop AIChatPage's `Switch to Trusted` button:
|
|
105
|
+
// when the deny came from ApprovalGate (not shell-policy), surface
|
|
106
|
+
// the exact CLI command the user can run to relax the per-session
|
|
107
|
+
// policy. The structured `approval` outcome is attached by
|
|
108
|
+
// `evaluateShellCommandWithApproval` in agent-core.js.
|
|
109
|
+
const approval = event.result?.approval;
|
|
110
|
+
if (approval?.decision === "deny" && approval?.via !== "shell-policy") {
|
|
111
|
+
const sid = options?.sessionId;
|
|
112
|
+
const policy = approval.policy || "strict";
|
|
113
|
+
if (sid && policy === "strict") {
|
|
114
|
+
process.stdout.write(
|
|
115
|
+
chalk.yellow(
|
|
116
|
+
` Hint: relax policy with cc session policy ${sid} --set trusted\n`,
|
|
117
|
+
),
|
|
118
|
+
);
|
|
119
|
+
} else if (sid) {
|
|
120
|
+
process.stdout.write(
|
|
121
|
+
chalk.yellow(
|
|
122
|
+
` Hint: per-session policy is "${policy}" — see cc session policy ${sid}\n`,
|
|
123
|
+
),
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
104
127
|
} else if (event.result?.success) {
|
|
105
128
|
process.stdout.write(chalk.green(` Done\n`));
|
|
106
129
|
}
|