@ridit/lens 0.4.7 → 0.4.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/dist/index.mjs CHANGED
@@ -78207,6 +78207,7 @@ async function runHeadless(opts) {
78207
78207
  let session = opts.sessionId ? loadSession(opts.sessionId) ?? createSessionWithId(opts.sessionId, repoPath) : opts.single ? getLatestSession(repoPath) ?? createSession(repoPath) : createSession(repoPath);
78208
78208
  if (opts.resume) {
78209
78209
  const msgs = getMessages(session);
78210
+ const pending = getLastDeniedAction(msgs);
78210
78211
  let trimAt = -1;
78211
78212
  for (let i = msgs.length - 1;i >= 0; i--) {
78212
78213
  const msg = msgs[i];
@@ -78227,6 +78228,9 @@ async function runHeadless(opts) {
78227
78228
  if (trimAt >= 0) {
78228
78229
  session = { ...session, messages: msgs.slice(0, trimAt) };
78229
78230
  }
78231
+ if (pending) {
78232
+ session = addMessage(session, "user", `Proceed with the previously denied operation: use the ${pending.tool} tool on "${pending.description}". Permission has been granted.`);
78233
+ }
78230
78234
  if (!opts.single || opts.sessionId)
78231
78235
  saveSession(session);
78232
78236
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ridit/lens",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Understand your codebase.",
5
5
  "author": "Ridit Jangra <riditjangra09@gmail.com> (https://ridit.space)",
6
6
  "license": "MIT",
package/src/index.tsx CHANGED
@@ -93,6 +93,8 @@ async function runHeadless(opts: {
93
93
  // This leaves the session ending at the last successful state so the agent
94
94
  // can re-attempt the denied tool with forceAll: true.
95
95
  const msgs = getMessages(session);
96
+ // Capture the pending denied action before trimming so we can add an explicit proceed instruction
97
+ const pending = getLastDeniedAction(msgs);
96
98
  let trimAt = -1;
97
99
  for (let i = msgs.length - 1; i >= 0; i--) {
98
100
  const msg = msgs[i];
@@ -119,6 +121,14 @@ async function runHeadless(opts: {
119
121
  if (trimAt >= 0) {
120
122
  session = { ...session, messages: msgs.slice(0, trimAt) };
121
123
  }
124
+ // Add an explicit instruction to proceed with the denied tool so the model doesn't ask again
125
+ if (pending) {
126
+ session = addMessage(
127
+ session,
128
+ "user",
129
+ `Proceed with the previously denied operation: use the ${pending.tool} tool on "${pending.description}". Permission has been granted.`,
130
+ );
131
+ }
122
132
  // Save trimmed session so context is clean for this run
123
133
  if (!opts.single || opts.sessionId) saveSession(session);
124
134
  } else {